Skip to content

Commit eeb1b9d

Browse files
committed
Revert "process: add more version properties to release"
This reverts commit 982e3bd. It is believed that the original PR should not have landed as it is as the implemented and exposed API has a variety of flaws. PR-URL: #19577 Refs: #19438 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent a1c96f8 commit eeb1b9d

File tree

5 files changed

+2
-66
lines changed

5 files changed

+2
-66
lines changed

doc/api/process.md

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,21 +1509,6 @@ tarball.
15091509
- `'Argon'` for the 4.x LTS line beginning with 4.2.0.
15101510
- `'Boron'` for the 6.x LTS line beginning with 6.9.0.
15111511
- `'Carbon'` for the 8.x LTS line beginning with 8.9.1.
1512-
* `majorVersion` {number} The major version of Node.js.
1513-
* `minorVersion` {number} The minor version of Node.js.
1514-
* `patchVersion` {number} The patch version of Node.js.
1515-
* `prereleaseTag` {string} The SemVer pre-release tag for Node.js.
1516-
* `computedVersion` {number} A number representing the current version, created
1517-
using the following method:
1518-
`(majorVersion << 16) + (minorVersion << 8) + patchVersion`
1519-
* `compareVersion` {function} Perform a SemVer comparison to the release
1520-
version.
1521-
* `major`
1522-
* `minor`
1523-
* `patch`
1524-
* Returns: {number} `-1` if the given version is lower than the release
1525-
version, `0` if the given version matches the process version, and `1`
1526-
if the given version is greater than the release version.
15271512

15281513
<!-- eslint-skip -->
15291514
```js
@@ -1532,12 +1517,7 @@ tarball.
15321517
lts: 'Argon',
15331518
sourceUrl: 'https://nodejs.org/download/release/v4.4.5/node-v4.4.5.tar.gz',
15341519
headersUrl: 'https://nodejs.org/download/release/v4.4.5/node-v4.4.5-headers.tar.gz',
1535-
libUrl: 'https://nodejs.org/download/release/v4.4.5/win-x64/node.lib',
1536-
majorVersion: 4,
1537-
minorVersion: 4,
1538-
patchVersion: 5,
1539-
prereleaseTag: '',
1540-
computedVersion: 263173,
1520+
libUrl: 'https://nodejs.org/download/release/v4.4.5/win-x64/node.lib'
15411521
}
15421522
```
15431523

lib/internal/bootstrap/node.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
_process.setupConfig(NativeModule._source);
3939
_process.setupSignalHandlers();
4040
_process.setupUncaughtExceptionCapture(exceptionHandlerState);
41-
_process.setupCompareVersion();
4241
NativeModule.require('internal/process/warning').setup();
4342
NativeModule.require('internal/process/next_tick').setup();
4443
NativeModule.require('internal/process/stdio').setup();

lib/internal/process.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,6 @@ function setupUncaughtExceptionCapture(exceptionHandlerState) {
283283
};
284284
}
285285

286-
function setupCompareVersion() {
287-
const { computedVersion } = process.release;
288-
process.release.compareVersion = (major, minor, patch) => {
289-
const comp = (major << 16) + (minor << 8) + patch;
290-
if (comp === computedVersion)
291-
return 0;
292-
return comp > computedVersion ? 1 : -1;
293-
};
294-
}
295-
296286
module.exports = {
297287
setup_performance,
298288
setup_cpuUsage,
@@ -303,6 +293,5 @@ module.exports = {
303293
setupSignalHandlers,
304294
setupChannel,
305295
setupRawDebug,
306-
setupUncaughtExceptionCapture,
307-
setupCompareVersion,
296+
setupUncaughtExceptionCapture
308297
};

src/node.cc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3022,23 +3022,6 @@ void SetupProcessObject(Environment* env,
30223022
READONLY_PROPERTY(release, "name",
30233023
OneByteString(env->isolate(), NODE_RELEASE));
30243024

3025-
READONLY_PROPERTY(release, "majorVersion",
3026-
Integer::New(env->isolate(), NODE_MAJOR_VERSION));
3027-
READONLY_PROPERTY(release, "minorVersion",
3028-
Integer::New(env->isolate(), NODE_MINOR_VERSION));
3029-
READONLY_PROPERTY(release, "patchVersion",
3030-
Integer::New(env->isolate(), NODE_PATCH_VERSION));
3031-
3032-
READONLY_PROPERTY(release, "prereleaseTag",
3033-
OneByteString(env->isolate(), NODE_TAG));
3034-
3035-
READONLY_PROPERTY(release,
3036-
"computedVersion",
3037-
Integer::New(env->isolate(),
3038-
(NODE_MAJOR_VERSION << 16) +
3039-
(NODE_MINOR_VERSION << 8) +
3040-
NODE_PATCH_VERSION));
3041-
30423025
#if NODE_VERSION_IS_LTS
30433026
READONLY_PROPERTY(release, "lts",
30443027
OneByteString(env->isolate(), NODE_VERSION_LTS_CODENAME));

test/parallel/test-process-release.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,3 @@ if (versionParts[0] === '4' && versionParts[1] >= 2) {
1818
} else {
1919
assert.strictEqual(process.release.lts, undefined);
2020
}
21-
22-
const {
23-
majorVersion: major,
24-
minorVersion: minor,
25-
patchVersion: patch,
26-
computedVersion,
27-
compareVersion,
28-
} = process.release;
29-
30-
assert.strictEqual(
31-
(major << 16) + (minor << 8) + patch, computedVersion);
32-
33-
assert.strictEqual(0, compareVersion(major, minor, patch));
34-
assert.strictEqual(1, compareVersion(major, minor, patch + 1));
35-
assert.strictEqual(-1, compareVersion(major - 1, minor, patch));

0 commit comments

Comments
 (0)