@tsonic/nodejs 10.0.12 → 10.0.16
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 +57 -17
- package/index/bindings.json +0 -60
- package/index/internal/index.d.ts +0 -3
- package/package.json +3 -3
- package/tsonic.bindings.json +10 -0
package/README.md
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
# @tsonic/nodejs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node-style APIs for **Tsonic** (TypeScript → .NET).
|
|
4
|
+
|
|
5
|
+
Use `@tsonic/nodejs` when you want Node-like modules (`fs`, `path`, `events`, `crypto`, `process`, `http`, …) while still compiling to a native binary with `tsonic`.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
### New project
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
mkdir my-app && cd my-app
|
|
13
|
+
tsonic init
|
|
14
|
+
tsonic add npm @tsonic/nodejs
|
|
15
|
+
npm run dev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Existing project
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
tsonic add npm @tsonic/nodejs
|
|
22
|
+
```
|
|
4
23
|
|
|
5
24
|
## Versioning
|
|
6
25
|
|
|
@@ -10,18 +29,10 @@ This repo is versioned by **.NET major**:
|
|
|
10
29
|
|
|
11
30
|
When publishing, run: `npm publish versions/10 --access public`
|
|
12
31
|
|
|
13
|
-
##
|
|
32
|
+
## Core Modules (what you get)
|
|
14
33
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- **Primitive aliases** - `int`, `long`, `decimal`, etc. via `@tsonic/core`
|
|
18
|
-
- **Full type safety** - Complete TypeScript declarations
|
|
19
|
-
|
|
20
|
-
## Installation
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install @tsonic/nodejs @tsonic/dotnet @tsonic/core
|
|
24
|
-
```
|
|
34
|
+
- `fs`, `path`, `events`, `crypto`, `process`
|
|
35
|
+
- `http` (separate module entrypoint)
|
|
25
36
|
|
|
26
37
|
## Usage
|
|
27
38
|
|
|
@@ -50,19 +61,51 @@ const dir = path.dirname(fullPath);
|
|
|
50
61
|
### Events
|
|
51
62
|
|
|
52
63
|
```typescript
|
|
53
|
-
import { EventEmitter } from "@tsonic/nodejs/index.js";
|
|
64
|
+
import { EventEmitter, console } from "@tsonic/nodejs/index.js";
|
|
54
65
|
|
|
55
66
|
class MyEmitter extends EventEmitter {}
|
|
56
67
|
const emitter = new MyEmitter();
|
|
57
68
|
emitter.on("data", (chunk) => console.log(chunk));
|
|
58
69
|
```
|
|
59
70
|
|
|
71
|
+
### Crypto
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { crypto } from "@tsonic/nodejs/index.js";
|
|
75
|
+
|
|
76
|
+
const hash = crypto.createHash("sha256").update("hello").digest("hex");
|
|
77
|
+
void hash;
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Process
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { process } from "@tsonic/nodejs/index.js";
|
|
84
|
+
|
|
85
|
+
const cwd = process.cwd();
|
|
86
|
+
void cwd;
|
|
87
|
+
```
|
|
88
|
+
|
|
60
89
|
### HTTP
|
|
61
90
|
|
|
62
91
|
```typescript
|
|
63
92
|
import { http } from "@tsonic/nodejs/nodejs.Http.js";
|
|
64
93
|
```
|
|
65
94
|
|
|
95
|
+
## Imports (important)
|
|
96
|
+
|
|
97
|
+
This is an ESM package. Import from the explicit entrypoints:
|
|
98
|
+
|
|
99
|
+
- `@tsonic/nodejs/index.js` for most Node-style APIs (`fs`, `path`, `crypto`, `process`, …)
|
|
100
|
+
- submodules like `@tsonic/nodejs/nodejs.Http.js` for separately emitted namespaces
|
|
101
|
+
|
|
102
|
+
Node’s built-in specifiers like `node:fs` are **not** supported here.
|
|
103
|
+
|
|
104
|
+
## Relationship to `@tsonic/js`
|
|
105
|
+
|
|
106
|
+
- `@tsonic/js` provides JavaScript runtime APIs (JS-style `console`, `JSON`, timers, etc.)
|
|
107
|
+
- `@tsonic/nodejs` provides Node-style modules (`fs`, `path`, `crypto`, `http`, etc.)
|
|
108
|
+
|
|
66
109
|
## Documentation
|
|
67
110
|
|
|
68
111
|
- `docs/README.md`
|
|
@@ -70,10 +113,7 @@ import { http } from "@tsonic/nodejs/nodejs.Http.js";
|
|
|
70
113
|
|
|
71
114
|
## Naming Conventions
|
|
72
115
|
|
|
73
|
-
- **
|
|
74
|
-
- **Members**: camelCase (TypeScript convention)
|
|
75
|
-
|
|
76
|
-
To generate CLR/PascalCase member names, regenerate with `--naming clr` (or omit `--naming js`).
|
|
116
|
+
- `@tsonic/nodejs` intentionally uses **Node/JS-style naming** (camelCase members).
|
|
77
117
|
|
|
78
118
|
## Development
|
|
79
119
|
|
package/index/bindings.json
CHANGED
|
@@ -11756,26 +11756,6 @@
|
|
|
11756
11756
|
"declaringClrType": "nodejs.PassThrough",
|
|
11757
11757
|
"declaringAssemblyName": "nodejs",
|
|
11758
11758
|
"isExtensionMethod": false
|
|
11759
|
-
},
|
|
11760
|
-
{
|
|
11761
|
-
"stableId": "nodejs:nodejs.PassThrough::_transform(System.Object,System.String,System.Action_2):System.Void",
|
|
11762
|
-
"clrName": "_transform",
|
|
11763
|
-
"metadataToken": 0,
|
|
11764
|
-
"canonicalSignature": "(System.Object,System.String,System.Action_2):System.Void",
|
|
11765
|
-
"normalizedSignature": "_transform|(System.Object,System.String,System.Action_2):System.Void|static=false",
|
|
11766
|
-
"emitScope": "ClassSurface",
|
|
11767
|
-
"provenance": "BaseOverload",
|
|
11768
|
-
"arity": 0,
|
|
11769
|
-
"parameterCount": 3,
|
|
11770
|
-
"isStatic": false,
|
|
11771
|
-
"isAbstract": false,
|
|
11772
|
-
"isVirtual": true,
|
|
11773
|
-
"isOverride": false,
|
|
11774
|
-
"isSealed": false,
|
|
11775
|
-
"visibility": "Protected",
|
|
11776
|
-
"declaringClrType": "nodejs.PassThrough",
|
|
11777
|
-
"declaringAssemblyName": "nodejs",
|
|
11778
|
-
"isExtensionMethod": false
|
|
11779
11759
|
}
|
|
11780
11760
|
],
|
|
11781
11761
|
"properties": [],
|
|
@@ -19677,46 +19657,6 @@
|
|
|
19677
19657
|
"declaringClrType": "nodejs.TLSSocket",
|
|
19678
19658
|
"declaringAssemblyName": "nodejs",
|
|
19679
19659
|
"isExtensionMethod": false
|
|
19680
|
-
},
|
|
19681
|
-
{
|
|
19682
|
-
"stableId": "nodejs:nodejs.TLSSocket::write(System.Byte[],System.Action_1):System.Boolean",
|
|
19683
|
-
"clrName": "write",
|
|
19684
|
-
"metadataToken": 0,
|
|
19685
|
-
"canonicalSignature": "(System.Byte[],System.Action_1):System.Boolean",
|
|
19686
|
-
"normalizedSignature": "write|(System.Byte[],System.Action_1):System.Boolean|static=false",
|
|
19687
|
-
"emitScope": "ClassSurface",
|
|
19688
|
-
"provenance": "BaseOverload",
|
|
19689
|
-
"arity": 0,
|
|
19690
|
-
"parameterCount": 2,
|
|
19691
|
-
"isStatic": false,
|
|
19692
|
-
"isAbstract": false,
|
|
19693
|
-
"isVirtual": false,
|
|
19694
|
-
"isOverride": false,
|
|
19695
|
-
"isSealed": false,
|
|
19696
|
-
"visibility": "Public",
|
|
19697
|
-
"declaringClrType": "nodejs.TLSSocket",
|
|
19698
|
-
"declaringAssemblyName": "nodejs",
|
|
19699
|
-
"isExtensionMethod": false
|
|
19700
|
-
},
|
|
19701
|
-
{
|
|
19702
|
-
"stableId": "nodejs:nodejs.TLSSocket::write(System.String,System.String,System.Action_1):System.Boolean",
|
|
19703
|
-
"clrName": "write",
|
|
19704
|
-
"metadataToken": 0,
|
|
19705
|
-
"canonicalSignature": "(System.String,System.String,System.Action_1):System.Boolean",
|
|
19706
|
-
"normalizedSignature": "write|(System.String,System.String,System.Action_1):System.Boolean|static=false",
|
|
19707
|
-
"emitScope": "ClassSurface",
|
|
19708
|
-
"provenance": "BaseOverload",
|
|
19709
|
-
"arity": 0,
|
|
19710
|
-
"parameterCount": 3,
|
|
19711
|
-
"isStatic": false,
|
|
19712
|
-
"isAbstract": false,
|
|
19713
|
-
"isVirtual": false,
|
|
19714
|
-
"isOverride": false,
|
|
19715
|
-
"isSealed": false,
|
|
19716
|
-
"visibility": "Public",
|
|
19717
|
-
"declaringClrType": "nodejs.TLSSocket",
|
|
19718
|
-
"declaringAssemblyName": "nodejs",
|
|
19719
|
-
"isExtensionMethod": false
|
|
19720
19660
|
}
|
|
19721
19661
|
],
|
|
19722
19662
|
"properties": [
|
|
@@ -1351,7 +1351,6 @@ export interface PassThrough$instance extends Transform {
|
|
|
1351
1351
|
readonly __tsonic_type_nodejs_PassThrough: never;
|
|
1352
1352
|
|
|
1353
1353
|
_transform(chunk: unknown, encoding: string, callback: Action_2<Exception, unknown>): void;
|
|
1354
|
-
_transform(chunk: unknown, encoding: string, callback: Action_2<Exception, unknown>): void;
|
|
1355
1354
|
}
|
|
1356
1355
|
|
|
1357
1356
|
|
|
@@ -2313,8 +2312,6 @@ export interface TLSSocket$instance extends Socket {
|
|
|
2313
2312
|
setMaxSendFragment(size: int): boolean;
|
|
2314
2313
|
write(data: byte[], callback?: Action_1<Exception>): boolean;
|
|
2315
2314
|
write(data: string, encoding?: string, callback?: Action_1<Exception>): boolean;
|
|
2316
|
-
write(data: byte[], callback?: Action_1<Exception>): boolean;
|
|
2317
|
-
write(data: string, encoding?: string, callback?: Action_1<Exception>): boolean;
|
|
2318
2315
|
}
|
|
2319
2316
|
|
|
2320
2317
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsonic/nodejs",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.16",
|
|
4
4
|
"description": "TypeScript type definitions for Node.js CLR library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"url": "https://github.com/tsoniclang/nodejs.git"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@tsonic/dotnet": "10.0.
|
|
23
|
-
"@tsonic/core": "10.0.
|
|
22
|
+
"@tsonic/dotnet": "10.0.16",
|
|
23
|
+
"@tsonic/core": "10.0.16"
|
|
24
24
|
}
|
|
25
25
|
}
|