websocket-ts 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +225 -212
- package/dist/cjs/src/backoff/exponentialbackoff.js +1 -1
- package/dist/cjs/src/backoff/exponentialbackoff.js.map +1 -1
- package/dist/cjs/src/index.d.ts +1 -1
- package/dist/cjs/src/index.d.ts.map +1 -1
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/websocket.d.ts +9 -3
- package/dist/cjs/src/websocket.d.ts.map +1 -1
- package/dist/cjs/src/websocket.js +7 -3
- package/dist/cjs/src/websocket.js.map +1 -1
- package/dist/cjs/src/websocket_builder.d.ts +9 -9
- package/dist/cjs/src/websocket_builder.d.ts.map +1 -1
- package/dist/cjs/src/websocket_builder.js +6 -6
- package/dist/cjs/src/websocket_builder.js.map +1 -1
- package/dist/cjs/src/websocket_event.d.ts +18 -7
- package/dist/cjs/src/websocket_event.d.ts.map +1 -1
- package/dist/cjs/src/websocket_event.js +8 -9
- package/dist/cjs/src/websocket_event.js.map +1 -1
- package/dist/cjs/src/websocket_retry_options.d.ts +1 -1
- package/dist/esm/src/backoff/exponentialbackoff.js +1 -1
- package/dist/esm/src/backoff/exponentialbackoff.js.map +1 -1
- package/dist/esm/src/index.d.ts +1 -1
- package/dist/esm/src/index.d.ts.map +1 -1
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/websocket.d.ts +9 -3
- package/dist/esm/src/websocket.d.ts.map +1 -1
- package/dist/esm/src/websocket.js +7 -3
- package/dist/esm/src/websocket.js.map +1 -1
- package/dist/esm/src/websocket_builder.d.ts +9 -9
- package/dist/esm/src/websocket_builder.d.ts.map +1 -1
- package/dist/esm/src/websocket_builder.js +6 -6
- package/dist/esm/src/websocket_builder.js.map +1 -1
- package/dist/esm/src/websocket_event.d.ts +18 -7
- package/dist/esm/src/websocket_event.d.ts.map +1 -1
- package/dist/esm/src/websocket_event.js +8 -9
- package/dist/esm/src/websocket_event.js.map +1 -1
- package/dist/esm/src/websocket_retry_options.d.ts +1 -1
- package/package.json +19 -24
- package/src/backoff/exponentialbackoff.ts +1 -1
- package/src/index.ts +1 -1
- package/src/websocket.ts +16 -5
- package/src/websocket_builder.ts +10 -10
- package/src/websocket_event.ts +22 -7
- package/src/websocket_retry_options.ts +1 -1
- package/tsconfig.cjs.json +74 -74
- package/tsconfig.esm.json +74 -74
- package/websocket-ts-2.2.0.tgz +0 -0
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Events that can be fired by the websocket.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
5
|
-
(function (WebsocketEvent) {
|
|
4
|
+
export const WebsocketEvent = {
|
|
6
5
|
/** Fired when the connection is opened. */
|
|
7
|
-
|
|
6
|
+
open: "open",
|
|
8
7
|
/** Fired when the connection is closed. */
|
|
9
|
-
|
|
8
|
+
close: "close",
|
|
10
9
|
/** Fired when the connection has been closed because of an error, such as when some data couldn't be sent. */
|
|
11
|
-
|
|
10
|
+
error: "error",
|
|
12
11
|
/** Fired when a message is received. */
|
|
13
|
-
|
|
12
|
+
message: "message",
|
|
14
13
|
/** Fired when the websocket tries to reconnect after a connection loss. */
|
|
15
|
-
|
|
14
|
+
retry: "retry",
|
|
16
15
|
/** Fired when the websocket successfully reconnects after a connection loss. */
|
|
17
|
-
|
|
18
|
-
}
|
|
16
|
+
reconnect: "reconnect",
|
|
17
|
+
};
|
|
19
18
|
//# sourceMappingURL=websocket_event.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket_event.js","sourceRoot":"","sources":["../../../src/websocket_event.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,
|
|
1
|
+
{"version":3,"file":"websocket_event.js","sourceRoot":"","sources":["../../../src/websocket_event.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,2CAA2C;IAC3C,IAAI,EAAE,MAAM;IAEZ,2CAA2C;IAC3C,KAAK,EAAE,OAAO;IAEd,8GAA8G;IAC9G,KAAK,EAAE,OAAO;IAEd,wCAAwC;IACxC,OAAO,EAAE,SAAS;IAElB,2EAA2E;IAC3E,KAAK,EAAE,OAAO;IAEd,gFAAgF;IAChF,SAAS,EAAE,WAAW;CACd,CAAC"}
|
|
@@ -8,7 +8,7 @@ export interface WebsocketConnectionRetryOptions {
|
|
|
8
8
|
*/
|
|
9
9
|
readonly maxRetries?: number;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Whether to reconnect immediately after a connection has been lost,
|
|
12
12
|
* ignoring the backoff strategy for the first retry.
|
|
13
13
|
*/
|
|
14
14
|
readonly instantReconnect?: boolean;
|
package/package.json
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "websocket-ts",
|
|
3
|
-
"
|
|
3
|
+
"description": "A WebSocket client library with optional reconnecting and buffering capabilities.",
|
|
4
|
+
"version": "2.3.0",
|
|
4
5
|
"main": "dist/cjs/src/index.js",
|
|
5
6
|
"types": "dist/cjs/src/index.d.ts",
|
|
6
7
|
"module": "dist/esm/src/index.js",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"exports": {
|
|
9
|
-
"import": "./dist/esm/src/index.js",
|
|
10
|
-
"require": "./dist/cjs/src/index.js"
|
|
11
|
-
},
|
|
12
8
|
"license": "MIT",
|
|
13
9
|
"keywords": [
|
|
14
10
|
"websocket",
|
|
@@ -26,28 +22,27 @@
|
|
|
26
22
|
"build": "npm run build:cjs && npm run build:esm",
|
|
27
23
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
28
24
|
"build:esm": "tsc -p tsconfig.esm.json",
|
|
29
|
-
"
|
|
30
|
-
"lint": "cross-env-shell eslint",
|
|
25
|
+
"lint": "cross-env-shell eslint './src/{**/*,*}.{js,ts}' './tests/{**/*,*}.{js,ts}'",
|
|
31
26
|
"test": "vitest",
|
|
32
27
|
"test:coverage": "vitest --coverage"
|
|
33
28
|
},
|
|
34
29
|
"devDependencies": {
|
|
35
|
-
"@eslint/eslintrc": "^3.
|
|
36
|
-
"@eslint/js": "^9.
|
|
37
|
-
"@types/ws": "^8.
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
39
|
-
"@typescript-eslint/parser": "^8.
|
|
40
|
-
"@vitest/coverage-v8": "^3.
|
|
41
|
-
"coveralls": "^
|
|
42
|
-
"cross-env": "^
|
|
43
|
-
"eslint": "^9.
|
|
44
|
-
"eslint-config-prettier": "^10.
|
|
45
|
-
"eslint-plugin-prettier": "^5.
|
|
46
|
-
"globals": "^
|
|
47
|
-
"jsdom": "^26.
|
|
30
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
31
|
+
"@eslint/js": "^9.39.4",
|
|
32
|
+
"@types/ws": "^8.18.1",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^8.57.2",
|
|
34
|
+
"@typescript-eslint/parser": "^8.57.2",
|
|
35
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
36
|
+
"coveralls-next": "^5.0.0",
|
|
37
|
+
"cross-env": "^10.1.0",
|
|
38
|
+
"eslint": "^9.39.4",
|
|
39
|
+
"eslint-config-prettier": "^10.1.8",
|
|
40
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
41
|
+
"globals": "^16.5.0",
|
|
42
|
+
"jsdom": "^26.1.0",
|
|
48
43
|
"ts-node": "^10.9.2",
|
|
49
|
-
"typescript": "^5.
|
|
50
|
-
"vitest": "^3.
|
|
51
|
-
"ws": "^8.
|
|
44
|
+
"typescript": "^5.9.3",
|
|
45
|
+
"vitest": "^3.2.4",
|
|
46
|
+
"ws": "^8.20.0"
|
|
52
47
|
}
|
|
53
48
|
}
|
|
@@ -46,7 +46,7 @@ export class ExponentialBackoff implements Backoff {
|
|
|
46
46
|
throw new Error("Base must be a positive integer or zero");
|
|
47
47
|
}
|
|
48
48
|
if (expMax !== undefined && (!Number.isInteger(expMax) || expMax < 0)) {
|
|
49
|
-
throw new Error("ExpMax must be
|
|
49
|
+
throw new Error("ExpMax must be undefined, a positive integer, or zero");
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
this.base = base;
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { LinearBackoff } from "./backoff/linearbackoff";
|
|
|
5
5
|
export { Queue } from "./queue/queue";
|
|
6
6
|
export { ArrayQueue } from "./queue/array_queue";
|
|
7
7
|
export { RingQueue } from "./queue/ring_queue";
|
|
8
|
-
export { Websocket } from "./websocket";
|
|
8
|
+
export { UrlProvider, Websocket } from "./websocket";
|
|
9
9
|
export { WebsocketBuffer } from "./websocket_buffer";
|
|
10
10
|
export { WebsocketBuilder } from "./websocket_builder";
|
|
11
11
|
export {
|
package/src/websocket.ts
CHANGED
|
@@ -12,11 +12,18 @@ import {
|
|
|
12
12
|
} from "./websocket_event";
|
|
13
13
|
import { WebsocketOptions } from "./websocket_options";
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* A URL or a function that returns a URL. When a function is provided, it is called on each connection attempt,
|
|
17
|
+
* enabling use cases like load balancing, auth token rotation, and failover.
|
|
18
|
+
*/
|
|
19
|
+
export type UrlProvider = string | (() => string);
|
|
20
|
+
|
|
15
21
|
/**
|
|
16
22
|
* A websocket wrapper that can be configured to reconnect automatically and buffer messages when the websocket is not connected.
|
|
17
23
|
*/
|
|
18
24
|
export class Websocket {
|
|
19
|
-
private readonly
|
|
25
|
+
private readonly _urlProvider: UrlProvider; // the url or url provider
|
|
26
|
+
private _url!: string; // the last resolved url
|
|
20
27
|
private readonly _protocols?: string | string[]; // the protocols to use
|
|
21
28
|
|
|
22
29
|
private _closedByUser: boolean = false; // whether the websocket was closed by the user
|
|
@@ -30,16 +37,16 @@ export class Websocket {
|
|
|
30
37
|
/**
|
|
31
38
|
* Creates a new websocket.
|
|
32
39
|
*
|
|
33
|
-
* @param url to connect to.
|
|
40
|
+
* @param url to connect to, or a function that returns a URL.
|
|
34
41
|
* @param protocols optional protocols to use.
|
|
35
42
|
* @param options optional options to use.
|
|
36
43
|
*/
|
|
37
44
|
constructor(
|
|
38
|
-
url:
|
|
45
|
+
url: UrlProvider,
|
|
39
46
|
protocols?: string | string[],
|
|
40
47
|
options?: WebsocketOptions,
|
|
41
48
|
) {
|
|
42
|
-
this.
|
|
49
|
+
this._urlProvider = url;
|
|
43
50
|
this._protocols = protocols;
|
|
44
51
|
|
|
45
52
|
// make a copy of the options to prevent the user from changing them
|
|
@@ -271,7 +278,11 @@ export class Websocket {
|
|
|
271
278
|
* @return the created browser-native websocket which is also stored in the '_underlyingWebsocket' property.
|
|
272
279
|
*/
|
|
273
280
|
private tryConnect(): WebSocket {
|
|
274
|
-
this.
|
|
281
|
+
this._url =
|
|
282
|
+
typeof this._urlProvider === "function"
|
|
283
|
+
? this._urlProvider()
|
|
284
|
+
: this._urlProvider;
|
|
285
|
+
this._underlyingWebsocket = new WebSocket(this._url, this.protocols); // create new browser-native websocket and add all event listeners
|
|
275
286
|
this._underlyingWebsocket.addEventListener(
|
|
276
287
|
WebsocketEvent.open,
|
|
277
288
|
this.handleOpenEvent,
|
package/src/websocket_builder.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
WebsocketEventListener,
|
|
5
5
|
WebsocketEventListenerOptions,
|
|
6
6
|
} from "./websocket_event";
|
|
7
|
-
import { Websocket } from "./websocket";
|
|
7
|
+
import { UrlProvider, Websocket } from "./websocket";
|
|
8
8
|
import { WebsocketBuffer } from "./websocket_buffer";
|
|
9
9
|
import { WebsocketOptions } from "./websocket_options";
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ import { WebsocketOptions } from "./websocket_options";
|
|
|
12
12
|
* Builder for websockets.
|
|
13
13
|
*/
|
|
14
14
|
export class WebsocketBuilder {
|
|
15
|
-
private readonly _url:
|
|
15
|
+
private readonly _url: UrlProvider;
|
|
16
16
|
|
|
17
17
|
private _protocols?: string | string[];
|
|
18
18
|
private _options?: WebsocketOptions;
|
|
@@ -20,18 +20,18 @@ export class WebsocketBuilder {
|
|
|
20
20
|
/**
|
|
21
21
|
* Creates a new WebsocketBuilder.
|
|
22
22
|
*
|
|
23
|
-
* @param url the url to connect to
|
|
23
|
+
* @param url the url to connect to, or a function that returns a URL
|
|
24
24
|
*/
|
|
25
|
-
constructor(url:
|
|
25
|
+
constructor(url: UrlProvider) {
|
|
26
26
|
this._url = url;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Getter for the url.
|
|
31
31
|
*
|
|
32
|
-
* @returns the url
|
|
32
|
+
* @returns the url or url provider
|
|
33
33
|
*/
|
|
34
|
-
get url():
|
|
34
|
+
get url(): UrlProvider {
|
|
35
35
|
return this._url;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -79,9 +79,9 @@ export class WebsocketBuilder {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
|
-
* Sets
|
|
82
|
+
* Sets whether to reconnect immediately after a connection has been lost, ignoring the backoff strategy for the first retry.
|
|
83
83
|
*
|
|
84
|
-
* @param instantReconnect
|
|
84
|
+
* @param instantReconnect whether to reconnect immediately after a connection has been lost
|
|
85
85
|
*/
|
|
86
86
|
public withInstantReconnect(
|
|
87
87
|
instantReconnect: boolean | undefined,
|
|
@@ -94,9 +94,9 @@ export class WebsocketBuilder {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
|
-
* Getter for
|
|
97
|
+
* Getter for whether to reconnect immediately after a connection has been lost, ignoring the backoff strategy for the first retry.
|
|
98
98
|
*
|
|
99
|
-
* @returns
|
|
99
|
+
* @returns whether to reconnect immediately after a connection has been lost, undefined if no value has been set
|
|
100
100
|
*/
|
|
101
101
|
get instantReconnect(): boolean | undefined {
|
|
102
102
|
return this._options?.retry?.instantReconnect;
|
package/src/websocket_event.ts
CHANGED
|
@@ -3,24 +3,39 @@ import { Websocket } from "./websocket";
|
|
|
3
3
|
/**
|
|
4
4
|
* Events that can be fired by the websocket.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export const WebsocketEvent = {
|
|
7
7
|
/** Fired when the connection is opened. */
|
|
8
|
-
open
|
|
8
|
+
open: "open",
|
|
9
9
|
|
|
10
10
|
/** Fired when the connection is closed. */
|
|
11
|
-
close
|
|
11
|
+
close: "close",
|
|
12
12
|
|
|
13
13
|
/** Fired when the connection has been closed because of an error, such as when some data couldn't be sent. */
|
|
14
|
-
error
|
|
14
|
+
error: "error",
|
|
15
15
|
|
|
16
16
|
/** Fired when a message is received. */
|
|
17
|
-
message
|
|
17
|
+
message: "message",
|
|
18
18
|
|
|
19
19
|
/** Fired when the websocket tries to reconnect after a connection loss. */
|
|
20
|
-
retry
|
|
20
|
+
retry: "retry",
|
|
21
21
|
|
|
22
22
|
/** Fired when the websocket successfully reconnects after a connection loss. */
|
|
23
|
-
reconnect
|
|
23
|
+
reconnect: "reconnect",
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
/** Union of all event type strings, allowing plain strings like "open" as event types. */
|
|
27
|
+
export type WebsocketEvent =
|
|
28
|
+
(typeof WebsocketEvent)[keyof typeof WebsocketEvent];
|
|
29
|
+
|
|
30
|
+
/** Provides member types (e.g. WebsocketEvent.open) for use as generic type arguments. */
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
32
|
+
export namespace WebsocketEvent {
|
|
33
|
+
export type open = typeof WebsocketEvent.open;
|
|
34
|
+
export type close = typeof WebsocketEvent.close;
|
|
35
|
+
export type error = typeof WebsocketEvent.error;
|
|
36
|
+
export type message = typeof WebsocketEvent.message;
|
|
37
|
+
export type retry = typeof WebsocketEvent.retry;
|
|
38
|
+
export type reconnect = typeof WebsocketEvent.reconnect;
|
|
24
39
|
}
|
|
25
40
|
|
|
26
41
|
/***
|
|
@@ -10,7 +10,7 @@ export interface WebsocketConnectionRetryOptions {
|
|
|
10
10
|
readonly maxRetries?: number;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Whether to reconnect immediately after a connection has been lost,
|
|
14
14
|
* ignoring the backoff strategy for the first retry.
|
|
15
15
|
*/
|
|
16
16
|
readonly instantReconnect?: boolean;
|
package/tsconfig.cjs.json
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Basic Options */
|
|
6
|
-
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
-
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
8
|
-
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
9
|
-
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
10
|
-
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
|
-
// "checkJs": true, /* Report errors in .js files. */
|
|
12
|
-
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
13
|
-
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
14
|
-
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
15
|
-
"sourceMap": true, /* Generates corresponding '.map' file. */
|
|
16
|
-
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
17
|
-
"outDir": "./dist/cjs", /* Redirect output structure to the directory. */
|
|
18
|
-
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
19
|
-
// "composite": true, /* Enable project compilation */
|
|
20
|
-
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
21
|
-
// "removeComments": true, /* Do not emit comments to output. */
|
|
22
|
-
// "noEmit": true, /* Do not emit outputs. */
|
|
23
|
-
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
24
|
-
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
25
|
-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
26
|
-
|
|
27
|
-
/* Strict Type-Checking Options */
|
|
28
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
29
|
-
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
30
|
-
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
31
|
-
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
32
|
-
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
33
|
-
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
34
|
-
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
35
|
-
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
36
|
-
|
|
37
|
-
/* Additional Checks */
|
|
38
|
-
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
39
|
-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
40
|
-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
41
|
-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
42
|
-
|
|
43
|
-
/* Module Resolution Options */
|
|
44
|
-
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
45
|
-
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
46
|
-
"paths": {
|
|
47
|
-
// workaround for: https://github.com/vitest-dev/vitest/issues/4567
|
|
48
|
-
"rollup/parseAst": ["./node_modules/rollup/dist/parseAst"]
|
|
49
|
-
}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
50
|
-
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
51
|
-
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
52
|
-
// "types": [], /* Type declaration files to be included in compilation. */
|
|
53
|
-
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
54
|
-
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
55
|
-
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
56
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
57
|
-
|
|
58
|
-
/* Source Map Options */
|
|
59
|
-
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
60
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
61
|
-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
62
|
-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
63
|
-
|
|
64
|
-
/* Experimental Options */
|
|
65
|
-
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
66
|
-
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
67
|
-
|
|
68
|
-
/* Advanced Options */
|
|
69
|
-
"skipLibCheck": true, /* Skip type checking of declaration files. */
|
|
70
|
-
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
71
|
-
},
|
|
72
|
-
"include": ["src", "tests"],
|
|
73
|
-
"exclude": ["node_modules", "dist"]
|
|
74
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Basic Options */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
8
|
+
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
9
|
+
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
10
|
+
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
|
+
// "checkJs": true, /* Report errors in .js files. */
|
|
12
|
+
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
13
|
+
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
14
|
+
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
15
|
+
"sourceMap": true, /* Generates corresponding '.map' file. */
|
|
16
|
+
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
17
|
+
"outDir": "./dist/cjs", /* Redirect output structure to the directory. */
|
|
18
|
+
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
19
|
+
// "composite": true, /* Enable project compilation */
|
|
20
|
+
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
21
|
+
// "removeComments": true, /* Do not emit comments to output. */
|
|
22
|
+
// "noEmit": true, /* Do not emit outputs. */
|
|
23
|
+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
24
|
+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
25
|
+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
26
|
+
|
|
27
|
+
/* Strict Type-Checking Options */
|
|
28
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
29
|
+
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
30
|
+
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
31
|
+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
32
|
+
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
33
|
+
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
34
|
+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
35
|
+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
36
|
+
|
|
37
|
+
/* Additional Checks */
|
|
38
|
+
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
39
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
40
|
+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
41
|
+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
42
|
+
|
|
43
|
+
/* Module Resolution Options */
|
|
44
|
+
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
45
|
+
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
46
|
+
"paths": {
|
|
47
|
+
// workaround for: https://github.com/vitest-dev/vitest/issues/4567
|
|
48
|
+
"rollup/parseAst": ["./node_modules/rollup/dist/parseAst"]
|
|
49
|
+
}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
50
|
+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
51
|
+
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
52
|
+
// "types": [], /* Type declaration files to be included in compilation. */
|
|
53
|
+
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
54
|
+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
55
|
+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
56
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
57
|
+
|
|
58
|
+
/* Source Map Options */
|
|
59
|
+
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
60
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
61
|
+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
62
|
+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
63
|
+
|
|
64
|
+
/* Experimental Options */
|
|
65
|
+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
66
|
+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
67
|
+
|
|
68
|
+
/* Advanced Options */
|
|
69
|
+
"skipLibCheck": true, /* Skip type checking of declaration files. */
|
|
70
|
+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
71
|
+
},
|
|
72
|
+
"include": ["src", "tests"],
|
|
73
|
+
"exclude": ["node_modules", "dist"]
|
|
74
|
+
}
|