1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -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) { Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {
return Buffer2.from(chunk.buffer, chunk.byteOffset, chunk.byteLength); return Buffer2.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
}; };
Stream._isArrayBufferView = isArrayBufferView;
}, },
}); });
/* End esm.sh bundle */ /* End esm.sh bundle */
@ -5311,11 +5312,15 @@ export const Duplex = CustomStream.Duplex;
export const PassThrough = CustomStream.PassThrough; export const PassThrough = CustomStream.PassThrough;
export const Stream = CustomStream.Stream; export const Stream = CustomStream.Stream;
export const Transform = CustomStream.Transform; export const Transform = CustomStream.Transform;
export const _isArrayBufferView = isArrayBufferView;
export const _isUint8Array = CustomStream._isUint8Array; export const _isUint8Array = CustomStream._isUint8Array;
export const _uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer; export const _uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer;
export const addAbortSignal = CustomStream.addAbortSignal; export const addAbortSignal = CustomStream.addAbortSignal;
export const pipeline = CustomStream.pipeline; 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) { function isWritableStream(object) {
return object instanceof WritableStream; return object instanceof WritableStream;

View file

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

View file

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

View file

@ -2,9 +2,24 @@
// Copyright Joyent and Node contributors. All rights reserved. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license.
// deno-lint-ignore-file // deno-lint-ignore-file
// TODO(bartlomieju): this should be 64?
let defaultHighWaterMarkBytes = 16 * 1024;
let defaultHighWaterMarkObjectMode = 16;
function getDefaultHighWaterMark(objectMode) { function getDefaultHighWaterMark(objectMode) {
return objectMode ? 16 : 16 * 1024; return objectMode
? defaultHighWaterMarkObjectMode
: defaultHighWaterMarkBytes;
} }
export default { getDefaultHighWaterMark }; function setDefaultHighWaterMark(objectMode, value) {
export { getDefaultHighWaterMark }; 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" // @deno-types="./_stream.d.ts"
import { import {
_isArrayBufferView,
_isUint8Array, _isUint8Array,
_uint8ArrayToBuffer, _uint8ArrayToBuffer,
addAbortSignal, addAbortSignal,
// compose, compose,
// destroy, destroy,
Duplex, Duplex,
finished, finished,
// isDisturbed, isDestroyed,
isDisturbed,
isErrored,
isReadable,
isWritable,
PassThrough, PassThrough,
pipeline, pipeline,
Readable, Readable,
@ -21,18 +26,28 @@ import {
} from "ext:deno_node/_stream.mjs"; } from "ext:deno_node/_stream.mjs";
import { import {
getDefaultHighWaterMark, getDefaultHighWaterMark,
setDefaultHighWaterMark,
} from "ext:deno_node/internal/streams/state.mjs"; } from "ext:deno_node/internal/streams/state.mjs";
export { export {
_isArrayBufferView,
_isUint8Array, _isUint8Array,
_uint8ArrayToBuffer, _uint8ArrayToBuffer,
addAbortSignal, addAbortSignal,
compose,
destroy,
Duplex, Duplex,
finished, finished,
getDefaultHighWaterMark, getDefaultHighWaterMark,
isDestroyed,
isDisturbed,
isErrored,
isReadable,
isWritable,
PassThrough, PassThrough,
pipeline, pipeline,
Readable, Readable,
setDefaultHighWaterMark,
Stream, Stream,
Transform, Transform,
Writable, Writable,

View file

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

View file

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