@modern-js/runtime-utils 2.70.4 → 2.70.6
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/cjs/node/index.js +1 -3
- package/dist/esm/node/index.js +0 -1
- package/dist/esm-node/node/index.js +0 -1
- package/dist/types/node/index.d.ts +0 -1
- package/package.json +3 -3
- package/dist/cjs/node/stream.js +0 -104
- package/dist/esm/node/stream.js +0 -87
- package/dist/esm-node/node/stream.js +0 -80
- package/dist/types/node/stream.d.ts +0 -4
package/dist/cjs/node/index.js
CHANGED
|
@@ -26,11 +26,9 @@ module.exports = __toCommonJS(node_exports);
|
|
|
26
26
|
var import_async_storage = require("../universal/async_storage.server");
|
|
27
27
|
var import_serialize = require("./serialize");
|
|
28
28
|
__reExport(node_exports, require("./loaderContext"), module.exports);
|
|
29
|
-
__reExport(node_exports, require("./stream"), module.exports);
|
|
30
29
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31
30
|
0 && (module.exports = {
|
|
32
31
|
serializeJson,
|
|
33
32
|
storage,
|
|
34
|
-
...require("./loaderContext")
|
|
35
|
-
...require("./stream")
|
|
33
|
+
...require("./loaderContext")
|
|
36
34
|
});
|
package/dist/esm/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.70.
|
|
18
|
+
"version": "2.70.6",
|
|
19
19
|
"_comment": "Provide ESM and CJS exports, ESM is used by runtime package, for treeshaking",
|
|
20
20
|
"exports": {
|
|
21
21
|
"./router": {
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
"lru-cache": "^10.4.3",
|
|
146
146
|
"react-router-dom": "6.30.3",
|
|
147
147
|
"serialize-javascript": "^6.0.0",
|
|
148
|
-
"@modern-js/types": "2.70.
|
|
149
|
-
"@modern-js/utils": "2.70.
|
|
148
|
+
"@modern-js/types": "2.70.6",
|
|
149
|
+
"@modern-js/utils": "2.70.6"
|
|
150
150
|
},
|
|
151
151
|
"peerDependencies": {
|
|
152
152
|
"react": ">=17.0.0",
|
package/dist/cjs/node/stream.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var stream_exports = {};
|
|
20
|
-
__export(stream_exports, {
|
|
21
|
-
createReadableStreamFromReadable: () => createReadableStreamFromReadable
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(stream_exports);
|
|
24
|
-
var import_stream = require("stream");
|
|
25
|
-
const createReadableStreamFromReadable = (source) => {
|
|
26
|
-
const pump = new StreamPump(source);
|
|
27
|
-
const stream = new ReadableStream(pump, pump);
|
|
28
|
-
return stream;
|
|
29
|
-
};
|
|
30
|
-
class StreamPump {
|
|
31
|
-
size(chunk) {
|
|
32
|
-
return (chunk === null || chunk === void 0 ? void 0 : chunk.byteLength) || 0;
|
|
33
|
-
}
|
|
34
|
-
start(controller) {
|
|
35
|
-
this.controller = controller;
|
|
36
|
-
this.stream.on("data", this.enqueue);
|
|
37
|
-
this.stream.once("error", this.error);
|
|
38
|
-
this.stream.once("end", this.close);
|
|
39
|
-
this.stream.once("close", this.close);
|
|
40
|
-
}
|
|
41
|
-
pull() {
|
|
42
|
-
this.resume();
|
|
43
|
-
}
|
|
44
|
-
cancel(reason) {
|
|
45
|
-
if (this.stream.destroy) {
|
|
46
|
-
this.stream.destroy(reason);
|
|
47
|
-
}
|
|
48
|
-
process.nextTick(() => {
|
|
49
|
-
this.stream.off("data", this.enqueue);
|
|
50
|
-
this.stream.off("error", this.error);
|
|
51
|
-
this.stream.off("end", this.close);
|
|
52
|
-
this.stream.off("close", this.close);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
enqueue(chunk) {
|
|
56
|
-
if (this.controller) {
|
|
57
|
-
try {
|
|
58
|
-
const bytes = chunk instanceof Uint8Array ? chunk : Buffer.from(chunk);
|
|
59
|
-
const available = (this.controller.desiredSize || 0) - bytes.byteLength;
|
|
60
|
-
this.controller.enqueue(bytes);
|
|
61
|
-
if (available <= 0) {
|
|
62
|
-
this.pause();
|
|
63
|
-
}
|
|
64
|
-
} catch (error) {
|
|
65
|
-
this.controller.error(new Error("Could not create Buffer, chunk must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object"));
|
|
66
|
-
this.cancel();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
pause() {
|
|
71
|
-
if (this.stream.pause) {
|
|
72
|
-
this.stream.pause();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
resume() {
|
|
76
|
-
if (this.stream.readable && this.stream.resume) {
|
|
77
|
-
this.stream.resume();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
close() {
|
|
81
|
-
if (this.controller) {
|
|
82
|
-
this.controller.close();
|
|
83
|
-
delete this.controller;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
error(error) {
|
|
87
|
-
if (this.controller) {
|
|
88
|
-
this.controller.error(error);
|
|
89
|
-
delete this.controller;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
constructor(stream) {
|
|
93
|
-
this.highWaterMark = stream.readableHighWaterMark || new import_stream.Stream.Readable().readableHighWaterMark;
|
|
94
|
-
this.accumalatedSize = 0;
|
|
95
|
-
this.stream = stream;
|
|
96
|
-
this.enqueue = this.enqueue.bind(this);
|
|
97
|
-
this.error = this.error.bind(this);
|
|
98
|
-
this.close = this.close.bind(this);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
-
0 && (module.exports = {
|
|
103
|
-
createReadableStreamFromReadable
|
|
104
|
-
});
|
package/dist/esm/node/stream.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
|
|
2
|
-
import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
|
|
3
|
-
import { Stream } from "stream";
|
|
4
|
-
var createReadableStreamFromReadable = function(source) {
|
|
5
|
-
var pump = new StreamPump(source);
|
|
6
|
-
var stream = new ReadableStream(pump, pump);
|
|
7
|
-
return stream;
|
|
8
|
-
};
|
|
9
|
-
var StreamPump = /* @__PURE__ */ function() {
|
|
10
|
-
"use strict";
|
|
11
|
-
function StreamPump2(stream) {
|
|
12
|
-
_class_call_check(this, StreamPump2);
|
|
13
|
-
this.highWaterMark = stream.readableHighWaterMark || new Stream.Readable().readableHighWaterMark;
|
|
14
|
-
this.accumalatedSize = 0;
|
|
15
|
-
this.stream = stream;
|
|
16
|
-
this.enqueue = this.enqueue.bind(this);
|
|
17
|
-
this.error = this.error.bind(this);
|
|
18
|
-
this.close = this.close.bind(this);
|
|
19
|
-
}
|
|
20
|
-
var _proto = StreamPump2.prototype;
|
|
21
|
-
_proto.size = function size(chunk) {
|
|
22
|
-
return (chunk === null || chunk === void 0 ? void 0 : chunk.byteLength) || 0;
|
|
23
|
-
};
|
|
24
|
-
_proto.start = function start(controller) {
|
|
25
|
-
this.controller = controller;
|
|
26
|
-
this.stream.on("data", this.enqueue);
|
|
27
|
-
this.stream.once("error", this.error);
|
|
28
|
-
this.stream.once("end", this.close);
|
|
29
|
-
this.stream.once("close", this.close);
|
|
30
|
-
};
|
|
31
|
-
_proto.pull = function pull() {
|
|
32
|
-
this.resume();
|
|
33
|
-
};
|
|
34
|
-
_proto.cancel = function cancel(reason) {
|
|
35
|
-
var _this = this;
|
|
36
|
-
if (this.stream.destroy) {
|
|
37
|
-
this.stream.destroy(reason);
|
|
38
|
-
}
|
|
39
|
-
process.nextTick(function() {
|
|
40
|
-
_this.stream.off("data", _this.enqueue);
|
|
41
|
-
_this.stream.off("error", _this.error);
|
|
42
|
-
_this.stream.off("end", _this.close);
|
|
43
|
-
_this.stream.off("close", _this.close);
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
_proto.enqueue = function enqueue(chunk) {
|
|
47
|
-
if (this.controller) {
|
|
48
|
-
try {
|
|
49
|
-
var bytes = _instanceof(chunk, Uint8Array) ? chunk : Buffer.from(chunk);
|
|
50
|
-
var available = (this.controller.desiredSize || 0) - bytes.byteLength;
|
|
51
|
-
this.controller.enqueue(bytes);
|
|
52
|
-
if (available <= 0) {
|
|
53
|
-
this.pause();
|
|
54
|
-
}
|
|
55
|
-
} catch (error) {
|
|
56
|
-
this.controller.error(new Error("Could not create Buffer, chunk must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object"));
|
|
57
|
-
this.cancel();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
_proto.pause = function pause() {
|
|
62
|
-
if (this.stream.pause) {
|
|
63
|
-
this.stream.pause();
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
_proto.resume = function resume() {
|
|
67
|
-
if (this.stream.readable && this.stream.resume) {
|
|
68
|
-
this.stream.resume();
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
_proto.close = function close() {
|
|
72
|
-
if (this.controller) {
|
|
73
|
-
this.controller.close();
|
|
74
|
-
delete this.controller;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
_proto.error = function error(error) {
|
|
78
|
-
if (this.controller) {
|
|
79
|
-
this.controller.error(error);
|
|
80
|
-
delete this.controller;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
return StreamPump2;
|
|
84
|
-
}();
|
|
85
|
-
export {
|
|
86
|
-
createReadableStreamFromReadable
|
|
87
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { Stream } from "stream";
|
|
2
|
-
const createReadableStreamFromReadable = (source) => {
|
|
3
|
-
const pump = new StreamPump(source);
|
|
4
|
-
const stream = new ReadableStream(pump, pump);
|
|
5
|
-
return stream;
|
|
6
|
-
};
|
|
7
|
-
class StreamPump {
|
|
8
|
-
size(chunk) {
|
|
9
|
-
return (chunk === null || chunk === void 0 ? void 0 : chunk.byteLength) || 0;
|
|
10
|
-
}
|
|
11
|
-
start(controller) {
|
|
12
|
-
this.controller = controller;
|
|
13
|
-
this.stream.on("data", this.enqueue);
|
|
14
|
-
this.stream.once("error", this.error);
|
|
15
|
-
this.stream.once("end", this.close);
|
|
16
|
-
this.stream.once("close", this.close);
|
|
17
|
-
}
|
|
18
|
-
pull() {
|
|
19
|
-
this.resume();
|
|
20
|
-
}
|
|
21
|
-
cancel(reason) {
|
|
22
|
-
if (this.stream.destroy) {
|
|
23
|
-
this.stream.destroy(reason);
|
|
24
|
-
}
|
|
25
|
-
process.nextTick(() => {
|
|
26
|
-
this.stream.off("data", this.enqueue);
|
|
27
|
-
this.stream.off("error", this.error);
|
|
28
|
-
this.stream.off("end", this.close);
|
|
29
|
-
this.stream.off("close", this.close);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
enqueue(chunk) {
|
|
33
|
-
if (this.controller) {
|
|
34
|
-
try {
|
|
35
|
-
const bytes = chunk instanceof Uint8Array ? chunk : Buffer.from(chunk);
|
|
36
|
-
const available = (this.controller.desiredSize || 0) - bytes.byteLength;
|
|
37
|
-
this.controller.enqueue(bytes);
|
|
38
|
-
if (available <= 0) {
|
|
39
|
-
this.pause();
|
|
40
|
-
}
|
|
41
|
-
} catch (error) {
|
|
42
|
-
this.controller.error(new Error("Could not create Buffer, chunk must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object"));
|
|
43
|
-
this.cancel();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
pause() {
|
|
48
|
-
if (this.stream.pause) {
|
|
49
|
-
this.stream.pause();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
resume() {
|
|
53
|
-
if (this.stream.readable && this.stream.resume) {
|
|
54
|
-
this.stream.resume();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
close() {
|
|
58
|
-
if (this.controller) {
|
|
59
|
-
this.controller.close();
|
|
60
|
-
delete this.controller;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
error(error) {
|
|
64
|
-
if (this.controller) {
|
|
65
|
-
this.controller.error(error);
|
|
66
|
-
delete this.controller;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
constructor(stream) {
|
|
70
|
-
this.highWaterMark = stream.readableHighWaterMark || new Stream.Readable().readableHighWaterMark;
|
|
71
|
-
this.accumalatedSize = 0;
|
|
72
|
-
this.stream = stream;
|
|
73
|
-
this.enqueue = this.enqueue.bind(this);
|
|
74
|
-
this.error = this.error.bind(this);
|
|
75
|
-
this.close = this.close.bind(this);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
export {
|
|
79
|
-
createReadableStreamFromReadable
|
|
80
|
-
};
|