node-semvers 1.2.1 → 1.2.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/assets/postinstall.cjs +19 -9
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/lib/existsSync.js +25 -0
- package/dist/cjs/lib/existsSync.js.map +1 -0
- package/dist/cjs/lib/packageRoot.js +7 -4
- package/dist/cjs/lib/packageRoot.js.map +1 -1
- package/dist/esm/constants.mjs +1 -1
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/lib/existsSync.mjs +9 -0
- package/dist/esm/lib/existsSync.mjs.map +1 -0
- package/dist/esm/lib/packageRoot.mjs +7 -4
- package/dist/esm/lib/packageRoot.mjs.map +1 -1
- package/dist/types/lib/existsSync.d.ts +1 -0
- package/dist/types/lib/packageRoot.d.ts +1 -1
- package/package.json +4 -3
package/assets/postinstall.cjs
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('exit'), require('fetch-json-cache'), require('path'), require('url')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exit', 'fetch-json-cache', 'path', 'url'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.tsdsBuild = factory(global.exit, global.Cache, global.path, global.url));
|
|
5
|
-
})(this, (function (exit, Cache, path, url) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('exit'), require('fetch-json-cache'), require('path'), require('url'), require('fs'), require('fs-access-sync-compat')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exit', 'fetch-json-cache', 'path', 'url', 'fs', 'fs-access-sync-compat'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.tsdsBuild = factory(global.exit, global.Cache, global.path, global.url, global.fs, global.accessSync));
|
|
5
|
+
})(this, (function (exit, Cache, path, url, fs, accessSync) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
8
|
-
function
|
|
9
|
-
|
|
8
|
+
function existsSync(path) {
|
|
9
|
+
try {
|
|
10
|
+
accessSync(path);
|
|
11
|
+
return true;
|
|
12
|
+
} catch (_err) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function packageRoot(dir) {
|
|
18
|
+
var packagePath = path.join(dir, 'package.json');
|
|
19
|
+
if (existsSync(packagePath) && JSON.parse(fs.readFileSync(packagePath, 'utf8')).name) return dir;
|
|
10
20
|
var nextDir = path.dirname(dir);
|
|
11
|
-
if (nextDir === dir) throw new Error(
|
|
12
|
-
return packageRoot(nextDir
|
|
21
|
+
if (nextDir === dir) throw new Error('Package root not found');
|
|
22
|
+
return packageRoot(nextDir);
|
|
13
23
|
}
|
|
14
24
|
|
|
15
25
|
var __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('postinstall.cjs', document.baseURI).href))));
|
|
16
|
-
var root = packageRoot(__dirname
|
|
26
|
+
var root = packageRoot(__dirname);
|
|
17
27
|
var constants = {
|
|
18
28
|
CACHE_DIRECTORY: path.resolve(path.join(root, '.cache')),
|
|
19
29
|
DISTS_URL: 'https://nodejs.org/dist/index.json',
|
package/dist/cjs/constants.js
CHANGED
|
@@ -17,7 +17,7 @@ function _interop_require_default(obj) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
var __dirname = _path.default.dirname(typeof __filename !== 'undefined' ? __filename : _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()));
|
|
20
|
-
var root = (0, _packageRoot.default)(__dirname
|
|
20
|
+
var root = (0, _packageRoot.default)(__dirname);
|
|
21
21
|
var _default = {
|
|
22
22
|
CACHE_DIRECTORY: _path.default.resolve(_path.default.join(root, '.cache')),
|
|
23
23
|
DISTS_URL: 'https://nodejs.org/dist/index.json',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["constants.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\nimport packageRoot from './lib/packageRoot.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst root = packageRoot(__dirname
|
|
1
|
+
{"version":3,"sources":["constants.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\nimport packageRoot from './lib/packageRoot.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst root = packageRoot(__dirname);\n\nexport default {\n CACHE_DIRECTORY: path.resolve(path.join(root, '.cache')),\n DISTS_URL: 'https://nodejs.org/dist/index.json',\n SCHEDULES_URL: 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json',\n};\n"],"names":["__dirname","path","dirname","__filename","url","fileURLToPath","root","packageRoot","CACHE_DIRECTORY","resolve","join","DISTS_URL","SCHEDULES_URL"],"mappings":";;;;+BAQA;;;eAAA;;;2DARiB;0DACD;kEAEQ;;;;;;AAExB,IAAMA,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaC,YAAG,CAACC,aAAa,CAAC;AAClG,IAAMC,OAAOC,IAAAA,oBAAW,EAACP;IAEzB,WAAe;IACbQ,iBAAiBP,aAAI,CAACQ,OAAO,CAACR,aAAI,CAACS,IAAI,CAACJ,MAAM;IAC9CK,WAAW;IACXC,eAAe;AACjB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return existsSync;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _fsaccesssynccompat = /*#__PURE__*/ _interop_require_default(require("fs-access-sync-compat"));
|
|
12
|
+
function _interop_require_default(obj) {
|
|
13
|
+
return obj && obj.__esModule ? obj : {
|
|
14
|
+
default: obj
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function existsSync(path) {
|
|
18
|
+
try {
|
|
19
|
+
(0, _fsaccesssynccompat.default)(path);
|
|
20
|
+
return true;
|
|
21
|
+
} catch (_err) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["existsSync.ts"],"sourcesContent":["import accessSync from 'fs-access-sync-compat';\n\nexport default function existsSync(path) {\n try {\n accessSync(path);\n return true;\n } catch (_err) {\n return false;\n }\n}\n"],"names":["existsSync","path","accessSync","_err"],"mappings":";;;;+BAEA;;;eAAwBA;;;yEAFD;;;;;;AAER,SAASA,WAAWC,IAAI;IACrC,IAAI;QACFC,IAAAA,2BAAU,EAACD;QACX,OAAO;IACT,EAAE,OAAOE,MAAM;QACb,OAAO;IACT;AACF"}
|
|
@@ -8,16 +8,19 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return packageRoot;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
11
12
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
|
+
var _existsSync = /*#__PURE__*/ _interop_require_default(require("./existsSync.js"));
|
|
12
14
|
function _interop_require_default(obj) {
|
|
13
15
|
return obj && obj.__esModule ? obj : {
|
|
14
16
|
default: obj
|
|
15
17
|
};
|
|
16
18
|
}
|
|
17
|
-
function packageRoot(dir
|
|
18
|
-
|
|
19
|
+
function packageRoot(dir) {
|
|
20
|
+
var packagePath = _path.default.join(dir, 'package.json');
|
|
21
|
+
if ((0, _existsSync.default)(packagePath) && JSON.parse(_fs.default.readFileSync(packagePath, 'utf8')).name) return dir;
|
|
19
22
|
var nextDir = _path.default.dirname(dir);
|
|
20
|
-
if (nextDir === dir) throw new Error(
|
|
21
|
-
return packageRoot(nextDir
|
|
23
|
+
if (nextDir === dir) throw new Error('Package root not found');
|
|
24
|
+
return packageRoot(nextDir);
|
|
22
25
|
}
|
|
23
26
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packageRoot.ts"],"sourcesContent":["import path from 'path';\n\nexport default function packageRoot(dir
|
|
1
|
+
{"version":3,"sources":["packageRoot.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport existsSync from './existsSync.js';\n\nexport default function packageRoot(dir) {\n const packagePath = path.join(dir, 'package.json');\n if (existsSync(packagePath) && JSON.parse(fs.readFileSync(packagePath, 'utf8')).name) return dir;\n const nextDir = path.dirname(dir);\n if (nextDir === dir) throw new Error('Package root not found');\n return packageRoot(nextDir);\n}\n"],"names":["packageRoot","dir","packagePath","path","join","existsSync","JSON","parse","fs","readFileSync","name","nextDir","dirname","Error"],"mappings":";;;;+BAIA;;;eAAwBA;;;yDAJT;2DACE;iEACM;;;;;;AAER,SAASA,YAAYC,GAAG;IACrC,IAAMC,cAAcC,aAAI,CAACC,IAAI,CAACH,KAAK;IACnC,IAAII,IAAAA,mBAAU,EAACH,gBAAgBI,KAAKC,KAAK,CAACC,WAAE,CAACC,YAAY,CAACP,aAAa,SAASQ,IAAI,EAAE,OAAOT;IAC7F,IAAMU,UAAUR,aAAI,CAACS,OAAO,CAACX;IAC7B,IAAIU,YAAYV,KAAK,MAAM,IAAIY,MAAM;IACrC,OAAOb,YAAYW;AACrB"}
|
package/dist/esm/constants.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import path from 'path';
|
|
|
2
2
|
import url from 'url';
|
|
3
3
|
import packageRoot from './lib/packageRoot.mjs';
|
|
4
4
|
const __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));
|
|
5
|
-
const root = packageRoot(__dirname
|
|
5
|
+
const root = packageRoot(__dirname);
|
|
6
6
|
export default {
|
|
7
7
|
CACHE_DIRECTORY: path.resolve(path.join(root, '.cache')),
|
|
8
8
|
DISTS_URL: 'https://nodejs.org/dist/index.json',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["constants.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\nimport packageRoot from './lib/packageRoot.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst root = packageRoot(__dirname
|
|
1
|
+
{"version":3,"sources":["constants.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\n\nimport packageRoot from './lib/packageRoot.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst root = packageRoot(__dirname);\n\nexport default {\n CACHE_DIRECTORY: path.resolve(path.join(root, '.cache')),\n DISTS_URL: 'https://nodejs.org/dist/index.json',\n SCHEDULES_URL: 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json',\n};\n"],"names":["path","url","packageRoot","__dirname","dirname","__filename","fileURLToPath","root","CACHE_DIRECTORY","resolve","join","DISTS_URL","SCHEDULES_URL"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AAEtB,OAAOC,iBAAiB,uBAAuB;AAE/C,MAAMC,YAAYH,KAAKI,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaJ,IAAIK,aAAa,CAAC,YAAYL,GAAG;AACjH,MAAMM,OAAOL,YAAYC;AAEzB,eAAe;IACbK,iBAAiBR,KAAKS,OAAO,CAACT,KAAKU,IAAI,CAACH,MAAM;IAC9CI,WAAW;IACXC,eAAe;AACjB,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["existsSync.ts"],"sourcesContent":["import accessSync from 'fs-access-sync-compat';\n\nexport default function existsSync(path) {\n try {\n accessSync(path);\n return true;\n } catch (_err) {\n return false;\n }\n}\n"],"names":["accessSync","existsSync","path","_err"],"mappings":"AAAA,OAAOA,gBAAgB,wBAAwB;AAE/C,eAAe,SAASC,WAAWC,IAAI;IACrC,IAAI;QACFF,WAAWE;QACX,OAAO;IACT,EAAE,OAAOC,MAAM;QACb,OAAO;IACT;AACF"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
1
2
|
import path from 'path';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
import existsSync from './existsSync.mjs';
|
|
4
|
+
export default function packageRoot(dir) {
|
|
5
|
+
const packagePath = path.join(dir, 'package.json');
|
|
6
|
+
if (existsSync(packagePath) && JSON.parse(fs.readFileSync(packagePath, 'utf8')).name) return dir;
|
|
4
7
|
const nextDir = path.dirname(dir);
|
|
5
|
-
if (nextDir === dir) throw new Error(
|
|
6
|
-
return packageRoot(nextDir
|
|
8
|
+
if (nextDir === dir) throw new Error('Package root not found');
|
|
9
|
+
return packageRoot(nextDir);
|
|
7
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packageRoot.ts"],"sourcesContent":["import path from 'path';\n\nexport default function packageRoot(dir
|
|
1
|
+
{"version":3,"sources":["packageRoot.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport existsSync from './existsSync.js';\n\nexport default function packageRoot(dir) {\n const packagePath = path.join(dir, 'package.json');\n if (existsSync(packagePath) && JSON.parse(fs.readFileSync(packagePath, 'utf8')).name) return dir;\n const nextDir = path.dirname(dir);\n if (nextDir === dir) throw new Error('Package root not found');\n return packageRoot(nextDir);\n}\n"],"names":["fs","path","existsSync","packageRoot","dir","packagePath","join","JSON","parse","readFileSync","name","nextDir","dirname","Error"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,gBAAgB,kBAAkB;AAEzC,eAAe,SAASC,YAAYC,GAAG;IACrC,MAAMC,cAAcJ,KAAKK,IAAI,CAACF,KAAK;IACnC,IAAIF,WAAWG,gBAAgBE,KAAKC,KAAK,CAACR,GAAGS,YAAY,CAACJ,aAAa,SAASK,IAAI,EAAE,OAAON;IAC7F,MAAMO,UAAUV,KAAKW,OAAO,CAACR;IAC7B,IAAIO,YAAYP,KAAK,MAAM,IAAIS,MAAM;IACrC,OAAOV,YAAYQ;AACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function existsSync(path: any): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function packageRoot(dir: any
|
|
1
|
+
export default function packageRoot(dir: any): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-semvers",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Utilities for managing versions of node including looking up codenames",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -46,11 +46,12 @@
|
|
|
46
46
|
"postinstall": "node scripts/postinstall.cjs",
|
|
47
47
|
"test": "tsds test:node --no-timeouts",
|
|
48
48
|
"test:engines": "nvu engines npm test",
|
|
49
|
-
"version": ""
|
|
49
|
+
"version": "tsds version"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"exit": "^0.1.2",
|
|
53
53
|
"fetch-json-cache": "^1.2.1",
|
|
54
|
+
"fs-access-sync-compat": "^1.0.2",
|
|
54
55
|
"getopts-compat": "^2.2.5",
|
|
55
56
|
"isarray": "^2.0.5",
|
|
56
57
|
"semver": "^5.7.1"
|
|
@@ -67,7 +68,7 @@
|
|
|
67
68
|
"rimraf2": "^2.8.2",
|
|
68
69
|
"rollup": "^4.29.1",
|
|
69
70
|
"rollup-plugin-node-externals": "^8.0.0",
|
|
70
|
-
"ts-dev-stack": "^1.4.
|
|
71
|
+
"ts-dev-stack": "^1.4.3",
|
|
71
72
|
"ts-swc-rollup-plugin": "^1.4.0"
|
|
72
73
|
},
|
|
73
74
|
"packageManager": "npm@11.0.0+sha512.11dff29565d2297c74e7c594a9762581bde969f0aa5cbe6f5b3644bf008a16c065ece61094d9ffbb81125be38df8e1ba43eb8244b3d30c61eb797e9a2440e3ec",
|