Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs: add missed FSWatcher.prototype.start deprecation #29989

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2548,6 +2548,20 @@ APIs that do not make sense to use in userland. File streams should always be
opened through their corresponding factory methods [`fs.createWriteStream()`][]
and [`fs.createReadStream()`][]) or by passing a file descriptor in options.

<a id="DEP0XXX"></a>
### DEP0XXX: `FSWatcher.start()`are internal
<!-- YAML
changes:
- version: REPLACEME
pr-url: REPLACEME
description: Runtime deprecation
-->

Type: Runtime

The `FSWatcher.prototype.start()` function is an undocumented internal API that
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional suggestion:

Suggested change
The `FSWatcher.prototype.start()` function is an undocumented internal API that
`FSWatcher.prototype.start()` is an undocumented internal API that

does not make ense to use in userland.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
does not make ense to use in userland.
does not make sense to use in userland.


[`--pending-deprecation`]: cli.html#cli_pending_deprecation
[`--throw-deprecation`]: cli.html#cli_throw_deprecation
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
Expand Down
7 changes: 7 additions & 0 deletions lib/internal/fs/watchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const { toNamespacedPath } = require('path');
const { validateUint32 } = require('internal/validators');
const assert = require('internal/assert');

const { deprecate } = require('internal/util');

const kOldStatus = Symbol('kOldStatus');
const kUseBigint = Symbol('kUseBigint');

Expand Down Expand Up @@ -174,6 +176,11 @@ FSWatcher.prototype[kFSWatchStart] = function(filename,
}
};

FSWatcher.prototype.start = deprecate(
FSWatcher.prototype[kFSWatchStart],
'FSWatcher.prototype.start() is deprecated',
'DEP0XXX');

// This method is a noop if the watcher has not been started or
// has already been closed.
FSWatcher.prototype.close = function() {
Expand Down