@ccheever/exact-ibex-runtime 0.1.0
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/package.json +63 -0
- package/src/abort/AbortController.ts +23 -0
- package/src/abort/AbortSignal.ts +152 -0
- package/src/abort/index.ts +2 -0
- package/src/accessibility.ts +12 -0
- package/src/arraybuffer-detach.ts +109 -0
- package/src/base64/base64.ts +168 -0
- package/src/base64/index.ts +1 -0
- package/src/blob/Blob.ts +259 -0
- package/src/blob/File.ts +59 -0
- package/src/blob/FormData.ts +323 -0
- package/src/blob/index.ts +3 -0
- package/src/bootstrap.ts +1946 -0
- package/src/broadcast/BroadcastChannel.ts +280 -0
- package/src/broadcast/index.ts +5 -0
- package/src/cache/Cache.ts +349 -0
- package/src/cache/CacheStorage.ts +89 -0
- package/src/cache/index.ts +27 -0
- package/src/camera/index.ts +6202 -0
- package/src/camera/processor.worker.ts +194 -0
- package/src/camera/scene.ts +195 -0
- package/src/clipboard/Clipboard.ts +129 -0
- package/src/clipboard/ClipboardItem.ts +97 -0
- package/src/clipboard/index.ts +6 -0
- package/src/clone/index.ts +1 -0
- package/src/clone/structuredClone.ts +389 -0
- package/src/clone/transferableSymbols.ts +2 -0
- package/src/compression/CompressionStream.ts +146 -0
- package/src/compression/DecompressionStream.ts +342 -0
- package/src/compression/index.ts +4 -0
- package/src/console/Console.ts +341 -0
- package/src/console/index.ts +2 -0
- package/src/core/accessibility-state.ts +263 -0
- package/src/core/accessibility.ts +184 -0
- package/src/core/agent-state.ts +37 -0
- package/src/core/diagnostics-logs.ts +144 -0
- package/src/core/host-call-bridge.ts +16 -0
- package/src/core/i18n-helpers.ts +189 -0
- package/src/core/locale-state.ts +253 -0
- package/src/core/locale.ts +95 -0
- package/src/crypto/Crypto.ts +2743 -0
- package/src/crypto/index.ts +1 -0
- package/src/diagnostics/logs.ts +7 -0
- package/src/encoding/TextDecoder.ts +1181 -0
- package/src/encoding/TextDecoderStream.ts +58 -0
- package/src/encoding/TextEncoder.ts +180 -0
- package/src/encoding/TextEncoderStream.ts +39 -0
- package/src/encoding/index.ts +8 -0
- package/src/events/CloseEvent.ts +91 -0
- package/src/events/DOMException.ts +409 -0
- package/src/events/ErrorEvent.ts +39 -0
- package/src/events/Event.ts +151 -0
- package/src/events/EventTarget.ts +280 -0
- package/src/events/FocusEvent.ts +27 -0
- package/src/events/KeyboardEvent.ts +46 -0
- package/src/events/MessageEvent.ts +61 -0
- package/src/events/ProgressEvent.ts +33 -0
- package/src/events/PromiseRejectionEvent.ts +31 -0
- package/src/events/index.ts +52 -0
- package/src/eventsource/EventSource.ts +371 -0
- package/src/eventsource/index.ts +2 -0
- package/src/fetch/Headers.ts +642 -0
- package/src/fetch/Request.ts +760 -0
- package/src/fetch/Response.ts +543 -0
- package/src/fetch/body.ts +1256 -0
- package/src/fetch/cookie-jar.ts +566 -0
- package/src/fetch/demo.ts +207 -0
- package/src/fetch/errors.ts +101 -0
- package/src/fetch/fetch.ts +2610 -0
- package/src/fetch/index.ts +101 -0
- package/src/fetch/native-bridge.ts +65 -0
- package/src/fetch/types.ts +258 -0
- package/src/filereader/FileReader.ts +236 -0
- package/src/filereader/index.ts +1 -0
- package/src/fs/Dirent.ts +39 -0
- package/src/fs/ExactFile.ts +450 -0
- package/src/fs/Stats.ts +80 -0
- package/src/fs/index.ts +944 -0
- package/src/fs/promises.ts +386 -0
- package/src/fs/shared.ts +328 -0
- package/src/http-server/index.js +697 -0
- package/src/http-server/index.ts +27 -0
- package/src/identity.generated.ts +14 -0
- package/src/index.ts +283 -0
- package/src/indexeddb/IDBCursor.ts +188 -0
- package/src/indexeddb/IDBDatabase.ts +343 -0
- package/src/indexeddb/IDBFactory.ts +269 -0
- package/src/indexeddb/IDBIndex.ts +194 -0
- package/src/indexeddb/IDBKeyRange.ts +109 -0
- package/src/indexeddb/IDBObjectStore.ts +468 -0
- package/src/indexeddb/IDBRequest.ts +163 -0
- package/src/indexeddb/IDBTransaction.ts +207 -0
- package/src/indexeddb/index.ts +34 -0
- package/src/indexeddb/utils.ts +52 -0
- package/src/inspect/index.ts +1 -0
- package/src/inspect/inspect.ts +465 -0
- package/src/internal/detect.ts +104 -0
- package/src/locale.ts +10 -0
- package/src/location/index.ts +1059 -0
- package/src/locks/LockManager.ts +460 -0
- package/src/locks/index.ts +12 -0
- package/src/media/VideoFrame.ts +58 -0
- package/src/messaging/MessageChannel.ts +31 -0
- package/src/messaging/MessagePort.ts +180 -0
- package/src/messaging/index.ts +2 -0
- package/src/messaging.ts +247 -0
- package/src/native/NativeModules.ts +354 -0
- package/src/native/index.ts +1 -0
- package/src/navigator/Navigator.ts +351 -0
- package/src/navigator/index.ts +1 -0
- package/src/node/Buffer.ts +1786 -0
- package/src/node/index.ts +4 -0
- package/src/node/path.ts +495 -0
- package/src/node/process.ts +2528 -0
- package/src/performance/Performance.ts +532 -0
- package/src/performance/index.ts +21 -0
- package/src/polyfills/array.ts +236 -0
- package/src/polyfills/arraybuffer.ts +172 -0
- package/src/polyfills/groupby.ts +85 -0
- package/src/polyfills/index.ts +85 -0
- package/src/polyfills/intl.ts +1956 -0
- package/src/polyfills/iterator.ts +479 -0
- package/src/polyfills/promise.ts +37 -0
- package/src/polyfills/set.ts +245 -0
- package/src/polyfills/string.ts +85 -0
- package/src/polyfills/typedarray.ts +110 -0
- package/src/promise-rejection-tracking.ts +464 -0
- package/src/react-native/index.ts +388 -0
- package/src/runtime-entry.ts +55 -0
- package/src/scheduling/AnimationFrame.ts +105 -0
- package/src/scheduling/IdleCallback.ts +167 -0
- package/src/scheduling/index.ts +13 -0
- package/src/security/Capabilities.ts +1146 -0
- package/src/security/Permissions.ts +392 -0
- package/src/security/capability-bits.generated.ts +63 -0
- package/src/security/index.ts +16 -0
- package/src/sqlite/Database.ts +456 -0
- package/src/sqlite/Statement.ts +206 -0
- package/src/sqlite/constants.ts +79 -0
- package/src/sqlite/errors.ts +25 -0
- package/src/sqlite/index.ts +34 -0
- package/src/sqlite/module.js +438 -0
- package/src/storage/Storage.ts +291 -0
- package/src/storage/StorageManager.ts +91 -0
- package/src/storage/index.ts +3 -0
- package/src/stream-compat.ts +47 -0
- package/src/streams/ReadableStream.ts +4131 -0
- package/src/streams/TransformStream.ts +375 -0
- package/src/streams/WritableStream.ts +866 -0
- package/src/streams/index.ts +41 -0
- package/src/timers/Timers.ts +296 -0
- package/src/timers/index.ts +11 -0
- package/src/url/URL.ts +656 -0
- package/src/url/URLPattern.ts +850 -0
- package/src/url/URLSearchParams.ts +244 -0
- package/src/url/index.ts +9 -0
- package/src/websocket/WebSocket.ts +770 -0
- package/src/websocket/WebSocketError.ts +52 -0
- package/src/websocket/WebSocketStream.ts +628 -0
- package/src/websocket/index.ts +7 -0
- package/src/window/index.ts +872 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URLSearchParams - WHATWG URL Standard Implementation
|
|
3
|
+
*
|
|
4
|
+
* @see https://url.spec.whatwg.org/#urlsearchparams
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { URL } from "./URL";
|
|
8
|
+
|
|
9
|
+
export class URLSearchParams {
|
|
10
|
+
private _params: Array<[string, string]> = [];
|
|
11
|
+
private _url: URL | null = null;
|
|
12
|
+
|
|
13
|
+
constructor(
|
|
14
|
+
init?:
|
|
15
|
+
| string
|
|
16
|
+
| URLSearchParams
|
|
17
|
+
| Record<string, string>
|
|
18
|
+
| Iterable<[string, string]>
|
|
19
|
+
) {
|
|
20
|
+
if (init === undefined || init === null) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (typeof init === "string") {
|
|
25
|
+
this._parseString(init);
|
|
26
|
+
} else if (init instanceof URLSearchParams) {
|
|
27
|
+
this._params = [...init._params];
|
|
28
|
+
} else if (typeof init === "object") {
|
|
29
|
+
if (Symbol.iterator in init) {
|
|
30
|
+
// Iterable of [key, value] pairs
|
|
31
|
+
const entries = Array.from(init as Iterable<[string, string]>);
|
|
32
|
+
for (let i = 0; i < entries.length; i++) {
|
|
33
|
+
const [key, value] = entries[i];
|
|
34
|
+
this._params.push([String(key), String(value)]);
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
// Plain object
|
|
38
|
+
const keys = Object.keys(init as Record<string, string>);
|
|
39
|
+
for (let i = 0; i < keys.length; i++) {
|
|
40
|
+
const key = keys[i];
|
|
41
|
+
this._params.push([key, String((init as Record<string, string>)[key])]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private _parseString(input: string): void {
|
|
48
|
+
// Remove leading ?
|
|
49
|
+
let str = input;
|
|
50
|
+
if (str.startsWith("?")) {
|
|
51
|
+
str = str.slice(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!str) return;
|
|
55
|
+
|
|
56
|
+
// Split by &
|
|
57
|
+
const pairs = str.split("&");
|
|
58
|
+
for (const pair of pairs) {
|
|
59
|
+
if (!pair) continue;
|
|
60
|
+
|
|
61
|
+
const eqIndex = pair.indexOf("=");
|
|
62
|
+
if (eqIndex === -1) {
|
|
63
|
+
this._params.push([this._decode(pair), ""]);
|
|
64
|
+
} else {
|
|
65
|
+
const key = this._decode(pair.slice(0, eqIndex));
|
|
66
|
+
const value = this._decode(pair.slice(eqIndex + 1));
|
|
67
|
+
this._params.push([key, value]);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private _decode(str: string): string {
|
|
73
|
+
try {
|
|
74
|
+
return decodeURIComponent(str.replace(/\+/g, " "));
|
|
75
|
+
} catch {
|
|
76
|
+
return str;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private _encode(str: string): string {
|
|
81
|
+
return encodeURIComponent(str).replace(/%20/g, "+");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private _update(): void {
|
|
85
|
+
if (this._url) {
|
|
86
|
+
this._url._updateSearch(this.toString());
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** @internal */
|
|
91
|
+
_setURL(url: URL): void {
|
|
92
|
+
this._url = url;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
append(name: string, value: string): void {
|
|
96
|
+
this._params.push([String(name), String(value)]);
|
|
97
|
+
this._update();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
delete(name: string, value?: string): void {
|
|
101
|
+
const key = String(name);
|
|
102
|
+
if (value === undefined) {
|
|
103
|
+
this._params = this._params.filter(([k]) => k !== key);
|
|
104
|
+
} else {
|
|
105
|
+
const val = String(value);
|
|
106
|
+
this._params = this._params.filter(([k, v]) => !(k === key && v === val));
|
|
107
|
+
}
|
|
108
|
+
this._update();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
get(name: string): string | null {
|
|
112
|
+
const key = String(name);
|
|
113
|
+
const entry = this._params.find(([k]) => k === key);
|
|
114
|
+
return entry ? entry[1] : null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
getAll(name: string): string[] {
|
|
118
|
+
const key = String(name);
|
|
119
|
+
return this._params.filter(([k]) => k === key).map(([, v]) => v);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
has(name: string, value?: string): boolean {
|
|
123
|
+
const key = String(name);
|
|
124
|
+
if (value === undefined) {
|
|
125
|
+
return this._params.some(([k]) => k === key);
|
|
126
|
+
}
|
|
127
|
+
const val = String(value);
|
|
128
|
+
return this._params.some(([k, v]) => k === key && v === val);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
set(name: string, value: string): void {
|
|
132
|
+
const key = String(name);
|
|
133
|
+
const val = String(value);
|
|
134
|
+
|
|
135
|
+
// Remove all existing entries with this name except the first
|
|
136
|
+
let found = false;
|
|
137
|
+
this._params = this._params.filter(([k]) => {
|
|
138
|
+
if (k === key) {
|
|
139
|
+
if (!found) {
|
|
140
|
+
found = true;
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
return true;
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// Set or append
|
|
149
|
+
if (found) {
|
|
150
|
+
const index = this._params.findIndex(([k]) => k === key);
|
|
151
|
+
this._params[index] = [key, val];
|
|
152
|
+
} else {
|
|
153
|
+
this._params.push([key, val]);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
this._update();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
sort(): void {
|
|
160
|
+
this._params.sort((a, b) => {
|
|
161
|
+
if (a[0] < b[0]) return -1;
|
|
162
|
+
if (a[0] > b[0]) return 1;
|
|
163
|
+
return 0;
|
|
164
|
+
});
|
|
165
|
+
this._update();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
get size(): number {
|
|
169
|
+
return this._params.length;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
get length(): number {
|
|
173
|
+
return this._params.length;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
toString(): string {
|
|
177
|
+
return this._params
|
|
178
|
+
.map(([k, v]) => `${this._encode(k)}=${this._encode(v)}`)
|
|
179
|
+
.join("&");
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
toJSON(): Record<string, string | string[]> {
|
|
183
|
+
const result: Record<string, string | string[]> = {};
|
|
184
|
+
|
|
185
|
+
for (let i = 0; i < this._params.length; i++) {
|
|
186
|
+
const [key, value] = this._params[i];
|
|
187
|
+
const existing = result[key];
|
|
188
|
+
|
|
189
|
+
if (existing === undefined) {
|
|
190
|
+
result[key] = value;
|
|
191
|
+
} else if (Array.isArray(existing)) {
|
|
192
|
+
existing.push(value);
|
|
193
|
+
} else {
|
|
194
|
+
result[key] = [existing, value];
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
forEach(
|
|
202
|
+
callback: (value: string, name: string, parent: URLSearchParams) => void,
|
|
203
|
+
thisArg?: any
|
|
204
|
+
): void {
|
|
205
|
+
// Use indexed loop to avoid the Rolldown for-of → forEach transform which
|
|
206
|
+
// rewrites `this` inside the callback to the global object.
|
|
207
|
+
const params = this._params;
|
|
208
|
+
for (let i = 0; i < params.length; i++) {
|
|
209
|
+
callback.call(thisArg, params[i][1], params[i][0], this);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
*entries(): IterableIterator<[string, string]> {
|
|
214
|
+
for (const entry of this._params) {
|
|
215
|
+
yield entry;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
*keys(): IterableIterator<string> {
|
|
220
|
+
for (const [key] of this._params) {
|
|
221
|
+
yield key;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
*values(): IterableIterator<string> {
|
|
226
|
+
for (const [, value] of this._params) {
|
|
227
|
+
yield value;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
[Symbol.iterator](): IterableIterator<[string, string]> {
|
|
232
|
+
return this.entries();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
for (const key of ["size", "length"] as const) {
|
|
237
|
+
const descriptor = Object.getOwnPropertyDescriptor(URLSearchParams.prototype, key);
|
|
238
|
+
if (descriptor) {
|
|
239
|
+
Object.defineProperty(URLSearchParams.prototype, key, {
|
|
240
|
+
...descriptor,
|
|
241
|
+
enumerable: true,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
package/src/url/index.ts
ADDED