@napi-rs/cli 3.10.0 → 3.10.2
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/dist/cli.js +445 -26
- package/dist/index.cjs +445 -26
- package/dist/index.d.cts +1 -1
- package/dist/index.js +445 -26
- package/docs/wasi.md +17 -0
- package/package.json +1 -1
- package/src/api/__tests__/__snapshots__/templates.spec.ts.md +1492 -86
- package/src/api/__tests__/__snapshots__/templates.spec.ts.snap +0 -0
- package/src/api/__tests__/templates.spec.ts +223 -0
- package/src/api/templates/load-wasi-template.ts +473 -36
- package/src/utils/__tests__/reconciliation.spec.ts +9 -2
package/docs/wasi.md
CHANGED
|
@@ -336,6 +336,23 @@ Consumers that need deterministic cleanup before process exit should use the
|
|
|
336
336
|
deferred loader and call its `dispose()` function, or the `dispose` returned by
|
|
337
337
|
`createInstance()`.
|
|
338
338
|
|
|
339
|
+
Every termination goes through the emnapi thread manager
|
|
340
|
+
(`PThread.terminateWorker`) rather than a bare `worker.terminate()`. The manager
|
|
341
|
+
counts a worker exit as expected only for terminations it performed itself and
|
|
342
|
+
reports any other one as a worker failure — a throw that lands inside Node.js's
|
|
343
|
+
`exit` emit and strands the promise the termination depends on. The manager is
|
|
344
|
+
captured while the emnapi module is being created, before the wasm is loaded, so
|
|
345
|
+
it is reachable even from the initialization rollback — the one path where
|
|
346
|
+
instantiation never returned.
|
|
347
|
+
|
|
348
|
+
Disposal holds the event loop open with a timer of its own until the
|
|
349
|
+
terminations settle, so `await dispose()` resolves even as the last statement of
|
|
350
|
+
a script. The pool workers cannot do that themselves: they are unreferenced so
|
|
351
|
+
an idle binding never keeps a process alive, and emnapi unreferences them again
|
|
352
|
+
whenever one reports that its thread is ready. The timer is released the moment
|
|
353
|
+
the terminations settle, and a binding that is never disposed still does not
|
|
354
|
+
hold an idle process open.
|
|
355
|
+
|
|
339
356
|
When type generation is disabled, the generated browser root exposes the
|
|
340
357
|
binding as its default export. `napi new` also removes the template's
|
|
341
358
|
`index.d.ts` and declaration metadata instead of publishing stale template
|