From 1cb60d46ea6c98823e710d4df49094c073edc758 Mon Sep 17 00:00:00 2001
From: Chunpeng Huo <huocp@me.com>
Date: Sun, 27 Oct 2024 18:56:14 +1000
Subject: [PATCH] chore: upgrade deps

---
 .eslintignore                                |  2 -
 .eslintrc.json                               | 25 -------
 eslint.config.mjs                            | 35 ++++++++++
 lib/build/bundle.js                          |  8 ++-
 lib/build/bundled-source.js                  |  2 +-
 lib/build/dependency-description.js          |  2 +-
 lib/build/dependency-inclusion.js            |  2 +-
 lib/build/index.js                           |  4 +-
 lib/build/utils.js                           |  2 +-
 lib/cli-options.js                           |  2 +-
 lib/cli.js                                   |  2 +-
 lib/file-system.js                           |  4 +-
 lib/package-managers/base-package-manager.js |  2 +-
 lib/project.js                               |  2 +-
 package.json                                 | 68 ++++++++++----------
 spec/lib/build/dependency-inclusion.spec.js  |  1 -
 16 files changed, 86 insertions(+), 77 deletions(-)
 delete mode 100644 .eslintignore
 delete mode 100644 .eslintrc.json
 create mode 100644 eslint.config.mjs

diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644
index 238923f0e..000000000
--- a/.eslintignore
+++ /dev/null
@@ -1,2 +0,0 @@
-lib/build/amodro-trace
-dist
diff --git a/.eslintrc.json b/.eslintrc.json
deleted file mode 100644
index 5cb4ab607..000000000
--- a/.eslintrc.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
-  "extends": "eslint:recommended",
-  "rules": {
-    "no-prototype-builtins": 0,
-    "no-console": 0,
-    "getter-return": 0,
-    "no-inner-declarations": 0,
-    "comma-dangle": ["error", {
-      "arrays": "never",
-      "objects": "never",
-      "imports": "never",
-      "exports": "never",
-      "functions": "never"
-    }]
-  },
-  "parserOptions": {
-    "sourceType": "script",
-    "ecmaVersion": 2018
-  },
-  "env": {
-    "node": true,
-    "es6": true,
-    "jasmine": true
-  }
-}
diff --git a/eslint.config.mjs b/eslint.config.mjs
new file mode 100644
index 000000000..91eac93d3
--- /dev/null
+++ b/eslint.config.mjs
@@ -0,0 +1,35 @@
+import globals from "globals";
+import eslint from "@eslint/js";
+
+export default [
+  {
+    ignores: ["lib/build/amodro-trace", "**/dist"],
+  },
+  eslint.configs.recommended,
+  {
+    languageOptions: {
+      globals: {
+        ...globals.node,
+        ...globals.jasmine,
+      },
+
+      ecmaVersion: 2019,
+      sourceType: "commonjs",
+    },
+
+    rules: {
+      "no-prototype-builtins": 0,
+      "no-console": 0,
+      "getter-return": 0,
+      "no-inner-declarations": 0,
+
+      "comma-dangle": ["error", {
+        arrays: "never",
+        objects: "never",
+        imports: "never",
+        exports: "never",
+        functions: "never",
+      }],
+    },
+  }
+];
diff --git a/lib/build/bundle.js b/lib/build/bundle.js
index 4f5505a85..b8ef64c54 100644
--- a/lib/build/bundle.js
+++ b/lib/build/bundle.js
@@ -177,7 +177,7 @@ exports.Bundle = class {
     // in AMD module environment. There is special code in lib/build/amodro-trace/write/defines.js
     // to bring up global var "moment".
     const special = [];
-    while (true) { // eslint-disable-line no-constant-condition
+    while (true) {
       const idx = sorted.findIndex(f => f.dependencyInclusion && (
         f.dependencyInclusion.description.name === 'jquery' ||
         f.dependencyInclusion.description.name === 'moment'));
@@ -284,7 +284,7 @@ exports.Bundle = class {
             if (base64SourceMap) {
               return null;
             }
-          } catch (error) {
+          } catch {
             // we don't want the build to fail when a sourcemap file can't be parsed
             return null;
           }
@@ -292,7 +292,9 @@ exports.Bundle = class {
           let converter;
 
           try {
-            converter = Convert.fromMapFileSource(file.contents.toString(), parsedPath.dir);
+            converter = Convert.fromMapFileSource(file.contents.toString(), (filename) =>
+              fs.readFileSync(path.resolve(parsedPath.dir, filename), 'utf-8')
+            );
           } catch (e) {
             logger.error(e);
             return null;
diff --git a/lib/build/bundled-source.js b/lib/build/bundled-source.js
index d9b5a6a73..15e562a69 100644
--- a/lib/build/bundled-source.js
+++ b/lib/build/bundled-source.js
@@ -227,7 +227,7 @@ exports.BundledSource = class {
 
         try {
           contents = cjsTransform(modulePath, this.contents, forceCjsWrap);
-        } catch (ignore) {
+        } catch {
           // file is not in amd/cjs format, try native es module
           try {
             contents = esTransform(modulePath, this.contents);
diff --git a/lib/build/dependency-description.js b/lib/build/dependency-description.js
index 76258cd13..5c3aaf5d1 100644
--- a/lib/build/dependency-description.js
+++ b/lib/build/dependency-description.js
@@ -35,7 +35,7 @@ exports.DependencyDescription = class {
 
     try {
       return fs.readFileSync(p).toString();
-    } catch (e) {
+    } catch {
       console.log('error', p);
       return '';
     }
diff --git a/lib/build/dependency-inclusion.js b/lib/build/dependency-inclusion.js
index c231403de..83e21bf24 100644
--- a/lib/build/dependency-inclusion.js
+++ b/lib/build/dependency-inclusion.js
@@ -1,6 +1,6 @@
 const path = require('path');
 const SourceInclusion = require('./source-inclusion').SourceInclusion;
-const minimatch = require('minimatch');
+const { minimatch } = require('minimatch');
 const Utils = require('./utils');
 const logger = require('aurelia-logging').getLogger('DependencyInclusion');
 
diff --git a/lib/build/index.js b/lib/build/index.js
index 68cf6f30b..c99e12c94 100644
--- a/lib/build/index.js
+++ b/lib/build/index.js
@@ -3,7 +3,7 @@ const Bundler = require('./bundler').Bundler;
 const PackageAnalyzer = require('./package-analyzer').PackageAnalyzer;
 const PackageInstaller = require('./package-installer').PackageInstaller;
 const cacheDir = require('./utils').cacheDir;
-const del = require('del');
+const fs = require('fs');
 
 let bundler;
 let project;
@@ -60,7 +60,7 @@ exports.dest = function(opts) {
 
 exports.clearCache = function() {
   // delete cache folder outside of cwd
-  return del(cacheDir, {force: true});
+  return fs.promises.rm(cacheDir, { recursive: true, force: true });
 };
 
 function buildLoaderConfig(p) {
diff --git a/lib/build/utils.js b/lib/build/utils.js
index d6425689b..85ff6baf1 100644
--- a/lib/build/utils.js
+++ b/lib/build/utils.js
@@ -58,7 +58,7 @@ exports.getCache = function(hash) {
   const filePath = cachedFilePath(hash);
   try {
     return JSON.parse(fs.readFileSync(filePath));
-  } catch (e) {
+  } catch {
     // ignore
   }
 };
diff --git a/lib/cli-options.js b/lib/cli-options.js
index 82bf3df13..9c46d4c07 100644
--- a/lib/cli-options.js
+++ b/lib/cli-options.js
@@ -6,7 +6,7 @@ function definedEnvironments() {
   let files;
   try {
     files = fs.readdirSync('aurelia_project/environments');
-  } catch (e) {
+  } catch {
     // ignore
   }
   files && files.forEach(file => {
diff --git a/lib/cli.js b/lib/cli.js
index 3ee9b95d6..b23680f4a 100644
--- a/lib/cli.js
+++ b/lib/cli.js
@@ -78,7 +78,7 @@ exports.CLI = class {
         // need to configure logger after getting args
         this.configureLogger();
         resolve(found);
-      } catch (e) {
+      } catch {
         if (this.project) {
           this.project.resolveTask(commandModule).then(taskPath => {
             if (taskPath) {
diff --git a/lib/file-system.js b/lib/file-system.js
index a51ce6687..5187903b6 100644
--- a/lib/file-system.js
+++ b/lib/file-system.js
@@ -103,7 +103,7 @@ exports.statSync = function(path) {
 exports.isFile = function(path) {
   try {
     return fs.statSync(path).isFile();
-  } catch (err) {
+  } catch {
     // ignore
     return false;
   }
@@ -112,7 +112,7 @@ exports.isFile = function(path) {
 exports.isDirectory = function(path) {
   try {
     return fs.statSync(path).isDirectory();
-  } catch (err) {
+  } catch {
     // ignore
     return false;
   }
diff --git a/lib/package-managers/base-package-manager.js b/lib/package-managers/base-package-manager.js
index 673a94532..ad46d8c03 100644
--- a/lib/package-managers/base-package-manager.js
+++ b/lib/package-managers/base-package-manager.js
@@ -31,7 +31,7 @@ exports.BasePackageManager = class {
   getExecutablePath(directory) {
     try {
       return npmWhich(directory).sync(this.executableName);
-    } catch (e) {
+    } catch {
       return null;
     }
   }
diff --git a/lib/project.js b/lib/project.js
index 3362e843f..a906f8a27 100644
--- a/lib/project.js
+++ b/lib/project.js
@@ -109,7 +109,7 @@ function installBabel() {
     configFile: false,
     plugins: [
       ['@babel/plugin-proposal-decorators', { legacy: true }],
-      ['@babel/plugin-proposal-class-properties', { loose: true }],
+      ['@babel/plugin-transform-class-properties', { loose: true }],
       ['@babel/plugin-transform-modules-commonjs', {loose: true}]
     ],
     only: [/aurelia_project/]
diff --git a/package.json b/package.json
index 1752a2f39..a4dc563ee 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
     "lint": "eslint lib spec",
     "pretest": "npm run lint",
     "test": "jasmine",
-    "coverage": "nyc jasmine",
+    "coverage": "c8 jasmine",
     "test:watch": "nodemon -x 'npm test'",
     "preversion": "npm test",
     "version": "standard-changelog && git add CHANGELOG.md",
@@ -38,64 +38,64 @@
     "url": "https://github.com/aurelia/cli"
   },
   "dependencies": {
-    "@babel/core": "^7.18.2",
-    "@babel/plugin-proposal-class-properties": "^7.17.12",
-    "@babel/plugin-proposal-decorators": "^7.18.2",
-    "@babel/plugin-transform-modules-amd": "^7.18.0",
-    "@babel/plugin-transform-modules-commonjs": "^7.18.2",
-    "@babel/register": "^7.17.7",
+    "@babel/core": "^7.26.0",
+    "@babel/plugin-proposal-decorators": "^7.25.9",
+    "@babel/plugin-transform-class-properties": "^7.25.9",
+    "@babel/plugin-transform-modules-amd": "^7.25.9",
+    "@babel/plugin-transform-modules-commonjs": "^7.25.9",
+    "@babel/register": "^7.25.9",
     "ansi-colors": "^4.1.3",
-    "assert": "^2.0.0",
-    "aurelia-dependency-injection": "^1.5.2",
+    "assert": "^2.1.0",
+    "aurelia-dependency-injection": "^1.6.1",
     "aurelia-logging": "^1.5.2",
     "aurelia-polyfills": "^1.3.4",
     "browserify-zlib": "^0.2.0",
-    "buffer": "^5.7.0",
+    "buffer": "^6.0.3",
     "concat-with-sourcemaps": "^1.1.0",
     "console-browserify": "^1.2.0",
     "constants-browserify": "^1.0.0",
-    "convert-source-map": "^1.8.0",
-    "crypto-browserify": "^3.12.0",
-    "del": "^6.1.1",
-    "domain-browser": "^4.22.0",
-    "enquirer": "^2.3.6",
+    "convert-source-map": "^2.0.0",
+    "crypto-browserify": "^3.12.1",
+    "domain-browser": "^5.7.0",
+    "enquirer": "^2.4.1",
     "events": "^3.3.0",
     "fs-browser-stub": "^1.0.1",
-    "gulp": "^4.0.2",
-    "htmlparser2": "^8.0.1",
+    "gulp": ">=4.0.2",
+    "htmlparser2": "^9.1.0",
     "https-browserify": "^1.0.0",
     "lodash": "^4.17.21",
     "map-stream": "0.0.7",
-    "meriyah": "^4.2.1",
-    "minimatch": "^5.1.0",
+    "meriyah": "^6.0.2",
+    "minimatch": "^10.0.1",
     "npm-which": "^3.0.1",
     "os-browserify": "^0.3.0",
     "path-browserify": "1.0.1",
     "process": "^0.11.10",
-    "punycode": "^2.1.1",
+    "punycode": "^2.3.1",
     "querystring-browser-stub": "^1.0.0",
-    "readable-stream": "^3.6.0",
-    "resolve": "^1.22.0",
-    "semver": "^7.3.7",
+    "readable-stream": "^4.5.2",
+    "resolve": "^1.22.8",
+    "semver": "^7.6.3",
     "stream-browserify": "^3.0.0",
     "stream-http": "^3.2.0",
     "string_decoder": "^1.3.0",
-    "terser": "^5.14.0",
+    "terser": "^5.36.0",
     "timers-browserify": "^2.0.12",
     "tty-browserify": "0.0.1",
-    "typescript": "^4.7.3",
-    "url": "^0.11.0",
-    "util": "^0.12.4",
+    "typescript": "^5.6.3",
+    "url": "^0.11.4",
+    "util": "^0.12.5",
     "vm-browserify": "^1.1.2"
   },
   "devDependencies": {
-    "@types/node": "^17.0.39",
-    "eslint": "^8.17.0",
-    "jasmine": "^4.1.0",
+    "@types/node": "^22.8.1",
+    "c8": "^10.1.2",
+    "eslint": "^9.13.0",
+    "globals": "^15.11.0",
+    "jasmine": "^5.4.0",
     "jasmine-spec-reporter": "^7.0.0",
-    "nodemon": "^2.0.16",
-    "nyc": "^15.1.0",
-    "standard-changelog": "^2.0.27",
-    "yargs": "^17.5.1"
+    "nodemon": "^3.1.7",
+    "standard-changelog": "^6.0.0",
+    "yargs": "^17.7.2"
   }
 }
diff --git a/spec/lib/build/dependency-inclusion.spec.js b/spec/lib/build/dependency-inclusion.spec.js
index bde8c1622..7452fbc26 100644
--- a/spec/lib/build/dependency-inclusion.spec.js
+++ b/spec/lib/build/dependency-inclusion.spec.js
@@ -183,7 +183,6 @@ describe('the DependencyInclusion module', () => {
       lazyMain: true
     };
 
-    // eslint-disable-next-line no-unused-vars
     let sut = new DependencyInclusion(bundle, description);
 
     sut.traceResources()