trzsz2 1.1.0 → 1.2.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.
@@ -1,6 +1,5 @@
1
- var Trzsz2 = function(exports) {
1
+ var Trzsz2 = (function(exports) {
2
2
  "use strict";
3
- /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
4
3
  const Z_FIXED$1 = 4;
5
4
  const Z_BINARY = 0;
6
5
  const Z_TEXT = 1;
@@ -3119,6 +3118,7 @@ var Trzsz2 = function(exports) {
3119
3118
  hold = 0;
3120
3119
  bits = 0;
3121
3120
  state.mode = TIME;
3121
+ /* falls through */
3122
3122
  case TIME:
3123
3123
  while (bits < 32) {
3124
3124
  if (have === 0) {
@@ -3141,6 +3141,7 @@ var Trzsz2 = function(exports) {
3141
3141
  hold = 0;
3142
3142
  bits = 0;
3143
3143
  state.mode = OS;
3144
+ /* falls through */
3144
3145
  case OS:
3145
3146
  while (bits < 16) {
3146
3147
  if (have === 0) {
@@ -3162,6 +3163,7 @@ var Trzsz2 = function(exports) {
3162
3163
  hold = 0;
3163
3164
  bits = 0;
3164
3165
  state.mode = EXLEN;
3166
+ /* falls through */
3165
3167
  case EXLEN:
3166
3168
  if (state.flags & 1024) {
3167
3169
  while (bits < 16) {
@@ -3187,6 +3189,7 @@ var Trzsz2 = function(exports) {
3187
3189
  state.head.extra = null;
3188
3190
  }
3189
3191
  state.mode = EXTRA;
3192
+ /* falls through */
3190
3193
  case EXTRA:
3191
3194
  if (state.flags & 1024) {
3192
3195
  copy = state.length;
@@ -3223,6 +3226,7 @@ var Trzsz2 = function(exports) {
3223
3226
  }
3224
3227
  state.length = 0;
3225
3228
  state.mode = NAME;
3229
+ /* falls through */
3226
3230
  case NAME:
3227
3231
  if (state.flags & 2048) {
3228
3232
  if (have === 0) {
@@ -3248,6 +3252,7 @@ var Trzsz2 = function(exports) {
3248
3252
  }
3249
3253
  state.length = 0;
3250
3254
  state.mode = COMMENT;
3255
+ /* falls through */
3251
3256
  case COMMENT:
3252
3257
  if (state.flags & 4096) {
3253
3258
  if (have === 0) {
@@ -3272,6 +3277,7 @@ var Trzsz2 = function(exports) {
3272
3277
  state.head.comment = null;
3273
3278
  }
3274
3279
  state.mode = HCRC;
3280
+ /* falls through */
3275
3281
  case HCRC:
3276
3282
  if (state.flags & 512) {
3277
3283
  while (bits < 16) {
@@ -3310,6 +3316,7 @@ var Trzsz2 = function(exports) {
3310
3316
  hold = 0;
3311
3317
  bits = 0;
3312
3318
  state.mode = DICT;
3319
+ /* falls through */
3313
3320
  case DICT:
3314
3321
  if (state.havedict === 0) {
3315
3322
  strm.next_out = put;
@@ -3322,10 +3329,12 @@ var Trzsz2 = function(exports) {
3322
3329
  }
3323
3330
  strm.adler = state.check = 1;
3324
3331
  state.mode = TYPE;
3332
+ /* falls through */
3325
3333
  case TYPE:
3326
3334
  if (flush === Z_BLOCK || flush === Z_TREES) {
3327
3335
  break inf_leave;
3328
3336
  }
3337
+ /* falls through */
3329
3338
  case TYPEDO:
3330
3339
  if (state.last) {
3331
3340
  hold >>>= bits & 7;
@@ -3390,8 +3399,10 @@ var Trzsz2 = function(exports) {
3390
3399
  if (flush === Z_TREES) {
3391
3400
  break inf_leave;
3392
3401
  }
3402
+ /* falls through */
3393
3403
  case COPY_:
3394
3404
  state.mode = COPY;
3405
+ /* falls through */
3395
3406
  case COPY:
3396
3407
  copy = state.length;
3397
3408
  if (copy) {
@@ -3439,6 +3450,7 @@ var Trzsz2 = function(exports) {
3439
3450
  }
3440
3451
  state.have = 0;
3441
3452
  state.mode = LENLENS;
3453
+ /* falls through */
3442
3454
  case LENLENS:
3443
3455
  while (state.have < state.ncode) {
3444
3456
  while (bits < 3) {
@@ -3468,6 +3480,7 @@ var Trzsz2 = function(exports) {
3468
3480
  }
3469
3481
  state.have = 0;
3470
3482
  state.mode = CODELENS;
3483
+ /* falls through */
3471
3484
  case CODELENS:
3472
3485
  while (state.have < state.nlen + state.ndist) {
3473
3486
  for (; ; ) {
@@ -3585,8 +3598,10 @@ var Trzsz2 = function(exports) {
3585
3598
  if (flush === Z_TREES) {
3586
3599
  break inf_leave;
3587
3600
  }
3601
+ /* falls through */
3588
3602
  case LEN_:
3589
3603
  state.mode = LEN;
3604
+ /* falls through */
3590
3605
  case LEN:
3591
3606
  if (have >= 6 && left >= 258) {
3592
3607
  strm.next_out = put;
@@ -3668,6 +3683,7 @@ var Trzsz2 = function(exports) {
3668
3683
  }
3669
3684
  state.extra = here_op & 15;
3670
3685
  state.mode = LENEXT;
3686
+ /* falls through */
3671
3687
  case LENEXT:
3672
3688
  if (state.extra) {
3673
3689
  n = state.extra;
@@ -3686,6 +3702,7 @@ var Trzsz2 = function(exports) {
3686
3702
  }
3687
3703
  state.was = state.length;
3688
3704
  state.mode = DIST;
3705
+ /* falls through */
3689
3706
  case DIST:
3690
3707
  for (; ; ) {
3691
3708
  here = state.distcode[hold & (1 << state.distbits) - 1];
@@ -3736,6 +3753,7 @@ var Trzsz2 = function(exports) {
3736
3753
  state.offset = here_val;
3737
3754
  state.extra = here_op & 15;
3738
3755
  state.mode = DISTEXT;
3756
+ /* falls through */
3739
3757
  case DISTEXT:
3740
3758
  if (state.extra) {
3741
3759
  n = state.extra;
@@ -3758,6 +3776,7 @@ var Trzsz2 = function(exports) {
3758
3776
  break;
3759
3777
  }
3760
3778
  state.mode = MATCH;
3779
+ /* falls through */
3761
3780
  case MATCH:
3762
3781
  if (left === 0) {
3763
3782
  break inf_leave;
@@ -3834,6 +3853,7 @@ var Trzsz2 = function(exports) {
3834
3853
  bits = 0;
3835
3854
  }
3836
3855
  state.mode = LENGTH;
3856
+ /* falls through */
3837
3857
  case LENGTH:
3838
3858
  if (state.wrap && state.flags) {
3839
3859
  while (bits < 32) {
@@ -3853,6 +3873,7 @@ var Trzsz2 = function(exports) {
3853
3873
  bits = 0;
3854
3874
  }
3855
3875
  state.mode = DONE;
3876
+ /* falls through */
3856
3877
  case DONE:
3857
3878
  ret = Z_STREAM_END$1;
3858
3879
  break inf_leave;
@@ -3862,6 +3883,7 @@ var Trzsz2 = function(exports) {
3862
3883
  case MEM:
3863
3884
  return Z_MEM_ERROR$1;
3864
3885
  case SYNC:
3886
+ /* falls through */
3865
3887
  default:
3866
3888
  return Z_STREAM_ERROR$1;
3867
3889
  }
@@ -4168,6 +4190,9 @@ var Trzsz2 = function(exports) {
4168
4190
  function strToUint8(str) {
4169
4191
  return Uint8Array.from(str, (v) => v.charCodeAt(0));
4170
4192
  }
4193
+ function strToUtf8(str) {
4194
+ return new TextEncoder().encode(str);
4195
+ }
4171
4196
  async function uint8ToStr(buf, encoding = "binary") {
4172
4197
  if (typeof Buffer === "function") {
4173
4198
  return Buffer.from(buf).toString(encoding);
@@ -5034,13 +5059,6 @@ var Trzsz2 = function(exports) {
5034
5059
  if (Md5.hashStr("hello") !== "5d41402abc4b2a76b9719d911017c592") {
5035
5060
  throw new Error("Md5 self test failed.");
5036
5061
  }
5037
- /**
5038
- * trzsz2: https://github.com/zxdong262/trzsz2
5039
- * Copyright(c) 2024 Lonny Wong
5040
- * @license MIT
5041
- *
5042
- * Pure protocol implementation without fs/browser dependencies.
5043
- */
5044
5062
  function getEscapeChars(escapeAll) {
5045
5063
  const escapeChars = [
5046
5064
  ["î", "îî"],
@@ -5277,7 +5295,7 @@ var Trzsz2 = function(exports) {
5277
5295
  * @param str - The string.
5278
5296
  */
5279
5297
  async sendString(typ, str) {
5280
- await this.sendLine(typ, encodeBuffer(str));
5298
+ await this.sendLine(typ, encodeBuffer(strToUtf8(str)));
5281
5299
  }
5282
5300
  /**
5283
5301
  * Receive a string.
@@ -5811,13 +5829,6 @@ var Trzsz2 = function(exports) {
5811
5829
  return localNames;
5812
5830
  }
5813
5831
  }
5814
- /**
5815
- * trzsz2: https://github.com/zxdong262/trzsz2
5816
- * Copyright(c) 2024 Lonny Wong
5817
- * @license MIT
5818
- *
5819
- * Pure protocol implementation without fs/browser dependencies.
5820
- */
5821
5832
  function getLength(str) {
5822
5833
  return str.replace(/[\u4e00-\u9fa5]/g, "**").length;
5823
5834
  }
@@ -6136,6 +6147,7 @@ var Trzsz2 = function(exports) {
6136
6147
  exports.isVT100End = isVT100End;
6137
6148
  exports.strToArrBuf = strToArrBuf;
6138
6149
  exports.strToUint8 = strToUint8;
6150
+ exports.strToUtf8 = strToUtf8;
6139
6151
  exports.stripServerOutput = stripServerOutput;
6140
6152
  exports.stripTmuxStatusLine = stripTmuxStatusLine;
6141
6153
  exports.trzszVersion = trzszVersion;
@@ -6143,5 +6155,5 @@ var Trzsz2 = function(exports) {
6143
6155
  exports.unescapeData = unescapeData;
6144
6156
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6145
6157
  return exports;
6146
- }({});
6158
+ })({});
6147
6159
  //# sourceMappingURL=trzsz2.js.map