@tsonic/tsbindgen 0.7.7 → 0.7.9
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 +39 -25
- package/lib/tsbindgen.dll +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ tsbindgen generates TypeScript declaration files (`.d.ts`) from .NET assemblies
|
|
|
8
8
|
|
|
9
9
|
- **Complete BCL coverage** - Generates declarations for all 130 BCL namespaces, 4,296 types, and 50,675+ members
|
|
10
10
|
- **Zero TypeScript errors** - Output validates cleanly with `tsc --strict`
|
|
11
|
-
- **
|
|
11
|
+
- **CLR primitives** - Numeric type aliases (`int`, `long`, `decimal`, etc.) via `@tsonic/types`
|
|
12
12
|
- **Dual naming modes** - CLR PascalCase (`GetEnumerator`) or JavaScript camelCase (`getEnumerator`)
|
|
13
13
|
- **Generic type preservation** - Full generic type parameter support with constraints
|
|
14
14
|
- **Metadata sidecars** - CLR-specific information (static, virtual, override) in companion JSON files
|
|
@@ -16,8 +16,19 @@ tsbindgen generates TypeScript declaration files (`.d.ts`) from .NET assemblies
|
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
|
+
### Via npm (recommended)
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install tsbindgen
|
|
23
|
+
# or
|
|
24
|
+
npm install @tsonic/tsbindgen
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Requires .NET 10 runtime installed.
|
|
28
|
+
|
|
29
|
+
### From source
|
|
30
|
+
|
|
19
31
|
```bash
|
|
20
|
-
# Clone and build
|
|
21
32
|
git clone https://github.com/tsoniclang/tsbindgen
|
|
22
33
|
cd tsbindgen
|
|
23
34
|
dotnet build src/tsbindgen/tsbindgen.csproj
|
|
@@ -28,30 +39,33 @@ dotnet build src/tsbindgen/tsbindgen.csproj
|
|
|
28
39
|
### Generate BCL declarations
|
|
29
40
|
|
|
30
41
|
```bash
|
|
31
|
-
#
|
|
42
|
+
# Via npm
|
|
43
|
+
npx tsbindgen generate -d ~/.dotnet/shared/Microsoft.NETCore.App/10.0.0 -o ./output
|
|
44
|
+
|
|
45
|
+
# Via dotnet (from source)
|
|
32
46
|
dotnet run --project src/tsbindgen/tsbindgen.csproj -- \
|
|
33
|
-
generate -d ~/.dotnet/shared/Microsoft.NETCore.App/10.0.0
|
|
34
|
-
-o ./output
|
|
47
|
+
generate -d ~/.dotnet/shared/Microsoft.NETCore.App/10.0.0 -o ./output
|
|
35
48
|
```
|
|
36
49
|
|
|
37
50
|
### Generate for a custom assembly
|
|
38
51
|
|
|
39
52
|
```bash
|
|
40
|
-
#
|
|
53
|
+
# Via npm
|
|
54
|
+
npx tsbindgen generate -a ./MyLibrary.dll -d $DOTNET_RUNTIME -o ./output
|
|
55
|
+
|
|
56
|
+
# Via dotnet (from source)
|
|
41
57
|
dotnet run --project src/tsbindgen/tsbindgen.csproj -- \
|
|
42
|
-
generate -a ./MyLibrary.dll
|
|
43
|
-
-d ~/.dotnet/shared/Microsoft.NETCore.App/10.0.0 \
|
|
44
|
-
-o ./output
|
|
58
|
+
generate -a ./MyLibrary.dll -d $DOTNET_RUNTIME -o ./output
|
|
45
59
|
```
|
|
46
60
|
|
|
47
61
|
### Library mode (exclude BCL types)
|
|
48
62
|
|
|
49
63
|
```bash
|
|
50
64
|
# First, generate BCL types
|
|
51
|
-
|
|
65
|
+
npx tsbindgen generate -d $DOTNET_RUNTIME -o ./bcl-types
|
|
52
66
|
|
|
53
67
|
# Then generate your library, importing BCL from the pre-existing package
|
|
54
|
-
|
|
68
|
+
npx tsbindgen generate -a ./MyLibrary.dll -d $DOTNET_RUNTIME -o ./my-lib --lib ./bcl-types
|
|
55
69
|
```
|
|
56
70
|
|
|
57
71
|
## CLI Reference
|
|
@@ -80,16 +94,16 @@ dotnet run -- generate -a ./MyLibrary.dll -d $DOTNET_RUNTIME -o ./my-lib --lib .
|
|
|
80
94
|
|
|
81
95
|
```bash
|
|
82
96
|
# Generate BCL with JavaScript naming
|
|
83
|
-
|
|
97
|
+
npx tsbindgen generate -d $DOTNET_RUNTIME -o ./out --naming js
|
|
84
98
|
|
|
85
99
|
# Generate specific namespaces only
|
|
86
|
-
|
|
100
|
+
npx tsbindgen generate -d $DOTNET_RUNTIME -o ./out -n System,System.Collections.Generic
|
|
87
101
|
|
|
88
102
|
# Verbose output with specific log categories
|
|
89
|
-
|
|
103
|
+
npx tsbindgen generate -d $DOTNET_RUNTIME -o ./out -v --logs ImportPlanner,FacadeEmitter
|
|
90
104
|
|
|
91
105
|
# Strict mode (additional validation)
|
|
92
|
-
|
|
106
|
+
npx tsbindgen generate -d $DOTNET_RUNTIME -o ./out --strict
|
|
93
107
|
```
|
|
94
108
|
|
|
95
109
|
## Output Structure
|
|
@@ -120,19 +134,19 @@ output/
|
|
|
120
134
|
|
|
121
135
|
### Primitive Types
|
|
122
136
|
|
|
123
|
-
CLR primitive types map to
|
|
137
|
+
CLR primitive types map to type aliases from `@tsonic/types`:
|
|
124
138
|
|
|
125
139
|
| CLR Type | TypeScript Type |
|
|
126
140
|
|----------|----------------|
|
|
127
|
-
| `System.Int32` | `int` |
|
|
128
|
-
| `System.Int64` | `long` |
|
|
129
|
-
| `System.Single` | `float` |
|
|
130
|
-
| `System.Double` | `double` |
|
|
131
|
-
| `System.Decimal` | `decimal` |
|
|
132
|
-
| `System.Byte` | `byte` |
|
|
133
|
-
| `System.Boolean` | `
|
|
141
|
+
| `System.Int32` | `int` (alias for `number`) |
|
|
142
|
+
| `System.Int64` | `long` (alias for `number`) |
|
|
143
|
+
| `System.Single` | `float` (alias for `number`) |
|
|
144
|
+
| `System.Double` | `double` (alias for `number`) |
|
|
145
|
+
| `System.Decimal` | `decimal` (alias for `number`) |
|
|
146
|
+
| `System.Byte` | `byte` (alias for `number`) |
|
|
147
|
+
| `System.Boolean` | `bool` (branded) |
|
|
134
148
|
| `System.String` | `string` |
|
|
135
|
-
| `System.Char` | `char` |
|
|
149
|
+
| `System.Char` | `char` (branded) |
|
|
136
150
|
|
|
137
151
|
### Generic Types
|
|
138
152
|
|
|
@@ -240,7 +254,7 @@ dotnet run --project src/tsbindgen/tsbindgen.csproj -- <args>
|
|
|
240
254
|
|
|
241
255
|
- **[@tsonic/dotnet](https://www.npmjs.com/package/@tsonic/dotnet)** - Pre-generated BCL types with JavaScript naming
|
|
242
256
|
- **[@tsonic/dotnet-pure](https://www.npmjs.com/package/@tsonic/dotnet-pure)** - Pre-generated BCL types with CLR naming
|
|
243
|
-
- **[@tsonic/types](https://www.npmjs.com/package/@tsonic/types)** -
|
|
257
|
+
- **[@tsonic/types](https://www.npmjs.com/package/@tsonic/types)** - CLR primitive type aliases
|
|
244
258
|
|
|
245
259
|
## License
|
|
246
260
|
|
package/lib/tsbindgen.dll
CHANGED
|
Binary file
|