@tsonic/nodejs 10.0.40 → 10.0.42

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 CHANGED
@@ -15,7 +15,7 @@ Use `@tsonic/nodejs` when you want Node-like modules (`fs`, `path`, `events`, `c
15
15
 
16
16
  ```bash
17
17
  mkdir my-app && cd my-app
18
- npx --yes tsonic@latest init --surface nodejs
18
+ npx --yes tsonic@latest init --surface @tsonic/js
19
19
  npx --yes tsonic@latest add npm @tsonic/nodejs
20
20
  ```
21
21
 
@@ -40,11 +40,7 @@ npm run dev
40
40
  npx --yes tsonic@latest add npm @tsonic/nodejs
41
41
  ```
42
42
 
43
- If the workspace is not already Node surface, set:
44
-
45
- ```bash
46
- npx --yes tsonic@latest init --surface nodejs
47
- ```
43
+ `@tsonic/nodejs` is a regular package, not a surface. Use `@tsonic/js` for the ambient JavaScript world, and add `@tsonic/nodejs` when you want `node:*` module imports. If your workspace is still on CLR, switch its `surface` to `@tsonic/js` first.
48
44
 
49
45
  ## Versioning
50
46
 
@@ -52,7 +48,13 @@ This repo is versioned by runtime major:
52
48
 
53
49
  - `10` → `versions/10/` → npm: `@tsonic/nodejs@10.x`
54
50
 
55
- When publishing, run: `npm publish versions/10 --access public`
51
+ Before publishing, run `npm run selftest`.
52
+
53
+ Publish with:
54
+
55
+ ```bash
56
+ npm run publish:10
57
+ ```
56
58
 
57
59
  ## Core Modules (what you get)
58
60
 
@@ -93,10 +95,10 @@ emitter.on("data", (chunk) => console.log(chunk));
93
95
  ### Crypto
94
96
 
95
97
  ```ts
96
- import { randomUUID } from "node:crypto";
98
+ import { createHash } from "node:crypto";
97
99
 
98
- const id = randomUUID();
99
- void id;
100
+ const hash = createHash("sha256").update("hello").digest("hex");
101
+ void hash;
100
102
  ```
101
103
 
102
104
  ### Process
@@ -111,22 +113,25 @@ void cwd;
111
113
  ### HTTP
112
114
 
113
115
  ```typescript
114
- import { http } from "@tsonic/nodejs/nodejs.Http.js";
116
+ import { createServer } from "node:http";
117
+
118
+ const server = createServer((_req, res) => {
119
+ res.writeHead(200, "OK");
120
+ res.end("Hello from Tsonic!");
121
+ });
122
+
123
+ void server;
115
124
  ```
116
125
 
117
126
  ## Imports (important)
118
127
 
119
- For `--surface nodejs` projects, prefer Node-style imports:
128
+ For JS-surface projects with `@tsonic/nodejs` installed, prefer Node-style imports:
120
129
 
121
130
  - `node:fs`, `node:path`, `node:crypto`, `node:process`, ...
122
131
  - bare aliases (`fs`, `path`, `crypto`, ...) are also supported
123
132
 
124
133
  Direct ESM imports from `@tsonic/nodejs/index.js` are still supported.
125
134
 
126
- `node:http` is currently not mapped by the surface alias set; use:
127
-
128
- - `@tsonic/nodejs/nodejs.Http.js`
129
-
130
135
  ## Relationship to `@tsonic/js`
131
136
 
132
137
  - `@tsonic/js` provides JavaScript runtime APIs (JS-style `console`, `JSON`, timers, etc.)
@@ -147,6 +152,14 @@ Direct ESM imports from `@tsonic/nodejs/index.js` are still supported.
147
152
 
148
153
  See `__build/` for regeneration scripts.
149
154
 
155
+ Run the publish-gated validation suite with:
156
+
157
+ ```bash
158
+ npm run selftest
159
+ ```
160
+
161
+ When sibling `@tsonic/*` repos are checked out locally, the selftest installs those local packages first, whether they are versioned package repos (for example `../js/versions/10`) or root-package repos (for example `../aspnetcore`). That keeps the consumer validation coherent across a local release wave instead of mixing one local package with stale published transitive dependencies. The selftest also fails on peer-dependency warnings, so stale local release waves are caught before publish.
162
+
150
163
  ## License
151
164
 
152
165
  MIT