@tsonic/js 0.1.3 → 10.0.5
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/README.md +8 -0
- package/__internal/extensions/index.d.ts +67 -0
- package/index/bindings.json +3587 -5644
- package/index/internal/index.d.ts +69 -33
- package/index.d.ts +6 -3
- package/package.json +5 -4
- package/__build/scripts/generate.sh +0 -116
- package/index/internal/metadata.json +0 -7741
- package/tsconfig.json +0 -18
|
@@ -66,7 +66,7 @@ export interface Date$instance {
|
|
|
66
66
|
toLocaleDateString(): string;
|
|
67
67
|
toLocaleString(): string;
|
|
68
68
|
toLocaleTimeString(): string;
|
|
69
|
-
|
|
69
|
+
ToString(): string;
|
|
70
70
|
toTimeString(): string;
|
|
71
71
|
toUTCString(): string;
|
|
72
72
|
valueOf(): long;
|
|
@@ -87,12 +87,15 @@ export const Date: {
|
|
|
87
87
|
export type Date = Date$instance;
|
|
88
88
|
|
|
89
89
|
export interface Float32Array$instance {
|
|
90
|
+
readonly __tsonic_iface_System_Collections_Generic_IEnumerable_1: never;
|
|
91
|
+
readonly __tsonic_iface_System_Collections_IEnumerable: never;
|
|
92
|
+
|
|
90
93
|
readonly byteLength: int;
|
|
91
|
-
|
|
94
|
+
[index: number]: float;
|
|
92
95
|
readonly length: int;
|
|
93
96
|
at(index: int): Nullable<System_Internal.Single>;
|
|
94
97
|
fill(value: float, start?: int, end?: Nullable<System_Internal.Int32>): Float32Array;
|
|
95
|
-
|
|
98
|
+
GetEnumerator(): IEnumerator<System_Internal.Single>;
|
|
96
99
|
includes(value: float, fromIndex?: int): boolean;
|
|
97
100
|
indexOf(value: float, fromIndex?: int): int;
|
|
98
101
|
join(separator?: string): string;
|
|
@@ -115,12 +118,15 @@ export const Float32Array: {
|
|
|
115
118
|
export type Float32Array = Float32Array$instance;
|
|
116
119
|
|
|
117
120
|
export interface Float64Array$instance {
|
|
121
|
+
readonly __tsonic_iface_System_Collections_Generic_IEnumerable_1: never;
|
|
122
|
+
readonly __tsonic_iface_System_Collections_IEnumerable: never;
|
|
123
|
+
|
|
118
124
|
readonly byteLength: int;
|
|
119
|
-
|
|
125
|
+
[index: number]: double;
|
|
120
126
|
readonly length: int;
|
|
121
127
|
at(index: int): Nullable<System_Internal.Double>;
|
|
122
128
|
fill(value: double, start?: int, end?: Nullable<System_Internal.Int32>): Float64Array;
|
|
123
|
-
|
|
129
|
+
GetEnumerator(): IEnumerator<System_Internal.Double>;
|
|
124
130
|
includes(value: double, fromIndex?: int): boolean;
|
|
125
131
|
indexOf(value: double, fromIndex?: int): int;
|
|
126
132
|
join(separator?: string): string;
|
|
@@ -143,12 +149,15 @@ export const Float64Array: {
|
|
|
143
149
|
export type Float64Array = Float64Array$instance;
|
|
144
150
|
|
|
145
151
|
export interface Int16Array$instance {
|
|
152
|
+
readonly __tsonic_iface_System_Collections_Generic_IEnumerable_1: never;
|
|
153
|
+
readonly __tsonic_iface_System_Collections_IEnumerable: never;
|
|
154
|
+
|
|
146
155
|
readonly byteLength: int;
|
|
147
|
-
|
|
156
|
+
[index: number]: short;
|
|
148
157
|
readonly length: int;
|
|
149
158
|
at(index: int): Nullable<System_Internal.Int16>;
|
|
150
159
|
fill(value: short, start?: int, end?: Nullable<System_Internal.Int32>): Int16Array;
|
|
151
|
-
|
|
160
|
+
GetEnumerator(): IEnumerator<System_Internal.Int16>;
|
|
152
161
|
includes(value: short, fromIndex?: int): boolean;
|
|
153
162
|
indexOf(value: short, fromIndex?: int): int;
|
|
154
163
|
join(separator?: string): string;
|
|
@@ -171,12 +180,15 @@ export const Int16Array: {
|
|
|
171
180
|
export type Int16Array = Int16Array$instance;
|
|
172
181
|
|
|
173
182
|
export interface Int32Array$instance {
|
|
183
|
+
readonly __tsonic_iface_System_Collections_Generic_IEnumerable_1: never;
|
|
184
|
+
readonly __tsonic_iface_System_Collections_IEnumerable: never;
|
|
185
|
+
|
|
174
186
|
readonly byteLength: int;
|
|
175
|
-
|
|
187
|
+
[index: number]: int;
|
|
176
188
|
readonly length: int;
|
|
177
189
|
at(index: int): Nullable<System_Internal.Int32>;
|
|
178
190
|
fill(value: int, start?: int, end?: Nullable<System_Internal.Int32>): Int32Array;
|
|
179
|
-
|
|
191
|
+
GetEnumerator(): IEnumerator<System_Internal.Int32>;
|
|
180
192
|
includes(value: int, fromIndex?: int): boolean;
|
|
181
193
|
indexOf(value: int, fromIndex?: int): int;
|
|
182
194
|
join(separator?: string): string;
|
|
@@ -199,12 +211,15 @@ export const Int32Array: {
|
|
|
199
211
|
export type Int32Array = Int32Array$instance;
|
|
200
212
|
|
|
201
213
|
export interface Int8Array$instance {
|
|
214
|
+
readonly __tsonic_iface_System_Collections_Generic_IEnumerable_1: never;
|
|
215
|
+
readonly __tsonic_iface_System_Collections_IEnumerable: never;
|
|
216
|
+
|
|
202
217
|
readonly byteLength: int;
|
|
203
|
-
|
|
218
|
+
[index: number]: sbyte;
|
|
204
219
|
readonly length: int;
|
|
205
220
|
at(index: int): Nullable<System_Internal.SByte>;
|
|
206
221
|
fill(value: sbyte, start?: int, end?: Nullable<System_Internal.Int32>): Int8Array;
|
|
207
|
-
|
|
222
|
+
GetEnumerator(): IEnumerator<System_Internal.SByte>;
|
|
208
223
|
includes(value: sbyte, fromIndex?: int): boolean;
|
|
209
224
|
indexOf(value: sbyte, fromIndex?: int): int;
|
|
210
225
|
join(separator?: string): string;
|
|
@@ -227,7 +242,10 @@ export const Int8Array: {
|
|
|
227
242
|
export type Int8Array = Int8Array$instance;
|
|
228
243
|
|
|
229
244
|
export interface JSArray_1$instance<T> {
|
|
230
|
-
|
|
245
|
+
readonly __tsonic_iface_System_Collections_Generic_IEnumerable_1: never;
|
|
246
|
+
readonly __tsonic_iface_System_Collections_IEnumerable: never;
|
|
247
|
+
|
|
248
|
+
[index: number]: T;
|
|
231
249
|
readonly length: int;
|
|
232
250
|
at(index: int): T;
|
|
233
251
|
concat(...items: unknown[]): JSArray_1<T>;
|
|
@@ -256,7 +274,7 @@ export interface JSArray_1$instance<T> {
|
|
|
256
274
|
forEach(callback: Action<T>): void;
|
|
257
275
|
forEach(callback: Action<T, System_Internal.Int32>): void;
|
|
258
276
|
forEach(callback: Action<T, System_Internal.Int32, JSArray_1<T>>): void;
|
|
259
|
-
|
|
277
|
+
GetEnumerator(): IEnumerator<T>;
|
|
260
278
|
includes(searchElement: T): boolean;
|
|
261
279
|
indexOf(searchElement: T, fromIndex?: int): int;
|
|
262
280
|
join(separator?: string): string;
|
|
@@ -289,7 +307,7 @@ export interface JSArray_1$instance<T> {
|
|
|
289
307
|
toReversed(): JSArray_1<T>;
|
|
290
308
|
toSorted(compareFunc?: Func<T, T, System_Internal.Double>): JSArray_1<T>;
|
|
291
309
|
toSpliced(start: int, deleteCount?: Nullable<System_Internal.Int32>, ...items: T[]): JSArray_1<T>;
|
|
292
|
-
|
|
310
|
+
ToString(): string;
|
|
293
311
|
unshift(item: T): int;
|
|
294
312
|
unshift(...items: T[]): int;
|
|
295
313
|
values(): IEnumerable__System_Collections_Generic<T>;
|
|
@@ -313,6 +331,9 @@ export const JSArray_1: {
|
|
|
313
331
|
export type JSArray_1<T> = JSArray_1$instance<T>;
|
|
314
332
|
|
|
315
333
|
export interface Map_2$instance<K, V> {
|
|
334
|
+
readonly __tsonic_iface_System_Collections_Generic_IEnumerable_1: never;
|
|
335
|
+
readonly __tsonic_iface_System_Collections_IEnumerable: never;
|
|
336
|
+
|
|
316
337
|
readonly size: int;
|
|
317
338
|
clear(): void;
|
|
318
339
|
delete(key: K): boolean;
|
|
@@ -321,7 +342,7 @@ export interface Map_2$instance<K, V> {
|
|
|
321
342
|
forEach(callback: Action<V, K>): void;
|
|
322
343
|
forEach(callback: Action<V>): void;
|
|
323
344
|
get(key: K): V | undefined;
|
|
324
|
-
|
|
345
|
+
GetEnumerator(): IEnumerator<KeyValuePair<K, V>>;
|
|
325
346
|
has(key: K): boolean;
|
|
326
347
|
keys(): IEnumerable__System_Collections_Generic<K>;
|
|
327
348
|
set(key: K, value: V): Map_2<K, V>;
|
|
@@ -349,7 +370,7 @@ export interface RegExp$instance {
|
|
|
349
370
|
readonly unicode: boolean;
|
|
350
371
|
exec(str: string): RegExpMatchResult | undefined;
|
|
351
372
|
test(str: string): boolean;
|
|
352
|
-
|
|
373
|
+
ToString(): string;
|
|
353
374
|
}
|
|
354
375
|
|
|
355
376
|
|
|
@@ -365,7 +386,7 @@ export interface RegExpMatchResult$instance {
|
|
|
365
386
|
readonly groups: (string | undefined)[];
|
|
366
387
|
readonly index: int;
|
|
367
388
|
readonly input: string;
|
|
368
|
-
readonly
|
|
389
|
+
readonly [groupIndex: number]: string | undefined;
|
|
369
390
|
readonly length: int;
|
|
370
391
|
readonly value: string;
|
|
371
392
|
}
|
|
@@ -379,6 +400,9 @@ export const RegExpMatchResult: {
|
|
|
379
400
|
export type RegExpMatchResult = RegExpMatchResult$instance;
|
|
380
401
|
|
|
381
402
|
export interface Set_1$instance<T> {
|
|
403
|
+
readonly __tsonic_iface_System_Collections_Generic_IEnumerable_1: never;
|
|
404
|
+
readonly __tsonic_iface_System_Collections_IEnumerable: never;
|
|
405
|
+
|
|
382
406
|
readonly size: int;
|
|
383
407
|
add(value: T): Set_1<T>;
|
|
384
408
|
clear(): void;
|
|
@@ -388,7 +412,7 @@ export interface Set_1$instance<T> {
|
|
|
388
412
|
forEach(callback: Action<T, T, Set_1<T>>): void;
|
|
389
413
|
forEach(callback: Action<T, T>): void;
|
|
390
414
|
forEach(callback: Action<T>): void;
|
|
391
|
-
|
|
415
|
+
GetEnumerator(): IEnumerator<T>;
|
|
392
416
|
has(value: T): boolean;
|
|
393
417
|
intersection(other: Set_1<T>): Set_1<T>;
|
|
394
418
|
isDisjointFrom(other: Set_1<T>): boolean;
|
|
@@ -410,12 +434,15 @@ export const Set_1: {
|
|
|
410
434
|
export type Set_1<T> = Set_1$instance<T>;
|
|
411
435
|
|
|
412
436
|
export interface Uint16Array$instance {
|
|
437
|
+
readonly __tsonic_iface_System_Collections_Generic_IEnumerable_1: never;
|
|
438
|
+
readonly __tsonic_iface_System_Collections_IEnumerable: never;
|
|
439
|
+
|
|
413
440
|
readonly byteLength: int;
|
|
414
|
-
|
|
441
|
+
[index: number]: ushort;
|
|
415
442
|
readonly length: int;
|
|
416
443
|
at(index: int): Nullable<System_Internal.UInt16>;
|
|
417
444
|
fill(value: ushort, start?: int, end?: Nullable<System_Internal.Int32>): Uint16Array;
|
|
418
|
-
|
|
445
|
+
GetEnumerator(): IEnumerator<System_Internal.UInt16>;
|
|
419
446
|
includes(value: ushort, fromIndex?: int): boolean;
|
|
420
447
|
indexOf(value: ushort, fromIndex?: int): int;
|
|
421
448
|
join(separator?: string): string;
|
|
@@ -438,12 +465,15 @@ export const Uint16Array: {
|
|
|
438
465
|
export type Uint16Array = Uint16Array$instance;
|
|
439
466
|
|
|
440
467
|
export interface Uint32Array$instance {
|
|
468
|
+
readonly __tsonic_iface_System_Collections_Generic_IEnumerable_1: never;
|
|
469
|
+
readonly __tsonic_iface_System_Collections_IEnumerable: never;
|
|
470
|
+
|
|
441
471
|
readonly byteLength: int;
|
|
442
|
-
|
|
472
|
+
[index: number]: uint;
|
|
443
473
|
readonly length: int;
|
|
444
474
|
at(index: int): Nullable<System_Internal.UInt32>;
|
|
445
475
|
fill(value: uint, start?: int, end?: Nullable<System_Internal.Int32>): Uint32Array;
|
|
446
|
-
|
|
476
|
+
GetEnumerator(): IEnumerator<System_Internal.UInt32>;
|
|
447
477
|
includes(value: uint, fromIndex?: int): boolean;
|
|
448
478
|
indexOf(value: uint, fromIndex?: int): int;
|
|
449
479
|
join(separator?: string): string;
|
|
@@ -466,12 +496,15 @@ export const Uint32Array: {
|
|
|
466
496
|
export type Uint32Array = Uint32Array$instance;
|
|
467
497
|
|
|
468
498
|
export interface Uint8Array$instance {
|
|
499
|
+
readonly __tsonic_iface_System_Collections_Generic_IEnumerable_1: never;
|
|
500
|
+
readonly __tsonic_iface_System_Collections_IEnumerable: never;
|
|
501
|
+
|
|
469
502
|
readonly byteLength: int;
|
|
470
|
-
|
|
503
|
+
[index: number]: byte;
|
|
471
504
|
readonly length: int;
|
|
472
505
|
at(index: int): Nullable<System_Internal.Byte>;
|
|
473
506
|
fill(value: byte, start?: int, end?: Nullable<System_Internal.Int32>): Uint8Array;
|
|
474
|
-
|
|
507
|
+
GetEnumerator(): IEnumerator<System_Internal.Byte>;
|
|
475
508
|
includes(value: byte, fromIndex?: int): boolean;
|
|
476
509
|
indexOf(value: byte, fromIndex?: int): int;
|
|
477
510
|
join(separator?: string): string;
|
|
@@ -494,18 +527,21 @@ export const Uint8Array: {
|
|
|
494
527
|
export type Uint8Array = Uint8Array$instance;
|
|
495
528
|
|
|
496
529
|
export interface Uint8ClampedArray$instance {
|
|
530
|
+
readonly __tsonic_iface_System_Collections_Generic_IEnumerable_1: never;
|
|
531
|
+
readonly __tsonic_iface_System_Collections_IEnumerable: never;
|
|
532
|
+
|
|
497
533
|
readonly byteLength: int;
|
|
498
|
-
|
|
534
|
+
[index: number]: byte;
|
|
499
535
|
readonly length: int;
|
|
500
536
|
at(index: int): Nullable<System_Internal.Byte>;
|
|
501
537
|
fill(value: byte, start?: int, end?: Nullable<System_Internal.Int32>): Uint8ClampedArray;
|
|
502
|
-
|
|
538
|
+
GetEnumerator(): IEnumerator<System_Internal.Byte>;
|
|
503
539
|
includes(value: byte, fromIndex?: int): boolean;
|
|
504
540
|
indexOf(value: byte, fromIndex?: int): int;
|
|
505
541
|
join(separator?: string): string;
|
|
506
542
|
reverse(): Uint8ClampedArray;
|
|
507
543
|
set(array: IEnumerable__System_Collections_Generic<System_Internal.Byte>, offset?: int): void;
|
|
508
|
-
|
|
544
|
+
SetClamped(index: int, value: int): void;
|
|
509
545
|
slice(begin?: int, end?: Nullable<System_Internal.Int32>): Uint8ClampedArray;
|
|
510
546
|
sort(compareFn?: Comparison<System_Internal.Byte>): Uint8ClampedArray;
|
|
511
547
|
subarray(begin?: int, end?: Nullable<System_Internal.Int32>): Uint8ClampedArray;
|
|
@@ -578,19 +614,19 @@ export type console = console$instance;
|
|
|
578
614
|
|
|
579
615
|
export abstract class Globals$instance {
|
|
580
616
|
static readonly undefined: unknown | undefined;
|
|
581
|
-
static readonly
|
|
582
|
-
static readonly
|
|
583
|
-
static
|
|
617
|
+
static readonly Infinity: double;
|
|
618
|
+
static readonly NaN: double;
|
|
619
|
+
static Boolean(value: unknown): boolean;
|
|
584
620
|
static decodeURI(uri: string): string;
|
|
585
621
|
static decodeURIComponent(component: string): string;
|
|
586
622
|
static encodeURI(uri: string): string;
|
|
587
623
|
static encodeURIComponent(component: string): string;
|
|
588
624
|
static isFinite(value: double): boolean;
|
|
589
625
|
static isNaN(value: double): boolean;
|
|
590
|
-
static
|
|
626
|
+
static Number(value: unknown): double;
|
|
591
627
|
static parseFloat(str: string): double;
|
|
592
628
|
static parseInt(str: string, radix?: Nullable<System_Internal.Int32>): Nullable<System_Internal.Int64>;
|
|
593
|
-
static
|
|
629
|
+
static String(value: unknown): string;
|
|
594
630
|
}
|
|
595
631
|
|
|
596
632
|
|
|
@@ -661,7 +697,7 @@ export abstract class Number$instance {
|
|
|
661
697
|
static readonly MIN_SAFE_INTEGER: double;
|
|
662
698
|
static readonly POSITIVE_INFINITY: double;
|
|
663
699
|
static readonly NEGATIVE_INFINITY: double;
|
|
664
|
-
static readonly
|
|
700
|
+
static readonly NaN: double;
|
|
665
701
|
static readonly EPSILON: double;
|
|
666
702
|
static isFinite(value: double): boolean;
|
|
667
703
|
static isInteger(value: double): boolean;
|
package/index.d.ts
CHANGED
|
@@ -42,17 +42,20 @@ export { Uint8Array as Uint8Array } from './index/internal/index.js';
|
|
|
42
42
|
export { Uint8ClampedArray as Uint8ClampedArray } from './index/internal/index.js';
|
|
43
43
|
export { WeakMap_2 as WeakMap } from './index/internal/index.js';
|
|
44
44
|
export { WeakSet_1 as WeakSet } from './index/internal/index.js';
|
|
45
|
+
// Extension methods (C# using semantics)
|
|
46
|
+
export type { ExtensionMethods_Tsonic_JSRuntime as ExtensionMethods } from './__internal/extensions/index.js';
|
|
47
|
+
|
|
45
48
|
|
|
46
49
|
// Flattened exports from static classes
|
|
47
50
|
// From Tsonic.JSRuntime.Globals
|
|
48
|
-
export declare function
|
|
51
|
+
export declare function Boolean(value: unknown): boolean;
|
|
49
52
|
export declare function decodeURI(uri: string): string;
|
|
50
53
|
export declare function decodeURIComponent(component: string): string;
|
|
51
54
|
export declare function encodeURI(uri: string): string;
|
|
52
55
|
export declare function encodeURIComponent(component: string): string;
|
|
53
56
|
export declare function isFinite(value: double): boolean;
|
|
54
57
|
export declare function isNaN(value: double): boolean;
|
|
55
|
-
export declare function
|
|
58
|
+
export declare function Number(value: unknown): double;
|
|
56
59
|
export declare function parseFloat(str: string): double;
|
|
57
60
|
export declare function parseInt(str: string, radix?: Nullable<System_Internal.Int32>): Nullable<System_Internal.Int64>;
|
|
58
|
-
export declare function
|
|
61
|
+
export declare function String(value: unknown): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsonic/js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "10.0.5",
|
|
4
4
|
"description": "TypeScript type definitions for JavaScript Runtime (JSRuntime) library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"tsonic",
|
|
11
11
|
"dotnet",
|
|
12
12
|
"clr",
|
|
13
|
-
"jsruntime"
|
|
13
|
+
"jsruntime",
|
|
14
|
+
"net10"
|
|
14
15
|
],
|
|
15
16
|
"author": "Tsonic Team",
|
|
16
17
|
"license": "MIT",
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
"url": "https://github.com/tsoniclang/js.git"
|
|
20
21
|
},
|
|
21
22
|
"peerDependencies": {
|
|
22
|
-
"@tsonic/dotnet": "^0.
|
|
23
|
-
"@tsonic/core": "^0.
|
|
23
|
+
"@tsonic/dotnet": "^10.0.1",
|
|
24
|
+
"@tsonic/core": "^10.0.1"
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Generate TypeScript declarations for @tsonic/js (JSRuntime library)
|
|
3
|
-
#
|
|
4
|
-
# This script regenerates all TypeScript type declarations from the
|
|
5
|
-
# Tsonic.JSRuntime.dll assembly using tsbindgen.
|
|
6
|
-
#
|
|
7
|
-
# Prerequisites:
|
|
8
|
-
# - .NET 10 SDK installed
|
|
9
|
-
# - tsbindgen repository cloned at ../tsbindgen (sibling directory)
|
|
10
|
-
# - js-runtime repository cloned at ../js-runtime (sibling directory)
|
|
11
|
-
#
|
|
12
|
-
# Usage:
|
|
13
|
-
# ./__build/scripts/generate.sh
|
|
14
|
-
|
|
15
|
-
set -e
|
|
16
|
-
|
|
17
|
-
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
18
|
-
PROJECT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
19
|
-
TSBINDGEN_DIR="$PROJECT_DIR/../tsbindgen"
|
|
20
|
-
JS_RUNTIME_DIR="$PROJECT_DIR/../js-runtime"
|
|
21
|
-
DOTNET_LIB="$PROJECT_DIR/../dotnet"
|
|
22
|
-
CORE_LIB="$PROJECT_DIR/../core"
|
|
23
|
-
|
|
24
|
-
# .NET runtime path (needed for BCL type resolution)
|
|
25
|
-
DOTNET_VERSION="${DOTNET_VERSION:-10.0.0}"
|
|
26
|
-
DOTNET_HOME="${DOTNET_HOME:-$HOME/.dotnet}"
|
|
27
|
-
DOTNET_RUNTIME_PATH="$DOTNET_HOME/shared/Microsoft.NETCore.App/$DOTNET_VERSION"
|
|
28
|
-
|
|
29
|
-
# Tsonic.JSRuntime.dll path
|
|
30
|
-
JSRUNTIME_DLL="$JS_RUNTIME_DIR/artifacts/bin/Tsonic.JSRuntime/Release/net10.0/Tsonic.JSRuntime.dll"
|
|
31
|
-
|
|
32
|
-
echo "================================================================"
|
|
33
|
-
echo "Generating @tsonic/js TypeScript Declarations"
|
|
34
|
-
echo "================================================================"
|
|
35
|
-
echo ""
|
|
36
|
-
echo "Configuration:"
|
|
37
|
-
echo " JSRuntime.dll: $JSRUNTIME_DLL"
|
|
38
|
-
echo " .NET Runtime: $DOTNET_RUNTIME_PATH"
|
|
39
|
-
echo " BCL Library: $DOTNET_LIB (external reference)"
|
|
40
|
-
echo " tsbindgen: $TSBINDGEN_DIR"
|
|
41
|
-
echo " Output: $PROJECT_DIR"
|
|
42
|
-
echo " Naming: JS (camelCase)"
|
|
43
|
-
echo ""
|
|
44
|
-
|
|
45
|
-
# Verify prerequisites
|
|
46
|
-
if [ ! -f "$JSRUNTIME_DLL" ]; then
|
|
47
|
-
echo "ERROR: Tsonic.JSRuntime.dll not found at $JSRUNTIME_DLL"
|
|
48
|
-
echo "Build it first: cd ../js-runtime && dotnet build -c Release"
|
|
49
|
-
exit 1
|
|
50
|
-
fi
|
|
51
|
-
|
|
52
|
-
if [ ! -d "$DOTNET_RUNTIME_PATH" ]; then
|
|
53
|
-
echo "ERROR: .NET runtime not found at $DOTNET_RUNTIME_PATH"
|
|
54
|
-
echo "Set DOTNET_HOME or DOTNET_VERSION environment variables"
|
|
55
|
-
exit 1
|
|
56
|
-
fi
|
|
57
|
-
|
|
58
|
-
if [ ! -d "$TSBINDGEN_DIR" ]; then
|
|
59
|
-
echo "ERROR: tsbindgen not found at $TSBINDGEN_DIR"
|
|
60
|
-
echo "Clone it: git clone https://github.com/tsoniclang/tsbindgen ../tsbindgen"
|
|
61
|
-
exit 1
|
|
62
|
-
fi
|
|
63
|
-
|
|
64
|
-
if [ ! -d "$DOTNET_LIB" ]; then
|
|
65
|
-
echo "ERROR: @tsonic/dotnet not found at $DOTNET_LIB"
|
|
66
|
-
echo "Clone it: git clone https://github.com/tsoniclang/dotnet ../dotnet"
|
|
67
|
-
exit 1
|
|
68
|
-
fi
|
|
69
|
-
|
|
70
|
-
if [ ! -d "$CORE_LIB" ]; then
|
|
71
|
-
echo "ERROR: @tsonic/core not found at $CORE_LIB"
|
|
72
|
-
echo "Clone it: git clone https://github.com/tsoniclang/core ../core"
|
|
73
|
-
exit 1
|
|
74
|
-
fi
|
|
75
|
-
|
|
76
|
-
# Clean output directory (keep config files)
|
|
77
|
-
echo "[1/3] Cleaning output directory..."
|
|
78
|
-
cd "$PROJECT_DIR"
|
|
79
|
-
|
|
80
|
-
# Remove all namespace directories (but keep config files, __build, node_modules, .git)
|
|
81
|
-
find . -maxdepth 1 -type d \
|
|
82
|
-
! -name '.' \
|
|
83
|
-
! -name '.git' \
|
|
84
|
-
! -name '.tests' \
|
|
85
|
-
! -name 'node_modules' \
|
|
86
|
-
! -name '__build' \
|
|
87
|
-
-exec rm -rf {} \; 2>/dev/null || true
|
|
88
|
-
|
|
89
|
-
# Remove generated files at root
|
|
90
|
-
rm -f *.d.ts *.js 2>/dev/null || true
|
|
91
|
-
|
|
92
|
-
echo " Done"
|
|
93
|
-
|
|
94
|
-
# Build tsbindgen
|
|
95
|
-
echo "[2/3] Building tsbindgen..."
|
|
96
|
-
cd "$TSBINDGEN_DIR"
|
|
97
|
-
dotnet build src/tsbindgen/tsbindgen.csproj -c Release --verbosity quiet
|
|
98
|
-
echo " Done"
|
|
99
|
-
|
|
100
|
-
# Generate types with JavaScript-style naming
|
|
101
|
-
# Uses --lib to reference BCL types from @tsonic/dotnet instead of regenerating them
|
|
102
|
-
# Uses --namespace-map to emit as index.d.ts/index.js for cleaner imports
|
|
103
|
-
# Uses --flatten-class to export Globals methods as top-level functions
|
|
104
|
-
echo "[3/3] Generating TypeScript declarations..."
|
|
105
|
-
dotnet run --project src/tsbindgen/tsbindgen.csproj --no-build -c Release -- \
|
|
106
|
-
generate -a "$JSRUNTIME_DLL" -d "$DOTNET_RUNTIME_PATH" -o "$PROJECT_DIR" \
|
|
107
|
-
--lib "$DOTNET_LIB" \
|
|
108
|
-
--lib "$CORE_LIB" \
|
|
109
|
-
--naming js \
|
|
110
|
-
--namespace-map "Tsonic.JSRuntime=index" \
|
|
111
|
-
--flatten-class "Tsonic.JSRuntime.Globals"
|
|
112
|
-
|
|
113
|
-
echo ""
|
|
114
|
-
echo "================================================================"
|
|
115
|
-
echo "Generation Complete"
|
|
116
|
-
echo "================================================================"
|