@yume-chan/stream-extra 2.6.1 → 3.0.0-beta.1

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.
Files changed (162) hide show
  1. package/LICENSE +1 -1
  2. package/esm/buffered-transform.d.ts +2 -2
  3. package/esm/buffered-transform.d.ts.map +1 -1
  4. package/esm/buffered-transform.js +16 -16
  5. package/esm/buffered-transform.js.map +1 -1
  6. package/esm/buffered.d.ts +1 -1
  7. package/esm/buffered.d.ts.map +1 -1
  8. package/esm/buffered.js.map +1 -1
  9. package/esm/concat.d.ts +25 -16
  10. package/esm/concat.d.ts.map +1 -1
  11. package/esm/concat.js +124 -93
  12. package/esm/concat.js.map +1 -1
  13. package/esm/consumable/readable.d.ts +2 -2
  14. package/esm/consumable/readable.d.ts.map +1 -1
  15. package/esm/consumable/readable.js +1 -1
  16. package/esm/consumable/readable.js.map +1 -1
  17. package/esm/consumable/wrap-byte-readable.d.ts +5 -2
  18. package/esm/consumable/wrap-byte-readable.d.ts.map +1 -1
  19. package/esm/consumable/wrap-byte-readable.js +12 -6
  20. package/esm/consumable/wrap-byte-readable.js.map +1 -1
  21. package/esm/consumable/wrap-writable.d.ts +1 -1
  22. package/esm/consumable/wrap-writable.d.ts.map +1 -1
  23. package/esm/consumable/wrap-writable.js +1 -1
  24. package/esm/consumable/wrap-writable.js.map +1 -1
  25. package/esm/consumable/writable.d.ts +2 -2
  26. package/esm/consumable/writable.d.ts.map +1 -1
  27. package/esm/consumable/writable.js +1 -1
  28. package/esm/consumable/writable.js.map +1 -1
  29. package/esm/consumable.d.ts +4 -0
  30. package/esm/consumable.d.ts.map +1 -1
  31. package/esm/consumable.js +5 -0
  32. package/esm/consumable.js.map +1 -1
  33. package/esm/distribution.d.ts +1 -1
  34. package/esm/distribution.d.ts.map +1 -1
  35. package/esm/distribution.js +1 -1
  36. package/esm/distribution.js.map +1 -1
  37. package/esm/duplex.d.ts +2 -2
  38. package/esm/duplex.d.ts.map +1 -1
  39. package/esm/duplex.js +1 -1
  40. package/esm/duplex.js.map +1 -1
  41. package/esm/global/abort-signal.d.ts +87 -0
  42. package/esm/global/abort-signal.d.ts.map +1 -0
  43. package/esm/global/abort-signal.js +4 -0
  44. package/esm/global/abort-signal.js.map +1 -0
  45. package/esm/global/compression.d.ts +15 -0
  46. package/esm/global/compression.d.ts.map +1 -0
  47. package/esm/global/compression.js +4 -0
  48. package/esm/global/compression.js.map +1 -0
  49. package/esm/global/encoding.d.ts +25 -0
  50. package/esm/global/encoding.d.ts.map +1 -0
  51. package/esm/global/encoding.js +4 -0
  52. package/esm/global/encoding.js.map +1 -0
  53. package/esm/global/event.d.ts +191 -0
  54. package/esm/global/event.d.ts.map +1 -0
  55. package/esm/global/event.js +4 -0
  56. package/esm/global/event.js.map +1 -0
  57. package/esm/global/index.d.ts +7 -0
  58. package/esm/global/index.d.ts.map +1 -0
  59. package/esm/global/index.js +7 -0
  60. package/esm/global/index.js.map +1 -0
  61. package/esm/{types.d.ts → global/streams.d.ts} +136 -222
  62. package/esm/global/streams.d.ts.map +1 -0
  63. package/esm/{stream.js → global/streams.js} +16 -8
  64. package/esm/global/streams.js.map +1 -0
  65. package/esm/global/timer.d.ts +13 -0
  66. package/esm/global/timer.d.ts.map +1 -0
  67. package/esm/global/timer.js +4 -0
  68. package/esm/global/timer.js.map +1 -0
  69. package/esm/global/utils.d.ts +9 -0
  70. package/esm/global/utils.d.ts.map +1 -0
  71. package/esm/global/utils.js +5 -0
  72. package/esm/global/utils.js.map +1 -0
  73. package/esm/index.d.ts +2 -2
  74. package/esm/index.d.ts.map +1 -1
  75. package/esm/index.js +2 -2
  76. package/esm/index.js.map +1 -1
  77. package/esm/inspect.d.ts +6 -2
  78. package/esm/inspect.d.ts.map +1 -1
  79. package/esm/inspect.js +10 -4
  80. package/esm/inspect.js.map +1 -1
  81. package/esm/maybe-consumable/wrap-writable.d.ts +1 -1
  82. package/esm/maybe-consumable/wrap-writable.d.ts.map +1 -1
  83. package/esm/maybe-consumable/wrap-writable.js +1 -1
  84. package/esm/maybe-consumable/wrap-writable.js.map +1 -1
  85. package/esm/maybe-consumable/writable.d.ts +2 -2
  86. package/esm/maybe-consumable/writable.d.ts.map +1 -1
  87. package/esm/maybe-consumable/writable.js +1 -1
  88. package/esm/maybe-consumable/writable.js.map +1 -1
  89. package/esm/pipe-from.d.ts +3 -3
  90. package/esm/pipe-from.d.ts.map +1 -1
  91. package/esm/pipe-from.js +1 -1
  92. package/esm/pipe-from.js.map +1 -1
  93. package/esm/push-readable.d.ts +2 -2
  94. package/esm/push-readable.d.ts.map +1 -1
  95. package/esm/push-readable.js +1 -1
  96. package/esm/push-readable.js.map +1 -1
  97. package/esm/split-string.d.ts +6 -2
  98. package/esm/split-string.d.ts.map +1 -1
  99. package/esm/split-string.js +28 -7
  100. package/esm/split-string.js.map +1 -1
  101. package/esm/struct-deserialize.js.map +1 -1
  102. package/esm/struct-serialize.d.ts +1 -1
  103. package/esm/struct-serialize.d.ts.map +1 -1
  104. package/esm/struct-serialize.js +1 -1
  105. package/esm/struct-serialize.js.map +1 -1
  106. package/esm/try-close.d.ts +3 -5
  107. package/esm/try-close.d.ts.map +1 -1
  108. package/esm/try-close.js.map +1 -1
  109. package/esm/wrap-readable.d.ts +2 -2
  110. package/esm/wrap-readable.d.ts.map +1 -1
  111. package/esm/wrap-readable.js +1 -1
  112. package/esm/wrap-readable.js.map +1 -1
  113. package/esm/wrap-writable.d.ts +2 -2
  114. package/esm/wrap-writable.d.ts.map +1 -1
  115. package/esm/wrap-writable.js +1 -1
  116. package/esm/wrap-writable.js.map +1 -1
  117. package/package.json +10 -10
  118. package/src/buffered-transform.ts +24 -25
  119. package/src/buffered.ts +4 -1
  120. package/src/concat.ts +161 -118
  121. package/src/consumable/readable.ts +2 -2
  122. package/src/consumable/wrap-byte-readable.ts +20 -7
  123. package/src/consumable/wrap-writable.ts +1 -1
  124. package/src/consumable/writable.ts +2 -2
  125. package/src/consumable.ts +8 -0
  126. package/src/distribution.ts +1 -1
  127. package/src/duplex.ts +2 -2
  128. package/src/global/abort-signal.ts +129 -0
  129. package/src/global/compression.ts +28 -0
  130. package/src/global/encoding.ts +36 -0
  131. package/src/global/event.ts +220 -0
  132. package/src/global/index.ts +6 -0
  133. package/src/{types.ts → global/streams.ts} +266 -244
  134. package/src/global/timer.ts +18 -0
  135. package/src/global/utils.ts +14 -0
  136. package/src/index.ts +2 -2
  137. package/src/inspect.ts +18 -4
  138. package/src/maybe-consumable/wrap-writable.ts +1 -1
  139. package/src/maybe-consumable/writable.ts +3 -3
  140. package/src/pipe-from.ts +2 -2
  141. package/src/push-readable.ts +2 -2
  142. package/src/split-string.ts +41 -7
  143. package/src/struct-deserialize.ts +1 -1
  144. package/src/struct-serialize.ts +1 -1
  145. package/src/try-close.ts +0 -12
  146. package/src/wrap-readable.ts +2 -2
  147. package/src/wrap-writable.ts +5 -2
  148. package/tsconfig.build.json +1 -6
  149. package/CHANGELOG.md +0 -102
  150. package/esm/encoding.d.ts +0 -21
  151. package/esm/encoding.d.ts.map +0 -1
  152. package/esm/encoding.js +0 -4
  153. package/esm/encoding.js.map +0 -1
  154. package/esm/stream.d.ts +0 -25
  155. package/esm/stream.d.ts.map +0 -1
  156. package/esm/stream.js.map +0 -1
  157. package/esm/types.d.ts.map +0 -1
  158. package/esm/types.js +0 -3
  159. package/esm/types.js.map +0 -1
  160. package/src/encoding.ts +0 -39
  161. package/src/stream.ts +0 -106
  162. package/tsconfig.build.tsbuildinfo +0 -1
