quickwin 2.3.1 → 3.0.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 (172) hide show
  1. package/README.en.md +1 -2
  2. package/README.md +1 -2
  3. package/constants.ts +15 -0
  4. package/enum_map.d.ts +3 -0
  5. package/examples/PdfCanvas.js +1 -1
  6. package/examples/PdfCanvas.tsx +2 -2
  7. package/examples/execd/main.js +334 -188
  8. package/examples/pdf_preview2.js +76 -67
  9. package/examples/pdf_preview2.ts +84 -64
  10. package/examples/pdf_viewer.js +4932 -1029
  11. package/examples/pdf_viewer.tsx +11 -22
  12. package/examples/test_gallery.js +308 -143
  13. package/examples/test_gallery.tsx +12 -7
  14. package/examples/test_react_lazy.js +295 -133
  15. package/examples/test_react_lazy.tsx +4 -3
  16. package/examples/test_react_listbox.js +293 -132
  17. package/examples/test_react_listbox.tsx +3 -2
  18. package/examples/test_root_window.js +283 -126
  19. package/examples/test_tab.js +295 -133
  20. package/examples/test_tab.tsx +4 -3
  21. package/examples/tray_demo.js +37 -30
  22. package/examples/tray_demo.tsx +39 -32
  23. package/lib/abort.d.ts +21 -0
  24. package/lib/assert.d.ts +2 -0
  25. package/lib/bitmap.d.ts +7 -0
  26. package/lib/bitmap.js +40 -0
  27. package/lib/cache-utils.d.ts +6 -0
  28. package/lib/certs.d.ts +1 -0
  29. package/lib/certs.js +31 -3
  30. package/lib/dpi.d.ts +9 -0
  31. package/lib/dpi.js +30 -0
  32. package/lib/dumpRects.d.ts +2 -0
  33. package/lib/dumpRects.js +14 -7
  34. package/lib/exec-log.d.ts +23 -0
  35. package/lib/fetch.d.ts +4 -0
  36. package/lib/ffi/bind.d.ts +70 -0
  37. package/lib/ffi/bind.js +5 -4
  38. package/lib/ffi/ctype.d.ts +117 -0
  39. package/lib/ffi/index.d.ts +2 -0
  40. package/lib/ffi/struct.d.ts +174 -0
  41. package/lib/http-common.d.ts +143 -0
  42. package/lib/http-server.d.ts +59 -0
  43. package/lib/polyfill.d.ts +22 -0
  44. package/lib/react-qw/components/Button.d.ts +9 -0
  45. package/lib/react-qw/components/CheckBox.d.ts +11 -0
  46. package/lib/react-qw/components/ComboBox.d.ts +11 -0
  47. package/lib/react-qw/components/DateTimePicker.d.ts +15 -0
  48. package/lib/react-qw/components/DateTimePicker.js +6 -7
  49. package/lib/react-qw/components/Input.d.ts +15 -0
  50. package/lib/react-qw/components/Input.js +5 -1
  51. package/lib/react-qw/components/Link.d.ts +12 -0
  52. package/lib/react-qw/components/ListBox.d.ts +13 -0
  53. package/lib/react-qw/components/ListView.d.ts +37 -0
  54. package/lib/react-qw/components/ListView.js +8 -6
  55. package/lib/react-qw/components/PathPicker.d.ts +23 -0
  56. package/lib/react-qw/components/ProgressBar.d.ts +9 -0
  57. package/lib/react-qw/components/RadioButton.d.ts +11 -0
  58. package/lib/react-qw/components/ScrollView.d.ts +9 -0
  59. package/lib/react-qw/components/ScrollView.js +28 -22
  60. package/lib/react-qw/components/Slider.d.ts +12 -0
  61. package/lib/react-qw/components/Tab.d.ts +14 -0
  62. package/lib/react-qw/components/Tooltip.d.ts +7 -0
  63. package/lib/react-qw/components/TreeView.d.ts +18 -0
  64. package/lib/react-qw/components/index.d.ts +16 -0
  65. package/lib/react-qw/index.d.ts +24 -0
  66. package/lib/react-qw/index.js +7 -5
  67. package/lib/react-qw/layout.d.ts +29 -0
  68. package/lib/react-qw/nmhdr.d.ts +1 -0
  69. package/lib/react-qw/props.d.ts +2 -0
  70. package/lib/react-qw/props.js +3 -3
  71. package/lib/react-qw/reconciler.d.ts +21 -0
  72. package/lib/react-qw/reconciler.js +12 -17
  73. package/lib/stream.d.ts +20 -0
  74. package/lib/text-codec.d.ts +39 -0
  75. package/lib/text-measure.d.ts +14 -0
  76. package/lib/text-measure.js +9 -6
  77. package/lib/url.d.ts +54 -0
  78. package/lib/websocket.d.ts +73 -0
  79. package/lib/windows/{advapi32.ts → advapi32.d.ts} +6 -21
  80. package/lib/windows/comctl32.d.ts +14 -0
  81. package/lib/windows/comctl32.js +3 -2
  82. package/lib/windows/comdlg32.d.ts +4 -0
  83. package/lib/windows/{gdi32.ts → gdi32.d.ts} +184 -97
  84. package/lib/windows/gdi32.js +28 -6
  85. package/lib/windows/{kernel32.ts → kernel32.d.ts} +145 -113
  86. package/lib/windows/kernel32.js +9 -0
  87. package/lib/windows/{msimg32.ts → msimg32.d.ts} +11 -14
  88. package/lib/windows/ntdll.d.ts +5 -0
  89. package/lib/windows/ole32.d.ts +3 -0
  90. package/lib/windows/{psapi.ts → psapi.d.ts} +9 -18
  91. package/lib/windows/shell32.d.ts +51 -0
  92. package/lib/windows/shell32.js +11 -2
  93. package/lib/windows/structs.d.ts +3141 -0
  94. package/lib/windows/structs.js +51 -0
  95. package/lib/windows/user32.d.ts +623 -0
  96. package/lib/windows/user32.js +6 -5
  97. package/lib/windows/version.d.ts +27 -0
  98. package/lib/windows/{winspool.ts → winspool.d.ts} +18 -32
  99. package/main.js +13 -5
  100. package/package.json +16 -7
  101. package/quickwin.d.ts +13 -115
  102. package/qwin-nowasm-x86.exe +0 -0
  103. package/qwin-nowasm.exe +0 -0
  104. package/qwin-x86.exe +0 -0
  105. package/qwin.exe +0 -0
  106. package/test/bench_ffi_callraw.js +3 -4
  107. package/test/bench_ffi_callraw.ts +3 -4
  108. package/test/debug/mupdf_debug.js +4 -22
  109. package/test/debug/wasm_export_debug.js +2 -12
  110. package/test/debug/wasm_names.js +3 -13
  111. package/test/example.pdf +0 -0
  112. package/test/mupdf-cdn.js +40 -0
  113. package/test/mupdf-cdn.ts +43 -0
  114. package/test/test_ffi.js +8 -9
  115. package/test/test_ffi.ts +8 -9
  116. package/test/test_ffi_abi.js +6 -6
  117. package/test/test_ffi_abi.ts +8 -8
  118. package/test/test_ffi_windows.js +82 -11
  119. package/test/test_ffi_windows.ts +85 -11
  120. package/test/test_gdi_draw.js +3 -3
  121. package/test/test_gdi_draw.ts +4 -4
  122. package/test/test_mupdf_render.js +4 -22
  123. package/test/test_mupdf_render.ts +4 -23
  124. package/test/test_mupdf_twice.js +4 -19
  125. package/test/test_mupdf_twice.ts +4 -20
  126. package/test/test_mupdf_wasm.js +10 -4
  127. package/test/test_mupdf_wasm.ts +6 -4
  128. package/test/test_react_complex.js +316 -140
  129. package/test/test_react_counter.js +295 -133
  130. package/test/test_react_flex.js +297 -138
  131. package/test/test_react_hidden.js +296 -134
  132. package/test/test_react_listview_link.js +288 -131
  133. package/test/test_react_notify.js +290 -133
  134. package/test/test_react_render.js +295 -133
  135. package/lib/abort.ts +0 -69
  136. package/lib/assert.ts +0 -7
  137. package/lib/cache-utils.ts +0 -40
  138. package/lib/certs.ts +0 -229
  139. package/lib/dumpRects.ts +0 -26
  140. package/lib/exec-log.ts +0 -30
  141. package/lib/fetch.ts +0 -589
  142. package/lib/ffi/bind.ts +0 -539
  143. package/lib/ffi/ctype.ts +0 -371
  144. package/lib/ffi/index.ts +0 -6
  145. package/lib/ffi/struct.ts +0 -780
  146. package/lib/http-common.ts +0 -441
  147. package/lib/http-server.ts +0 -604
  148. package/lib/polyfill.ts +0 -171
  149. package/lib/react-qw/components/index.ts +0 -17
  150. package/lib/react-qw/index.ts +0 -96
  151. package/lib/react-qw/layout.ts +0 -111
  152. package/lib/react-qw/nmhdr.ts +0 -7
  153. package/lib/react-qw/props.ts +0 -41
  154. package/lib/react-qw/reconciler.ts +0 -383
  155. package/lib/stream.ts +0 -22
  156. package/lib/text-codec.ts +0 -171
  157. package/lib/text-measure.ts +0 -41
  158. package/lib/url.ts +0 -201
  159. package/lib/websocket.ts +0 -600
  160. package/lib/windows/comctl32.ts +0 -19
  161. package/lib/windows/comdlg32.ts +0 -10
  162. package/lib/windows/ntdll.ts +0 -11
  163. package/lib/windows/ole32.ts +0 -9
  164. package/lib/windows/shell32.ts +0 -39
  165. package/lib/windows/structs.ts +0 -752
  166. package/lib/windows/user32.ts +0 -619
  167. package/lib/windows/version.ts +0 -35
  168. package/vendor/mupdf-wasm/mupdf-wasm.d.ts +0 -571
  169. package/vendor/mupdf-wasm/mupdf-wasm.js +0 -2749
  170. package/vendor/mupdf-wasm/mupdf-wasm.wasm +0 -0
  171. package/vendor/mupdf-wasm/mupdf.d.ts +0 -939
  172. package/vendor/mupdf-wasm/mupdf.js +0 -3317
