@rsdoctor/utils 1.6.2 → 1.6.3-beta.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/dist/common.cjs CHANGED
@@ -548,8 +548,16 @@ for(var __rspack_i in (()=>{
548
548
  }
549
549
  async function fetchShardingData(shardingFiles, fetchImplement) {
550
550
  if (0 === shardingFiles.length) return [];
551
- let inflater = external_stream_.Readable.from(decodeBase64Shards(shardingFiles, fetchImplement)).pipe((0, external_zlib_.createInflate)()), decoder = new external_string_decoder_namespaceObject.StringDecoder('utf8'), jsonParts = [];
552
- for await (let chunk of inflater)jsonParts.push(decoder.write(external_buffer_.Buffer.from(chunk)));
551
+ let decoder = new external_string_decoder_namespaceObject.StringDecoder('utf8'), jsonParts = [];
552
+ await new Promise((resolve, reject)=>{
553
+ (0, external_stream_.pipeline)(external_stream_.Readable.from(decodeBase64Shards(shardingFiles, fetchImplement)), (0, external_zlib_.createInflate)(), new external_stream_.Writable({
554
+ write (chunk, _encoding, callback) {
555
+ jsonParts.push(decoder.write(external_buffer_.Buffer.from(chunk))), callback();
556
+ }
557
+ }), (error)=>{
558
+ error ? reject(error) : resolve();
559
+ });
560
+ });
553
561
  let finalPart = decoder.end();
554
562
  return finalPart && jsonParts.push(finalPart), JSON.parse(jsonParts.join(''));
555
563
  }
package/dist/common.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { __webpack_require__ } from "./0~rslib-runtime.js";
2
2
  import { Buffer } from "buffer";
3
- import { Readable } from "stream";
3
+ import { Readable, Writable, pipeline } from "stream";
4
4
  import { StringDecoder } from "string_decoder";
5
5
  import { createInflate, deflateSync, inflateSync } from "zlib";
6
6
  import path_0, { isAbsolute, relative } from "path";
@@ -194,8 +194,16 @@ function isShardingData(data) {
194
194
  }
195
195
  async function fetchShardingData(shardingFiles, fetchImplement) {
196
196
  if (0 === shardingFiles.length) return [];
197
- let inflater = Readable.from(decodeBase64Shards(shardingFiles, fetchImplement)).pipe(createInflate()), decoder = new StringDecoder('utf8'), jsonParts = [];
198
- for await (let chunk of inflater)jsonParts.push(decoder.write(Buffer.from(chunk)));
197
+ let decoder = new StringDecoder('utf8'), jsonParts = [];
198
+ await new Promise((resolve, reject)=>{
199
+ pipeline(Readable.from(decodeBase64Shards(shardingFiles, fetchImplement)), createInflate(), new Writable({
200
+ write (chunk, _encoding, callback) {
201
+ jsonParts.push(decoder.write(Buffer.from(chunk))), callback();
202
+ }
203
+ }), (error)=>{
204
+ error ? reject(error) : resolve();
205
+ });
206
+ });
199
207
  let finalPart = decoder.end();
200
208
  return finalPart && jsonParts.push(finalPart), JSON.parse(jsonParts.join(''));
201
209
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/utils",
3
- "version": "1.6.2",
3
+ "version": "1.6.3-beta.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -101,7 +101,7 @@
101
101
  "picocolors": "^1.1.1",
102
102
  "rslog": "^2.1.2",
103
103
  "strip-ansi": "^7.2.0",
104
- "@rsdoctor/types": "1.6.2"
104
+ "@rsdoctor/types": "1.6.3-beta.0"
105
105
  },
106
106
  "devDependencies": {
107
107
  "@types/babel__code-frame": "7.27.0",