websocket-ts 2.2.0 → 2.2.1

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 CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Joscha Behrmann
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Joscha Behrmann
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,212 +1,212 @@
1
- <div>
2
- <div align="center">
3
- <img src="https://raw.githubusercontent.com/jjxxs/websocket-ts/gh-pages/websocket-ts-logo.svg" alt="websocket-ts" width="300" height="65" />
4
- </div>
5
- <p align="center">
6
- <img src="https://github.com/jjxxs/websocket-ts/actions/workflows/build.yml/badge.svg" alt="Build Status" />
7
- <img src="https://github.com/jjxxs/websocket-ts/actions/workflows/test.yml/badge.svg" alt="Build Status" />
8
- <a href="https://coveralls.io/github/jjxxs/websocket-ts?branch=master">
9
- <img src="https://coveralls.io/repos/github/jjxxs/websocket-ts/badge.svg?branch=master&service=github" alt="Coverage Status" />
10
- </a>
11
- <a href="https://github.com/jjxxs/websocket-ts/releases/latest">
12
- <img src="https://img.shields.io/github/v/release/jjxxs/websocket-ts" alt="Release" />
13
- </a>
14
- <a href="/LICENSE">
15
- <img src="https://img.shields.io/github/license/jjxxs/websocket-ts" alt="License" />
16
- </a>
17
- </p>
18
- </div>
19
-
20
- <div align="center">
21
- A <b>WebSocket</b> for browsers with <b>auto-reconnect</b> and <b>message buffering</b> written in <b>TypeScript</b>.
22
- </div>
23
-
24
- ## Features
25
-
26
- - **Lightweight & Standalone**: No dependencies, 2.1 kB minified & gzipped.
27
- - **Browser-native**: Utilizes WebSocket API, offers direct access.
28
- - **Smart Reconnect**: Optional auto-reconnect and message buffering.
29
- - **Easy Setup**: Optional builder class for quick initialization.
30
- - **Well-Tested**: High test coverage, well-documented for extensibility.
31
- - **Module Support**: Supports CommonJS and ES6 modules.
32
-
33
- ## Installation
34
-
35
- Install `websocket-ts` with npm:
36
-
37
- ```bash
38
- $ npm install websocket-ts
39
- ```
40
-
41
- ## Quickstart
42
- This example shows how to use the package, complete with message buffering and automatic reconnection.
43
- The created websocket will echo back any received messages. It will buffer messages when disconnected
44
- and attempt to reconnect every 1 second.
45
-
46
- ```typescript
47
- import {
48
- ArrayQueue,
49
- ConstantBackoff,
50
- Websocket,
51
- WebsocketBuilder,
52
- WebsocketEvent,
53
- } from "websocket-ts";
54
-
55
- // Initialize WebSocket with buffering and 1s reconnection delay
56
- const ws = new WebsocketBuilder("ws://localhost:8080")
57
- .withBuffer(new ArrayQueue()) // buffer messages when disconnected
58
- .withBackoff(new ConstantBackoff(1000)) // retry every 1s
59
- .build();
60
-
61
- // Function to output & echo received messages
62
- const echoOnMessage = (i: Websocket, ev: MessageEvent) => {
63
- console.log(`received message: ${ev.data}`);
64
- i.send(`echo: ${ev.data}`);
65
- };
66
-
67
- // Add event listeners
68
- ws.addEventListener(WebsocketEvent.open, () => console.log("opened!"));
69
- ws.addEventListener(WebsocketEvent.close, () => console.log("closed!"));
70
- ws.addEventListener(WebsocketEvent.message, echoOnMessage);
71
- ```
72
-
73
- ## Usage
74
- This will demonstrate how to use `websocket-ts` in your project using the provided `WebsocketBuild`-class.
75
-
76
- For a more detailed description of the API, please refer to the [API Documentation](https://jjxxs.github.io/websocket-ts/).
77
-
78
- #### Initialization
79
-
80
- Create a new instance with the `WebsocketBuilder`:
81
-
82
- ```typescript
83
- const ws = new WebsocketBuilder("ws://localhost:42421").build();
84
- ```
85
-
86
- #### Events
87
-
88
- There are six events which can be subscribed to through with event listeners:
89
-
90
- ```typescript
91
- export enum WebsocketEvent {
92
- open = "open", // Connection opened
93
- close = "close", // Connection closed
94
- error = "error", // Error-induced closure
95
- message = "message", // Message received
96
- retry = "retry", // Reconnect attempt
97
- reconnect = "reconnect" // Successful reconnect
98
- }
99
- ```
100
-
101
- #### Add Event Listeners
102
- Event listeners receive the websocket instance (`i`) and the triggering event (`ev`) as arguments.
103
-
104
- ```typescript
105
- const ws = new WebsocketBuilder("ws://localhost:42421")
106
- .onOpen((i, ev) => console.log("opened"))
107
- .onClose((i, ev) => console.log("closed"))
108
- .onError((i, ev) => console.log("error"))
109
- .onMessage((i, ev) => console.log("message"))
110
- .onRetry((i, ev) => console.log("retry"))
111
- .onReconnect((i, ev) => console.log("reconnect"))
112
- .build();
113
- ```
114
-
115
- #### Remove Event Listeners
116
-
117
- To unregister a specific event listener, use `removeEventListener`:
118
-
119
- ```typescript
120
- let ws: Websocket
121
- /* ... */
122
- ws.removeEventListener(WebsocketEvent.open, openEventListener);
123
- ```
124
-
125
- #### Send Message
126
-
127
- Use the `send` method to send a message to the server:
128
-
129
- ```typescript
130
- let ws: Websocket;
131
- /* ... */
132
- ws.send("Hello World!");
133
- ```
134
-
135
- #### Reconnect & Backoff (Optional)
136
-
137
- If you'd like the websocket to automatically reconnect upon disconnection, you can optionally provide a `Backoff` strategy.
138
- This sets the delay between reconnection attempts. There are three built-in `Backoff` implementations, or you can create
139
- your own by implementing the `Backoff` interface. If no Backoff is provided, the websocket will not attempt to reconnect.
140
-
141
- ##### ConstantBackoff
142
-
143
- The `ConstantBackoff` strategy enforces a fixed delay between each reconnection attempt.
144
- To set a constant 1-second wait time, use:
145
-
146
- ```typescript
147
- const ws = new WebsocketBuilder("ws://localhost:42421")
148
- .withBackoff(new ConstantBackoff(1000)) // 1000ms = 1s
149
- .build();
150
- ```
151
-
152
- ##### LinearBackoff
153
-
154
- The `LinearBackoff` strategy increases the delay between reconnection attempts linearly,
155
- up to an optional maximum. For example, to start with a 0-second delay and increase by
156
- 10 second for each retry, capping at 60 seconds, use:
157
-
158
- ```typescript
159
- const ws = new WebsocketBuilder("ws://localhost:42421")
160
- .withBackoff(new LinearBackoff(0, 10000, 60000)) // 0ms, 10s, 20s, 30s, 40s, 50s, 60s
161
- .build();
162
- ```
163
-
164
- ##### ExponentialBackoff
165
-
166
- The `ExponentialBackoff` strategy doubles the delay between each reconnection attempt, up
167
- to a specified maximum. This approach is inspired by the binary exponential backoff algorithm
168
- commonly used in networking. For example, to generate a backoff series like `[1s, 2s, 4s, 8s]`, use:
169
-
170
- ```typescript
171
- const ws = new WebsocketBuilder("ws://localhost:42421")
172
- .withBackoff(new ExponentialBackoff(1000, 6)) // 1s, 2s, 4s, 8s, 16s, 32s, 64s
173
- .build();
174
- ```
175
-
176
- #### Buffer (Optional)
177
-
178
- To buffer outgoing messages when the websocket is disconnected, you can optionally specify
179
- a `Queue`. This queue will temporarily store your messages and send them in sequence when
180
- the websocket (re)connects. Two built-in `Queue` implementations are available, or you can
181
- create your own by implementing the `Queue` interface. If no queue is provided, messages
182
- won't be buffered.
183
-
184
- ##### RingQueue
185
-
186
- The `RingQueue` is a fixed-capacity, first-in-first-out (FIFO) queue. When it reaches capacity,
187
- the oldest element is removed to accommodate new ones. Reading from the queue returns and
188
- removes the oldest element. For instance, to set up a `RingQueue` with a 100-element capacity,
189
- use:
190
-
191
- ```typescript
192
- const ws = new WebsocketBuilder("ws://localhost:42421")
193
- .withBuffer(new RingQueue(100))
194
- .build();
195
- ```
196
-
197
- ##### ArrayQueue
198
-
199
- The ArrayQueue offers an unbounded capacity, functioning as a first-in-first-out (FIFO) queue.
200
- Reading from this queue returns and removes the oldest element. To use an `ArrayQueue`, use:
201
-
202
- ```typescript
203
- const ws = new WebsocketBuilder("ws://localhost:42421")
204
- .withBuffer(new ArrayQueue())
205
- .build();
206
- ```
207
-
208
- ## Build & Tests
209
-
210
- To compile the project, execute `npm run build`.
211
-
1
+ <div>
2
+ <div align="center">
3
+ <img src="https://raw.githubusercontent.com/jjxxs/websocket-ts/gh-pages/websocket-ts-logo.svg" alt="websocket-ts" width="300" height="65" />
4
+ </div>
5
+ <p align="center">
6
+ <img src="https://github.com/jjxxs/websocket-ts/actions/workflows/build.yml/badge.svg" alt="Build Status" />
7
+ <img src="https://github.com/jjxxs/websocket-ts/actions/workflows/test.yml/badge.svg" alt="Build Status" />
8
+ <a href="https://coveralls.io/github/jjxxs/websocket-ts?branch=master">
9
+ <img src="https://coveralls.io/repos/github/jjxxs/websocket-ts/badge.svg?branch=master&service=github" alt="Coverage Status" />
10
+ </a>
11
+ <a href="https://github.com/jjxxs/websocket-ts/releases/latest">
12
+ <img src="https://img.shields.io/github/v/release/jjxxs/websocket-ts" alt="Release" />
13
+ </a>
14
+ <a href="/LICENSE">
15
+ <img src="https://img.shields.io/github/license/jjxxs/websocket-ts" alt="License" />
16
+ </a>
17
+ </p>
18
+ </div>
19
+
20
+ <div align="center">
21
+ A <b>WebSocket</b> for browsers with <b>auto-reconnect</b> and <b>message buffering</b> written in <b>TypeScript</b>.
22
+ </div>
23
+
24
+ ## Features
25
+
26
+ - **Lightweight & Standalone**: No dependencies, 2.1 kB minified & gzipped.
27
+ - **Browser-native**: Utilizes WebSocket API, offers direct access.
28
+ - **Smart Reconnect**: Optional auto-reconnect and message buffering.
29
+ - **Easy Setup**: Optional builder class for quick initialization.
30
+ - **Well-Tested**: High test coverage, well-documented for extensibility.
31
+ - **Module Support**: Supports CommonJS and ES6 modules.
32
+
33
+ ## Installation
34
+
35
+ Install `websocket-ts` with npm:
36
+
37
+ ```bash
38
+ $ npm install websocket-ts
39
+ ```
40
+
41
+ ## Quickstart
42
+ This example shows how to use the package, complete with message buffering and automatic reconnection.
43
+ The created websocket will echo back any received messages. It will buffer messages when disconnected
44
+ and attempt to reconnect every 1 second.
45
+
46
+ ```typescript
47
+ import {
48
+ ArrayQueue,
49
+ ConstantBackoff,
50
+ Websocket,
51
+ WebsocketBuilder,
52
+ WebsocketEvent,
53
+ } from "websocket-ts";
54
+
55
+ // Initialize WebSocket with buffering and 1s reconnection delay
56
+ const ws = new WebsocketBuilder("ws://localhost:8080")
57
+ .withBuffer(new ArrayQueue()) // buffer messages when disconnected
58
+ .withBackoff(new ConstantBackoff(1000)) // retry every 1s
59
+ .build();
60
+
61
+ // Function to output & echo received messages
62
+ const echoOnMessage = (i: Websocket, ev: MessageEvent) => {
63
+ console.log(`received message: ${ev.data}`);
64
+ i.send(`echo: ${ev.data}`);
65
+ };
66
+
67
+ // Add event listeners
68
+ ws.addEventListener(WebsocketEvent.open, () => console.log("opened!"));
69
+ ws.addEventListener(WebsocketEvent.close, () => console.log("closed!"));
70
+ ws.addEventListener(WebsocketEvent.message, echoOnMessage);
71
+ ```
72
+
73
+ ## Usage
74
+ This will demonstrate how to use `websocket-ts` in your project using the provided `WebsocketBuild`-class.
75
+
76
+ For a more detailed description of the API, please refer to the [API Documentation](https://jjxxs.github.io/websocket-ts/).
77
+
78
+ #### Initialization
79
+
80
+ Create a new instance with the `WebsocketBuilder`:
81
+
82
+ ```typescript
83
+ const ws = new WebsocketBuilder("ws://localhost:42421").build();
84
+ ```
85
+
86
+ #### Events
87
+
88
+ There are six events which can be subscribed to through with event listeners:
89
+
90
+ ```typescript
91
+ export enum WebsocketEvent {
92
+ open = "open", // Connection opened
93
+ close = "close", // Connection closed
94
+ error = "error", // Error-induced closure
95
+ message = "message", // Message received
96
+ retry = "retry", // Reconnect attempt
97
+ reconnect = "reconnect" // Successful reconnect
98
+ }
99
+ ```
100
+
101
+ #### Add Event Listeners
102
+ Event listeners receive the websocket instance (`i`) and the triggering event (`ev`) as arguments.
103
+
104
+ ```typescript
105
+ const ws = new WebsocketBuilder("ws://localhost:42421")
106
+ .onOpen((i, ev) => console.log("opened"))
107
+ .onClose((i, ev) => console.log("closed"))
108
+ .onError((i, ev) => console.log("error"))
109
+ .onMessage((i, ev) => console.log("message"))
110
+ .onRetry((i, ev) => console.log("retry"))
111
+ .onReconnect((i, ev) => console.log("reconnect"))
112
+ .build();
113
+ ```
114
+
115
+ #### Remove Event Listeners
116
+
117
+ To unregister a specific event listener, use `removeEventListener`:
118
+
119
+ ```typescript
120
+ let ws: Websocket
121
+ /* ... */
122
+ ws.removeEventListener(WebsocketEvent.open, openEventListener);
123
+ ```
124
+
125
+ #### Send Message
126
+
127
+ Use the `send` method to send a message to the server:
128
+
129
+ ```typescript
130
+ let ws: Websocket;
131
+ /* ... */
132
+ ws.send("Hello World!");
133
+ ```
134
+
135
+ #### Reconnect & Backoff (Optional)
136
+
137
+ If you'd like the websocket to automatically reconnect upon disconnection, you can optionally provide a `Backoff` strategy.
138
+ This sets the delay between reconnection attempts. There are three built-in `Backoff` implementations, or you can create
139
+ your own by implementing the `Backoff` interface. If no Backoff is provided, the websocket will not attempt to reconnect.
140
+
141
+ ##### ConstantBackoff
142
+
143
+ The `ConstantBackoff` strategy enforces a fixed delay between each reconnection attempt.
144
+ To set a constant 1-second wait time, use:
145
+
146
+ ```typescript
147
+ const ws = new WebsocketBuilder("ws://localhost:42421")
148
+ .withBackoff(new ConstantBackoff(1000)) // 1000ms = 1s
149
+ .build();
150
+ ```
151
+
152
+ ##### LinearBackoff
153
+
154
+ The `LinearBackoff` strategy increases the delay between reconnection attempts linearly,
155
+ up to an optional maximum. For example, to start with a 0-second delay and increase by
156
+ 10 second for each retry, capping at 60 seconds, use:
157
+
158
+ ```typescript
159
+ const ws = new WebsocketBuilder("ws://localhost:42421")
160
+ .withBackoff(new LinearBackoff(0, 10000, 60000)) // 0ms, 10s, 20s, 30s, 40s, 50s, 60s
161
+ .build();
162
+ ```
163
+
164
+ ##### ExponentialBackoff
165
+
166
+ The `ExponentialBackoff` strategy doubles the delay between each reconnection attempt, up
167
+ to a specified maximum. This approach is inspired by the binary exponential backoff algorithm
168
+ commonly used in networking. For example, to generate a backoff series like `[1s, 2s, 4s, 8s]`, use:
169
+
170
+ ```typescript
171
+ const ws = new WebsocketBuilder("ws://localhost:42421")
172
+ .withBackoff(new ExponentialBackoff(1000, 6)) // 1s, 2s, 4s, 8s, 16s, 32s, 64s
173
+ .build();
174
+ ```
175
+
176
+ #### Buffer (Optional)
177
+
178
+ To buffer outgoing messages when the websocket is disconnected, you can optionally specify
179
+ a `Queue`. This queue will temporarily store your messages and send them in sequence when
180
+ the websocket (re)connects. Two built-in `Queue` implementations are available, or you can
181
+ create your own by implementing the `Queue` interface. If no queue is provided, messages
182
+ won't be buffered.
183
+
184
+ ##### RingQueue
185
+
186
+ The `RingQueue` is a fixed-capacity, first-in-first-out (FIFO) queue. When it reaches capacity,
187
+ the oldest element is removed to accommodate new ones. Reading from the queue returns and
188
+ removes the oldest element. For instance, to set up a `RingQueue` with a 100-element capacity,
189
+ use:
190
+
191
+ ```typescript
192
+ const ws = new WebsocketBuilder("ws://localhost:42421")
193
+ .withBuffer(new RingQueue(100))
194
+ .build();
195
+ ```
196
+
197
+ ##### ArrayQueue
198
+
199
+ The ArrayQueue offers an unbounded capacity, functioning as a first-in-first-out (FIFO) queue.
200
+ Reading from this queue returns and removes the oldest element. To use an `ArrayQueue`, use:
201
+
202
+ ```typescript
203
+ const ws = new WebsocketBuilder("ws://localhost:42421")
204
+ .withBuffer(new ArrayQueue())
205
+ .build();
206
+ ```
207
+
208
+ ## Build & Tests
209
+
210
+ To compile the project, execute `npm run build`.
211
+
212
212
  To run tests, use `npm run test`.
package/package.json CHANGED
@@ -1,14 +1,9 @@
1
1
  {
2
2
  "name": "websocket-ts",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "main": "dist/cjs/src/index.js",
5
5
  "types": "dist/cjs/src/index.d.ts",
6
6
  "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
7
  "license": "MIT",
13
8
  "keywords": [
14
9
  "websocket",
@@ -27,7 +22,7 @@
27
22
  "build:cjs": "tsc -p tsconfig.cjs.json",
28
23
  "build:esm": "tsc -p tsconfig.esm.json",
29
24
  "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
  },
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
+ }
package/tsconfig.esm.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": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8
- "module": "es6", /* 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/esm", /* 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": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8
+ "module": "es6", /* 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/esm", /* 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
+ }
Binary file
Binary file