toilscript 0.0.1 → 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.
Files changed (120) hide show
  1. package/LICENSE +201 -201
  2. package/NOTICE +94 -94
  3. package/README.md +101 -114
  4. package/bin/asc.js +0 -0
  5. package/bin/asinit.js +0 -0
  6. package/dist/asc.generated.d.ts +10022 -0
  7. package/dist/asc.js +24457 -0
  8. package/dist/asc.js.map +7 -0
  9. package/dist/importmap.json +9 -0
  10. package/dist/toilscript.generated.d.ts +11237 -0
  11. package/dist/toilscript.js +337 -0
  12. package/dist/toilscript.js.map +7 -0
  13. package/dist/web.js +22 -0
  14. package/lib/binaryen.d.ts +2 -2
  15. package/lib/binaryen.js +2 -2
  16. package/package.json +115 -114
  17. package/std/README.md +6 -6
  18. package/std/assembly/array.ts +550 -550
  19. package/std/assembly/arraybuffer.ts +77 -77
  20. package/std/assembly/atomics.ts +127 -127
  21. package/std/assembly/bindings/asyncify.ts +16 -16
  22. package/std/assembly/bindings/dom.ts +291 -291
  23. package/std/assembly/bindings/node.ts +6 -6
  24. package/std/assembly/bitflags.ts +53 -53
  25. package/std/assembly/builtins.ts +2650 -2650
  26. package/std/assembly/byteslice.ts +177 -177
  27. package/std/assembly/compat.ts +2 -2
  28. package/std/assembly/console.ts +42 -42
  29. package/std/assembly/crypto.ts +9 -9
  30. package/std/assembly/dataview.ts +181 -181
  31. package/std/assembly/date.ts +375 -375
  32. package/std/assembly/diagnostics.ts +11 -11
  33. package/std/assembly/encoding.ts +151 -151
  34. package/std/assembly/endian.ts +45 -45
  35. package/std/assembly/error.ts +44 -44
  36. package/std/assembly/fixedarray.ts +173 -173
  37. package/std/assembly/fixedmap.ts +326 -326
  38. package/std/assembly/fixedset.ts +275 -275
  39. package/std/assembly/function.ts +42 -42
  40. package/std/assembly/index.d.ts +2891 -2891
  41. package/std/assembly/iterator.ts +35 -35
  42. package/std/assembly/map.ts +269 -269
  43. package/std/assembly/math.ts +3289 -3289
  44. package/std/assembly/memory.ts +123 -123
  45. package/std/assembly/number.ts +388 -388
  46. package/std/assembly/object.ts +36 -36
  47. package/std/assembly/performance.ts +9 -9
  48. package/std/assembly/pointer.ts +80 -80
  49. package/std/assembly/polyfills.ts +27 -27
  50. package/std/assembly/process.ts +50 -50
  51. package/std/assembly/reference.ts +48 -48
  52. package/std/assembly/regexp.ts +12 -12
  53. package/std/assembly/rt/README.md +83 -83
  54. package/std/assembly/rt/common.ts +81 -81
  55. package/std/assembly/rt/index-incremental.ts +2 -2
  56. package/std/assembly/rt/index-memory.ts +1 -1
  57. package/std/assembly/rt/index-minimal.ts +2 -2
  58. package/std/assembly/rt/index-stub.ts +1 -1
  59. package/std/assembly/rt/index.d.ts +37 -37
  60. package/std/assembly/rt/itcms.ts +419 -419
  61. package/std/assembly/rt/memory-runtime.ts +94 -94
  62. package/std/assembly/rt/rtrace.ts +15 -15
  63. package/std/assembly/rt/stub.ts +133 -133
  64. package/std/assembly/rt/tcms.ts +254 -254
  65. package/std/assembly/rt/tlsf.ts +592 -592
  66. package/std/assembly/rt.ts +90 -90
  67. package/std/assembly/set.ts +225 -225
  68. package/std/assembly/shared/feature.ts +68 -68
  69. package/std/assembly/shared/runtime.ts +13 -13
  70. package/std/assembly/shared/target.ts +11 -11
  71. package/std/assembly/shared/tsconfig.json +11 -11
  72. package/std/assembly/shared/typeinfo.ts +72 -72
  73. package/std/assembly/staticarray.ts +423 -423
  74. package/std/assembly/string.ts +850 -850
  75. package/std/assembly/symbol.ts +114 -114
  76. package/std/assembly/table.ts +16 -16
  77. package/std/assembly/tsconfig.json +6 -6
  78. package/std/assembly/typedarray.ts +1954 -1954
  79. package/std/assembly/uri.ts +17 -17
  80. package/std/assembly/util/bytes.ts +107 -107
  81. package/std/assembly/util/casemap.ts +497 -497
  82. package/std/assembly/util/error.ts +58 -58
  83. package/std/assembly/util/hash.ts +117 -117
  84. package/std/assembly/util/math.ts +1922 -1922
  85. package/std/assembly/util/memory.ts +290 -290
  86. package/std/assembly/util/number.ts +873 -873
  87. package/std/assembly/util/sort.ts +313 -313
  88. package/std/assembly/util/string.ts +1202 -1202
  89. package/std/assembly/util/uri.ts +275 -275
  90. package/std/assembly/vector.ts +4 -4
  91. package/std/assembly.json +16 -16
  92. package/std/portable/index.d.ts +461 -461
  93. package/std/portable/index.js +416 -416
  94. package/std/portable.json +11 -11
  95. package/std/types/assembly/index.d.ts +1 -1
  96. package/std/types/assembly/package.json +2 -2
  97. package/std/types/portable/index.d.ts +1 -1
  98. package/std/types/portable/package.json +2 -2
  99. package/tsconfig-base.json +13 -13
  100. package/util/README.md +23 -23
  101. package/util/browser/fs.js +1 -1
  102. package/util/browser/module.js +5 -5
  103. package/util/browser/path.js +520 -520
  104. package/util/browser/process.js +59 -59
  105. package/util/browser/url.js +23 -23
  106. package/util/cpu.d.ts +9 -9
  107. package/util/cpu.js +42 -42
  108. package/util/find.d.ts +6 -6
  109. package/util/find.js +20 -20
  110. package/util/node.d.ts +21 -21
  111. package/util/node.js +34 -34
  112. package/util/options.d.ts +70 -70
  113. package/util/options.js +262 -262
  114. package/util/terminal.d.ts +52 -52
  115. package/util/terminal.js +35 -35
  116. package/util/text.d.ts +26 -26
  117. package/util/text.js +114 -114
  118. package/util/tsconfig.json +9 -9
  119. package/util/web.d.ts +11 -11
  120. package/util/web.js +33 -33
