@rsdoctor/utils 1.6.2 → 1.6.3
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 +19 -2
- package/dist/common.js +20 -3
- package/package.json +2 -2
package/dist/common.cjs
CHANGED
|
@@ -548,8 +548,25 @@ for(var __rspack_i in (()=>{
|
|
|
548
548
|
}
|
|
549
549
|
async function fetchShardingData(shardingFiles, fetchImplement) {
|
|
550
550
|
if (0 === shardingFiles.length) return [];
|
|
551
|
-
let
|
|
552
|
-
|
|
551
|
+
let decoder = new external_string_decoder_namespaceObject.StringDecoder('utf8'), jsonParts = [];
|
|
552
|
+
await new Promise((resolve, reject)=>{
|
|
553
|
+
let iterator, reading;
|
|
554
|
+
(0, external_stream_.pipeline)((iterator = decodeBase64Shards(shardingFiles, fetchImplement)[Symbol.asyncIterator](), reading = !1, new external_stream_.Readable({
|
|
555
|
+
read () {
|
|
556
|
+
reading || (reading = !0, iterator.next().then(({ value, done })=>{
|
|
557
|
+
reading = !1, this.push(done ? null : value);
|
|
558
|
+
}, (error)=>{
|
|
559
|
+
reading = !1, this.destroy(error);
|
|
560
|
+
}));
|
|
561
|
+
}
|
|
562
|
+
})), (0, external_zlib_.createInflate)(), new external_stream_.Writable({
|
|
563
|
+
write (chunk, _encoding, callback) {
|
|
564
|
+
jsonParts.push(decoder.write(external_buffer_.Buffer.from(chunk))), callback();
|
|
565
|
+
}
|
|
566
|
+
}), (error)=>{
|
|
567
|
+
error ? reject(error) : resolve();
|
|
568
|
+
});
|
|
569
|
+
});
|
|
553
570
|
let finalPart = decoder.end();
|
|
554
571
|
return finalPart && jsonParts.push(finalPart), JSON.parse(jsonParts.join(''));
|
|
555
572
|
}
|
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,25 @@ function isShardingData(data) {
|
|
|
194
194
|
}
|
|
195
195
|
async function fetchShardingData(shardingFiles, fetchImplement) {
|
|
196
196
|
if (0 === shardingFiles.length) return [];
|
|
197
|
-
let
|
|
198
|
-
|
|
197
|
+
let decoder = new StringDecoder('utf8'), jsonParts = [];
|
|
198
|
+
await new Promise((resolve, reject)=>{
|
|
199
|
+
let iterator, reading;
|
|
200
|
+
pipeline((iterator = decodeBase64Shards(shardingFiles, fetchImplement)[Symbol.asyncIterator](), reading = !1, new Readable({
|
|
201
|
+
read () {
|
|
202
|
+
reading || (reading = !0, iterator.next().then(({ value, done })=>{
|
|
203
|
+
reading = !1, this.push(done ? null : value);
|
|
204
|
+
}, (error)=>{
|
|
205
|
+
reading = !1, this.destroy(error);
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
})), createInflate(), new Writable({
|
|
209
|
+
write (chunk, _encoding, callback) {
|
|
210
|
+
jsonParts.push(decoder.write(Buffer.from(chunk))), callback();
|
|
211
|
+
}
|
|
212
|
+
}), (error)=>{
|
|
213
|
+
error ? reject(error) : resolve();
|
|
214
|
+
});
|
|
215
|
+
});
|
|
199
216
|
let finalPart = decoder.end();
|
|
200
217
|
return finalPart && jsonParts.push(finalPart), JSON.parse(jsonParts.join(''));
|
|
201
218
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/utils",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
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.
|
|
104
|
+
"@rsdoctor/types": "1.6.3"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@types/babel__code-frame": "7.27.0",
|