1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

feat(ext/node): export more symbols from streams and timers/promises (#25582)

This commit is contained in:
Bartek Iwańczuk 2024-09-12 00:02:50 +01:00 committed by GitHub
parent 5e0b2aa473
commit 05bd547238
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 60 additions and 15 deletions

View file

@ -5277,6 +5277,7 @@ var require_stream = __commonJS({
Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {
return Buffer2.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
};
Stream._isArrayBufferView = isArrayBufferView;
},
});
/* End esm.sh bundle */
@ -5311,11 +5312,15 @@ export const Duplex = CustomStream.Duplex;
export const PassThrough = CustomStream.PassThrough;
export const Stream = CustomStream.Stream;
export const Transform = CustomStream.Transform;
export const _isArrayBufferView = isArrayBufferView;
export const _isUint8Array = CustomStream._isUint8Array;
export const _uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer;
export const addAbortSignal = CustomStream.addAbortSignal;
export const pipeline = CustomStream.pipeline;
export { finished };
export const isDisturbed = CustomStream.isDisturbed;
export const isErrored = CustomStream.isErrored;
export const compose = CustomStream.compose;
export { destroy, finished, isDestroyed, isReadable, isWritable };
function isWritableStream(object) {
return object instanceof WritableStream;

View file

@ -7,6 +7,7 @@ export {
Buffer,
constants,
default,
INSPECT_MAX_BYTES,
isAscii,
isUtf8,
kMaxLength,

View file

@ -65,7 +65,7 @@ const customInspectSymbol =
? Symbol["for"]("nodejs.util.inspect.custom")
: null;
const INSPECT_MAX_BYTES = 50;
export const INSPECT_MAX_BYTES = 50;
export const constants = {
MAX_LENGTH: kMaxLength,

View file

@ -2,9 +2,24 @@
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// deno-lint-ignore-file
// TODO(bartlomieju): this should be 64?
let defaultHighWaterMarkBytes = 16 * 1024;
let defaultHighWaterMarkObjectMode = 16;
function getDefaultHighWaterMark(objectMode) {
return objectMode ? 16 : 16 * 1024;
return objectMode
? defaultHighWaterMarkObjectMode
: defaultHighWaterMarkBytes;
}
export default { getDefaultHighWaterMark };
export { getDefaultHighWaterMark };
function setDefaultHighWaterMark(objectMode, value) {
validateInteger(value, "value", 0);
if (objectMode) {
defaultHighWaterMarkObjectMode = value;
} else {
defaultHighWaterMarkBytes = value;
}
}
export default { getDefaultHighWaterMark, setDefaultHighWaterMark };
export { getDefaultHighWaterMark, setDefaultHighWaterMark };

View file

@ -4,14 +4,19 @@
// @deno-types="./_stream.d.ts"
import {
_isArrayBufferView,
_isUint8Array,
_uint8ArrayToBuffer,
addAbortSignal,
// compose,
// destroy,
compose,
destroy,
Duplex,
finished,
// isDisturbed,
isDestroyed,
isDisturbed,
isErrored,
isReadable,
isWritable,
PassThrough,
pipeline,
Readable,
@ -21,18 +26,28 @@ import {
} from "ext:deno_node/_stream.mjs";
import {
getDefaultHighWaterMark,
setDefaultHighWaterMark,
} from "ext:deno_node/internal/streams/state.mjs";
export {
_isArrayBufferView,
_isUint8Array,
_uint8ArrayToBuffer,
addAbortSignal,
compose,
destroy,
Duplex,
finished,
getDefaultHighWaterMark,
isDestroyed,
isDisturbed,
isErrored,
isReadable,
isWritable,
PassThrough,
pipeline,
Readable,
setDefaultHighWaterMark,
Stream,
Transform,
Writable,

View file

@ -19,10 +19,16 @@ import {
TextDecoderStream,
TextEncoderStream,
} from "ext:deno_web/08_text_encoding.js";
import {
CompressionStream,
DecompressionStream,
} from "ext:deno_web/14_compression.js";
export {
ByteLengthQueuingStrategy,
CompressionStream,
CountQueuingStrategy,
DecompressionStream,
ReadableByteStreamController,
ReadableStream,
ReadableStreamBYOBReader,
@ -39,19 +45,21 @@ export {
};
export default {
ByteLengthQueuingStrategy,
CompressionStream,
CountQueuingStrategy,
DecompressionStream,
ReadableByteStreamController,
ReadableStream,
ReadableStreamBYOBReader,
ReadableStreamBYOBRequest,
ReadableStreamDefaultReader,
ReadableByteStreamController,
ReadableStreamDefaultController,
ReadableStreamDefaultReader,
TextDecoderStream,
TextEncoderStream,
TransformStream,
TransformStreamDefaultController,
WritableStream,
WritableStreamDefaultWriter,
WritableStreamDefaultController,
ByteLengthQueuingStrategy,
CountQueuingStrategy,
TextEncoderStream,
TextDecoderStream,
WritableStreamDefaultWriter,
};

View file

@ -17,4 +17,5 @@ export default {
setTimeout,
setImmediate,
setInterval,
scheduler,
};