| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 77db391 commit 15e7563
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3554,6 +3554,9 @@ Please use `value instanceof WebAssembly.Module` instead. | |||
| 3554 | 3554 | ||
| 3555 | 3555 | <!-- YAML | |
| 3556 | 3556 | changes: | |
| 3557 | + - version: REPLACEME | ||
| 3558 | + pr-url: https://github.com/nodejs/node/pull/51050 | ||
| 3559 | + description: Runtime deprecation. | ||
| 3557 | 3560 | - version: | |
| 3558 | 3561 | - v21.5.0 | |
| 3559 | 3562 | - v20.12.0 | |
@@ -3562,7 +3565,7 @@ changes: | |||
| 3562 | 3565 | description: Documentation-only deprecation. | |
| 3563 | 3566 | --> | |
| 3564 | 3567 | ||
| 3565 | - Type: Documentation-only | ||
| 3568 | + Type: Runtime | ||
| 3566 | 3569 | ||
| 3567 | 3570 | The [`dirent.path`][] is deprecated due to its lack of consistency across | |
| 3568 | 3571 | release lines. Please use [`dirent.parentPath`][] instead. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6763,13 +6763,17 @@ deprecated: | |||
| 6763 | 6763 | - v21.5.0 | |
| 6764 | 6764 | - v20.12.0 | |
| 6765 | 6765 | - v18.20.0 | |
| 6766 | + changes: | ||
| 6767 | + - version: REPLACEME | ||
| 6768 | + pr-url: https://github.com/nodejs/node/pull/51050 | ||
| 6769 | + description: Accessing this property emits a warning. It is now read-only. | ||
| 6766 | 6770 | --> | |
| 6767 | 6771 | ||
| 6768 | 6772 | > Stability: 0 - Deprecated: Use [`dirent.parentPath`][] instead. | |
| 6769 | 6773 | ||
| 6770 | 6774 | * {string} | |
| 6771 | 6775 | ||
| 6772 | - Alias for `dirent.parentPath`. | ||
| 6776 | + Alias for `dirent.parentPath`. Read-only. | ||
| 6773 | 6777 | ||
| 6774 | 6778 | ### Class: `fs.FSWatcher` | |
| 6775 | 6779 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -166,7 +166,6 @@ class Dirent { | |||
| 166 | 166 | constructor(name, type, path) { | |
| 167 | 167 | this.name = name; | |
| 168 | 168 | this.parentPath = path; | |
| 169 | - this.path = path; | ||
| 170 | 169 | this[kType] = type; | |
| 171 | 170 | } | |
| 172 | 171 | ||
@@ -215,6 +214,15 @@ for (const name of ReflectOwnKeys(Dirent.prototype)) { | |||
| 215 | 214 | }; | |
| 216 | 215 | } | |
| 217 | 216 | ||
| 217 | + ObjectDefineProperty(Dirent.prototype, 'path', { | ||
| 218 | + __proto__: null, | ||
| 219 | + get: deprecate(function() { | ||
| 220 | + return this.parentPath; | ||
| 221 | + }, 'dirent.path is deprecated in favor of dirent.parentPath', 'DEP0178'), | ||
| 222 | + configurable: true, | ||
| 223 | + enumerable: false, | ||
| 224 | + }); | ||
| 225 | + | ||
| 218 | 226 | function copyObject(source) { | |
| 219 | 227 | const target = {}; | |
| 220 | 228 | for (const key in source) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -88,6 +88,11 @@ const filename = 'foo'; | |||
| 88 | 88 | common.mustCall((err, dirent) => { | |
| 89 | 89 | assert.strictEqual(err, null); | |
| 90 | 90 | assert.strictEqual(dirent.name, filenameBuffer); | |
| 91 | + common.expectWarning( | ||
| 92 | + 'DeprecationWarning', | ||
| 93 | + 'dirent.path is deprecated in favor of dirent.parentPath', | ||
| 94 | + 'DEP0178'); | ||
| 95 | + assert.deepStrictEqual(dirent.path, Buffer.from(tmpdir.resolve(`${filename}/`))); | ||
| 91 | 96 | }, | |
| 92 | 97 | )); | |
| 93 | 98 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments