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.
Files changed (48) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +225 -212
  3. package/dist/cjs/src/backoff/exponentialbackoff.js +1 -1
  4. package/dist/cjs/src/backoff/exponentialbackoff.js.map +1 -1
  5. package/dist/cjs/src/index.d.ts +1 -1
  6. package/dist/cjs/src/index.d.ts.map +1 -1
  7. package/dist/cjs/src/index.js.map +1 -1
  8. package/dist/cjs/src/websocket.d.ts +9 -3
  9. package/dist/cjs/src/websocket.d.ts.map +1 -1
  10. package/dist/cjs/src/websocket.js +7 -3
  11. package/dist/cjs/src/websocket.js.map +1 -1
  12. package/dist/cjs/src/websocket_builder.d.ts +9 -9
  13. package/dist/cjs/src/websocket_builder.d.ts.map +1 -1
  14. package/dist/cjs/src/websocket_builder.js +6 -6
  15. package/dist/cjs/src/websocket_builder.js.map +1 -1
  16. package/dist/cjs/src/websocket_event.d.ts +18 -7
  17. package/dist/cjs/src/websocket_event.d.ts.map +1 -1
  18. package/dist/cjs/src/websocket_event.js +8 -9
  19. package/dist/cjs/src/websocket_event.js.map +1 -1
  20. package/dist/cjs/src/websocket_retry_options.d.ts +1 -1
  21. package/dist/esm/src/backoff/exponentialbackoff.js +1 -1
  22. package/dist/esm/src/backoff/exponentialbackoff.js.map +1 -1
  23. package/dist/esm/src/index.d.ts +1 -1
  24. package/dist/esm/src/index.d.ts.map +1 -1
  25. package/dist/esm/src/index.js.map +1 -1
  26. package/dist/esm/src/websocket.d.ts +9 -3
  27. package/dist/esm/src/websocket.d.ts.map +1 -1
  28. package/dist/esm/src/websocket.js +7 -3
  29. package/dist/esm/src/websocket.js.map +1 -1
  30. package/dist/esm/src/websocket_builder.d.ts +9 -9
  31. package/dist/esm/src/websocket_builder.d.ts.map +1 -1
  32. package/dist/esm/src/websocket_builder.js +6 -6
  33. package/dist/esm/src/websocket_builder.js.map +1 -1
  34. package/dist/esm/src/websocket_event.d.ts +18 -7
  35. package/dist/esm/src/websocket_event.d.ts.map +1 -1
  36. package/dist/esm/src/websocket_event.js +8 -9
  37. package/dist/esm/src/websocket_event.js.map +1 -1
  38. package/dist/esm/src/websocket_retry_options.d.ts +1 -1
  39. package/package.json +19 -24
  40. package/src/backoff/exponentialbackoff.ts +1 -1
  41. package/src/index.ts +1 -1
  42. package/src/websocket.ts +16 -5
  43. package/src/websocket_builder.ts +10 -10
  44. package/src/websocket_event.ts +22 -7
  45. package/src/websocket_retry_options.ts +1 -1
  46. package/tsconfig.cjs.json +74 -74
  47. package/tsconfig.esm.json +74 -74
  48. 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 var WebsocketEvent;
5
- (function (WebsocketEvent) {
4
+ export const WebsocketEvent = {
6
5
  /** Fired when the connection is opened. */
7
- WebsocketEvent["open"] = "open";
6
+ open: "open",
8
7
  /** Fired when the connection is closed. */
9
- WebsocketEvent["close"] = "close";
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
- WebsocketEvent["error"] = "error";
10
+ error: "error",
12
11
  /** Fired when a message is received. */
13
- WebsocketEvent["message"] = "message";
12
+ message: "message",
14
13
  /** Fired when the websocket tries to reconnect after a connection loss. */
15
- WebsocketEvent["retry"] = "retry";
14
+ retry: "retry",
16
15
  /** Fired when the websocket successfully reconnects after a connection loss. */
17
- WebsocketEvent["reconnect"] = "reconnect";
18
- })(WebsocketEvent || (WebsocketEvent = {}));
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,CAAN,IAAY,cAkBX;AAlBD,WAAY,cAAc;IACxB,2CAA2C;IAC3C,+BAAa,CAAA;IAEb,2CAA2C;IAC3C,iCAAe,CAAA;IAEf,8GAA8G;IAC9G,iCAAe,CAAA;IAEf,wCAAwC;IACxC,qCAAmB,CAAA;IAEnB,2EAA2E;IAC3E,iCAAe,CAAA;IAEf,gFAAgF;IAChF,yCAAuB,CAAA;AACzB,CAAC,EAlBW,cAAc,KAAd,cAAc,QAkBzB"}
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
- * Wether to reconnect immediately after a connection has been lost,
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
- "version": "2.2.0",
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
- "coveralls": "cat ./coverage/lcov.info | coveralls",
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.2.0",
36
- "@eslint/js": "^9.20.0",
37
- "@types/ws": "^8.5.14",
38
- "@typescript-eslint/eslint-plugin": "^8.24.0",
39
- "@typescript-eslint/parser": "^8.24.0",
40
- "@vitest/coverage-v8": "^3.0.5",
41
- "coveralls": "^3.1.1",
42
- "cross-env": "^7.0.3",
43
- "eslint": "^9.20.1",
44
- "eslint-config-prettier": "^10.0.1",
45
- "eslint-plugin-prettier": "^5.2.3",
46
- "globals": "^15.15.0",
47
- "jsdom": "^26.0.0",
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.7.3",
50
- "vitest": "^3.0.5",
51
- "ws": "^8.18.0"
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 a undefined, a positive integer or zero");
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 _url: string; // the url to connect to
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: string,
45
+ url: UrlProvider,
39
46
  protocols?: string | string[],
40
47
  options?: WebsocketOptions,
41
48
  ) {
42
- this._url = url;
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._underlyingWebsocket = new WebSocket(this.url, this.protocols); // create new browser-native websocket and add all event listeners
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,
@@ -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: string;
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: string) {
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(): string {
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 wether to reconnect immediately after a connection has been lost, ignoring the backoff strategy for the first retry.
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 wether to reconnect immediately after a connection has been lost
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 wether to reconnect immediately after a connection has been lost, ignoring the backoff strategy for the first retry.
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 wether to reconnect immediately after a connection has been lost, undefined if no value has been set
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;
@@ -3,24 +3,39 @@ import { Websocket } from "./websocket";
3
3
  /**
4
4
  * Events that can be fired by the websocket.
5
5
  */
6
- export enum WebsocketEvent {
6
+ export const WebsocketEvent = {
7
7
  /** Fired when the connection is opened. */
8
- open = "open",
8
+ open: "open",
9
9
 
10
10
  /** Fired when the connection is closed. */
11
- close = "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 = "error",
14
+ error: "error",
15
15
 
16
16
  /** Fired when a message is received. */
17
- message = "message",
17
+ message: "message",
18
18
 
19
19
  /** Fired when the websocket tries to reconnect after a connection loss. */
20
- retry = "retry",
20
+ retry: "retry",
21
21
 
22
22
  /** Fired when the websocket successfully reconnects after a connection loss. */
23
- reconnect = "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
- * Wether to reconnect immediately after a connection has been lost,
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
+ }