From 4747348c686fe0e2e5acc31c9ea0be44a1ad8cc4 Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Thu, 28 Mar 2024 22:30:41 -0500 Subject: [PATCH] Target ES2022 main reason is browsers should be updating and supported features. But also makes our bundles slightly smaller and biggest of all gives us updated definitions for things like Error Cause/extra error constructors.... --- .eslintrc.js | 2 +- packages/angularjs/package.json | 4 ++-- packages/browser/package.json | 4 ++-- .../browser/test/plugins/BrowserErrorPlugin.test.ts | 10 ++++++++++ packages/browser/tsconfig.json | 2 +- packages/core/package.json | 4 ++-- packages/node/tsconfig.json | 2 +- packages/react/package.json | 4 ++-- packages/react/tsconfig.json | 2 +- packages/vue/package.json | 4 ++-- packages/vue/tsconfig.json | 2 +- tsconfig.json | 4 ++-- 12 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 73b75e43..fdcb3fb8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -23,7 +23,7 @@ module.exports = { }, parser: "@typescript-eslint/parser", parserOptions: { - ecmaVersion: 2020, + ecmaVersion: 2022, sourceType: "module", project: ["./tsconfig.json"], tsconfigRootDir: __dirname diff --git a/packages/angularjs/package.json b/packages/angularjs/package.json index 3abf0592..b96588da 100644 --- a/packages/angularjs/package.json +++ b/packages/angularjs/package.json @@ -33,8 +33,8 @@ "./package.json": "./package.json" }, "scripts": { - "build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2021 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2021 --format=esm --outfile=dist/index.bundle.min.js", - "watch": "tsc -p ../core/tsconfig.json -w --preserveWatchOutput & tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2021 --format=esm --watch --outfile=dist/index.bundle.js" + "build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2022 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2022 --format=esm --outfile=dist/index.bundle.min.js", + "watch": "tsc -p ../core/tsconfig.json -w --preserveWatchOutput & tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2022 --format=esm --watch --outfile=dist/index.bundle.js" }, "sideEffects": false, "publishConfig": { diff --git a/packages/browser/package.json b/packages/browser/package.json index b8353b34..44f9d7ff 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -45,8 +45,8 @@ "testEnvironment": "jsdom" }, "scripts": { - "build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2021 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2021 --format=esm --outfile=dist/index.bundle.min.js", - "watch": "tsc -p ../core/tsconfig.json -w --preserveWatchOutput & tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2021 --format=esm --watch --outfile=dist/index.bundle.js", + "build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2022 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2022 --format=esm --outfile=dist/index.bundle.min.js", + "watch": "tsc -p ../core/tsconfig.json -w --preserveWatchOutput & tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2022 --format=esm --watch --outfile=dist/index.bundle.js", "test": "jest", "test:watch": "jest --watch" }, diff --git a/packages/browser/test/plugins/BrowserErrorPlugin.test.ts b/packages/browser/test/plugins/BrowserErrorPlugin.test.ts index 2725c20a..d07d79a0 100644 --- a/packages/browser/test/plugins/BrowserErrorPlugin.test.ts +++ b/packages/browser/test/plugins/BrowserErrorPlugin.test.ts @@ -53,6 +53,16 @@ describe("BrowserErrorPlugin", () => { }); }); + test("should add error cause", async () => { + const error = { + someProperty: "Test" + }; + await processError(new Error("Error With Cause", { cause: error })); + const additionalData = getAdditionalData(context.event); + expect(additionalData).not.toBeNull(); + expect(additionalData?.cause).toStrictEqual(error); + }); + test("should add custom properties to additional data", async () => { const error = { someProperty: "Test" diff --git a/packages/browser/tsconfig.json b/packages/browser/tsconfig.json index 42566802..92baf962 100644 --- a/packages/browser/tsconfig.json +++ b/packages/browser/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "lib": ["DOM", "ES2021"], + "lib": ["DOM", "ES2022"], "outDir": "dist", "rootDir": "src", "types": ["jest"] diff --git a/packages/core/package.json b/packages/core/package.json index 8a1054a4..d73cd58a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -45,8 +45,8 @@ "testEnvironment": "jsdom" }, "scripts": { - "build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2021 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2021 --format=esm --outfile=dist/index.bundle.min.js", - "watch": "tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2021 --format=esm --watch --outfile=dist/index.bundle.js", + "build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2022 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2022 --format=esm --outfile=dist/index.bundle.min.js", + "watch": "tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2022 --format=esm --watch --outfile=dist/index.bundle.js", "test": "jest", "test:watch": "jest --watch" }, diff --git a/packages/node/tsconfig.json b/packages/node/tsconfig.json index 0e407fb3..c5f1b0a1 100644 --- a/packages/node/tsconfig.json +++ b/packages/node/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "lib": ["ES2021"], + "lib": ["ES2022"], "outDir": "dist", "rootDir": "src", "types": ["node", "jest"] diff --git a/packages/react/package.json b/packages/react/package.json index 7d52e07e..8b013c71 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -33,8 +33,8 @@ "./package.json": "./package.json" }, "scripts": { - "build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2021 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2021 --format=esm --outfile=dist/index.bundle.min.js", - "watch": "tsc -p ../core/tsconfig.json -w --preserveWatchOutput & tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2021 --format=esm --watch --outfile=dist/index.bundle.js" + "build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2022 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2022 --format=esm --outfile=dist/index.bundle.min.js", + "watch": "tsc -p ../core/tsconfig.json -w --preserveWatchOutput & tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2022 --format=esm --watch --outfile=dist/index.bundle.js" }, "sideEffects": false, "publishConfig": { diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json index 53214787..db74db6d 100644 --- a/packages/react/tsconfig.json +++ b/packages/react/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "lib": ["DOM", "ES2021"], + "lib": ["DOM", "ES2022"], "outDir": "dist", "rootDir": "src", "jsx": "react" diff --git a/packages/vue/package.json b/packages/vue/package.json index d366025c..95602ced 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -33,8 +33,8 @@ "./package.json": "./package.json" }, "scripts": { - "build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2021 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2021 --format=esm --outfile=dist/index.bundle.min.js", - "watch": "tsc -p tsconfig.json -w --preserveWatchOutput & && esbuild src/index.ts --bundle --sourcemap --target=es2021 --format=esm --watch --outfile=dist/index.bundle.js &" + "build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2022 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2022 --format=esm --outfile=dist/index.bundle.min.js", + "watch": "tsc -p tsconfig.json -w --preserveWatchOutput & && esbuild src/index.ts --bundle --sourcemap --target=es2022 --format=esm --watch --outfile=dist/index.bundle.js &" }, "sideEffects": false, "publishConfig": { diff --git a/packages/vue/tsconfig.json b/packages/vue/tsconfig.json index 551e95ae..0b196d33 100644 --- a/packages/vue/tsconfig.json +++ b/packages/vue/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "lib": ["DOM", "ES2021"], + "lib": ["DOM", "ES2022"], "outDir": "dist", "rootDir": "src" }, diff --git a/tsconfig.json b/tsconfig.json index 2bd2b85e..9660a012 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "exactOptionalPropertyTypes": true, "forceConsistentCasingInFileNames": true, "isolatedModules": true, - "lib": ["ES2021", "DOM"], + "lib": ["DOM", "ES2022"], "module": "ESNext", "moduleResolution": "Node", "noImplicitAny": true, @@ -18,7 +18,7 @@ "skipLibCheck": true, "sourceMap": true, "strict": true, - "target": "ES2021", + "target": "ES2022", "useUnknownInCatchVariables": true } }