@@ -1,441 +0,0 @@
1
- import './polyfill.js'
2
- import './stream.js'
3
-
4
- // ── Byte helpers ──
5
-
6
- export function _concat(parts: Uint8Array[]): Uint8Array<ArrayBuffer> {
7
- if (parts.length === 0) return new Uint8Array(0)
8
- let totalLen = 0
9
- for (const p of parts) totalLen += p.length
10
- const result = new Uint8Array(totalLen)
11
- let offset = 0
12
- for (const p of parts) { result.set(p, offset); offset += p.length }
13
- return result
14
- }
15
-
16
- export function _toReadableStream(body: BodyInit): ReadableStream<Uint8Array> {
17
- if (body instanceof ReadableStream) return body
18
- const bytes = (typeof body === 'string')
19
- ? new TextEncoder().encode(body)
20
- : (body instanceof ArrayBuffer)
21
- ? new Uint8Array(body)
22
- : new Uint8Array(body.buffer, body.byteOffset, body.byteLength)
23
- return new ReadableStream<Uint8Array>({
24
- start(ctrl) {
25
- ctrl.enqueue(bytes)
26
- ctrl.close()
27
- }
28
- })
29
- }
30
-
31
- export async function _readStream(stream: ReadableStream<Uint8Array>): Promise<Uint8Array<ArrayBuffer>> {
32
- const reader = stream.getReader()
33
- const chunks: Uint8Array[] = []
34
- while (true) {
35
- const { done, value } = await reader.read()
36
- if (done) break
37
- chunks.push(value)
38
- }
39
- return _concat(chunks)
40
- }
41
-
42
- export function _hasChunkedEnd(data: Uint8Array): boolean {
43
- if (data.length < 7) return false
44
- let i = data.length - 7
45
- return data[i] === 0x0D && data[i+1] === 0x0A && data[i+2] === 0x30 && data[i+3] === 0x0D && data[i+4] === 0x0A && data[i+5] === 0x0D && data[i+6] === 0x0A
46
- }
47
-
48
- export function decodeChunked(data: Uint8Array): Uint8Array {
49
- const chunks: Uint8Array[] = []
50
- let pos = 0
51
- while (pos < data.length) {
52
- let crlf = -1
53
- for (let i = pos; i < data.length - 1; i++) {
54
- if (data[i] === 0x0D && data[i + 1] === 0x0A) { crlf = i; break }
55
- }
56
- if (crlf < 0) break
57
-
58
- let size = 0
59
- for (let i = pos; i < crlf; i++) {
60
- const b = data[i]!
61
- if (b >= 0x30 && b <= 0x39) size = size * 16 + (b - 0x30)
62
- else if (b >= 0x41 && b <= 0x46) size = size * 16 + (b - 0x37)
63
- else if (b >= 0x61 && b <= 0x66) size = size * 16 + (b - 0x57)
64
- else break
65
- }
66
-
67
- const dataStart = crlf + 2
68
- if (size === 0) {
69
- for (let i = dataStart; i < data.length - 3; i++) {
70
- if (data[i] === 0x0D && data[i+1] === 0x0A && data[i+2] === 0x0D && data[i+3] === 0x0A) {
71
- pos = i + 4; break
72
- }
73
- }
74
- if (pos === dataStart) break
75
- break
76
- }
77
-
78
- if (dataStart + size > data.length) break
79
- chunks.push(data.subarray(dataStart, dataStart + size))
80
- pos = dataStart + size + 2
81
- }
82
- return _concat(chunks)
83
- }
84
-
85
- // ── Headers ──
86
-
87
- // Flat array storage: [name0, value0, name1, value1, ...]
88
- // Pairs at even/odd indices. Strings are immutable, so [...this._headers] is a correct deep copy.
89
-
90
- export class HeadersImpl {
91
- private _headers: string[] = []
92
-
93
- constructor(init?: HeadersInit) {
94
- if (init) {
95
- if (init instanceof HeadersImpl) {
96
- this._headers = [...init._headers]
97
- } else if (Array.isArray(init)) {
98
- this._headers = init.flatMap(([k, v]) => [k.toLowerCase(), v])
99
- } else if (typeof init === 'object') {
100
- this._headers = Object.entries(init).flatMap(([k, v]) => [k.toLowerCase(), v])
101
- }
102
- }
103
- }
104
-
105
- append(name: string, value: string): void {
106
- this._headers.push(name.toLowerCase(), value)
107
- }
108
-
109
- delete(name: string): void {
110
- const key = name.toLowerCase()
111
- const h = this._headers
112
- let i = h.length - 2
113
- while (i >= 0) {
114
- if (h[i] === key) { h.splice(i, 2); i -= 2 } else i -= 2
115
- }
116
- }
117
-
118
- get(name: string): string | null {
119
- const key = name.toLowerCase()
120
- const matches = [...this.entries()].filter(([k]) => k === key).map(([, v]) => v)
121
- return matches.length ? matches.join(', ') : null
122
- }
123
-
124
- has(name: string): boolean {
125
- return [...this.keys()].includes(name.toLowerCase())
126
- }
127
-
128
- set(name: string, value: string): void {
129
- const key = name.toLowerCase()
130
- const h = this._headers
131
- let found = false
132
- let i = h.length - 2
133
- while (i >= 0) {
134
- if (h[i] === key) {
135
- if (!found) {
136
- h[i + 1] = value
137
- found = true
138
- } else {
139
- h.splice(i, 2)
140
- }
141
- }
142
- i -= 2
143
- }
144
- if (!found) h.push(key, value)
145
- }
146
-
147
- forEach(callback: (value: string, name: string, headers: HeadersImpl) => void): void {
148
- for (const [name, value] of this) {
149
- callback(value, name, this)
150
- }
151
- }
152
-
153
- *entries(): IterableIterator<[string, string]> {
154
- const h = this._headers
155
- for (let i = 0; i < h.length; i += 2) {
156
- yield [h[i]!, h[i + 1]!]
157
- }
158
- }
159
-
160
- *keys(): IterableIterator<string> {
161
- for (const [k] of this) yield k
162
- }
163
-
164
- *values(): IterableIterator<string> {
165
- for (const [, v] of this) yield v
166
- }
167
-
168
- [Symbol.iterator](): IterableIterator<[string, string]> {
169
- return this.entries()
170
- }
171
- }
172
-
173
- // ── Request ──
174
-
175
- export class RequestImpl {
176
- readonly url: string
177
- readonly method: string
178
- readonly headers: HeadersImpl
179
- private _body: ReadableStream<Uint8Array> | null
180
- readonly redirect: RequestRedirect
181
- readonly timeout: number
182
- readonly maxRedirects: number
183
- private _bodyConsumed: boolean = false
184
- readonly integrity: string = ''
185
- readonly keepalive: boolean = false
186
- readonly mode: string = 'cors'
187
- readonly cache: string = 'default'
188
- readonly credentials: string = 'same-origin'
189
- readonly referrer: string = 'about:client'
190
- readonly referrerPolicy: string = ''
191
- readonly signal: AbortSignal | null
192
- readonly rejectUnauthorized: boolean
193
- readonly destination: string = ''
194
-
195
- get body(): ReadableStream<Uint8Array> | null { return this._body }
196
-
197
- get bodyUsed(): boolean {
198
- return this._bodyConsumed || (this._body?.locked ?? false)
199
- }
200
-
201
- constructor(input: string | RequestImpl, init: RequestInit = {}) {
202
- const initBody = init.body
203
- if (input instanceof RequestImpl) {
204
- this.url = input.url
205
- this.method = init.method || input.method
206
- this.headers = new HeadersImpl(init.headers || input.headers)
207
- if (initBody !== undefined && initBody !== null) {
208
- this._body = _toReadableStream(initBody)
209
- } else {
210
- this._body = input._body
211
- }
212
- this.redirect = init.redirect || input.redirect
213
- this.timeout = init.timeout || input.timeout
214
- this.maxRedirects = init.maxRedirects || input.maxRedirects
215
- this.rejectUnauthorized = init.rejectUnauthorized === undefined
216
- ? input.rejectUnauthorized
217
- : init.rejectUnauthorized
218
- } else {
219
- this.url = input
220
- this.method = init.method || 'GET'
221
- this.headers = new HeadersImpl(init.headers)
222
- this._body = initBody !== null && initBody !== undefined ? _toReadableStream(initBody) : null
223
- this.redirect = init.redirect || 'follow'
224
- this.timeout = init.timeout || 30000
225
- this.maxRedirects = init.maxRedirects || 5
226
- this.rejectUnauthorized = init.rejectUnauthorized ?? true
227
- }
228
- this.signal = init.signal !== undefined
229
- ? init.signal
230
- : (input instanceof RequestImpl ? input.signal : null)
231
- }
232
-
233
- async arrayBuffer(): Promise<ArrayBuffer> {
234
- if (!this.body) return new ArrayBuffer(0)
235
- if (this._bodyConsumed) throw new TypeError('Body already used')
236
- this._bodyConsumed = true
237
- const bytes = await _readStream(this.body)
238
- return bytes.buffer
239
- }
240
-
241
- async json<T = unknown>(): Promise<T> {
242
- return JSON.parse(await this.text())
243
- }
244
-
245
- async text(): Promise<string> {
246
- if (!this.body) return ''
247
- if (this._bodyConsumed) throw new TypeError('Body already used')
248
- this._bodyConsumed = true
249
- const bytes = await _readStream(this.body)
250
- return new TextDecoder('utf-8').decode(bytes)
251
- }
252
-
253
- clone(): RequestImpl {
254
- if (this.bodyUsed) throw new TypeError('Body already used')
255
- if (this._body) {
256
- const [branch1, branch2] = this._body.tee()
257
- this._body = branch1
258
- const req = new RequestImpl(this.url, {
259
- method: this.method,
260
- headers: this.headers,
261
- body: branch2,
262
- redirect: this.redirect,
263
- timeout: this.timeout,
264
- maxRedirects: this.maxRedirects,
265
- signal: this.signal,
266
- })
267
- return req
268
- }
269
- return new RequestImpl(this.url, {
270
- method: this.method,
271
- headers: this.headers,
272
- redirect: this.redirect,
273
- timeout: this.timeout,
274
- maxRedirects: this.maxRedirects,
275
- signal: this.signal,
276
- })
277
- }
278
- }
279
-
280
- // ── Response ──
281
-
282
- export class ResponseImpl {
283
- readonly status: number
284
- readonly statusText: string
285
- readonly ok: boolean
286
-
287
- private _headers: HeadersImpl
288
- _redirected: boolean = false
289
- private _type: ResponseType = 'basic'
290
- _url: string = ''
291
- private _body: ReadableStream<Uint8Array>
292
- private _bodyConsumed: boolean = false
293
- private _trailers: Promise<HeadersInit> | undefined
294
-
295
- get body(): ReadableStream<Uint8Array> { return this._body }
296
- get bodyUsed(): boolean { return this._bodyConsumed || this._body.locked }
297
- /** Trailing headers to emit after a chunked body (Promise resolves to
298
- * a HeadersInit), when a `Trailer` declaration header is present. */
299
- get trailers(): Promise<HeadersInit> | undefined { return this._trailers }
300
- get headers(): HeadersImpl { return this._headers }
301
- get redirected(): boolean { return this._redirected }
302
- get type(): ResponseType { return this._type }
303
- get url(): string { return this._url }
304
-
305
- constructor(body?: BodyInit | null, init?: ResponseInit) {
306
- const status = init?.status ?? 200
307
- const statusText = init?.statusText ?? ''
308
- const headers = new HeadersImpl(init?.headers)
309
- this.status = status
310
- this.statusText = statusText
311
- this._headers = headers
312
- this._trailers = init?.trailers
313
- this.ok = status >= 200 && status < 300
314
- if (body instanceof ReadableStream) {
315
- this._body = body
316
- } else {
317
- let bytes: Uint8Array
318
- if (body == null) {
319
- bytes = new Uint8Array(0)
320
- } else if (typeof body === 'string') {
321
- bytes = new TextEncoder().encode(body)
322
- } else if (body instanceof ArrayBuffer) {
323
- bytes = new Uint8Array(body)
324
- } else {
325
- bytes = new Uint8Array(body.buffer, body.byteOffset, body.byteLength)
326
- }
327
- if (!headers.has('content-length')) headers.set('Content-Length', String(bytes.byteLength))
328
- this._body = new ReadableStream<Uint8Array>({
329
- start(ctrl) {
330
- ctrl.enqueue(bytes)
331
- ctrl.close()
332
- }
333
- })
334
- }
335
- }
336
-
337
- async text(): Promise<string> {
338
- if (this.bodyUsed) throw new TypeError('Body already used')
339
- this._bodyConsumed = true
340
- const bytes = await _readStream(this._body)
341
- return new TextDecoder('utf-8').decode(bytes)
342
- }
343
-
344
- async json<T = unknown>(): Promise<T> {
345
- return JSON.parse(await this.text())
346
- }
347
-
348
- async arrayBuffer(): Promise<ArrayBuffer> {
349
- if (this.bodyUsed) throw new TypeError('Body already used')
350
- this._bodyConsumed = true
351
- const bytes = await _readStream(this._body)
352
- return bytes.buffer
353
- }
354
-
355
- async bytes(): Promise<Uint8Array> {
356
- if (this.bodyUsed) throw new TypeError('Body already used')
357
- this._bodyConsumed = true
358
- return await _readStream(this._body)
359
- }
360
-
361
- clone(): Response {
362
- if (this.bodyUsed) throw new TypeError('Body already used')
363
- const [branch1, branch2] = this._body.tee()
364
- this._body = branch1
365
- return new ResponseImpl(branch2, { status: this.status, statusText: this.statusText, headers: this._headers, trailers: this._trailers })
366
- }
367
-
368
- _applyDecompressedBody(stream: ReadableStream<Uint8Array>, _body: ArrayBuffer, newHeaders: HeadersImpl): void {
369
- this._bodyConsumed = false
370
- this._body = stream
371
- this._headers = newHeaders
372
- }
373
- }
374
-
375
- // ── Global declarations ──
376
-
377
- declare global {
378
- type HeadersInit = [string, string][] | Record<string, string> | Headers
379
- type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView
380
- type RequestRedirect = 'error' | 'follow' | 'manual'
381
- type RequestCache = 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload'
382
- type RequestCredentials = 'include' | 'omit' | 'same-origin'
383
- type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
384
- type ResponseType = 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect'
385
-
386
- interface AbortSignal {
387
- readonly aborted: boolean;
388
- readonly reason: unknown;
389
- onabort: ((event: { type: 'abort'; target: unknown }) => void) | null;
390
- addEventListener(type: 'abort', listener: (e: { type: 'abort'; target: unknown }) => void): void;
391
- removeEventListener(type: 'abort', listener: (e: { type: 'abort'; target: unknown }) => void): void;
392
- throwIfAborted(): void;
393
- }
394
-
395
- interface RequestInit {
396
- body?: BodyInit | null;
397
- cache?: RequestCache;
398
- credentials?: RequestCredentials;
399
- headers?: HeadersInit;
400
- integrity?: string;
401
- keepalive?: boolean;
402
- method?: string;
403
- mode?: RequestMode;
404
- redirect?: RequestRedirect;
405
- referrer?: string;
406
- referrerPolicy?: string;
407
- signal?: AbortSignal | null;
408
- window?: null;
409
- timeout?: number;
410
- maxRedirects?: number;
411
- /** Non-standard: when false, TLS certificate verification is skipped
412
- * (mirrors Node's https.request rejectUnauthorized option). */
413
- rejectUnauthorized?: boolean;
414
- }
415
-
416
- interface ResponseInit {
417
- status?: number;
418
- statusText?: string;
419
- headers?: HeadersInit;
420
- /** Non-standard: trailing headers, resolved after the body streams.
421
- * http-server emits them (Node addTrailers semantics) when a `Trailer`
422
- * declaration header is present and the body is chunk-framed. */
423
- trailers?: Promise<HeadersInit>;
424
- }
425
-
426
- interface Headers extends HeadersImpl {}
427
- var Headers: typeof HeadersImpl
428
- interface Response extends Omit<ResponseImpl, '_url' | '_redirected' | '_applyDecompressedBody'> {}
429
- interface ResponseConstructor {
430
- new(body?: BodyInit | null, init?: ResponseInit): Response
431
- }
432
- var Response: ResponseConstructor
433
- interface Request extends RequestImpl {}
434
- var Request: typeof RequestImpl
435
- }
436
-
437
- // ── Register globals ──
438
-
439
- globalThis.Headers = HeadersImpl
440
- globalThis.Request = RequestImpl
441
- globalThis.Response = ResponseImpl