From ece39b0ecf60b8444407e5a95ae7db200c5a6e07 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 17 Oct 2022 14:00:24 -0400 Subject: [PATCH 1/2] major: minimum node 14 --- package.json | 3 +++ tsconfig.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 4b36be7b..68fee803 100644 --- a/package.json +++ b/package.json @@ -131,5 +131,8 @@ "vue": "^2.6.10", "vue-server-renderer": "^2.6.10", "when": "^3.7.8" + }, + "engines": { + "node": ">=14" } } diff --git a/tsconfig.json b/tsconfig.json index 2c758fa1..27218b7f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,7 @@ "noUnusedParameters": true, "noImplicitThis": true, "outDir": "out", - "target": "es2017", + "target": "es2020", "types": ["node"], "skipLibCheck": true, "strict": true From 2514965f162d16a1fc944731b826e451a1fb8996 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 17 Oct 2022 14:13:44 -0400 Subject: [PATCH 2/2] bump typescript 4.8.4 --- package.json | 2 +- src/analyze.ts | 4 ++-- src/node-file-trace.ts | 10 +++++----- yarn.lock | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 68fee803..6f9c6992 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "swig": "^1.4.2", "tiny-json-http": "^7.1.2", "twilio": "^3.33.0", - "typescript": "^3.9.6", + "typescript": "^4.8.4", "uglify-js": "^3.6.0", "unified": "^10.1.0", "vm2": "^3.9.11", diff --git a/src/analyze.ts b/src/analyze.ts index 2ddb828e..1b4261ad 100644 --- a/src/analyze.ts +++ b/src/analyze.ts @@ -269,7 +269,7 @@ export default async function analyze(id: string, code: string, job: Job): Promi ast = acorn.parse(code, { ecmaVersion: 'latest', allowReturnOutsideFunction: true }); isESM = false; } - catch (e) { + catch (e: any) { const isModule = e && e.message && e.message.includes('sourceType: module'); if (!isModule) { job.warnings.add(new Error(`Failed to parse ${id} as script:\n${e && e.message}`)); @@ -281,7 +281,7 @@ export default async function analyze(id: string, code: string, job: Job): Promi ast = acorn.parse(code, { ecmaVersion: 'latest', sourceType: 'module', allowAwaitOutsideFunction: true }); isESM = true; } - catch (e) { + catch (e: any) { job.warnings.add(new Error(`Failed to parse ${id} as module:\n${e && e.message}`)); // Parser errors just skip analysis return { assets, deps, imports, isESM: false }; diff --git a/src/node-file-trace.ts b/src/node-file-trace.ts index a0e871b8..7dd8627b 100644 --- a/src/node-file-trace.ts +++ b/src/node-file-trace.ts @@ -168,7 +168,7 @@ export class Job { this.symlinkCache.set(path, link); return link; } - catch (e) { + catch (e: any) { if (e.code !== 'EINVAL' && e.code !== 'ENOENT' && e.code !== 'UNKNOWN') throw e; this.symlinkCache.set(path, null); @@ -202,7 +202,7 @@ export class Job { this.statCache.set(path, stats); return stats; } - catch (e) { + catch (e: any) { if (e.code === 'ENOENT') { this.statCache.set(path, null); return null; @@ -227,7 +227,7 @@ export class Job { this.fileCache.set(path, source); return source; } - catch (e) { + catch (e: any) { if (e.code === 'ENOENT' || e.code === 'EISDIR') { this.fileCache.set(path, null); return null; @@ -358,7 +358,7 @@ export class Job { try { var resolved = await this.resolve(dep, path, this, !isESM); } - catch (e) { + catch (e: any) { this.warnings.add(new Error(`Failed to resolve dependency ${dep}:\n${e && e.message}`)); return; } @@ -379,7 +379,7 @@ export class Job { try { var resolved = await this.resolve(dep, path, this, false); } - catch (e) { + catch (e: any) { this.warnings.add(new Error(`Failed to resolve dependency ${dep}:\n${e && e.message}`)); return; } diff --git a/yarn.lock b/yarn.lock index c28ac883..baa2fdcf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15720,10 +15720,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^3.9.6: - version "3.9.9" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.9.tgz#e69905c54bc0681d0518bd4d587cc6f2d0b1a674" - integrity sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w== +typescript@^4.8.4: + version "4.8.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" + integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== uglify-es@^3.3.9: version "3.3.9"