gritty 10.0.2 → 10.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.
package/ChangeLog CHANGED
@@ -1,3 +1,14 @@
1
+ 2026.04.03, v10.1.0
2
+
3
+ feature:
4
+ - f8a84d2 client: terminal disconnected...: write on next line
5
+ - bea8ef7 gritty: webpack-cli v7.0.2
6
+ - 198d341 gritty: putout v42.4.2
7
+ - 77f703e gritty: madrun v13.0.1
8
+ - cde5ebd gritty: eslint-plugin-putout v31.1.2
9
+ - cec19f4 gritty: css-minimizer-webpack-plugin v8.0.0
10
+ - c987136 gritty: superc8 v12.3.1
11
+
1
12
  2026.02.12, v10.0.2
2
13
 
3
14
  fix:
package/README.md CHANGED
@@ -109,7 +109,6 @@ And use it this way:
109
109
  // server.js
110
110
  import http from 'node:http';
111
111
  import {gritty} from 'gritty';
112
-
113
112
  import express from 'express';
114
113
  import {Server} from 'socket.io';
115
114
 
package/dist/gritty.js CHANGED
@@ -3352,12 +3352,13 @@ class Encoder {
3352
3352
  class Decoder extends Emitter {
3353
3353
  /**
3354
3354
  * Decoder constructor
3355
- *
3356
- * @param {function} reviver - custom reviver to pass down to JSON.stringify
3357
3355
  */
3358
- constructor(reviver) {
3356
+ constructor(opts) {
3359
3357
  super();
3360
- this.reviver = reviver;
3358
+ this.opts = Object.assign({
3359
+ reviver: undefined,
3360
+ maxAttachments: 10,
3361
+ }, typeof opts === "function" ? { reviver: opts } : opts);
3361
3362
  }
3362
3363
  /**
3363
3364
  * Decodes an encoded packet string into packet JSON.
@@ -3428,7 +3429,14 @@ class Decoder extends Emitter {
3428
3429
  if (buf != Number(buf) || str.charAt(i) !== "-") {
3429
3430
  throw new Error("Illegal attachments");
3430
3431
  }
3431
- p.attachments = Number(buf);
3432
+ const n = Number(buf);
3433
+ if (!isInteger(n) || n < 0) {
3434
+ throw new Error("Illegal attachments");
3435
+ }
3436
+ else if (n > this.opts.maxAttachments) {
3437
+ throw new Error("too many attachments");
3438
+ }
3439
+ p.attachments = n;
3432
3440
  }
3433
3441
  // look up namespace (if any)
3434
3442
  if ("/" === str.charAt(i + 1)) {
@@ -3474,7 +3482,7 @@ class Decoder extends Emitter {
3474
3482
  }
3475
3483
  tryParse(str) {
3476
3484
  try {
3477
- return JSON.parse(str, this.reviver);
3485
+ return JSON.parse(str, this.opts.reviver);
3478
3486
  }
3479
3487
  catch (e) {
3480
3488
  return false;
@@ -5175,7 +5183,9 @@ function _onConnect(socket, fitAddon, {
5175
5183
  fitAddon.fit();
5176
5184
  }
5177
5185
  function _onDisconnect(terminal) {
5186
+ terminal.writeln('');
5178
5187
  terminal.writeln('terminal disconnected...');
5188
+ terminal.writeln('');
5179
5189
  }
5180
5190
  function _onData(terminal, data) {
5181
5191
  terminal.write(data);