@@ -0,0 +1,28 @@
1
+ import type { TransformStream } from "./streams.js";
2
+ import { getGlobalValue } from "./utils.js";
3
+
4
+ export type CompressionStream = TransformStream<
5
+ ArrayBufferView | ArrayBufferLike,
6
+ Uint8Array<ArrayBuffer>
7
+ >;
8
+
9
+ interface CompressionStreamConstructor {
10
+ prototype: CompressionStream;
11
+ new (format: string): CompressionStream;
12
+ }
13
+
14
+ export const CompressionStream =
15
+ getGlobalValue<CompressionStreamConstructor>("CompressionStream");
16
+
17
+ export type DecompressionStream = TransformStream<
18
+ ArrayBufferView | ArrayBufferLike,
19
+ Uint8Array<ArrayBuffer>
20
+ >;
21
+
22
+ interface DecompressionStreamConstructor {
23
+ prototype: DecompressionStream;
24
+ new (): DecompressionStream;
25
+ }
26
+
27
+ export const DecompressionStream =
28
+ getGlobalValue<DecompressionStreamConstructor>("DecompressionStream");
@@ -0,0 +1,36 @@
1
+ import type { TransformStream } from "./streams.js";
2
+ import { getGlobalValue } from "./utils.js";
3
+
4
+ export interface TextDecoderOptions {
5
+ fatal?: boolean;
6
+ ignoreBOM?: boolean;
7
+ }
8
+
9
+ export interface TextDecoderStream extends TransformStream<
10
+ ArrayBufferView | ArrayBufferLike,
11
+ string
12
+ > {
13
+ readonly encoding: string;
14
+ readonly fatal: boolean;
15
+ readonly ignoreBOM: boolean;
16
+ }
17
+
18
+ interface TextDecoderStreamConstructor {
19
+ prototype: TextDecoderStream;
20
+ new (label?: string, options?: TextDecoderOptions): TextDecoderStream;
21
+ }
22
+
23
+ export const TextDecoderStream =
24
+ getGlobalValue<TextDecoderStreamConstructor>("TextDecoderStream");
25
+
26
+ export interface TextEncoderStream extends TransformStream<string, Uint8Array> {
27
+ readonly encoding: string;
28
+ }
29
+
30
+ interface TextEncoderStreamConstructor {
31
+ prototype: TextEncoderStream;
32
+ new (): TextEncoderStream;
33
+ }
34
+
35
+ export const TextEncoderStream =
36
+ getGlobalValue<TextEncoderStreamConstructor>("TextEncoderStream");
@@ -0,0 +1,220 @@
1
+ import type { AbortSignal } from "./abort-signal.js";
2
+ import type { GlobalPrototypeOr, GlobalValueOr } from "./utils.js";
3
+ import { getGlobalValue } from "./utils.js";
4
+
5
+ type DOMHighResTimeStamp = number;
6
+
7
+ /**
8
+ * The **`Event`** interface represents an event which takes place on an EventTarget.
9
+ *
10
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
11
+ */
12
+ interface _Event {
13
+ /**
14
+ * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.
15
+ *
16
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
17
+ */
18
+ readonly bubbles: boolean;
19
+ /**
20
+ * The **`cancelBubble`** property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details.
21
+ * @deprecated
22
+ *
23
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
24
+ */
25
+ cancelBubble: boolean;
26
+ /**
27
+ * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.
28
+ *
29
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
30
+ */
31
+ readonly cancelable: boolean;
32
+ /**
33
+ * The read-only **`composed`** property of the Event interface returns a boolean value which indicates whether or not the event will propagate across the shadow DOM boundary into the standard DOM.
34
+ *
35
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
36
+ */
37
+ readonly composed: boolean;
38
+ /**
39
+ * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.
40
+ *
41
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
42
+ */
43
+ readonly currentTarget: EventTarget | null;
44
+ /**
45
+ * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.
46
+ *
47
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
48
+ */
49
+ readonly defaultPrevented: boolean;
50
+ /**
51
+ * The **`eventPhase`** read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.
52
+ *
53
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
54
+ */
55
+ readonly eventPhase: number;
56
+ /**
57
+ * The **`isTrusted`** read-only property of the Event interface is a boolean value that is true when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and false when the event was dispatched via EventTarget.dispatchEvent(). The only exception is the click event, which initializes the isTrusted property to false in user agents.
58
+ *
59
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
60
+ */
61
+ readonly isTrusted: boolean;
62
+ /**
63
+ * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.
64
+ * @deprecated
65
+ *
66
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
67
+ */
68
+ returnValue: boolean;
69
+ /**
70
+ * The deprecated **`Event.srcElement`** is an alias for the Event.target property. Use Event.target instead.
71
+ * @deprecated
72
+ *
73
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
74
+ */
75
+ readonly srcElement: EventTarget | null;
76
+ /**
77
+ * The read-only **`target`** property of the Event interface is a reference to the object onto which the event was dispatched. It is different from Event.currentTarget when the event handler is called during the bubbling or capturing phase of the event.
78
+ *
79
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
80
+ */
81
+ readonly target: EventTarget | null;
82
+ /**
83
+ * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.
84
+ *
85
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
86
+ */
87
+ readonly timeStamp: DOMHighResTimeStamp;
88
+ /**
89
+ * The **`type`** read-only property of the Event interface returns a string containing the event's type. It is set when the event is constructed and is the name commonly used to refer to the specific event, such as click, load, or error.
90
+ *
91
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
92
+ */
93
+ readonly type: string;
94
+ /**
95
+ * The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked. This does not include nodes in shadow trees if the shadow root was created with its ShadowRoot.mode closed.
96
+ *
97
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
98
+ */
99
+ composedPath(): EventTarget[];
100
+ /**
101
+ * The **`Event.initEvent()`** method is used to initialize the value of an event created using Document.createEvent().
102
+ * @deprecated
103
+ *
104
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/initEvent)
105
+ */
106
+ initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
107
+ /**
108
+ * The **`preventDefault()`** method of the Event interface tells the user agent that the event is being explicitly handled, so its default action, such as page scrolling, link navigation, or pasting text, should not be taken.
109
+ *
110
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
111
+ */
112
+ preventDefault(): void;
113
+ /**
114
+ * The **`stopImmediatePropagation()`** method of the Event interface prevents other listeners of the same event from being called.
115
+ *
116
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
117
+ */
118
+ stopImmediatePropagation(): void;
119
+ /**
120
+ * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. It does not, however, prevent any default behaviors from occurring; for instance, clicks on links are still processed. If you want to stop those behaviors, see the preventDefault() method. It also does not prevent propagation to other event-handlers of the current element. If you want to stop those, see stopImmediatePropagation().
121
+ *
122
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
123
+ */
124
+ stopPropagation(): void;
125
+ readonly NONE: 0;
126
+ readonly CAPTURING_PHASE: 1;
127
+ readonly AT_TARGET: 2;
128
+ readonly BUBBLING_PHASE: 3;
129
+ }
130
+
131
+ export type Event = GlobalPrototypeOr<"Event", _Event>;
132
+
133
+ export interface EventInit {
134
+ bubbles?: boolean;
135
+ cancelable?: boolean;
136
+ composed?: boolean;
137
+ }
138
+
139
+ interface _EventConstructor {
140
+ prototype: Event;
141
+ new (type: string, eventInitDict?: EventInit): Event;
142
+ readonly NONE: 0;
143
+ readonly CAPTURING_PHASE: 1;
144
+ readonly AT_TARGET: 2;
145
+ readonly BUBBLING_PHASE: 3;
146
+ }
147
+
148
+ type EventConstructor = GlobalValueOr<"Event", _EventConstructor>;
149
+
150
+ export const Event = getGlobalValue<EventConstructor>("Event");
151
+
152
+ export interface EventListenerOptions {
153
+ capture?: boolean;
154
+ }
155
+
156
+ export interface AddEventListenerOptions extends EventListenerOptions {
157
+ once?: boolean;
158
+ passive?: boolean;
159
+ signal?: AbortSignal;
160
+ }
161
+
162
+ interface EventListener {
163
+ (evt: Event): void;
164
+ }
165
+
166
+ interface EventListenerObject {
167
+ handleEvent(object: Event): void;
168
+ }
169
+
170
+ export type EventListenerOrEventListenerObject =
171
+ EventListener | EventListenerObject;
172
+
173
+ /**
174
+ * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them. In other words, any target of events implements the three methods associated with this interface.
175
+ *
176
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
177
+ */
178
+ interface _EventTarget {
179
+ /**
180
+ * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
181
+ *
182
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
183
+ */
184
+ addEventListener(
185
+ type: string,
186
+ callback: EventListenerOrEventListenerObject | null,
187
+ options?: AddEventListenerOptions | boolean,
188
+ ): void;
189
+ /**
190
+ * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
191
+ *
192
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
193
+ */
194
+ dispatchEvent(event: Event): boolean;
195
+ /**
196
+ * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.
197
+ *
198
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
199
+ */
200
+ removeEventListener(
201
+ type: string,
202
+ callback: EventListenerOrEventListenerObject | null,
203
+ options?: EventListenerOptions | boolean,
204
+ ): void;
205
+ }
206
+
207
+ export type EventTarget = GlobalPrototypeOr<"EventTarget", _EventTarget>;
208
+
209
+ interface _EventTargetConstructor {
210
+ prototype: EventTarget;
211
+ new (): EventTarget;
212
+ }
213
+
214
+ type EventTargetConstructor = GlobalValueOr<
215
+ "EventTarget",
216
+ _EventTargetConstructor
217
+ >;
218
+
219
+ export const EventTarget =
220
+ getGlobalValue<EventTargetConstructor>("EventTarget");
@@ -0,0 +1,6 @@
1
+ export * from "./abort-signal.js";
2
+ export * from "./compression.js";
3
+ export * from "./encoding.js";
4
+ export * from "./event.js";
5
+ export * from "./streams.js";
6
+ export * from "./timer.js";