Skip to content

Commit 6898ae6

Browse files
authored
Target ES2022 (#149)
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....
1 parent 96e40b0 commit 6898ae6

12 files changed

+27
-17
lines changed

.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = {
2323
},
2424
parser: "@typescript-eslint/parser",
2525
parserOptions: {
26-
ecmaVersion: 2020,
26+
ecmaVersion: 2022,
2727
sourceType: "module",
2828
project: ["./tsconfig.json"],
2929
tsconfigRootDir: __dirname

packages/angularjs/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"./package.json": "./package.json"
3434
},
3535
"scripts": {
36-
"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",
37-
"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"
36+
"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",
37+
"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"
3838
},
3939
"sideEffects": false,
4040
"publishConfig": {

packages/browser/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
"testEnvironment": "jsdom"
4646
},
4747
"scripts": {
48-
"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",
49-
"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",
48+
"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",
49+
"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",
5050
"test": "jest",
5151
"test:watch": "jest --watch"
5252
},

packages/browser/test/plugins/BrowserErrorPlugin.test.ts

+10
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ describe("BrowserErrorPlugin", () => {
5353
});
5454
});
5555

56+
test("should add error cause", async () => {
57+
const error = {
58+
someProperty: "Test"
59+
};
60+
await processError(new Error("Error With Cause", { cause: error }));
61+
const additionalData = getAdditionalData(context.event);
62+
expect(additionalData).not.toBeNull();
63+
expect(additionalData?.cause).toStrictEqual(error);
64+
});
65+
5666
test("should add custom properties to additional data", async () => {
5767
const error = {
5868
someProperty: "Test"

packages/browser/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"lib": ["DOM", "ES2021"],
4+
"lib": ["DOM", "ES2022"],
55
"outDir": "dist",
66
"rootDir": "src",
77
"types": ["jest"]

packages/core/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
"testEnvironment": "jsdom"
4646
},
4747
"scripts": {
48-
"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",
49-
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2021 --format=esm --watch --outfile=dist/index.bundle.js",
48+
"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",
49+
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2022 --format=esm --watch --outfile=dist/index.bundle.js",
5050
"test": "jest",
5151
"test:watch": "jest --watch"
5252
},

packages/node/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"lib": ["ES2021"],
4+
"lib": ["ES2022"],
55
"outDir": "dist",
66
"rootDir": "src",
77
"types": ["node", "jest"]

packages/react/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"./package.json": "./package.json"
3434
},
3535
"scripts": {
36-
"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",
37-
"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"
36+
"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",
37+
"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"
3838
},
3939
"sideEffects": false,
4040
"publishConfig": {

packages/react/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"lib": ["DOM", "ES2021"],
4+
"lib": ["DOM", "ES2022"],
55
"outDir": "dist",
66
"rootDir": "src",
77
"jsx": "react"

packages/vue/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"./package.json": "./package.json"
3434
},
3535
"scripts": {
36-
"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",
37-
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput & && esbuild src/index.ts --bundle --sourcemap --target=es2021 --format=esm --watch --outfile=dist/index.bundle.js &"
36+
"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",
37+
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput & && esbuild src/index.ts --bundle --sourcemap --target=es2022 --format=esm --watch --outfile=dist/index.bundle.js &"
3838
},
3939
"sideEffects": false,
4040
"publishConfig": {

packages/vue/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"lib": ["DOM", "ES2021"],
4+
"lib": ["DOM", "ES2022"],
55
"outDir": "dist",
66
"rootDir": "src"
77
},

tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"exactOptionalPropertyTypes": true,
77
"forceConsistentCasingInFileNames": true,
88
"isolatedModules": true,
9-
"lib": ["ES2021", "DOM"],
9+
"lib": ["DOM", "ES2022"],
1010
"module": "ESNext",
1111
"moduleResolution": "Node",
1212
"noImplicitAny": true,
@@ -18,7 +18,7 @@
1818
"skipLibCheck": true,
1919
"sourceMap": true,
2020
"strict": true,
21-
"target": "ES2021",
21+
"target": "ES2022",
2222
"useUnknownInCatchVariables": true
2323
}
2424
}

0 commit comments

Comments
 (0)