Skip to content

Commit 219b1ab

Browse files
authored
Target ES2021 and ESM Node18 (fetch built in) (#125)
* Fixed typing issues in svelte example * Target ES2021 and ESM Node18 (fetch built in)
1 parent 3c1e208 commit 219b1ab

14 files changed

+1352
-1464
lines changed

example/svelte-kit/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
},
1515
"devDependencies": {
1616
"@sveltejs/adapter-auto": "^2.0.0",
17-
"@sveltejs/kit": "^1.7.1",
18-
"svelte": "^3.54.0",
19-
"svelte-check": "^3.0.1",
20-
"typescript": "^4.9.3",
21-
"vite": "^4.0.0"
17+
"@sveltejs/kit": "^1.8.8",
18+
"svelte": "^3.55.1",
19+
"svelte-check": "^3.0.4",
20+
"typescript": "^4.9.5",
21+
"vite": "^4.1.4"
2222
},
2323
"type": "module",
2424
"publishConfig": {

example/svelte-kit/src/hooks.client.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Exceptionless } from "@exceptionless/browser";
2+
import { toError } from "@exceptionless/core";
23

34
Exceptionless.startup(c => {
45
c.apiKey = "LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw";
@@ -11,5 +12,5 @@ Exceptionless.startup(c => {
1112
/** @type {import('@sveltejs/kit').HandleClientError} */
1213
export async function handleError({ error, event }) {
1314
console.log('client error handler');
14-
await Exceptionless.submitException(error);
15+
await Exceptionless.submitException(toError(error));
1516
}

example/svelte-kit/src/hooks.server.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { toError } from "@exceptionless/core";
12
import { Exceptionless } from "@exceptionless/node";
23

34
Exceptionless.startup(c => {
@@ -11,5 +12,5 @@ Exceptionless.startup(c => {
1112
/** @type {import('@sveltejs/kit').HandleServerError} */
1213
export async function handleError({ error, event }) {
1314
console.log('server error handler');
14-
await Exceptionless.submitException(error);
15+
await Exceptionless.submitException(toError(error));
1516
}

package-lock.json

+1,310-1,421
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
"example/*"
3434
],
3535
"devDependencies": {
36-
"@typescript-eslint/eslint-plugin": "^5.52.0",
37-
"@typescript-eslint/parser": "^5.52.0",
38-
"eslint": "^8.34.0",
36+
"@typescript-eslint/eslint-plugin": "^5.54.0",
37+
"@typescript-eslint/parser": "^5.54.0",
38+
"eslint": "^8.35.0",
3939
"eslint-plugin-eslint-comments": "^3.2.0",
4040
"eslint-plugin-eslint-plugin": "^5.0.8",
4141
"eslint-plugin-import": "^2.27.5",

packages/angularjs/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@
3333
"./package.json": "./package.json"
3434
},
3535
"scripts": {
36-
"build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2017 --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=es2017 --format=esm --watch --outfile=dist/index.bundle.js"
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"
3838
},
3939
"sideEffects": false,
4040
"publishConfig": {
4141
"access": "public"
4242
},
4343
"devDependencies": {
4444
"@types/angular": "^1.8.4",
45-
"esbuild": "^0.17.8"
45+
"esbuild": "^0.17.10"
4646
},
4747
"dependencies": {
4848
"@exceptionless/browser": "2.0.0-dev"

packages/browser/package.json

+3-3
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=es2017 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2017 --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=es2017 --format=esm --watch --outfile=dist/index.bundle.js",
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",
5050
"test": "jest"
5151
},
5252
"sideEffects": false,
@@ -55,7 +55,7 @@
5555
},
5656
"devDependencies": {
5757
"@jest/globals": "^29.4.3",
58-
"esbuild": "^0.17.8",
58+
"esbuild": "^0.17.10",
5959
"jest": "^29.4.3",
6060
"jest-environment-jsdom": "^29.4.3",
6161
"jest-ts-webcompat-resolver": "^1.0.0",

packages/core/package.json

+3-3
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=es2017 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2017 --format=esm --outfile=dist/index.bundle.min.js",
49-
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --watch --outfile=dist/index.bundle.js",
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",
5050
"test": "jest"
5151
},
5252
"sideEffects": false,
@@ -55,7 +55,7 @@
5555
},
5656
"devDependencies": {
5757
"@jest/globals": "^29.4.3",
58-
"esbuild": "^0.17.8",
58+
"esbuild": "^0.17.10",
5959
"jest": "^29.4.3",
6060
"jest-environment-jsdom": "^29.4.3",
6161
"jest-ts-webcompat-resolver": "^1.0.0",

packages/node/package.json

+8-6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
".": "./dist/index.js",
3333
"./package.json": "./package.json"
3434
},
35+
"engines": {
36+
"node": ">=18"
37+
},
3538
"jest": {
3639
"moduleFileExtensions": [
3740
"js",
@@ -45,27 +48,26 @@
4548
"testEnvironment": "node"
4649
},
4750
"scripts": {
48-
"build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --platform=node --target=node12 --format=cjs --outfile=dist/index.bundle.js",
49-
"watch": "tsc -p ../core/tsconfig.json -w --preserveWatchOutput & tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --platform=node --sourcemap --target=node12 --format=cjs --watch --outfile=dist/index.bundle.js",
51+
"build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --platform=node --format=esm --outfile=dist/index.bundle.js",
52+
"watch": "tsc -p ../core/tsconfig.json -w --preserveWatchOutput & tsc -p tsconfig.json -w --preserveWatchOutput & esbuild src/index.ts --bundle --platform=node --sourcemap --format=esm --watch --outfile=dist/index.bundle.js",
5053
"test": "jest"
5154
},
5255
"sideEffects": false,
5356
"publishConfig": {
5457
"access": "public"
5558
},
5659
"devDependencies": {
57-
"@types/node": "^18.13.0",
60+
"@jest/globals": "^29.4.3",
61+
"@types/node": "^18.14.2",
5862
"@types/node-localstorage": "^1.3.0",
5963
"@types/stack-trace": "^0.0.30",
60-
"@jest/globals": "^29.4.3",
61-
"esbuild": "^0.17.8",
64+
"esbuild": "^0.17.10",
6265
"jest": "^29.4.3",
6366
"jest-ts-webcompat-resolver": "^1.0.0",
6467
"ts-jest": "^29.0.5"
6568
},
6669
"dependencies": {
6770
"@exceptionless/core": "2.0.0-dev",
68-
"node-fetch": "^3.3.0",
6971
"node-localstorage": "^2.2.1",
7072
"stack-trace": "^1.0.0-pre2"
7173
}

packages/node/src/NodeExceptionlessClient.ts

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import {
22
Configuration,
3-
DefaultSubmissionClient,
43
ExceptionlessClient,
54
LocalStorage,
65
SimpleErrorPlugin
76
} from "@exceptionless/core";
87

98
import { LocalStorage as LocalStoragePolyfill } from "node-localstorage";
10-
import fetch from "node-fetch";
119

1210
import { NodeErrorPlugin } from "./plugins/NodeErrorPlugin.js";
1311
import { NodeEnvironmentInfoPlugin } from "./plugins/NodeEnvironmentInfoPlugin.js";
@@ -21,15 +19,9 @@ export class NodeExceptionlessClient extends ExceptionlessClient {
2119
const config = this.config;
2220

2321
if (configurationOrApiKey && !this._initialized) {
24-
if (!globalThis?.localStorage) {
25-
const storage = new LocalStorage(undefined, new LocalStoragePolyfill(process.cwd() + '/.exceptionless'));
26-
config.useLocalStorage = () => storage;
27-
config.services.storage = storage;
28-
}
29-
30-
if (!globalThis?.fetch) {
31-
config.services.submissionClient = new DefaultSubmissionClient(config, fetch as (input: RequestInfo | URL, init?: RequestInit | undefined) => Promise<Response>);
32-
}
22+
const storage = new LocalStorage(undefined, new LocalStoragePolyfill(process.cwd() + '/.exceptionless'));
23+
config.useLocalStorage = () => storage;
24+
config.services.storage = storage;
3325

3426
config.addPlugin(new NodeEnvironmentInfoPlugin());
3527
config.addPlugin(new NodeGlobalHandlerPlugin());

packages/node/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4+
"lib": [
5+
"ES2021"
6+
],
47
"outDir": "dist",
58
"rootDir": "src",
69
"types": [

packages/react/package.json

+3-3
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=es2017 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2017 --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=es2017 --format=esm --watch --outfile=dist/index.bundle.js"
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"
3838
},
3939
"sideEffects": false,
4040
"publishConfig": {
@@ -44,7 +44,7 @@
4444
"@jest/globals": "^29.4.3",
4545
"@types/react": "^18.0.28",
4646
"@types/react-dom": "^18.0.11",
47-
"esbuild": "^0.17.8",
47+
"esbuild": "^0.17.10",
4848
"jest": "^29.4.3",
4949
"jest-ts-webcompat-resolver": "^1.0.0",
5050
"ts-jest": "^29.0.5"

packages/vue/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
"./package.json": "./package.json"
3434
},
3535
"scripts": {
36-
"build": "tsc -p tsconfig.json && esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --outfile=dist/index.bundle.js && esbuild src/index.ts --bundle --minify --sourcemap --target=es2017 --format=esm --outfile=dist/index.bundle.min.js",
37-
"watch": "tsc -p tsconfig.json -w --preserveWatchOutput & && esbuild src/index.ts --bundle --sourcemap --target=es2017 --format=esm --watch --outfile=dist/index.bundle.js &"
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 &"
3838
},
3939
"sideEffects": false,
4040
"publishConfig": {
4141
"access": "public"
4242
},
4343
"devDependencies": {
44-
"esbuild": "^0.17.8"
44+
"esbuild": "^0.17.10"
4545
},
4646
"dependencies": {
4747
"@exceptionless/browser": "2.0.0-dev"

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"skipLibCheck": true,
2222
"sourceMap": true,
2323
"strict": true,
24-
"target": "ES2019",
24+
"target": "ES2021",
2525
"useUnknownInCatchVariables": true
2626
}
2727
}

0 commit comments

Comments
 (0)