@@ -1,291 +1,291 @@
1
- @external("env", "globalThis")
2
- export declare const globalThis: externref;
3
-
4
- export declare namespace Math {
5
- @external("env", "Math.E")
6
- export const E: f64;
7
- @external("env", "Math.LN2")
8
- export const LN2: f64;
9
- @external("env", "Math.LN10")
10
- export const LN10: f64;
11
- @external("env", "Math.LOG2E")
12
- export const LOG2E: f64;
13
- @external("env", "Math.LOG10E")
14
- export const LOG10E: f64;
15
- @external("env", "Math.PI")
16
- export const PI: f64;
17
- @external("env", "Math.SQRT1_2")
18
- export const SQRT1_2: f64;
19
- @external("env", "Math.SQRT2")
20
- export const SQRT2: f64;
21
- @external("env", "Math.abs")
22
- export function abs(x: f64): f64;
23
- @external("env", "Math.acos")
24
- export function acos(x: f64): f64;
25
- @external("env", "Math.acosh")
26
- export function acosh(x: f64): f64;
27
- @external("env", "Math.asin")
28
- export function asin(x: f64): f64;
29
- @external("env", "Math.asinh")
30
- export function asinh(x: f64): f64;
31
- @external("env", "Math.atan")
32
- export function atan(x: f64): f64;
33
- @external("env", "Math.atan2")
34
- export function atan2(y: f64, x: f64): f64;
35
- @external("env", "Math.atanh")
36
- export function atanh(x: f64): f64;
37
- @external("env", "Math.cbrt")
38
- export function cbrt(x: f64): f64;
39
- @external("env", "Math.ceil")
40
- export function ceil(x: f64): f64;
41
- @external("env", "Math.clz32")
42
- export function clz32(x: f64): f64;
43
- @external("env", "Math.cos")
44
- export function cos(x: f64): f64;
45
- @external("env", "Math.cosh")
46
- export function cosh(x: f64): f64;
47
- @external("env", "Math.exp")
48
- export function exp(x: f64): f64;
49
- @external("env", "Math.expm1")
50
- export function expm1(x: f64): f64;
51
- @external("env", "Math.floor")
52
- export function floor(x: f64): f64;
53
- @external("env", "Math.fround")
54
- export function fround(x: f64): f32;
55
- @external("env", "Math.hypot")
56
- export function hypot(value1: f64, value2: f64): f64; // TODO: rest
57
- @external("env", "Math.imul")
58
- export function imul(a: f64, b: f64): f64;
59
- @external("env", "Math.log")
60
- export function log(x: f64): f64;
61
- @external("env", "Math.log10")
62
- export function log10(x: f64): f64;
63
- @external("env", "Math.log1p")
64
- export function log1p(x: f64): f64;
65
- @external("env", "Math.log2")
66
- export function log2(x: f64): f64;
67
- @external("env", "Math.max")
68
- export function max(value1: f64, value2: f64): f64; // TODO: rest
69
- @external("env", "Math.min")
70
- export function min(value1: f64, value2: f64): f64; // TODO: rest
71
- @external("env", "Math.pow")
72
- export function pow(base: f64, exponent: f64): f64;
73
- @external("env", "Math.random")
74
- export function random(): f64;
75
- @external("env", "Math.round")
76
- export function round(x: f64): f64;
77
- @external("env", "Math.sign")
78
- export function sign(x: f64): f64;
79
- @external("env", "Math.sin")
80
- export function sin(x: f64): f64;
81
- @external("env", "Math.sinh")
82
- export function sinh(x: f64): f64;
83
- @external("env", "Math.sqrt")
84
- export function sqrt(x: f64): f64;
85
- @external("env", "Math.tan")
86
- export function tan(x: f64): f64;
87
- @external("env", "Math.tanh")
88
- export function tanh(x: f64): f64;
89
- @external("env", "Math.trunc")
90
- export function trunc(x: f64): f64;
91
- }
92
-
93
- export declare namespace Reflect {
94
- @external("env", "Reflect.get")
95
- export function get(target: externref, propertyKey: string): externref;
96
- @external("env", "Reflect.getWithReceiver")
97
- @external.js("return Reflect.get(target, propertyKey, receiver);")
98
- export function getWithReceiver(target: externref, propertyKey: string, receiver: externref): externref;
99
- @external("env", "Reflect.has")
100
- export function has(target: externref, propertyKey: string): bool;
101
- @external("env", "Reflect.set")
102
- export function set(target: externref, propertyKey: string, value: externref): externref;
103
- @external("env", "Reflect.setWithReceiver")
104
- @external.js("return Reflect.set(target, propertyKey, value, receiver);")
105
- export function setWithReceiver(target: externref, propertyKey: string, value: externref , receiver: externref): externref;
106
- @external("env", "Reflect.apply")
107
- export function apply(target: externref, thisArgument: externref, argumentsList: externref): externref;
108
- }
109
-
110
- export declare namespace String {
111
- @external("env", "String.fromCodePoint")
112
- export function fromCodePoint(codepoint: i32): externref;
113
- @external("env", "String.fromCodePoints")
114
- @external.js("return String.fromCodePoint(...codepoints);")
115
- export function fromCodePoints(codepoints: i32[]): externref;
116
- }
117
-
118
- export declare namespace Object {
119
- @external("env", "Object.is")
120
- export function is(a: externref, b: externref): bool;
121
- @external("env", "Object.hasOwn")
122
- export function hasOwn(target: externref, propertyKey: string): bool;
123
- @external("env", "Object.assign")
124
- export function assign(target: externref, source: externref): externref;
125
- @external("env", "Object.keys")
126
- export function keys(target: externref): externref;
127
- @external("env", "Object.values")
128
- export function values(target: externref): externref;
129
- @external("env", "Object.entries")
130
- export function entries(target: externref): externref;
131
- @external("env", "Object.getOwnPropertyNames")
132
- export function getOwnPropertyNames(target: externref): externref;
133
- }
134
-
135
- export declare namespace Date {
136
- @external("env", "Date.now")
137
- export function now(): f64;
138
- }
139
-
140
- export declare namespace console {
141
- @external("env", "console.assert")
142
- export function assert(condition: bool, message: string): void;
143
- @external("env", "console.log")
144
- export function log(text: string): void;
145
- @external("env", "console.debug")
146
- export function debug(text: string): void;
147
- @external("env", "console.info")
148
- export function info(text: string): void;
149
- @external("env", "console.warn")
150
- export function warn(text: string): void;
151
- @external("env", "console.error")
152
- export function error(text: string): void;
153
- @external("env", "console.time")
154
- export function time(label: string): void;
155
- @external("env", "console.timeLog")
156
- export function timeLog(label: string): void;
157
- @external("env", "console.timeEnd")
158
- export function timeEnd(label: string): void;
159
- }
160
-
161
- export declare namespace document {
162
- /** Returns document's encoding. */
163
- @external("env", "document.characterSet")
164
- export const characterSet: string;
165
- /** Returns a value that indicates whether standards-compliant mode is switched on for the object. */
166
- @external("env", "document.compatMode")
167
- export const compatMode: string;
168
- /** Returns document's content type. */
169
- @external("env", "document.contentType")
170
- export const contentType: string;
171
- /** Returns a reference to the root node of the document. */
172
- @external("env", "document.documentElement")
173
- export const documentElement: externref;
174
- /** Returns document's URL. */
175
- @external("env", "document.documentURI")
176
- export const documentURI: string;
177
- /** Returns the URL of the location that referred the user to the current page. */
178
- @external("env", "document.referrer")
179
- export const referrer: string;
180
- /** Returns true if document has the ability of fullscreen mode, or false otherwise. */
181
- @external("env", "document.pictureInPictureEnabled")
182
- export const fullscreenEnabled: bool;
183
- /** Returns true if document has the ability of picture-in-picture mode, or false otherwise. */
184
- @external("env", "document.pictureInPictureEnabled")
185
- export const pictureInPictureEnabled: bool;
186
-
187
- /** Returns the number of child elements. */
188
- @external("env", "document.childElementCount")
189
- export const childElementCount: i32;
190
- /** Returns the child elements. */
191
- @external("env", "document.children")
192
- export const children: externref;
193
- /** Returns the first child that is an element, and null otherwise. */
194
- @external("env", "document.firstElementChild")
195
- export const firstElementChild: externref;
196
- /** Returns the last child that is an element, and null otherwise. */
197
- @external("env", "document.lastElementChild")
198
- export const lastElementChild: externref;
199
-
200
- /**
201
- * Returns the HTTP cookies that apply to the Document. If there are no cookies or cookies can't be applied
202
- * to this resource, the empty string will be returned.
203
- *
204
- * Can be set, to add a new cookie to the element's set of HTTP cookies.
205
- *
206
- * If the contents are sandboxed into a unique origin (e.g. in an iframe with the sandbox attribute),
207
- * a "SecurityError" DOMException will be thrown on getting and setting.
208
- */
209
- @external("env", "document.cookie")
210
- export let cookie: string;
211
- /** Represents the <body> or <frameset> node of the current document, or null if no such element exists. */
212
- @external("env", "document.body")
213
- export let body: externref;
214
- /** Sets or gets the security domain of the document. */
215
- @external("env", "document.domain")
216
- export let domain: string;
217
- /** Sets or gets the title of the document. */
218
- @external("env", "document.title")
219
- export let title: string;
220
- /** Sets or gets information about the current Location. */
221
- @external("env", "document.location")
222
- export let location: externref;
223
- /** Sets or gets the URL for the current document. */
224
- @external("env", "document.URL")
225
- export let URL: string;
226
-
227
- /**
228
- * Creates an instance of the element for the specified tag.
229
- * @param tagName The name of an element.
230
- */
231
- @external("env", "document.createElement")
232
- export function createElement(tagName: string /* , options?: ElementCreationOptions */): externref;
233
- /**
234
- * Returns a reference to the first HTMLElement object with the specified value of the ID attribute.
235
- * @param id String that specifies the ID value.
236
- */
237
- @external("env", "document.getElementById")
238
- export function getElementById(id: string): externref;
239
- /**
240
- * Returns a HTMLCollection of the elements in the object on which the method was invoked that have all the classes
241
- * given by classNames. The classNames argument is interpreted as a space-separated list of classes.
242
- * @param classNames Gets a collection of objects based on the value of the CLASS attribute.
243
- */
244
- @external("env", "document.getElementsByClassName")
245
- export function getElementsByClassName(classNames: string): externref;
246
- /**
247
- * Gets a collection of HTMLElement objects based on the value of the NAME or ID attribute.
248
- * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.
249
- */
250
- @external("env", "document.getElementsByName")
251
- export function getElementsByName(elementName: string): externref;
252
- /** Gets a value indicating whether the object currently has focus. */
253
- @external("env", "document.hasFocus")
254
- export function hasFocus(): bool;
255
- /** Inserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes. */
256
- @external("env", "document.append")
257
- export function append(node: externref): void;
258
- /** Inserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes. */
259
- @external("env", "document.prepend")
260
- export function prepend(node: externref): void;
261
- /** Replace all children of node with nodes, while replacing strings in nodes with equivalent Text nodes. */
262
- @external("env", "document.replaceChildren")
263
- export function replaceChildren(node: externref): void;
264
- /**
265
- * Writes one or more HTML expressions to a document in the specified window.
266
- * @param content Specifies the text and HTML tags to write.
267
- */
268
- @external("env", "document.write")
269
- export function write(content: string): void;
270
- /**
271
- * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.
272
- * @param content Specifies the text and HTML tags to write.
273
- */
274
- @external("env", "document.writeln")
275
- export function writeln(content: string): void;
276
- }
277
-
278
- export declare namespace performance {
279
- @external("env", "performance.now")
280
- export function now(): f64;
281
- }
282
-
283
- export namespace crypto {
284
- export function getRandomValues(array: Uint8Array): void {
285
- let values = getRandomValuesN(array.length);
286
- array.set(values);
287
- }
288
- @external("env", "crypto.getRandomValuesN")
289
- @external.js("let a = new Uint8Array(n); crypto.getRandomValues(a); return a;")
290
- export declare function getRandomValuesN(n: u32): Uint8Array;
291
- }
1
+ @external("env", "globalThis")
2
+ export declare const globalThis: externref;
3
+
4
+ export declare namespace Math {
5
+ @external("env", "Math.E")
6
+ export const E: f64;
7
+ @external("env", "Math.LN2")
8
+ export const LN2: f64;
9
+ @external("env", "Math.LN10")
10
+ export const LN10: f64;
11
+ @external("env", "Math.LOG2E")
12
+ export const LOG2E: f64;
13
+ @external("env", "Math.LOG10E")
14
+ export const LOG10E: f64;
15
+ @external("env", "Math.PI")
16
+ export const PI: f64;
17
+ @external("env", "Math.SQRT1_2")
18
+ export const SQRT1_2: f64;
19
+ @external("env", "Math.SQRT2")
20
+ export const SQRT2: f64;
21
+ @external("env", "Math.abs")
22
+ export function abs(x: f64): f64;
23
+ @external("env", "Math.acos")
24
+ export function acos(x: f64): f64;
25
+ @external("env", "Math.acosh")
26
+ export function acosh(x: f64): f64;
27
+ @external("env", "Math.asin")
28
+ export function asin(x: f64): f64;
29
+ @external("env", "Math.asinh")
30
+ export function asinh(x: f64): f64;
31
+ @external("env", "Math.atan")
32
+ export function atan(x: f64): f64;
33
+ @external("env", "Math.atan2")
34
+ export function atan2(y: f64, x: f64): f64;
35
+ @external("env", "Math.atanh")
36
+ export function atanh(x: f64): f64;
37
+ @external("env", "Math.cbrt")
38
+ export function cbrt(x: f64): f64;
39
+ @external("env", "Math.ceil")
40
+ export function ceil(x: f64): f64;
41
+ @external("env", "Math.clz32")
42
+ export function clz32(x: f64): f64;
43
+ @external("env", "Math.cos")
44
+ export function cos(x: f64): f64;
45
+ @external("env", "Math.cosh")
46
+ export function cosh(x: f64): f64;
47
+ @external("env", "Math.exp")
48
+ export function exp(x: f64): f64;
49
+ @external("env", "Math.expm1")
50
+ export function expm1(x: f64): f64;
51
+ @external("env", "Math.floor")
52
+ export function floor(x: f64): f64;
53
+ @external("env", "Math.fround")
54
+ export function fround(x: f64): f32;
55
+ @external("env", "Math.hypot")
56
+ export function hypot(value1: f64, value2: f64): f64; // TODO: rest
57
+ @external("env", "Math.imul")
58
+ export function imul(a: f64, b: f64): f64;
59
+ @external("env", "Math.log")
60
+ export function log(x: f64): f64;
61
+ @external("env", "Math.log10")
62
+ export function log10(x: f64): f64;
63
+ @external("env", "Math.log1p")
64
+ export function log1p(x: f64): f64;
65
+ @external("env", "Math.log2")
66
+ export function log2(x: f64): f64;
67
+ @external("env", "Math.max")
68
+ export function max(value1: f64, value2: f64): f64; // TODO: rest
69
+ @external("env", "Math.min")
70
+ export function min(value1: f64, value2: f64): f64; // TODO: rest
71
+ @external("env", "Math.pow")
72
+ export function pow(base: f64, exponent: f64): f64;
73
+ @external("env", "Math.random")
74
+ export function random(): f64;
75
+ @external("env", "Math.round")
76
+ export function round(x: f64): f64;
77
+ @external("env", "Math.sign")
78
+ export function sign(x: f64): f64;
79
+ @external("env", "Math.sin")
80
+ export function sin(x: f64): f64;
81
+ @external("env", "Math.sinh")
82
+ export function sinh(x: f64): f64;
83
+ @external("env", "Math.sqrt")
84
+ export function sqrt(x: f64): f64;
85
+ @external("env", "Math.tan")
86
+ export function tan(x: f64): f64;
87
+ @external("env", "Math.tanh")
88
+ export function tanh(x: f64): f64;
89
+ @external("env", "Math.trunc")
90
+ export function trunc(x: f64): f64;
91
+ }
92
+
93
+ export declare namespace Reflect {
94
+ @external("env", "Reflect.get")
95
+ export function get(target: externref, propertyKey: string): externref;
96
+ @external("env", "Reflect.getWithReceiver")
97
+ @external.js("return Reflect.get(target, propertyKey, receiver);")
98
+ export function getWithReceiver(target: externref, propertyKey: string, receiver: externref): externref;
99
+ @external("env", "Reflect.has")
100
+ export function has(target: externref, propertyKey: string): bool;
101
+ @external("env", "Reflect.set")
102
+ export function set(target: externref, propertyKey: string, value: externref): externref;
103
+ @external("env", "Reflect.setWithReceiver")
104
+ @external.js("return Reflect.set(target, propertyKey, value, receiver);")
105
+ export function setWithReceiver(target: externref, propertyKey: string, value: externref , receiver: externref): externref;
106
+ @external("env", "Reflect.apply")
107
+ export function apply(target: externref, thisArgument: externref, argumentsList: externref): externref;
108
+ }
109
+
110
+ export declare namespace String {
111
+ @external("env", "String.fromCodePoint")
112
+ export function fromCodePoint(codepoint: i32): externref;
113
+ @external("env", "String.fromCodePoints")
114
+ @external.js("return String.fromCodePoint(...codepoints);")
115
+ export function fromCodePoints(codepoints: i32[]): externref;
116
+ }
117
+
118
+ export declare namespace Object {
119
+ @external("env", "Object.is")
120
+ export function is(a: externref, b: externref): bool;
121
+ @external("env", "Object.hasOwn")
122
+ export function hasOwn(target: externref, propertyKey: string): bool;
123
+ @external("env", "Object.assign")
124
+ export function assign(target: externref, source: externref): externref;
125
+ @external("env", "Object.keys")
126
+ export function keys(target: externref): externref;
127
+ @external("env", "Object.values")
128
+ export function values(target: externref): externref;
129
+ @external("env", "Object.entries")
130
+ export function entries(target: externref): externref;
131
+ @external("env", "Object.getOwnPropertyNames")
132
+ export function getOwnPropertyNames(target: externref): externref;
133
+ }
134
+
135
+ export declare namespace Date {
136
+ @external("env", "Date.now")
137
+ export function now(): f64;
138
+ }
139
+
140
+ export declare namespace console {
141
+ @external("env", "console.assert")
142
+ export function assert(condition: bool, message: string): void;
143
+ @external("env", "console.log")
144
+ export function log(text: string): void;
145
+ @external("env", "console.debug")
146
+ export function debug(text: string): void;
147
+ @external("env", "console.info")
148
+ export function info(text: string): void;
149
+ @external("env", "console.warn")
150
+ export function warn(text: string): void;
151
+ @external("env", "console.error")
152
+ export function error(text: string): void;
153
+ @external("env", "console.time")
154
+ export function time(label: string): void;
155
+ @external("env", "console.timeLog")
156
+ export function timeLog(label: string): void;
157
+ @external("env", "console.timeEnd")
158
+ export function timeEnd(label: string): void;
159
+ }
160
+
161
+ export declare namespace document {
162
+ /** Returns document's encoding. */
163
+ @external("env", "document.characterSet")
164
+ export const characterSet: string;
165
+ /** Returns a value that indicates whether standards-compliant mode is switched on for the object. */
166
+ @external("env", "document.compatMode")
167
+ export const compatMode: string;
168
+ /** Returns document's content type. */
169
+ @external("env", "document.contentType")
170
+ export const contentType: string;
171
+ /** Returns a reference to the root node of the document. */
172
+ @external("env", "document.documentElement")
173
+ export const documentElement: externref;
174
+ /** Returns document's URL. */
175
+ @external("env", "document.documentURI")
176
+ export const documentURI: string;
177
+ /** Returns the URL of the location that referred the user to the current page. */
178
+ @external("env", "document.referrer")
179
+ export const referrer: string;
180
+ /** Returns true if document has the ability of fullscreen mode, or false otherwise. */
181
+ @external("env", "document.pictureInPictureEnabled")
182
+ export const fullscreenEnabled: bool;
183
+ /** Returns true if document has the ability of picture-in-picture mode, or false otherwise. */
184
+ @external("env", "document.pictureInPictureEnabled")
185
+ export const pictureInPictureEnabled: bool;
186
+
187
+ /** Returns the number of child elements. */
188
+ @external("env", "document.childElementCount")
189
+ export const childElementCount: i32;
190
+ /** Returns the child elements. */
191
+ @external("env", "document.children")
192
+ export const children: externref;
193
+ /** Returns the first child that is an element, and null otherwise. */
194
+ @external("env", "document.firstElementChild")
195
+ export const firstElementChild: externref;
196
+ /** Returns the last child that is an element, and null otherwise. */
197
+ @external("env", "document.lastElementChild")
198
+ export const lastElementChild: externref;
199
+
200
+ /**
201
+ * Returns the HTTP cookies that apply to the Document. If there are no cookies or cookies can't be applied
202
+ * to this resource, the empty string will be returned.
203
+ *
204
+ * Can be set, to add a new cookie to the element's set of HTTP cookies.
205
+ *
206
+ * If the contents are sandboxed into a unique origin (e.g. in an iframe with the sandbox attribute),
207
+ * a "SecurityError" DOMException will be thrown on getting and setting.
208
+ */
209
+ @external("env", "document.cookie")
210
+ export let cookie: string;
211
+ /** Represents the <body> or <frameset> node of the current document, or null if no such element exists. */
212
+ @external("env", "document.body")
213
+ export let body: externref;
214
+ /** Sets or gets the security domain of the document. */
215
+ @external("env", "document.domain")
216
+ export let domain: string;
217
+ /** Sets or gets the title of the document. */
218
+ @external("env", "document.title")
219
+ export let title: string;
220
+ /** Sets or gets information about the current Location. */
221
+ @external("env", "document.location")
222
+ export let location: externref;
223
+ /** Sets or gets the URL for the current document. */
224
+ @external("env", "document.URL")
225
+ export let URL: string;
226
+
227
+ /**
228
+ * Creates an instance of the element for the specified tag.
229
+ * @param tagName The name of an element.
230
+ */
231
+ @external("env", "document.createElement")
232
+ export function createElement(tagName: string /* , options?: ElementCreationOptions */): externref;
233
+ /**
234
+ * Returns a reference to the first HTMLElement object with the specified value of the ID attribute.
235
+ * @param id String that specifies the ID value.
236
+ */
237
+ @external("env", "document.getElementById")
238
+ export function getElementById(id: string): externref;
239
+ /**
240
+ * Returns a HTMLCollection of the elements in the object on which the method was invoked that have all the classes
241
+ * given by classNames. The classNames argument is interpreted as a space-separated list of classes.
242
+ * @param classNames Gets a collection of objects based on the value of the CLASS attribute.
243
+ */
244
+ @external("env", "document.getElementsByClassName")
245
+ export function getElementsByClassName(classNames: string): externref;
246
+ /**
247
+ * Gets a collection of HTMLElement objects based on the value of the NAME or ID attribute.
248
+ * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.
249
+ */
250
+ @external("env", "document.getElementsByName")
251
+ export function getElementsByName(elementName: string): externref;
252
+ /** Gets a value indicating whether the object currently has focus. */
253
+ @external("env", "document.hasFocus")
254
+ export function hasFocus(): bool;
255
+ /** Inserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes. */
256
+ @external("env", "document.append")
257
+ export function append(node: externref): void;
258
+ /** Inserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes. */
259
+ @external("env", "document.prepend")
260
+ export function prepend(node: externref): void;
261
+ /** Replace all children of node with nodes, while replacing strings in nodes with equivalent Text nodes. */
262
+ @external("env", "document.replaceChildren")
263
+ export function replaceChildren(node: externref): void;
264
+ /**
265
+ * Writes one or more HTML expressions to a document in the specified window.
266
+ * @param content Specifies the text and HTML tags to write.
267
+ */
268
+ @external("env", "document.write")
269
+ export function write(content: string): void;
270
+ /**
271
+ * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.
272
+ * @param content Specifies the text and HTML tags to write.
273
+ */
274
+ @external("env", "document.writeln")
275
+ export function writeln(content: string): void;
276
+ }
277
+
278
+ export declare namespace performance {
279
+ @external("env", "performance.now")
280
+ export function now(): f64;
281
+ }
282
+
283
+ export namespace crypto {
284
+ export function getRandomValues(array: Uint8Array): void {
285
+ let values = getRandomValuesN(array.length);
286
+ array.set(values);
287
+ }
288
+ @external("env", "crypto.getRandomValuesN")
289
+ @external.js("let a = new Uint8Array(n); crypto.getRandomValues(a); return a;")
290
+ export declare function getRandomValuesN(n: u32): Uint8Array;
291
+ }
@@ -1,6 +1,6 @@
1
- export declare namespace process {
2
- @external("env", "process.argv")
3
- export const argv: string[];
4
- @external("env", "process.exit")
5
- export function exit(code: i32): void;
6
- }
1
+ export declare namespace process {
2
+ @external("env", "process.argv")
3
+ export const argv: string[];
4
+ @external("env", "process.exit")
5
+ export function exit(code: i32): void;
6
+ }