@gurezo/web-serial-rxjs 3.0.0 → 3.1.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 (34) hide show
  1. package/README.ja.md +17 -10
  2. package/README.md +21 -12
  3. package/dist/errors/serial-error-code.d.ts +28 -19
  4. package/dist/errors/serial-error-code.d.ts.map +1 -1
  5. package/dist/errors/serial-error-context.d.ts +21 -7
  6. package/dist/errors/serial-error-context.d.ts.map +1 -1
  7. package/dist/errors/serial-error.d.ts +19 -20
  8. package/dist/errors/serial-error.d.ts.map +1 -1
  9. package/dist/index.d.ts +36 -12
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.mjs +215 -43
  12. package/dist/index.mjs.map +3 -3
  13. package/dist/internal/assert-never.d.ts +9 -0
  14. package/dist/internal/assert-never.d.ts.map +1 -1
  15. package/dist/internal/strip-ansi-sequences.d.ts +25 -0
  16. package/dist/internal/strip-ansi-sequences.d.ts.map +1 -0
  17. package/dist/session/create-serial-session.d.ts +1 -1
  18. package/dist/session/create-serial-session.d.ts.map +1 -1
  19. package/dist/session/index.d.ts +2 -1
  20. package/dist/session/index.d.ts.map +1 -1
  21. package/dist/session/internal/validate-serial-port-filters.d.ts.map +1 -1
  22. package/dist/session/is-connected-session-state.d.ts +11 -0
  23. package/dist/session/is-connected-session-state.d.ts.map +1 -0
  24. package/dist/session/normalize-serial-error.d.ts +1 -1
  25. package/dist/session/normalize-serial-error.d.ts.map +1 -1
  26. package/dist/session/serial-session-options.d.ts +41 -34
  27. package/dist/session/serial-session-options.d.ts.map +1 -1
  28. package/dist/session/serial-session-state.d.ts +3 -2
  29. package/dist/session/serial-session-state.d.ts.map +1 -1
  30. package/dist/session/serial-session.d.ts +46 -14
  31. package/dist/session/serial-session.d.ts.map +1 -1
  32. package/dist/terminal/create-terminal-buffer.d.ts +12 -1
  33. package/dist/terminal/create-terminal-buffer.d.ts.map +1 -1
  34. package/package.json +1 -1
@@ -1,2 +1,11 @@
1
+ /**
2
+ * Exhaustiveness helper for internal switch statements.
3
+ *
4
+ * @deprecated Not part of the canonical public API. Define a local helper in
5
+ * application code, or use `switch (state.status)` with
6
+ * {@link SerialSessionStatus}. Will be removed from public exports in the
7
+ * next major version.
8
+ * @internal
9
+ */
1
10
  export declare function assertNever(value: never): never;
2
11
  //# sourceMappingURL=assert-never.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assert-never.d.ts","sourceRoot":"","sources":["../../src/internal/assert-never.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAE/C"}
