@tsonic/js 0.1.2 → 10.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.
@@ -66,7 +66,7 @@ export interface Date$instance {
66
66
  toLocaleDateString(): string;
67
67
  toLocaleString(): string;
68
68
  toLocaleTimeString(): string;
69
- toString(): string;
69
+ ToString(): string;
70
70
  toTimeString(): string;
71
71
  toUTCString(): string;
72
72
  valueOf(): long;
@@ -88,16 +88,16 @@ export type Date = Date$instance;
88
88
 
89
89
  export interface Float32Array$instance {
90
90
  readonly byteLength: int;
91
- item: float;
91
+ Item: float;
92
92
  readonly length: int;
93
93
  at(index: int): Nullable<System_Internal.Single>;
94
94
  fill(value: float, start?: int, end?: Nullable<System_Internal.Int32>): Float32Array;
95
- getEnumerator(): IEnumerator<System_Internal.Single>;
95
+ GetEnumerator(): IEnumerator<System_Internal.Single>;
96
96
  includes(value: float, fromIndex?: int): boolean;
97
97
  indexOf(value: float, fromIndex?: int): int;
98
98
  join(separator?: string): string;
99
99
  reverse(): Float32Array;
100
- set_(array: IEnumerable__System_Collections_Generic<System_Internal.Single>, offset?: int): void;
100
+ set(array: IEnumerable__System_Collections_Generic<System_Internal.Single>, offset?: int): void;
101
101
  slice(begin?: int, end?: Nullable<System_Internal.Int32>): Float32Array;
102
102
  sort(compareFn?: Comparison<System_Internal.Single>): Float32Array;
103
103
  subarray(begin?: int, end?: Nullable<System_Internal.Int32>): Float32Array;
@@ -116,16 +116,16 @@ export type Float32Array = Float32Array$instance;
116
116
 
117
117
  export interface Float64Array$instance {
118
118
  readonly byteLength: int;
119
- item: double;
119
+ Item: double;
120
120
  readonly length: int;
121
121
  at(index: int): Nullable<System_Internal.Double>;
122
122
  fill(value: double, start?: int, end?: Nullable<System_Internal.Int32>): Float64Array;
123
- getEnumerator(): IEnumerator<System_Internal.Double>;
123
+ GetEnumerator(): IEnumerator<System_Internal.Double>;
124
124
  includes(value: double, fromIndex?: int): boolean;
125
125
  indexOf(value: double, fromIndex?: int): int;
126
126
  join(separator?: string): string;
127
127
  reverse(): Float64Array;
128
- set_(array: IEnumerable__System_Collections_Generic<System_Internal.Double>, offset?: int): void;
128
+ set(array: IEnumerable__System_Collections_Generic<System_Internal.Double>, offset?: int): void;
129
129
  slice(begin?: int, end?: Nullable<System_Internal.Int32>): Float64Array;
130
130
  sort(compareFn?: Comparison<System_Internal.Double>): Float64Array;
131
131
  subarray(begin?: int, end?: Nullable<System_Internal.Int32>): Float64Array;
@@ -144,16 +144,16 @@ export type Float64Array = Float64Array$instance;
144
144
 
145
145
  export interface Int16Array$instance {
146
146
  readonly byteLength: int;
147
- item: short;
147
+ Item: short;
148
148
  readonly length: int;
149
149
  at(index: int): Nullable<System_Internal.Int16>;
150
150
  fill(value: short, start?: int, end?: Nullable<System_Internal.Int32>): Int16Array;
151
- getEnumerator(): IEnumerator<System_Internal.Int16>;
151
+ GetEnumerator(): IEnumerator<System_Internal.Int16>;
152
152
  includes(value: short, fromIndex?: int): boolean;
153
153
  indexOf(value: short, fromIndex?: int): int;
154
154
  join(separator?: string): string;
155
155
  reverse(): Int16Array;
156
- set_(array: IEnumerable__System_Collections_Generic<System_Internal.Int16>, offset?: int): void;
156
+ set(array: IEnumerable__System_Collections_Generic<System_Internal.Int16>, offset?: int): void;
157
157
  slice(begin?: int, end?: Nullable<System_Internal.Int32>): Int16Array;
158
158
  sort(compareFn?: Comparison<System_Internal.Int16>): Int16Array;
159
159
  subarray(begin?: int, end?: Nullable<System_Internal.Int32>): Int16Array;
@@ -172,16 +172,16 @@ export type Int16Array = Int16Array$instance;
172
172
 
173
173
  export interface Int32Array$instance {
174
174
  readonly byteLength: int;
175
- item: int;
175
+ Item: int;
176
176
  readonly length: int;
177
177
  at(index: int): Nullable<System_Internal.Int32>;
178
178
  fill(value: int, start?: int, end?: Nullable<System_Internal.Int32>): Int32Array;
179
- getEnumerator(): IEnumerator<System_Internal.Int32>;
179
+ GetEnumerator(): IEnumerator<System_Internal.Int32>;
180
180
  includes(value: int, fromIndex?: int): boolean;
181
181
  indexOf(value: int, fromIndex?: int): int;
182
182
  join(separator?: string): string;
183
183
  reverse(): Int32Array;
184
- set_(array: IEnumerable__System_Collections_Generic<System_Internal.Int32>, offset?: int): void;
184
+ set(array: IEnumerable__System_Collections_Generic<System_Internal.Int32>, offset?: int): void;
185
185
  slice(begin?: int, end?: Nullable<System_Internal.Int32>): Int32Array;
186
186
  sort(compareFn?: Comparison<System_Internal.Int32>): Int32Array;
187
187
  subarray(begin?: int, end?: Nullable<System_Internal.Int32>): Int32Array;
@@ -200,16 +200,16 @@ export type Int32Array = Int32Array$instance;
200
200
 
201
201
  export interface Int8Array$instance {
202
202
  readonly byteLength: int;
203
- item: sbyte;
203
+ Item: sbyte;
204
204
  readonly length: int;
205
205
  at(index: int): Nullable<System_Internal.SByte>;
206
206
  fill(value: sbyte, start?: int, end?: Nullable<System_Internal.Int32>): Int8Array;
207
- getEnumerator(): IEnumerator<System_Internal.SByte>;
207
+ GetEnumerator(): IEnumerator<System_Internal.SByte>;
208
208
  includes(value: sbyte, fromIndex?: int): boolean;
209
209
  indexOf(value: sbyte, fromIndex?: int): int;
210
210
  join(separator?: string): string;
211
211
  reverse(): Int8Array;
212
- set_(array: IEnumerable__System_Collections_Generic<System_Internal.SByte>, offset?: int): void;
212
+ set(array: IEnumerable__System_Collections_Generic<System_Internal.SByte>, offset?: int): void;
213
213
  slice(begin?: int, end?: Nullable<System_Internal.Int32>): Int8Array;
214
214
  sort(compareFn?: Comparison<System_Internal.SByte>): Int8Array;
215
215
  subarray(begin?: int, end?: Nullable<System_Internal.Int32>): Int8Array;
@@ -227,7 +227,7 @@ export const Int8Array: {
227
227
  export type Int8Array = Int8Array$instance;
228
228
 
229
229
  export interface JSArray_1$instance<T> {
230
- item: T;
230
+ Item: T;
231
231
  readonly length: int;
232
232
  at(index: int): T;
233
233
  concat(...items: unknown[]): JSArray_1<T>;
@@ -256,7 +256,7 @@ export interface JSArray_1$instance<T> {
256
256
  forEach(callback: Action<T>): void;
257
257
  forEach(callback: Action<T, System_Internal.Int32>): void;
258
258
  forEach(callback: Action<T, System_Internal.Int32, JSArray_1<T>>): void;
259
- getEnumerator(): IEnumerator<T>;
259
+ GetEnumerator(): IEnumerator<T>;
260
260
  includes(searchElement: T): boolean;
261
261
  indexOf(searchElement: T, fromIndex?: int): int;
262
262
  join(separator?: string): string;
@@ -289,11 +289,11 @@ export interface JSArray_1$instance<T> {
289
289
  toReversed(): JSArray_1<T>;
290
290
  toSorted(compareFunc?: Func<T, T, System_Internal.Double>): JSArray_1<T>;
291
291
  toSpliced(start: int, deleteCount?: Nullable<System_Internal.Int32>, ...items: T[]): JSArray_1<T>;
292
- toString(): string;
292
+ ToString(): string;
293
293
  unshift(item: T): int;
294
294
  unshift(...items: T[]): int;
295
295
  values(): IEnumerable__System_Collections_Generic<T>;
296
- with_(index: int, value: T): JSArray_1<T>;
296
+ with(index: int, value: T): JSArray_1<T>;
297
297
  }
298
298
 
299
299
 
@@ -303,10 +303,10 @@ export const JSArray_1: {
303
303
  new<T>(source: T[]): JSArray_1<T>;
304
304
  new<T>(source: List<T>): JSArray_1<T>;
305
305
  new<T>(source: IEnumerable__System_Collections_Generic<T>): JSArray_1<T>;
306
- from_<T, TSource, TResult>(iterable: IEnumerable__System_Collections_Generic<TSource>, mapFunc: Func<TSource, System_Internal.Int32, TResult>): JSArray_1<TResult>;
307
- from_<T>(iterable: IEnumerable__System_Collections_Generic<T>): JSArray_1<T>;
306
+ from<T, TSource, TResult>(iterable: IEnumerable__System_Collections_Generic<TSource>, mapFunc: Func<TSource, System_Internal.Int32, TResult>): JSArray_1<TResult>;
307
+ from<T>(iterable: IEnumerable__System_Collections_Generic<T>): JSArray_1<T>;
308
308
  isArray<T>(value: unknown): boolean;
309
- of_<T>(...items: T[]): JSArray_1<T>;
309
+ of<T>(...items: T[]): JSArray_1<T>;
310
310
  };
311
311
 
312
312
 
@@ -315,16 +315,16 @@ export type JSArray_1<T> = JSArray_1$instance<T>;
315
315
  export interface Map_2$instance<K, V> {
316
316
  readonly size: int;
317
317
  clear(): void;
318
- delete_(key: K): boolean;
318
+ delete(key: K): boolean;
319
319
  entries(): IEnumerable__System_Collections_Generic<ValueTuple<K, V>>;
320
320
  forEach(callback: Action<V, K, Map_2<K, V>>): void;
321
321
  forEach(callback: Action<V, K>): void;
322
322
  forEach(callback: Action<V>): void;
323
- get_(key: K): V | undefined;
324
- getEnumerator(): IEnumerator<KeyValuePair<K, V>>;
323
+ get(key: K): V | undefined;
324
+ GetEnumerator(): IEnumerator<KeyValuePair<K, V>>;
325
325
  has(key: K): boolean;
326
326
  keys(): IEnumerable__System_Collections_Generic<K>;
327
- set_(key: K, value: V): Map_2<K, V>;
327
+ set(key: K, value: V): Map_2<K, V>;
328
328
  values(): IEnumerable__System_Collections_Generic<V>;
329
329
  }
330
330
 
@@ -349,7 +349,7 @@ export interface RegExp$instance {
349
349
  readonly unicode: boolean;
350
350
  exec(str: string): RegExpMatchResult | undefined;
351
351
  test(str: string): boolean;
352
- toString(): string;
352
+ ToString(): string;
353
353
  }
354
354
 
355
355
 
@@ -365,7 +365,7 @@ export interface RegExpMatchResult$instance {
365
365
  readonly groups: (string | undefined)[];
366
366
  readonly index: int;
367
367
  readonly input: string;
368
- readonly item: string;
368
+ readonly Item: string;
369
369
  readonly length: int;
370
370
  readonly value: string;
371
371
  }
@@ -382,13 +382,13 @@ export interface Set_1$instance<T> {
382
382
  readonly size: int;
383
383
  add(value: T): Set_1<T>;
384
384
  clear(): void;
385
- delete_(value: T): boolean;
385
+ delete(value: T): boolean;
386
386
  difference(other: Set_1<T>): Set_1<T>;
387
387
  entries(): IEnumerable__System_Collections_Generic<ValueTuple<T, T>>;
388
388
  forEach(callback: Action<T, T, Set_1<T>>): void;
389
389
  forEach(callback: Action<T, T>): void;
390
390
  forEach(callback: Action<T>): void;
391
- getEnumerator(): IEnumerator<T>;
391
+ GetEnumerator(): IEnumerator<T>;
392
392
  has(value: T): boolean;
393
393
  intersection(other: Set_1<T>): Set_1<T>;
394
394
  isDisjointFrom(other: Set_1<T>): boolean;
@@ -411,16 +411,16 @@ export type Set_1<T> = Set_1$instance<T>;
411
411
 
412
412
  export interface Uint16Array$instance {
413
413
  readonly byteLength: int;
414
- item: ushort;
414
+ Item: ushort;
415
415
  readonly length: int;
416
416
  at(index: int): Nullable<System_Internal.UInt16>;
417
417
  fill(value: ushort, start?: int, end?: Nullable<System_Internal.Int32>): Uint16Array;
418
- getEnumerator(): IEnumerator<System_Internal.UInt16>;
418
+ GetEnumerator(): IEnumerator<System_Internal.UInt16>;
419
419
  includes(value: ushort, fromIndex?: int): boolean;
420
420
  indexOf(value: ushort, fromIndex?: int): int;
421
421
  join(separator?: string): string;
422
422
  reverse(): Uint16Array;
423
- set_(array: IEnumerable__System_Collections_Generic<System_Internal.UInt16>, offset?: int): void;
423
+ set(array: IEnumerable__System_Collections_Generic<System_Internal.UInt16>, offset?: int): void;
424
424
  slice(begin?: int, end?: Nullable<System_Internal.Int32>): Uint16Array;
425
425
  sort(compareFn?: Comparison<System_Internal.UInt16>): Uint16Array;
426
426
  subarray(begin?: int, end?: Nullable<System_Internal.Int32>): Uint16Array;
@@ -439,16 +439,16 @@ export type Uint16Array = Uint16Array$instance;
439
439
 
440
440
  export interface Uint32Array$instance {
441
441
  readonly byteLength: int;
442
- item: uint;
442
+ Item: uint;
443
443
  readonly length: int;
444
444
  at(index: int): Nullable<System_Internal.UInt32>;
445
445
  fill(value: uint, start?: int, end?: Nullable<System_Internal.Int32>): Uint32Array;
446
- getEnumerator(): IEnumerator<System_Internal.UInt32>;
446
+ GetEnumerator(): IEnumerator<System_Internal.UInt32>;
447
447
  includes(value: uint, fromIndex?: int): boolean;
448
448
  indexOf(value: uint, fromIndex?: int): int;
449
449
  join(separator?: string): string;
450
450
  reverse(): Uint32Array;
451
- set_(array: IEnumerable__System_Collections_Generic<System_Internal.UInt32>, offset?: int): void;
451
+ set(array: IEnumerable__System_Collections_Generic<System_Internal.UInt32>, offset?: int): void;
452
452
  slice(begin?: int, end?: Nullable<System_Internal.Int32>): Uint32Array;
453
453
  sort(compareFn?: Comparison<System_Internal.UInt32>): Uint32Array;
454
454
  subarray(begin?: int, end?: Nullable<System_Internal.Int32>): Uint32Array;
@@ -467,16 +467,16 @@ export type Uint32Array = Uint32Array$instance;
467
467
 
468
468
  export interface Uint8Array$instance {
469
469
  readonly byteLength: int;
470
- item: byte;
470
+ Item: byte;
471
471
  readonly length: int;
472
472
  at(index: int): Nullable<System_Internal.Byte>;
473
473
  fill(value: byte, start?: int, end?: Nullable<System_Internal.Int32>): Uint8Array;
474
- getEnumerator(): IEnumerator<System_Internal.Byte>;
474
+ GetEnumerator(): IEnumerator<System_Internal.Byte>;
475
475
  includes(value: byte, fromIndex?: int): boolean;
476
476
  indexOf(value: byte, fromIndex?: int): int;
477
477
  join(separator?: string): string;
478
478
  reverse(): Uint8Array;
479
- set_(array: IEnumerable__System_Collections_Generic<System_Internal.Byte>, offset?: int): void;
479
+ set(array: IEnumerable__System_Collections_Generic<System_Internal.Byte>, offset?: int): void;
480
480
  slice(begin?: int, end?: Nullable<System_Internal.Int32>): Uint8Array;
481
481
  sort(compareFn?: Comparison<System_Internal.Byte>): Uint8Array;
482
482
  subarray(begin?: int, end?: Nullable<System_Internal.Int32>): Uint8Array;
@@ -495,17 +495,17 @@ export type Uint8Array = Uint8Array$instance;
495
495
 
496
496
  export interface Uint8ClampedArray$instance {
497
497
  readonly byteLength: int;
498
- item: byte;
498
+ Item: byte;
499
499
  readonly length: int;
500
500
  at(index: int): Nullable<System_Internal.Byte>;
501
501
  fill(value: byte, start?: int, end?: Nullable<System_Internal.Int32>): Uint8ClampedArray;
502
- getEnumerator(): IEnumerator<System_Internal.Byte>;
502
+ GetEnumerator(): IEnumerator<System_Internal.Byte>;
503
503
  includes(value: byte, fromIndex?: int): boolean;
504
504
  indexOf(value: byte, fromIndex?: int): int;
505
505
  join(separator?: string): string;
506
506
  reverse(): Uint8ClampedArray;
507
- set_(array: IEnumerable__System_Collections_Generic<System_Internal.Byte>, offset?: int): void;
508
- setClamped(index: int, value: int): void;
507
+ set(array: IEnumerable__System_Collections_Generic<System_Internal.Byte>, offset?: int): void;
508
+ SetClamped(index: int, value: int): void;
509
509
  slice(begin?: int, end?: Nullable<System_Internal.Int32>): Uint8ClampedArray;
510
510
  sort(compareFn?: Comparison<System_Internal.Byte>): Uint8ClampedArray;
511
511
  subarray(begin?: int, end?: Nullable<System_Internal.Int32>): Uint8ClampedArray;
@@ -523,10 +523,10 @@ export const Uint8ClampedArray: {
523
523
  export type Uint8ClampedArray = Uint8ClampedArray$instance;
524
524
 
525
525
  export interface WeakMap_2$instance<K, V> {
526
- delete_(key: K): boolean;
527
- get_(key: K): V | undefined;
526
+ delete(key: K): boolean;
527
+ get(key: K): V | undefined;
528
528
  has(key: K): boolean;
529
- set_(key: K, value: V): WeakMap_2<K, V>;
529
+ set(key: K, value: V): WeakMap_2<K, V>;
530
530
  }
531
531
 
532
532
 
@@ -539,7 +539,7 @@ export type WeakMap_2<K, V> = WeakMap_2$instance<K, V>;
539
539
 
540
540
  export interface WeakSet_1$instance<T> {
541
541
  add(value: T): WeakSet_1<T>;
542
- delete_(value: T): boolean;
542
+ delete(value: T): boolean;
543
543
  has(value: T): boolean;
544
544
  }
545
545
 
@@ -578,19 +578,19 @@ export type console = console$instance;
578
578
 
579
579
  export abstract class Globals$instance {
580
580
  static readonly undefined: unknown | undefined;
581
- static readonly infinity: double;
582
- static readonly naN: double;
583
- static boolean_(value: unknown): boolean;
581
+ static readonly Infinity: double;
582
+ static readonly NaN: double;
583
+ static Boolean(value: unknown): boolean;
584
584
  static decodeURI(uri: string): string;
585
585
  static decodeURIComponent(component: string): string;
586
586
  static encodeURI(uri: string): string;
587
587
  static encodeURIComponent(component: string): string;
588
588
  static isFinite(value: double): boolean;
589
589
  static isNaN(value: double): boolean;
590
- static number_(value: unknown): double;
590
+ static Number(value: unknown): double;
591
591
  static parseFloat(str: string): double;
592
592
  static parseInt(str: string, radix?: Nullable<System_Internal.Int32>): Nullable<System_Internal.Int64>;
593
- static string_(value: unknown): string;
593
+ static String(value: unknown): string;
594
594
  }
595
595
 
596
596
 
@@ -661,7 +661,7 @@ export abstract class Number$instance {
661
661
  static readonly MIN_SAFE_INTEGER: double;
662
662
  static readonly POSITIVE_INFINITY: double;
663
663
  static readonly NEGATIVE_INFINITY: double;
664
- static readonly naN: double;
664
+ static readonly NaN: double;
665
665
  static readonly EPSILON: double;
666
666
  static isFinite(value: double): boolean;
667
667
  static isInteger(value: double): boolean;
package/index.d.ts CHANGED
@@ -45,14 +45,14 @@ export { WeakSet_1 as WeakSet } from './index/internal/index.js';
45
45
 
46
46
  // Flattened exports from static classes
47
47
  // From Tsonic.JSRuntime.Globals
48
- export declare function boolean_(value: unknown): boolean;
48
+ export declare function Boolean(value: unknown): boolean;
49
49
  export declare function decodeURI(uri: string): string;
50
50
  export declare function decodeURIComponent(component: string): string;
51
51
  export declare function encodeURI(uri: string): string;
52
52
  export declare function encodeURIComponent(component: string): string;
53
53
  export declare function isFinite(value: double): boolean;
54
54
  export declare function isNaN(value: double): boolean;
55
- export declare function number_(value: unknown): double;
55
+ export declare function Number(value: unknown): double;
56
56
  export declare function parseFloat(str: string): double;
57
57
  export declare function parseInt(str: string, radix?: Nullable<System_Internal.Int32>): Nullable<System_Internal.Int64>;
58
- export declare function string_(value: unknown): string;
58
+ 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.1.2",
3
+ "version": "10.0.1",
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.8.4",
23
- "@tsonic/core": "^0.6.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 "================================================================"