From 8accb846e8bee9bdfc8ddd75b5a275f5c1ba431d Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Mon, 12 Aug 2024 11:03:46 +0100 Subject: [PATCH] lib: `Symbol.dispose` should be enabled with experimental flag The TC39 explicit resource management proposal is still at stage 3 and under active development. It must be enabled with an experimental flag `--experimental-explicit-resource-management`. The flag implies that the V8 option `--js-explicit-resource-management` to be enabled. When `--experimental-explicit-resource-management` flag is not set, an experimental warning is emitted. --- doc/api/cli.md | 12 ++++ doc/api/test.md | 2 + lib/internal/process/pre_execution.js | 62 +++++++++++++------ src/node_options.cc | 13 ++++ src/node_options.h | 1 + test/parallel/test-child-process-destroy.js | 2 + test/parallel/test-dgram-async-dispose.mjs | 2 + .../test-events-add-abort-listener.mjs | 2 + .../test-fs-promises-file-handle-dispose.js | 2 + .../test-http-server-async-dispose.js | 2 + .../test-http2-server-async-dispose.js | 2 + .../test-https-server-async-dispose.js | 2 + .../test-net-server-async-dispose.mjs | 2 + test/parallel/test-runner-mock-timers.js | 2 + test/parallel/test-stream-duplex-destroy.js | 2 + test/parallel/test-stream-readable-dispose.js | 2 + .../parallel/test-stream-transform-destroy.js | 2 + test/parallel/test-stream-writable-destroy.js | 2 + test/parallel/test-timers-dispose.js | 2 + .../test-inspector-open-dispose.mjs | 2 + 20 files changed, 102 insertions(+), 18 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index c0dfcd418b96a1..fcae1cd0e13297 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -941,6 +941,14 @@ added: v22.3.0 Enable exposition of [EventSource Web API][] on the global scope. +### `--experimental-explicit-resource-management` + + + +Use this flag to enable [Explicit Resource Management][] support. + ### `--experimental-import-meta-resolve`