1
+ {"version":3,"file":"assert-never.d.ts","sourceRoot":"","sources":["../../src/internal/assert-never.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAE/C"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Stateful ANSI escape stripper for streaming text chunks.
3
+ *
4
+ * Buffers incomplete sequences that span Web Serial read boundaries so
5
+ * partial ESC bytes are not emitted as visible text.
6
+ *
7
+ * @internal
8
+ */
9
+ export interface AnsiStripper {
10
+ feed(chunk: string): string;
11
+ flush(): string;
12
+ }
13
+ /**
14
+ * Strips ANSI escape sequences from a complete string in one pass.
15
+ *
16
+ * @internal
17
+ */
18
+ export declare function stripAnsiSequences(text: string): string;
19
+ /**
20
+ * Creates a streaming ANSI escape stripper.
21
+ *
22
+ * @internal
23
+ */
24
+ export declare function createAnsiStripper(): AnsiStripper;
25
+ //# sourceMappingURL=strip-ansi-sequences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strip-ansi-sequences.d.ts","sourceRoot":"","sources":["../../src/internal/strip-ansi-sequences.ts"],"names":[],"mappings":"AA6BA;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,KAAK,IAAI,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,CA2EjD"}
@@ -1,7 +1,7 @@
1
1
  import type { SerialSession } from './serial-session';
2
2
  import { type SerialSessionOptions } from './serial-session-options';
3
3
  /**
4
- * Create a v2 {@link SerialSession}.
4
+ * Create a {@link SerialSession}.
5
5
  *
6
6
  * This release wires the internal read pump (#202) and the internal send
7
7
  * queue (#203) into the session so that `connect$`, `disconnect$`,
@@ -1 +1 @@
1
- {"version":3,"file":"create-serial-session.d.ts","sourceRoot":"","sources":["../../src/session/create-serial-session.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAQlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,aAAa,CA4Gf"}
1
+ {"version":3,"file":"create-serial-session.d.ts","sourceRoot":"","sources":["../../src/session/create-serial-session.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAOlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,aAAa,CAyGf"}
@@ -1,10 +1,11 @@
1
1
  export { createSerialSession } from './create-serial-session';
2
2
  export type { SerialSession } from './serial-session';
3
- export type { SerialSessionOptions, SerialSessionReceiveReplayOptions, ResolvedSerialSessionOptions, } from './serial-session-options';
3
+ export type { SerialSessionOptions, SerialSessionFeatureOptions, SerialSessionReceiveReplayOptions, ResolvedSerialSessionOptions, } from './serial-session-options';
4
4
  export { resolveSerialSessionOptions } from './serial-session-options';
5
5
  export { MAX_RECEIVE_REPLAY_BUFFER_SIZE, MAX_RECEIVE_REPLAY_MAX_CHARS, } from './serial-session-options';
6
6
  export type { SerialPayload, SerialConnectionOptions } from '../types';
7
7
  export { SerialSessionStatus } from './serial-session-state';
8
+ export { isConnectedSessionState } from './is-connected-session-state';
8
9
  export type { SerialSessionState, IdleSessionState, ConnectingSessionState, ConnectedSessionState, DisconnectingSessionState, UnsupportedSessionState, ErrorSessionState, DisposedSessionState, } from './serial-session-state';
9
10
  export { DEFAULT_LINE_BUFFER_OPTIONS, type LineBufferOptions, } from './internal/line-buffer';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,YAAY,EACV,oBAAoB,EACpB,iCAAiC,EACjC,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,2BAA2B,EAC3B,KAAK,iBAAiB,GACvB,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,YAAY,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,iCAAiC,EACjC,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,2BAA2B,EAC3B,KAAK,iBAAiB,GACvB,MAAM,wBAAwB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate-serial-port-filters.d.ts","sourceRoot":"","sources":["../../../src/session/internal/validate-serial-port-filters.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,CAAC,EAAE,gBAAgB,EAAE,GAC3B,gBAAgB,EAAE,GAAG,SAAS,CAyChC"}
1
+ {"version":3,"file":"validate-serial-port-filters.d.ts","sourceRoot":"","sources":["../../../src/session/internal/validate-serial-port-filters.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,CAAC,EAAE,gBAAgB,EAAE,GAC3B,gBAAgB,EAAE,GAAG,SAAS,CAkEhC"}
@@ -0,0 +1,11 @@
1
+ import { type ConnectedSessionState, type SerialSessionState } from './serial-session-state';
2
+ /**
3
+ * Type predicate for {@link ConnectedSessionState}.
4
+ *
5
+ * Use with RxJS `filter()` to preserve discriminated union narrowing in
6
+ * pipelines so `portInfo` and other connected-only fields stay typed.
7
+ *
8
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/436 | Issue #436}
9
+ */
10
+ export declare function isConnectedSessionState(state: SerialSessionState): state is ConnectedSessionState;
11
+ //# sourceMappingURL=is-connected-session-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-connected-session-state.d.ts","sourceRoot":"","sources":["../../src/session/is-connected-session-state.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAExB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,kBAAkB,GACxB,KAAK,IAAI,qBAAqB,CAEhC"}
@@ -45,7 +45,7 @@ export interface NormalizeSerialErrorOptions {
45
45
  * control-flow event, not a hard failure.
46
46
  * 3. Any other value is wrapped as a {@link SerialError} with
47
47
  * {@link NormalizeSerialErrorOptions.fallbackCode}, preserving the
48
- * original error as `originalError` for debugging.
48
+ * underlying failure on {@link SerialError.context | context.cause}.
49
49
  *
50
50
  * @internal
51
51
  * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/199 | Issue #199}
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-serial-error.d.ts","sourceRoot":"","sources":["../../src/session/normalize-serial-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAW9D;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;;;;OAQG;IACH,YAAY,EAAE,eAAe,CAAC;IAC9B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,2BAA2B,GACnC,WAAW,CAqBb"}
1
+ {"version":3,"file":"normalize-serial-error.d.ts","sourceRoot":"","sources":["../../src/session/normalize-serial-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAW9D;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;;;;OAQG;IACH,YAAY,EAAE,eAAe,CAAC;IAC9B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,2BAA2B,GACnC,WAAW,CAuBb"}
@@ -1,40 +1,15 @@
1
1
  import { type BaudRate, type MaxChars, type MaxLines, type ReceiveReplayBufferSize, type SerialPortBufferSize } from '../internal/branded-numbers';
2
+ import type { SerialConnectionOptions } from '../types';
2
3
  import type { TerminalBufferOptions } from '../terminal/create-terminal-buffer';
3
4
  import { type LineBufferOptions } from './internal/line-buffer';
4
5
  /**
5
- * W3C connection fields shared with {@link SerialOptions}.
6
+ * Library-specific options for {@link createSerialSession} that are not passed
7
+ * to W3C `port.open`.
6
8
  *
7
- * @internal
8
- */
9
- type SerialSessionConnectionFields = Pick<SerialOptions, 'baudRate' | 'dataBits' | 'stopBits' | 'parity' | 'bufferSize' | 'flowControl'>;
10
- /**
11
- * Options for creating a {@link SerialSession} via {@link createSerialSession}.
12
- *
13
- * Connection parameters (`baudRate`, `dataBits`, `stopBits`, `parity`,
14
- * `bufferSize`, `flowControl`) are derived from the W3C {@link SerialOptions}
15
- * type and passed to `port.open`. All connection fields are optional here;
16
- * omitted values fall back to {@link DEFAULT_SERIAL_SESSION_OPTIONS}
17
- * (`baudRate` 9600, `dataBits` 8, `stopBits` 1, `parity` `'none'`,
18
- * `bufferSize` 255, `flowControl` `'none'`).
19
- *
20
- * @example
21
- * ```typescript
22
- * const session = createSerialSession({
23
- * baudRate: 115200,
24
- * dataBits: 8,
25
- * stopBits: 1,
26
- * parity: 'none',
27
- * flowControl: 'none',
28
- * filters: [{ usbVendorId: 0x1234, usbProductId: 0x5678 }],
29
- * });
30
- * ```
31
- *
32
- * @see {@link SerialOptions}
33
- * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/199 | Issue #199}
34
- * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/200 | Issue #200}
35
- * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/402 | Issue #402}
9
+ * @see {@link SerialConnectionOptions} for W3C connection parameters
10
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/441 | Issue #441}
36
11
  */
37
- export interface SerialSessionOptions extends Partial<SerialSessionConnectionFields> {
12
+ export interface SerialSessionFeatureOptions {
38
13
  /**
39
14
  * Filters for port selection when requesting a port.
40
15
  *
@@ -69,6 +44,38 @@ export interface SerialSessionOptions extends Partial<SerialSessionConnectionFie
69
44
  */
70
45
  lineBuffer?: LineBufferOptions;
71
46
  }
47
+ /**
48
+ * Options for creating a {@link SerialSession} via {@link createSerialSession}.
49
+ *
50
+ * Composes {@link Partial}<{@link SerialConnectionOptions}> (W3C connection
51
+ * parameters passed to `port.open`) with {@link SerialSessionFeatureOptions}
52
+ * (library-specific session features). All connection fields are optional;
53
+ * omitted values fall back to {@link DEFAULT_SERIAL_SESSION_OPTIONS}
54
+ * (`baudRate` 9600, `dataBits` 8, `stopBits` 1, `parity` `'none'`,
55
+ * `bufferSize` 255, `flowControl` `'none'`).
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * const session = createSerialSession({
60
+ * baudRate: 115200,
61
+ * dataBits: 8,
62
+ * stopBits: 1,
63
+ * parity: 'none',
64
+ * flowControl: 'none',
65
+ * filters: [{ usbVendorId: 0x1234, usbProductId: 0x5678 }],
66
+ * });
67
+ * ```
68
+ *
69
+ * @see {@link SerialConnectionOptions}
70
+ * @see {@link SerialSessionFeatureOptions}
71
+ * @see {@link SerialOptions}
72
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/199 | Issue #199}
73
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/200 | Issue #200}
74
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/402 | Issue #402}
75
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/441 | Issue #441}
76
+ */
77
+ export interface SerialSessionOptions extends Partial<SerialConnectionOptions>, SerialSessionFeatureOptions {
78
+ }
72
79
  /**
73
80
  * Options for {@link SerialSessionOptions.receiveReplay}.
74
81
  *
@@ -126,6 +133,7 @@ export declare function resolveReceiveReplayOptions(options?: SerialSessionRecei
126
133
  export type ResolvedTerminalBufferOptions = {
127
134
  maxLines: MaxLines;
128
135
  maxChars: MaxChars;
136
+ stripAnsi: boolean;
129
137
  };
130
138
  export declare function resolveTerminalBufferOptions(options?: TerminalBufferOptions): ResolvedTerminalBufferOptions;
131
139
  /**
@@ -169,7 +177,7 @@ export declare const DEFAULT_SERIAL_SESSION_OPTIONS: {
169
177
  lineBuffer: ResolvedLineBufferOptions;
170
178
  };
171
179
  /** Resolved W3C connection fields for {@link ResolvedSerialSessionOptions}. */
172
- export type ResolvedSerialSessionConnectionOptions = Required<Omit<SerialSessionConnectionFields, 'baudRate' | 'bufferSize'>> & {
180
+ export type ResolvedSerialSessionConnectionOptions = Required<Omit<SerialConnectionOptions, 'baudRate' | 'bufferSize'>> & {
173
181
  baudRate: BaudRate;
174
182
  bufferSize: SerialPortBufferSize;
175
183
  };
@@ -179,7 +187,7 @@ export type ResolvedSerialSessionConnectionOptions = Required<Omit<SerialSession
179
187
  * @throws {@link SerialError} with {@link SerialErrorCode.INVALID_CONNECTION_OPTIONS}
180
188
  * when `baudRate` is out of range.
181
189
  */
182
- export declare function resolveConnectionOptions(options?: Pick<SerialSessionOptions, 'baudRate' | 'dataBits' | 'stopBits' | 'parity' | 'bufferSize' | 'flowControl'>): ResolvedSerialSessionConnectionOptions;
190
+ export declare function resolveConnectionOptions(options?: Partial<SerialConnectionOptions>): ResolvedSerialSessionConnectionOptions;
183
191
  /**
184
192
  * Merge and validate {@link SerialSessionOptions} into a fully resolved
185
193
  * options object for internal session use.
@@ -193,5 +201,4 @@ export declare function resolveConnectionOptions(options?: Pick<SerialSessionOpt
193
201
  * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/403 | Issue #403}
194
202
  */
195
203
  export declare function resolveSerialSessionOptions(options?: SerialSessionOptions): ResolvedSerialSessionOptions;
196
- export {};
197
204
  //# sourceMappingURL=serial-session-options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serial-session-options.d.ts","sourceRoot":"","sources":["../../src/session/serial-session-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAIhF,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;AAGhC;;;;GAIG;AACH,KAAK,6BAA6B,GAAG,IAAI,CACvC,aAAa,EACb,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,aAAa,CAC/E,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,oBACf,SAAQ,OAAO,CAAC,6BAA6B,CAAC;IAC9C;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAE7B;;;;;;OAMG;IACH,aAAa,CAAC,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AC1E,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,yBAAyB,CAwB3B;AAED;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG,QAAQ,CACjD,IAAI,CACF,oBAAoB,EAClB,SAAS,GACT,eAAe,GACf,gBAAgB,GAChB,YAAY,GACZ,UAAU,GACV,YAAY,CACf,CACF,GAAG;IACF,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,oBAAoB,CAAC;IACjC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC7B,aAAa,EAAE,yCAAyC,CAAC;IACzD,cAAc,EAAE,6BAA6B,CAAC;IAC9C,UAAU,EAAE,yBAAyB,CAAC;CACvC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;CAUH,CAAC;AAEzC,+EAA+E;AAC/E,MAAM,MAAM,sCAAsC,GAAG,QAAQ,CAC3D,IAAI,CAAC,uBAAuB,EAAE,UAAU,GAAG,YAAY,CAAC,CACzD,GAAG;IACF,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,oBAAoB,CAAC;CAClC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,GACzC,sCAAsC,CAqCxC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,4BAA4B,CAW9B"}
@@ -39,7 +39,7 @@ export interface IdleSessionState {
39
39
  export interface ConnectingSessionState {
40
40
  readonly status: typeof SerialSessionStatus.Connecting;
41
41
  }
42
- /** @see {@link SerialSessionState} */
42
+ /** Connected lifecycle variant with narrowed {@link SerialPortInfo} access via `portInfo`. */
43
43
  export interface ConnectedSessionState {
44
44
  readonly status: typeof SerialSessionStatus.Connected;
45
45
  readonly portInfo: SerialPortInfo;
@@ -62,7 +62,8 @@ export interface DisposedSessionState {
62
62
  readonly status: typeof SerialSessionStatus.Disposed;
63
63
  }
64
64
  /**
65
- * Discriminated union emitted by {@link SerialSession.state$}.
65
+ * Discriminated union emitted by {@link SerialSession.state$} — the
66
+ * canonical lifecycle source.
66
67
  *
67
68
  * Each variant carries the lifecycle `status` plus optional detail fields
68
69
  * (`portInfo` when connected, `error` when in a fatal error state).
@@ -1 +1 @@
1
- {"version":3,"file":"serial-session-state.d.ts","sourceRoot":"","sources":["../../src/session/serial-session-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;CAQtB,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,mBAAmB,CAAC,IAAI,CAAC;CAClD;AAED,sCAAsC;AACtC,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,OAAO,mBAAmB,CAAC,UAAU,CAAC;CACxD;AAED,sCAAsC;AACtC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,OAAO,mBAAmB,CAAC,SAAS,CAAC;IACtD,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC;AAED,sCAAsC;AACtC,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,EAAE,OAAO,mBAAmB,CAAC,aAAa,CAAC;CAC3D;AAED,sCAAsC;AACtC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,OAAO,mBAAmB,CAAC,WA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,aAAa,CAAC;CAC3D;AAED,sCAAsC;AACtC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,OAAO,mBAAmB,CAAC,WAAW,CAAC;CACzD;AAED,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,OAAO,mBAAmB,CAAC,KAAK,CAAC;IAClD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED,sCAAsC;AACtC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,OAAO,mBAAmB,CAAC,QAAQ,CAAC;CACtD;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAC1B,gBAAgB,GAChB,sBAAsB,GACtB,qBAAqB,GACrB,yBAAyB,GACzB,uBAAuB,GACvB,iBAAiB,GACjB,oBAAoB,CAAC"}
@@ -3,11 +3,12 @@ import type { SerialError } from '../errors/serial-error';
3
3
  import type { SerialPayload } from '../types';
4
4
  import type { SerialSessionState } from './serial-session-state';
5
5
  /**
6
- * v2 public API for interacting with the Web Serial API through a
6
+ * Public API for interacting with the Web Serial API through a
7
7
  * minimal, session-oriented surface.
8
8
  *
9
9
  * The session is intentionally slim so that apps (Angular, Vue, React, etc.)
10
- * can drive their UI purely from `state$` + `isConnected$` + `receive$` + `terminalText$` + `lines$` + `errors$` and never
10
+ * can drive their UI from `state$` (canonical lifecycle state) + `errors$`
11
+ * (error event channel) + `receive$` + `terminalText$` + `lines$` and never
11
12
  * have to rebuild BehaviorSubjects, manage a read loop, or serialize writes
12
13
  * themselves.
13
14
  *
@@ -16,9 +17,20 @@ import type { SerialSessionState } from './serial-session-state';
16
17
  *
17
18
  * @example
18
19
  * ```typescript
20
+ * import { createSerialSession, SerialSessionStatus } from '@gurezo/web-serial-rxjs';
21
+ *
19
22
  * const session = createSerialSession({ baudRate: 115200 });
20
23
  *
21
- * session.state$.subscribe((state) => console.log('state:', state));
24
+ * session.state$.subscribe((state) => {
25
+ * switch (state.status) {
26
+ * case SerialSessionStatus.Connected:
27
+ * console.log('connected:', state.portInfo);
28
+ * break;
29
+ * case SerialSessionStatus.Error:
30
+ * console.error('error:', state.error);
31
+ * break;
32
+ * }
33
+ * });
22
34
  * session.receive$.subscribe((chunk) => console.log('rx:', chunk));
23
35
  * session.errors$.subscribe((error) => console.error('err:', error));
24
36
  *
@@ -80,14 +92,21 @@ export interface SerialSession {
80
92
  /**
81
93
  * Alias for {@link dispose$}.
82
94
  *
95
+ * @deprecated Prefer {@link dispose$}. This alias is retained for backward
96
+ * compatibility and is scheduled for removal in the next major version.
97
+ *
83
98
  * @returns An Observable that completes when disposal has finished.
99
+ *
100
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/433 | Issue #433}
84
101
  */
85
102
  destroy$(): Observable<void>;
86
103
  /**
87
- * Reactive session lifecycle state as a discriminated union.
104
+ * Canonical lifecycle source for the session.
88
105
  *
89
- * Replays the current state on subscribe. Switch on `state.status` and
90
- * use the per-variant fields (`portInfo`, `error`) instead of correlating
106
+ * Reactive session lifecycle state as a discriminated union. Replays the
107
+ * current state on subscribe. Switch on `state.status` and use the
108
+ * per-variant fields (`portInfo` when {@link SerialSessionStatus.Connected},
109
+ * `error` when {@link SerialSessionStatus.Error}) instead of correlating
91
110
  * separate streams.
92
111
  */
93
112
  readonly state$: Observable<SerialSessionState>;
@@ -96,6 +115,12 @@ export interface SerialSession {
96
115
  *
97
116
  * Derived from `state$` with `distinctUntilChanged` so UIs can bind
98
117
  * connect/disabled flags without reimplementing the comparison.
118
+ *
119
+ * @deprecated Prefer narrowing {@link state$} with
120
+ * {@link SerialSessionStatus.Connected}. Retained for backward compatibility;
121
+ * scheduled for removal in the next major version.
122
+ *
123
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/435 | Issue #435}
99
124
  */
100
125
  readonly isConnected$: Observable<boolean>;
101
126
  /**
@@ -105,24 +130,31 @@ export interface SerialSession {
105
130
  *
106
131
  * Emits the current value on subscribe. Use with {@link state$} to know when
107
132
  * the value is valid for your UI.
133
+ *
134
+ * @deprecated Prefer narrowing {@link state$} with
135
+ * {@link SerialSessionStatus.Connected} and using `state.portInfo`.
136
+ * Retained for backward compatibility; scheduled for removal in the next
137
+ * major version.
138
+ *
139
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/434 | Issue #434}
108
140
  */
109
141
  readonly portInfo$: Observable<SerialPortInfo | null>;
110
142
  /**
111
143
  * Synchronous read of the last {@link portInfo$} value.
112
144
  *
145
+ * @deprecated Prefer narrowing {@link state$} with
146
+ * {@link SerialSessionStatus.Connected} and using `state.portInfo`.
147
+ * Retained for backward compatibility; scheduled for removal in the next
148
+ * major version.
149
+ *
113
150
  * @returns The same as {@link SerialPort.getInfo} for the open port, or
114
151
  * `null` when not connected.
115
- */
116
- getPortInfo(): SerialPortInfo | null;
117
- /**
118
- * The underlying `SerialPort` while connected, or `null` otherwise.
119
152
  *
120
- * Avoid calling `port.close()` or replacing streams yourself; that conflicts
121
- * with session lifecycle. Prefer {@link getPortInfo} for identification.
153
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/434 | Issue #434}
122
154
  */
123
- getCurrentPort(): SerialPort | null;
155
+ getPortInfo(): SerialPortInfo | null;
124
156
  /**
125
- * Primary error channel.
157
+ * Canonical fatal / non-fatal error channel.
126
158
  *
127
159
  * All {@link SerialError} instances produced by the session (connect /
128
160
  * read / write / close) are multiplexed here. This is the main channel,
@@ -1 +1 @@
1
- {"version":3,"file":"serial-session.d.ts","sourceRoot":"","sources":["../../src/session/serial-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;;;;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AE,UAAU,CAAC,WAAW,CAAC,CAAC;IAE1C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAEtC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAE3C;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,cAAc,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAE5C;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAEpC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,IAAI,EAAE,aAAa,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;CAC9C"}
@@ -8,7 +8,9 @@ export interface TerminalBufferState {
8
8
  /**
9
9
  * Applies one raw decoder chunk to terminal display state.
10
10
  * Handles `\r\n` and lone `\n` as line endings, and lone `\r` as
11
- * carriage return (clear current line for redraw). Does not interpret ANSI escapes.
11
+ * carriage return (clear current line for redraw). When
12
+ * {@link TerminalBufferOptions.stripAnsi} is enabled (default), ANSI escape
13
+ * sequences are removed before line folding.
12
14
  *
13
15
  * @internal Exported for unit tests.
14
16
  */
@@ -58,6 +60,15 @@ export interface TerminalBufferOptions {
58
60
  * @default 1048576
59
61
  */
60
62
  maxChars?: number;
63
+ /**
64
+ * When `true`, strips ANSI escape sequences from incoming chunks before
65
+ * folding carriage-return redraws. Use `false` to preserve raw escape
66
+ * codes in {@link TerminalBuffer.text$}.
67
+ *
68
+ * @default true
69
+ * @see {@link https://github.com/gurezo/web-serial-rxjs/issues/428 | Issue #428}
70
+ */
71
+ stripAnsi?: boolean;
61
72
  }
62
73
  /** Default limits applied when options are omitted. */
63
74
  export declare const DEFAULT_TERMINAL_BUFFER_OPTIONS: Required<TerminalBufferOptions>;
@@ -1 +1 @@
1
- {"version":3,"file":"create-termin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MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,uDAAuD;AACvD,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,qBAAqB,CAKzE,CAAC;AAkBJ;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,EAC5B,OAAO,CAAC,EAAE,qBAAqB,GAC9B,cAAc,CAkBhB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gurezo/web-serial-rxjs",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "RxJS-based utilities for the Web Serial API, usable from Angular, React, Svelte, and Vanilla JavaScript/TypeScript.",
5
5
  "author": "Akihiko Kigure <akihiko.kigure@gmail.com>",
6
6
  "license": "MIT",