@gurezo/web-serial-rxjs 2.3.5 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/errors/serial-error-code.d.ts +43 -0
- package/dist/errors/serial-error-code.d.ts.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +447 -84
- package/dist/index.mjs.map +4 -4
- package/dist/internal/newline-tokenizer.d.ts +38 -0
- package/dist/internal/newline-tokenizer.d.ts.map +1 -0
- package/dist/session/create-serial-session.d.ts +2 -1
- package/dist/session/create-serial-session.d.ts.map +1 -1
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/internal/line-buffer.d.ts +24 -2
- package/dist/session/internal/line-buffer.d.ts.map +1 -1
- package/dist/session/internal/receive-replay-buffer.d.ts +37 -0
- package/dist/session/internal/receive-replay-buffer.d.ts.map +1 -0
- package/dist/session/read-pump.d.ts +9 -1
- package/dist/session/read-pump.d.ts.map +1 -1
- package/dist/session/serial-session-options.d.ts +42 -1
- package/dist/session/serial-session-options.d.ts.map +1 -1
- package/dist/session/serial-session-state.d.ts +1 -0
- package/dist/session/serial-session-state.d.ts.map +1 -1
- package/dist/session/serial-session.d.ts +35 -2
- package/dist/session/serial-session.d.ts.map +1 -1
- package/dist/session/session-state-machine.d.ts +1 -0
- package/dist/session/session-state-machine.d.ts.map +1 -1
- package/dist/terminal/create-terminal-buffer.d.ts +47 -1
- package/dist/terminal/create-terminal-buffer.d.ts.map +1 -1
- package/package.json +2 -1
- package/dist/index.js +0 -724
package/README.ja.md
CHANGED
|
@@ -27,7 +27,7 @@ Web Serial API は**デスクトップ**ブラウザでのみサポートされ
|
|
|
27
27
|
|
|
28
28
|
## 受信の replay(`receive$` と `receiveReplay$`)
|
|
29
29
|
|
|
30
|
-
`receive$` は **non-replay** のままです。購読後に届くチャンクだけが見えます。接続ごとに直近 *N* 件のデコード済みテキスト**チャンク**(read pump の 1 回の `onChunk` あたり 1 件。文字数ではありません)を遅延購読者にも渡したい場合は、`createSerialSession` に `receiveReplay: { enabled: true, bufferSize: 512 }` を指定し、`receiveReplay$` を購読します。`bufferSize`
|
|
30
|
+
`receive$` は **non-replay** のままです。購読後に届くチャンクだけが見えます。接続ごとに直近 *N* 件のデコード済みテキスト**チャンク**(read pump の 1 回の `onChunk` あたり 1 件。文字数ではありません)を遅延購読者にも渡したい場合は、`createSerialSession` に `receiveReplay: { enabled: true, bufferSize: 512 }` を指定し、`receiveReplay$` を購読します。`bufferSize` は 1〜65536 の正の safe integer である必要があります。任意の `maxChars` で保持チャンク全体の文字数上限を指定でき、超過時は古いチャンクから破棄し non-fatal の `RECEIVE_REPLAY_BUFFER_OVERFLOW` を `errors$` に emit します。`bufferSize` やチャンクサイズを大きくするとメモリ負荷が増えます。receive replay が **無効**(既定)のとき、`receiveReplay$` は `receive$` と同じ hot ストリームです。`lines$` の行分割に replay は付きません。生チャンクの `receiveReplay$` のみが対象です。
|
|
31
31
|
|
|
32
32
|
## `receive$` と `lines$`
|
|
33
33
|
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ After a successful `connect$`, use `getPortInfo()` or subscribe to `portInfo$` f
|
|
|
27
27
|
|
|
28
28
|
## Receive replay (`receive$` vs `receiveReplay$`)
|
|
29
29
|
|
|
30
|
-
`receive$` is **non-replay**: late subscribers only see chunks emitted after they subscribe. To retain the last *N* decoded text **chunks** per open connection (same bytes as `receive$`, e.g. for boot logs), pass `receiveReplay: { enabled: true, bufferSize: 512 }` to `createSerialSession` and subscribe to `receiveReplay$`. Larger `bufferSize`
|
|
30
|
+
`receive$` is **non-replay**: late subscribers only see chunks emitted after they subscribe. To retain the last *N* decoded text **chunks** per open connection (same bytes as `receive$`, e.g. for boot logs), pass `receiveReplay: { enabled: true, bufferSize: 512 }` to `createSerialSession` and subscribe to `receiveReplay$`. `bufferSize` must be a positive safe integer up to 65536. Optional `maxChars` bounds total buffered characters by discarding oldest chunks (non-fatal `RECEIVE_REPLAY_BUFFER_OVERFLOW` on `errors$`). Larger `bufferSize` or chunk sizes use more memory. When receive replay is **off** (default), `receiveReplay$` is the same hot stream as `receive$`. This option does not add replay to `lines$`—only raw decoder chunks on `receiveReplay$`.
|
|
31
31
|
|
|
32
32
|
## `receive$` vs `lines$`
|
|
33
33
|
|
|
@@ -126,6 +126,49 @@ export declare enum SerialErrorCode {
|
|
|
126
126
|
* detection) and the timeout period elapses first.
|
|
127
127
|
*/
|
|
128
128
|
OPERATION_TIMEOUT = "OPERATION_TIMEOUT",
|
|
129
|
+
/**
|
|
130
|
+
* Internal line buffer exceeded its configured size limit.
|
|
131
|
+
*
|
|
132
|
+
* This error occurs when the incomplete line tail held by the {@link SerialSession.lines$}
|
|
133
|
+
* framing buffer grows beyond {@link SerialSessionOptions.lineBuffer} `maxChars`.
|
|
134
|
+
* Leading characters are discarded to bound memory; the session remains connected.
|
|
135
|
+
*
|
|
136
|
+
* **Suggested action**: Increase `lineBuffer.maxChars`, handle framing on `receive$`,
|
|
137
|
+
* or ensure the device sends line terminators.
|
|
138
|
+
*/
|
|
139
|
+
LINE_BUFFER_OVERFLOW = "LINE_BUFFER_OVERFLOW",
|
|
140
|
+
/**
|
|
141
|
+
* Invalid receive replay options provided.
|
|
142
|
+
*
|
|
143
|
+
* This error occurs when {@link SerialSessionOptions.receiveReplay} values are
|
|
144
|
+
* out of range, such as a non-integer `bufferSize` or `maxChars`.
|
|
145
|
+
*
|
|
146
|
+
* **Suggested action**: Verify `receiveReplay` options match the documented
|
|
147
|
+
* ranges and value types.
|
|
148
|
+
*/
|
|
149
|
+
INVALID_RECEIVE_REPLAY_OPTIONS = "INVALID_RECEIVE_REPLAY_OPTIONS",
|
|
150
|
+
/**
|
|
151
|
+
* Receive replay buffer exceeded its configured character limit.
|
|
152
|
+
*
|
|
153
|
+
* This error occurs when buffered chunks on {@link SerialSession.receiveReplay$}
|
|
154
|
+
* exceed {@link SerialSessionOptions.receiveReplay} `maxChars`. Oldest chunks
|
|
155
|
+
* are discarded to bound memory; the session remains connected.
|
|
156
|
+
*
|
|
157
|
+
* **Suggested action**: Increase `receiveReplay.maxChars`, reduce chunk size at
|
|
158
|
+
* the source, or subscribe earlier to avoid relying on a large replay buffer.
|
|
159
|
+
*/
|
|
160
|
+
RECEIVE_REPLAY_BUFFER_OVERFLOW = "RECEIVE_REPLAY_BUFFER_OVERFLOW",
|
|
161
|
+
/**
|
|
162
|
+
* Session has been disposed and can no longer be used.
|
|
163
|
+
*
|
|
164
|
+
* This error occurs when calling {@link SerialSession.connect$} or
|
|
165
|
+
* {@link SerialSession.send$} after {@link SerialSession.dispose$} has
|
|
166
|
+
* completed. Create a new session instead of reusing a disposed instance.
|
|
167
|
+
*
|
|
168
|
+
* **Suggested action**: Call {@link SerialSession.dispose$} only when
|
|
169
|
+
* permanently tearing down a session, then create a new one if needed.
|
|
170
|
+
*/
|
|
171
|
+
SESSION_DISPOSED = "SESSION_DISPOSED",
|
|
129
172
|
/**
|
|
130
173
|
* Unknown error occurred.
|
|
131
174
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serial-error-code.d.ts","sourceRoot":"","sources":["../../src/errors/serial-error-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,oBAAY,eAAe;IACzB;;;;;;;;OAQG;IACH,qBAAqB,0BAA0B;IAE/C;;;;;;;;OAQG;IACH,kBAAkB,uBAAuB;IAEzC;;;;;;;OAOG;IACH,gBAAgB,qBAAqB;IAErC;;;;;;;OAOG;IACH,iBAAiB,sBAAsB;IAEvC;;;;;;;OAOG;IACH,aAAa,kBAAkB;IAE/B;;;;;;;OAOG;IACH,WAAW,gBAAgB;IAE3B;;;;;;;OAOG;IACH,YAAY,iBAAiB;IAE7B;;;;;;;;OAQG;IACH,eAAe,oBAAoB;IAEnC;;;;;;;OAOG;IACH,sBAAsB,2BAA2B;IAEjD;;;;;;;;OAQG;IACH,mBAAmB,wBAAwB;IAE3C;;;;;OAKG;IACH,iBAAiB,sBAAsB;IAEvC;;;;;;;OAOG;IACH,OAAO,YAAY;CACpB"}
|
|
1
|
+
{"version":3,"file":"serial-error-code.d.ts","sourceRoot":"","sources":["../../src/errors/serial-error-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,oBAAY,eAAe;IACzB;;;;;;;;OAQG;IACH,qBAAqB,0BAA0B;IAE/C;;;;;;;;OAQG;IACH,kBAAkB,uBAAuB;IAEzC;;;;;;;OAOG;IACH,gBAAgB,qBAAqB;IAErC;;;;;;;OAOG;IACH,iBAAiB,sBAAsB;IAEvC;;;;;;;OAOG;IACH,aAAa,kBAAkB;IAE/B;;;;;;;OAOG;IACH,WAAW,gBAAgB;IAE3B;;;;;;;OAOG;IACH,YAAY,iBAAiB;IAE7B;;;;;;;;OAQG;IACH,eAAe,oBAAoB;IAEnC;;;;;;;OAOG;IACH,sBAAsB,2BAA2B;IAEjD;;;;;;;;OAQG;IACH,mBAAmB,wBAAwB;IAE3C;;;;;OAKG;IACH,iBAAiB,sBAAsB;IAEvC;;;;;;;;;OASG;IACH,oBAAoB,yBAAyB;IAE7C;;;;;;;;OAQG;IACH,8BAA8B,mCAAmC;IAEjE;;;;;;;;;OASG;IACH,8BAA8B,mCAAmC;IAEjE;;;;;;;;;OASG;IACH,gBAAgB,qBAAqB;IAErC;;;;;;;OAOG;IACH,OAAO,YAAY;CACpB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
*
|
|
16
16
|
* - {@link createSerialSession} - factory for a {@link SerialSession}
|
|
17
17
|
* - {@link createTerminalBuffer} - terminal-style display text from {@link SerialSession.receive$}
|
|
18
|
+
* - {@link TerminalBufferOptions} - memory limits for terminal display text
|
|
19
|
+
* - {@link LineBufferOptions} - memory limits for lines$ incomplete line tail
|
|
18
20
|
* - {@link SerialSession} - the runtime interface
|
|
19
21
|
* - {@link SerialSessionOptions} - connection options
|
|
20
22
|
* - {@link SerialSessionState} - `state$` payload values (const + type)
|
|
@@ -55,10 +57,10 @@
|
|
|
55
57
|
* }
|
|
56
58
|
* ```
|
|
57
59
|
*/
|
|
58
|
-
export { createSerialSession, SerialSessionState } from './session';
|
|
59
|
-
export type { SerialSession, SerialSessionOptions, SerialSessionReceiveReplayOptions, } from './session';
|
|
60
|
+
export { createSerialSession, SerialSessionState, DEFAULT_LINE_BUFFER_OPTIONS } from './session';
|
|
61
|
+
export type { SerialSession, SerialSessionOptions, SerialSessionReceiveReplayOptions, LineBufferOptions, } from './session';
|
|
60
62
|
export { SerialError } from './errors/serial-error';
|
|
61
63
|
export { SerialErrorCode } from './errors/serial-error-code';
|
|
62
|
-
export { createTerminalBuffer } from './terminal/create-terminal-buffer';
|
|
63
|
-
export type { TerminalBuffer } from './terminal/create-terminal-buffer';
|
|
64
|
+
export { createTerminalBuffer, DEFAULT_TERMINAL_BUFFER_OPTIONS } from './terminal/create-terminal-buffer';
|
|
65
|
+
export type { TerminalBuffer, TerminalBufferOptions } from './terminal/create-terminal-buffer';
|
|
64
66
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AACjG,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,iCAAiC,EACjC,iBAAiB,GAClB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAC1G,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC"}
|