node-semvers 0.6.11 → 1.1.0

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.
Files changed (117) hide show
  1. package/dist/cjs/NodeVersions.js +125 -0
  2. package/dist/cjs/NodeVersions.js.map +1 -0
  3. package/dist/cjs/{scripts/cache.js → assets/postinstall.js} +5 -10
  4. package/dist/cjs/assets/postinstall.js.map +1 -0
  5. package/dist/cjs/cli.js +24 -29
  6. package/dist/cjs/cli.js.map +1 -1
  7. package/dist/cjs/constants.js +24 -11
  8. package/dist/cjs/constants.js.map +1 -1
  9. package/dist/cjs/index.js +26 -99
  10. package/dist/cjs/index.js.map +1 -1
  11. package/dist/cjs/lib/isNaN.js +16 -0
  12. package/dist/cjs/lib/isNaN.js.map +1 -0
  13. package/dist/cjs/lib/keyFunctions.js +25 -0
  14. package/dist/cjs/lib/keyFunctions.js.map +1 -0
  15. package/dist/cjs/lib/lineFunctions.js +27 -0
  16. package/dist/cjs/lib/lineFunctions.js.map +1 -0
  17. package/dist/cjs/lib/match.js +17 -0
  18. package/dist/cjs/lib/match.js.map +1 -0
  19. package/dist/cjs/lib/normalizeSchedule.js +24 -0
  20. package/dist/cjs/lib/normalizeSchedule.js.map +1 -0
  21. package/dist/cjs/lib/normalizeVersion.js +35 -0
  22. package/dist/cjs/lib/normalizeVersion.js.map +1 -0
  23. package/dist/cjs/lib/packageRoot.js +23 -0
  24. package/dist/cjs/lib/packageRoot.js.map +1 -0
  25. package/dist/cjs/parseExpression/index.js +35 -26
  26. package/dist/cjs/parseExpression/index.js.map +1 -1
  27. package/dist/cjs/parseExpression/isLTSFn.js +12 -8
  28. package/dist/cjs/parseExpression/isLTSFn.js.map +1 -1
  29. package/dist/cjs/parseExpression/isLatestFn.js +12 -8
  30. package/dist/cjs/parseExpression/isLatestFn.js.map +1 -1
  31. package/dist/cjs/parseExpression/schedulesForEach.js +12 -8
  32. package/dist/cjs/parseExpression/schedulesForEach.js.map +1 -1
  33. package/dist/cjs/parseExpression/schedulesLatest.js +19 -10
  34. package/dist/cjs/parseExpression/schedulesLatest.js.map +1 -1
  35. package/dist/cjs/types.js +5 -0
  36. package/dist/cjs/types.js.map +1 -0
  37. package/dist/esm/NodeVersions.mjs +97 -0
  38. package/dist/esm/NodeVersions.mjs.map +1 -0
  39. package/dist/esm/assets/postinstall.mjs +23 -0
  40. package/dist/esm/assets/postinstall.mjs.map +1 -0
  41. package/dist/esm/cli.mjs +64 -0
  42. package/dist/esm/cli.mjs.map +1 -0
  43. package/dist/esm/constants.mjs +10 -0
  44. package/dist/esm/constants.mjs.map +1 -0
  45. package/dist/esm/index.mjs +2 -0
  46. package/dist/esm/index.mjs.map +1 -0
  47. package/dist/esm/lib/isNaN.mjs +5 -0
  48. package/dist/esm/lib/isNaN.mjs.map +1 -0
  49. package/dist/esm/lib/keyFunctions.mjs +6 -0
  50. package/dist/esm/lib/keyFunctions.mjs.map +1 -0
  51. package/dist/esm/lib/lineFunctions.mjs +8 -0
  52. package/dist/esm/lib/lineFunctions.mjs.map +1 -0
  53. package/dist/esm/lib/match.mjs +6 -0
  54. package/dist/esm/lib/match.mjs.map +1 -0
  55. package/dist/esm/lib/normalizeSchedule.mjs +13 -0
  56. package/dist/esm/lib/normalizeSchedule.mjs.map +1 -0
  57. package/dist/esm/lib/normalizeVersion.mjs +24 -0
  58. package/dist/esm/lib/normalizeVersion.mjs.map +1 -0
  59. package/dist/esm/lib/packageRoot.mjs +7 -0
  60. package/dist/esm/lib/packageRoot.mjs.map +1 -0
  61. package/dist/esm/package.json +1 -0
  62. package/dist/esm/parseExpression/index.mjs +46 -0
  63. package/dist/esm/parseExpression/index.mjs.map +1 -0
  64. package/dist/esm/parseExpression/isLTSFn.mjs +5 -0
  65. package/dist/esm/parseExpression/isLTSFn.mjs.map +1 -0
  66. package/dist/esm/parseExpression/isLatestFn.mjs +5 -0
  67. package/dist/esm/parseExpression/isLatestFn.mjs.map +1 -0
  68. package/dist/esm/parseExpression/schedulesForEach.mjs +6 -0
  69. package/dist/esm/parseExpression/schedulesForEach.mjs.map +1 -0
  70. package/dist/esm/parseExpression/schedulesLatest.mjs +8 -0
  71. package/dist/esm/parseExpression/schedulesLatest.mjs.map +1 -0
  72. package/dist/esm/types.mjs +1 -0
  73. package/dist/esm/types.mjs.map +1 -0
  74. package/dist/types/NodeVersions.d.ts +9 -0
  75. package/dist/types/assets/postinstall.d.ts +2 -0
  76. package/dist/types/cli.d.ts +1 -1
  77. package/dist/types/constants.d.ts +6 -3
  78. package/dist/types/index.d.ts +2 -26
  79. package/dist/types/lib/isNaN.d.ts +1 -0
  80. package/dist/types/lib/keyFunctions.d.ts +2 -0
  81. package/dist/types/lib/lineFunctions.d.ts +2 -0
  82. package/dist/types/lib/match.d.ts +1 -0
  83. package/dist/types/lib/normalizeSchedule.d.ts +2 -0
  84. package/dist/types/lib/normalizeVersion.d.ts +2 -0
  85. package/dist/types/lib/packageRoot.d.ts +1 -0
  86. package/dist/types/parseExpression/index.d.ts +1 -2
  87. package/dist/types/parseExpression/isLTSFn.d.ts +1 -2
  88. package/dist/types/parseExpression/isLatestFn.d.ts +1 -2
  89. package/dist/types/parseExpression/schedulesForEach.d.ts +1 -2
  90. package/dist/types/parseExpression/schedulesLatest.d.ts +1 -2
  91. package/dist/types/types.d.ts +45 -0
  92. package/package.json +32 -15
  93. package/scripts/assets.js +19 -0
  94. package/scripts/postinstall.cjs +3 -0
  95. package/scripts/rollup.config.mjs +19 -0
  96. package/dist/cjs/isNaN.js +0 -12
  97. package/dist/cjs/isNaN.js.map +0 -1
  98. package/dist/cjs/keyFunctions.js +0 -13
  99. package/dist/cjs/keyFunctions.js.map +0 -1
  100. package/dist/cjs/lineFunctions.js +0 -15
  101. package/dist/cjs/lineFunctions.js.map +0 -1
  102. package/dist/cjs/match.js +0 -13
  103. package/dist/cjs/match.js.map +0 -1
  104. package/dist/cjs/normalizeSchedule.js +0 -20
  105. package/dist/cjs/normalizeSchedule.js.map +0 -1
  106. package/dist/cjs/normalizeVersion.js +0 -31
  107. package/dist/cjs/normalizeVersion.js.map +0 -1
  108. package/dist/cjs/scripts/cache.js.map +0 -1
  109. package/dist/types/isNaN.d.ts +0 -2
  110. package/dist/types/keyFunctions.d.ts +0 -2
  111. package/dist/types/lineFunctions.d.ts +0 -2
  112. package/dist/types/match.d.ts +0 -2
  113. package/dist/types/normalizeSchedule.d.ts +0 -6
  114. package/dist/types/normalizeVersion.d.ts +0 -12
  115. package/dist/types/scripts/cache.d.ts +0 -2
  116. package/scripts/cache.js +0 -3
  117. /package/bin/{cli.js → cli.cjs} +0 -0
@@ -0,0 +1,125 @@
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 NodeVersions;
9
+ }
10
+ });
11
+ var _fetchjsoncache = /*#__PURE__*/ _interop_require_default(require("fetch-json-cache"));
12
+ var _semver = /*#__PURE__*/ _interop_require_default(require("semver"));
13
+ var _constants = /*#__PURE__*/ _interop_require_default(require("./constants.js"));
14
+ var _keyFunctions = require("./lib/keyFunctions.js");
15
+ var _lineFunctions = require("./lib/lineFunctions.js");
16
+ var _match = /*#__PURE__*/ _interop_require_default(require("./lib/match.js"));
17
+ var _normalizeSchedule = /*#__PURE__*/ _interop_require_default(require("./lib/normalizeSchedule.js"));
18
+ var _normalizeVersion = /*#__PURE__*/ _interop_require_default(require("./lib/normalizeVersion.js"));
19
+ var _index = /*#__PURE__*/ _interop_require_default(require("./parseExpression/index.js"));
20
+ function _class_call_check(instance, Constructor) {
21
+ if (!(instance instanceof Constructor)) {
22
+ throw new TypeError("Cannot call a class as a function");
23
+ }
24
+ }
25
+ function _interop_require_default(obj) {
26
+ return obj && obj.__esModule ? obj : {
27
+ default: obj
28
+ };
29
+ }
30
+ var NodeVersions = /*#__PURE__*/ function() {
31
+ "use strict";
32
+ function NodeVersions(versions, schedule) {
33
+ _class_call_check(this, NodeVersions);
34
+ if (!versions) throw new Error('Missing option: versions');
35
+ if (!schedule) throw new Error('Missing option: schedule');
36
+ this.schedules = [];
37
+ for(var name in schedule)this.schedules.push((0, _normalizeSchedule.default)(name, schedule[name]));
38
+ this.schedules = this.schedules.sort(function(a, b) {
39
+ return _semver.default.gt(_semver.default.coerce(a.semver), _semver.default.coerce(b.semver)) ? 1 : -1;
40
+ });
41
+ this.versions = [];
42
+ for(var index = 0; index < versions.length; index++)this.versions.push((0, _normalizeVersion.default)(versions[index], this.schedules));
43
+ this.versions = this.versions.sort(function(a, b) {
44
+ return _semver.default.gt(a.semver, b.semver) ? -1 : 1;
45
+ });
46
+ }
47
+ var _proto = NodeVersions.prototype;
48
+ _proto.resolve = function resolve(expression, options) {
49
+ options = options || {};
50
+ var path = options.path || 'version';
51
+ // normalize
52
+ if (typeof expression === 'number') expression = "".concat(expression);
53
+ if (typeof expression !== 'string') return null;
54
+ expression = expression.trim();
55
+ // single result, try a match
56
+ var query = _index.default.call(this, expression, options.now || new Date());
57
+ if (query) {
58
+ var version = null;
59
+ for(var index = 0; index < this.versions.length; index++){
60
+ var test = this.versions[index];
61
+ if (options.now && options.now < test.date) continue;
62
+ if (!(0, _match.default)(test, query)) continue;
63
+ version = test;
64
+ break;
65
+ }
66
+ if (version) return version[path];
67
+ }
68
+ // filtered expression
69
+ var range = options.range || '';
70
+ var filters = {
71
+ lts: !!~range.indexOf('lts'),
72
+ key: undefined,
73
+ line: undefined
74
+ };
75
+ filters.key = ~range.indexOf('major') ? _keyFunctions.major : ~range.indexOf('minor') ? _keyFunctions.minor : undefined;
76
+ filters.line = ~range.indexOf('even') ? _lineFunctions.even : ~range.indexOf('odd') ? _lineFunctions.odd : undefined;
77
+ var results = [];
78
+ var founds = {};
79
+ for(var index1 = 0; index1 < this.versions.length; index1++){
80
+ var test1 = this.versions[index1];
81
+ if (options.now && options.now < test1.date) continue;
82
+ if (filters.lts && !test1.lts) continue;
83
+ if (filters.line && !filters.line(test1)) continue;
84
+ if (!_semver.default.satisfies(test1.semver, expression)) continue;
85
+ if (filters.key) {
86
+ if (founds[filters.key(test1)]) continue;
87
+ founds[filters.key(test1)] = true;
88
+ }
89
+ results.unshift(test1[path]);
90
+ }
91
+ return results;
92
+ };
93
+ NodeVersions.load = function load(options, callback) {
94
+ if (typeof options === 'function') {
95
+ callback = options;
96
+ options = null;
97
+ }
98
+ if (typeof callback === 'function') {
99
+ options = options || {};
100
+ var cache = new _fetchjsoncache.default(options.cacheDirectory || _constants.default.CACHE_DIRECTORY);
101
+ cache.get(_constants.default.DISTS_URL, function(err, versions) {
102
+ if (err) return callback(err);
103
+ cache.get(_constants.default.SCHEDULES_URL, function(err, schedule) {
104
+ err ? callback(err) : callback(null, new NodeVersions(versions, schedule));
105
+ });
106
+ });
107
+ } else {
108
+ return new Promise(function(resolve, reject) {
109
+ NodeVersions.load(options, function loadCallback(err, NodeVersions) {
110
+ err ? reject(err) : resolve(NodeVersions);
111
+ });
112
+ });
113
+ }
114
+ };
115
+ NodeVersions.loadSync = function loadSync(options) {
116
+ options = options || {};
117
+ var cache = new _fetchjsoncache.default(options.cacheDirectory || _constants.default.CACHE_DIRECTORY);
118
+ var versions = cache.getSync(_constants.default.DISTS_URL);
119
+ var schedule = cache.getSync(_constants.default.SCHEDULES_URL);
120
+ if (!versions || !schedule) return null;
121
+ return new NodeVersions(versions, schedule);
122
+ };
123
+ return NodeVersions;
124
+ }();
125
+ /* 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":["NodeVersions.ts"],"sourcesContent":["import Cache from 'fetch-json-cache';\nimport semver from 'semver';\n\nimport constants from './constants.js';\nimport { major, minor } from './lib/keyFunctions.js';\nimport { even, odd } from './lib/lineFunctions.js';\nimport match from './lib/match.js';\nimport normalizeSchedule from './lib/normalizeSchedule.js';\nimport normalizeVersion from './lib/normalizeVersion.js';\nimport parseExpression from './parseExpression/index.js';\n\nimport type { Schedule, ScheduleRaw, Version, VersionRaw } from './types.js';\n\nexport default class NodeVersions {\n versions: Version[];\n schedules: Schedule[];\n\n constructor(versions: VersionRaw[], schedule: ScheduleRaw[]) {\n if (!versions) throw new Error('Missing option: versions');\n if (!schedule) throw new Error('Missing option: schedule');\n\n this.schedules = [];\n for (const name in schedule) this.schedules.push(normalizeSchedule(name, schedule[name]));\n this.schedules = this.schedules.sort((a, b) => (semver.gt(semver.coerce(a.semver), semver.coerce(b.semver)) ? 1 : -1));\n\n this.versions = [];\n for (let index = 0; index < versions.length; index++) this.versions.push(normalizeVersion(versions[index], this.schedules));\n this.versions = this.versions.sort((a, b) => (semver.gt(a.semver, b.semver) ? -1 : 1));\n }\n\n static load(options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n\n const cache = new Cache(options.cacheDirectory || constants.CACHE_DIRECTORY);\n cache.get(constants.DISTS_URL, (err, versions: VersionRaw[]) => {\n if (err) return callback(err);\n\n cache.get(constants.SCHEDULES_URL, (err, schedule: ScheduleRaw[]) => {\n err ? callback(err) : callback(null, new NodeVersions(versions, schedule));\n });\n });\n } else {\n return new Promise((resolve, reject) => {\n NodeVersions.load(options, function loadCallback(err, NodeVersions) {\n err ? reject(err) : resolve(NodeVersions);\n });\n });\n }\n }\n\n static loadSync(options) {\n options = options || {};\n const cache = new Cache(options.cacheDirectory || constants.CACHE_DIRECTORY);\n const versions = cache.getSync(constants.DISTS_URL) as VersionRaw[];\n const schedule = cache.getSync(constants.SCHEDULES_URL) as ScheduleRaw[];\n if (!versions || !schedule) return null;\n return new NodeVersions(versions, schedule);\n }\n\n resolve(expression, options) {\n options = options || {};\n const path = options.path || 'version';\n\n // normalize\n if (typeof expression === 'number') expression = `${expression}`;\n if (typeof expression !== 'string') return null;\n expression = expression.trim();\n\n // single result, try a match\n const query = parseExpression.call(this, expression, options.now || new Date());\n if (query) {\n let version = null;\n for (let index = 0; index < this.versions.length; index++) {\n const test = this.versions[index];\n if (options.now && options.now < test.date) continue;\n if (!match(test, query)) continue;\n version = test;\n break;\n }\n if (version) return version[path];\n }\n\n // filtered expression\n const range = options.range || '';\n const filters = { lts: !!~range.indexOf('lts'), key: undefined, line: undefined };\n filters.key = ~range.indexOf('major') ? major : ~range.indexOf('minor') ? minor : undefined;\n filters.line = ~range.indexOf('even') ? even : ~range.indexOf('odd') ? odd : undefined;\n\n const results = [];\n const founds = {};\n\n for (let index = 0; index < this.versions.length; index++) {\n const test = this.versions[index];\n if (options.now && options.now < test.date) continue;\n if (filters.lts && !test.lts) continue;\n if (filters.line && !filters.line(test)) continue;\n if (!semver.satisfies(test.semver, expression)) continue;\n if (filters.key) {\n if (founds[filters.key(test)]) continue;\n founds[filters.key(test)] = true;\n }\n results.unshift(test[path]);\n }\n return results;\n }\n}\n"],"names":["NodeVersions","versions","schedule","Error","schedules","name","push","normalizeSchedule","sort","a","b","semver","gt","coerce","index","length","normalizeVersion","resolve","expression","options","path","trim","query","parseExpression","call","now","Date","version","test","date","match","range","filters","lts","indexOf","key","undefined","line","major","minor","even","odd","results","founds","satisfies","unshift","load","callback","cache","Cache","cacheDirectory","constants","CACHE_DIRECTORY","get","DISTS_URL","err","SCHEDULES_URL","Promise","reject","loadCallback","loadSync","getSync"],"mappings":";;;;;;;eAaqBA;;;qEAbH;6DACC;gEAEG;4BACO;6BACH;4DACR;wEACY;uEACD;4DACD;;;;;;;;;;;AAIb,IAAA,AAAMA,6BAAN;;aAAMA,aAIPC,QAAsB,EAAEC,QAAuB;gCAJxCF;QAKjB,IAAI,CAACC,UAAU,MAAM,IAAIE,MAAM;QAC/B,IAAI,CAACD,UAAU,MAAM,IAAIC,MAAM;QAE/B,IAAI,CAACC,SAAS,GAAG,EAAE;QACnB,IAAK,IAAMC,QAAQH,SAAU,IAAI,CAACE,SAAS,CAACE,IAAI,CAACC,IAAAA,0BAAiB,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;IACT;IAjGmB1C,aAiBZ8C,IAwBN,GAxBD,SAAOA,KAAK3B,OAAO,EAAE4B,QAAQ;QAC3B,IAAI,OAAO5B,YAAY,YAAY;YACjC4B,WAAW5B;YACXA,UAAU;QACZ;QAEA,IAAI,OAAO4B,aAAa,YAAY;YAClC5B,UAAUA,WAAW,CAAC;YAEtB,IAAM6B,QAAQ,IAAIC,uBAAK,CAAC9B,QAAQ+B,cAAc,IAAIC,kBAAS,CAACC,eAAe;YAC3EJ,MAAMK,GAAG,CAACF,kBAAS,CAACG,SAAS,EAAE,SAACC,KAAKtD;gBACnC,IAAIsD,KAAK,OAAOR,SAASQ;gBAEzBP,MAAMK,GAAG,CAACF,kBAAS,CAACK,aAAa,EAAE,SAACD,KAAKrD;oBACvCqD,MAAMR,SAASQ,OAAOR,SAAS,MAAM,IA/B1B/C,aA+B2CC,UAAUC;gBAClE;YACF;QACF,OAAO;YACL,OAAO,IAAIuD,QAAQ,SAACxC,SAASyC;gBAnCd1D,aAoCA8C,IAAI,CAAC3B,SAAS,SAASwC,aAAaJ,GAAG,EAAEvD,YAAY;oBAChEuD,MAAMG,OAAOH,OAAOtC,QAAQjB;gBAC9B;YACF;QACF;IACF;IAzCmBA,aA2CZ4D,QAON,GAPD,SAAOA,SAASzC,OAAO;QACrBA,UAAUA,WAAW,CAAC;QACtB,IAAM6B,QAAQ,IAAIC,uBAAK,CAAC9B,QAAQ+B,cAAc,IAAIC,kBAAS,CAACC,eAAe;QAC3E,IAAMnD,WAAW+C,MAAMa,OAAO,CAACV,kBAAS,CAACG,SAAS;QAClD,IAAMpD,WAAW8C,MAAMa,OAAO,CAACV,kBAAS,CAACK,aAAa;QACtD,IAAI,CAACvD,YAAY,CAACC,UAAU,OAAO;QACnC,OAAO,IAjDUF,aAiDOC,UAAUC;IACpC;WAlDmBF"}
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  var _exit = /*#__PURE__*/ _interop_require_default(require("exit"));
12
12
  var _fetchjsoncache = /*#__PURE__*/ _interop_require_default(require("fetch-json-cache"));
13
- var _constants = /*#__PURE__*/ _interop_require_default(require("../constants"));
13
+ var _constantscjs = /*#__PURE__*/ _interop_require_default(require("../constants.js"));
14
14
  function _interop_require_default(obj) {
15
15
  return obj && obj.__esModule ? obj : {
16
16
  default: obj
@@ -18,15 +18,15 @@ function _interop_require_default(obj) {
18
18
  }
19
19
  var _default = function() {
20
20
  var cacheJSON = function cacheJSON(callback) {
21
- cache.get(_constants.default.DISTS_URL, {
21
+ cache.get(_constantscjs.default.DISTS_URL, {
22
22
  force: true
23
23
  }, function(err) {
24
- err ? callback(err) : cache.get(_constants.default.SCHEDULES_URL, {
24
+ err ? callback(err) : cache.get(_constantscjs.default.SCHEDULES_URL, {
25
25
  force: true
26
26
  }, callback);
27
27
  });
28
28
  };
29
- var cache = new _fetchjsoncache.default(_constants.default.CACHE_DIRECTORY);
29
+ var cache = new _fetchjsoncache.default(_constantscjs.default.CACHE_DIRECTORY);
30
30
  cacheJSON(function(err) {
31
31
  if (err) {
32
32
  console.log("Failed to cache dists and schedules. Error: ".concat(err.message));
@@ -35,9 +35,4 @@ var _default = function() {
35
35
  (0, _exit.default)(0);
36
36
  });
37
37
  };
38
-
39
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
40
- Object.defineProperty(exports.default, '__esModule', { value: true });
41
- for (var key in exports) exports.default[key] = exports[key];
42
- module.exports = exports.default;
43
- }
38
+ /* 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":["postinstall.ts"],"sourcesContent":["import exit from 'exit';\nimport Cache from 'fetch-json-cache';\n// @ts-ignore\nimport constants from '../constants.cjs';\n\nexport default () => {\n const cache = new Cache(constants.CACHE_DIRECTORY);\n\n function cacheJSON(callback) {\n cache.get(constants.DISTS_URL, { force: true }, (err) => {\n err ? callback(err) : cache.get(constants.SCHEDULES_URL, { force: true }, callback);\n });\n }\n\n cacheJSON((err) => {\n if (err) {\n console.log(`Failed to cache dists and schedules. Error: ${err.message}`);\n return exit(err.code || -1);\n }\n exit(0);\n });\n};\n"],"names":["cacheJSON","callback","cache","get","constants","DISTS_URL","force","err","SCHEDULES_URL","Cache","CACHE_DIRECTORY","console","log","message","exit","code"],"mappings":";;;;+BAKA;;;eAAA;;;2DALiB;qEACC;mEAEI;;;;;;IAEtB,WAAe;QAGJA,YAAT,SAASA,UAAUC,QAAQ;QACzBC,MAAMC,GAAG,CAACC,qBAAS,CAACC,SAAS,EAAE;YAAEC,OAAO;QAAK,GAAG,SAACC;YAC/CA,MAAMN,SAASM,OAAOL,MAAMC,GAAG,CAACC,qBAAS,CAACI,aAAa,EAAE;gBAAEF,OAAO;YAAK,GAAGL;QAC5E;IACF;IANA,IAAMC,QAAQ,IAAIO,uBAAK,CAACL,qBAAS,CAACM,eAAe;IAQjDV,UAAU,SAACO;QACT,IAAIA,KAAK;YACPI,QAAQC,GAAG,CAAC,AAAC,+CAA0D,OAAZL,IAAIM,OAAO;YACtE,OAAOC,IAAAA,aAAI,EAACP,IAAIQ,IAAI,IAAI,CAAC;QAC3B;QACAD,IAAAA,aAAI,EAAC;IACP;AACF"}
package/dist/cjs/cli.js CHANGED
@@ -10,9 +10,9 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  var _exit = /*#__PURE__*/ _interop_require_default(require("exit"));
12
12
  var _getoptscompat = /*#__PURE__*/ _interop_require_default(require("getopts-compat"));
13
- var _index = /*#__PURE__*/ _interop_require_default(require("./index.js"));
13
+ var _NodeVersions = /*#__PURE__*/ _interop_require_default(require("./NodeVersions.js"));
14
14
  var _isarray = /*#__PURE__*/ _interop_require_default(require("isarray"));
15
- var _isNaN = /*#__PURE__*/ _interop_require_default(require("./isNaN.js"));
15
+ var _isNaN = /*#__PURE__*/ _interop_require_default(require("./lib/isNaN.js"));
16
16
  function _interop_require_default(obj) {
17
17
  return obj && obj.__esModule ? obj : {
18
18
  default: obj
@@ -20,46 +20,46 @@ function _interop_require_default(obj) {
20
20
  }
21
21
  var _default = function(argv) {
22
22
  var stringify = function stringify(value) {
23
- return typeof value === "string" ? value : JSON.stringify(value);
23
+ return typeof value === 'string' ? value : JSON.stringify(value);
24
24
  };
25
25
  var options = (0, _getoptscompat.default)(argv.slice(1), {
26
26
  alias: {
27
- path: "p",
28
- range: "r",
29
- now: "n"
27
+ path: 'p',
28
+ range: 'r',
29
+ now: 'n'
30
30
  },
31
31
  stopEarly: true
32
32
  });
33
- if (typeof options.now !== "undefined") options.now = new Date((0, _isNaN.default)(+options.now) ? Date.parse(options.now) : +options.now);
33
+ if (typeof options.now !== 'undefined') options.now = new Date((0, _isNaN.default)(+options.now) ? Date.parse(options.now) : +options.now);
34
34
  // define.option('-p, --path [path]', 'path within version including raw for unprocessed version', 'version');
35
35
  // define.option('-r, --range [range]', 'range type of major, minor, or patch with filters of lts, even, odd for version string expressions', 'patch');
36
36
  // define.option('-n, --now [date]', 'use a specific time as a Date.parse');
37
37
  if (options.help) {
38
- console.log("");
39
- console.log("Example call:");
40
- console.log(" $ nv [version string]");
41
- console.log("");
42
- console.log("Version Strings:");
43
- console.log("Any command that calls for a version can be provided any of the");
38
+ console.log('');
39
+ console.log('Example call:');
40
+ console.log(' $ nv [version string]');
41
+ console.log('');
42
+ console.log('Version Strings:');
43
+ console.log('Any command that calls for a version can be provided any of the');
44
44
  console.log('following "version-ish" identifies:');
45
- console.log("");
46
- console.log("- x.y.z A specific SemVer tuple");
47
- console.log("- x.y Major and minor version number");
48
- console.log("- x Just a major version number");
49
- console.log("- lts The most recent LTS (long-term support) node version");
50
- console.log("- lts/<name> The latest in a named LTS set. (argon, boron, etc.)");
45
+ console.log('');
46
+ console.log('- x.y.z A specific SemVer tuple');
47
+ console.log('- x.y Major and minor version number');
48
+ console.log('- x Just a major version number');
49
+ console.log('- lts The most recent LTS (long-term support) node version');
50
+ console.log('- lts/<name> The latest in a named LTS set. (argon, boron, etc.)');
51
51
  console.log('- lts/* Same as just "lts"');
52
- console.log("- latest The most recent (non-LTS) version");
52
+ console.log('- latest The most recent (non-LTS) version');
53
53
  console.log('- stable Backwards-compatible alias for "lts"');
54
54
  console.log('- [expression] Engine and semver module expression like "10.1.x || >=12.0.0"');
55
55
  return;
56
56
  }
57
57
  var args = argv.slice(0, 1).concat(options._);
58
58
  if (args.length < 1) {
59
- console.log("Missing version string. Example usage: nv [version string]. Use nv --help for information on version strings");
59
+ console.log('Missing version string. Example usage: nv [version string]. Use nv --help for information on version strings');
60
60
  return (0, _exit.default)(-1);
61
61
  }
62
- _index.default.load(options, function(err, semvers) {
62
+ _NodeVersions.default.load(options, function(err, semvers) {
63
63
  if (err) {
64
64
  console.log(err.message);
65
65
  return (0, _exit.default)(err.code || -1);
@@ -69,16 +69,11 @@ var _default = function(argv) {
69
69
  console.log("Unrecognized: ".concat(args[0]));
70
70
  return (0, _exit.default)(-1);
71
71
  }
72
- console.log("versions:");
72
+ console.log('versions:');
73
73
  if ((0, _isarray.default)(version)) {
74
74
  for(var index = 0; index < version.length; index++)console.log(stringify(version[index]));
75
75
  } else console.log(stringify(version));
76
76
  (0, _exit.default)(0);
77
77
  });
78
78
  };
79
-
80
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
81
- Object.defineProperty(exports.default, '__esModule', { value: true });
82
- for (var key in exports) exports.default[key] = exports[key];
83
- module.exports = exports.default;
84
- }
79
+ /* 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":["cli.js"],"sourcesContent":["import exit from 'exit';\nimport getopts from 'getopts-compat';\nimport NodeVersions from './index.js';\n\nimport isArray from 'isarray';\n// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>\nimport isNaN from './isNaN.js';\n\nexport default (argv) => {\n const options = getopts(argv.slice(1), {\n alias: { path: 'p', range: 'r', now: 'n' },\n stopEarly: true,\n });\n if (typeof options.now !== 'undefined') options.now = new Date(isNaN(+options.now) ? Date.parse(options.now) : +options.now);\n\n // define.option('-p, --path [path]', 'path within version including raw for unprocessed version', 'version');\n // define.option('-r, --range [range]', 'range type of major, minor, or patch with filters of lts, even, odd for version string expressions', 'patch');\n // define.option('-n, --now [date]', 'use a specific time as a Date.parse');\n\n if (options.help) {\n console.log('');\n console.log('Example call:');\n console.log(' $ nv [version string]');\n console.log('');\n console.log('Version Strings:');\n console.log('Any command that calls for a version can be provided any of the');\n console.log('following \"version-ish\" identifies:');\n console.log('');\n console.log('- x.y.z A specific SemVer tuple');\n console.log('- x.y Major and minor version number');\n console.log('- x Just a major version number');\n console.log('- lts The most recent LTS (long-term support) node version');\n console.log('- lts/<name> The latest in a named LTS set. (argon, boron, etc.)');\n console.log('- lts/* Same as just \"lts\"');\n console.log('- latest The most recent (non-LTS) version');\n console.log('- stable Backwards-compatible alias for \"lts\"');\n console.log('- [expression] Engine and semver module expression like \"10.1.x || >=12.0.0\"');\n return;\n }\n\n const args = argv.slice(0, 1).concat(options._);\n if (args.length < 1) {\n console.log('Missing version string. Example usage: nv [version string]. Use nv --help for information on version strings');\n return exit(-1);\n }\n\n function stringify(value) {\n return typeof value === 'string' ? value : JSON.stringify(value);\n }\n\n NodeVersions.load(options, (err, semvers) => {\n if (err) {\n console.log(err.message);\n return exit(err.code || -1);\n }\n\n const version = semvers.resolve(args[0], options);\n if (!version || (isArray(version) && !version.length)) {\n console.log(`Unrecognized: ${args[0]}`);\n return exit(-1);\n }\n\n console.log('versions:');\n if (isArray(version)) {\n for (let index = 0; index < version.length; index++) console.log(stringify(version[index]));\n } else console.log(stringify(version));\n exit(0);\n });\n};\n"],"names":["argv","stringify","value","JSON","options","getopts","slice","alias","path","range","now","stopEarly","Date","isNaN","parse","help","console","log","args","concat","_","length","exit","NodeVersions","load","err","semvers","message","code","version","resolve","isArray","index"],"mappings":";;;;+BAQA;;;eAAA;;;2DARiB;oEACG;4DACK;8DAEL;4DAEF;;;;;;IAElB,WAAe,SAACA;QAsCLC,YAAT,SAASA,UAAUC,KAAK;QACtB,OAAO,OAAOA,UAAU,WAAWA,QAAQC,KAAKF,SAAS,CAACC;IAC5D;IAvCA,IAAME,UAAUC,IAAAA,sBAAO,EAACL,KAAKM,KAAK,CAAC,IAAI;QACrCC,OAAO;YAAEC,MAAM;YAAKC,OAAO;YAAKC,KAAK;QAAI;QACzCC,WAAW;IACb;IACA,IAAI,OAAOP,QAAQM,GAAG,KAAK,aAAaN,QAAQM,GAAG,GAAG,IAAIE,KAAKC,IAAAA,cAAK,EAAC,CAACT,QAAQM,GAAG,IAAIE,KAAKE,KAAK,CAACV,QAAQM,GAAG,IAAI,CAACN,QAAQM,GAAG;IAE3H,8GAA8G;IAC9G,uJAAuJ;IACvJ,4EAA4E;IAE5E,IAAIN,QAAQW,IAAI,EAAE;QAChBC,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZ;IACF;IAEA,IAAMC,OAAOlB,KAAKM,KAAK,CAAC,GAAG,GAAGa,MAAM,CAACf,QAAQgB,CAAC;IAC9C,IAAIF,KAAKG,MAAM,GAAG,GAAG;QACnBL,QAAQC,GAAG,CAAC;QACZ,OAAOK,IAAAA,aAAI,EAAC,CAAC;IACf;IAMAC,cAAY,CAACC,IAAI,CAACpB,SAAS,SAACqB,KAAKC;QAC/B,IAAID,KAAK;YACPT,QAAQC,GAAG,CAACQ,IAAIE,OAAO;YACvB,OAAOL,IAAAA,aAAI,EAACG,IAAIG,IAAI,IAAI,CAAC;QAC3B;QAEA,IAAMC,UAAUH,QAAQI,OAAO,CAACZ,IAAI,CAAC,EAAE,EAAEd;QACzC,IAAI,CAACyB,WAAYE,IAAAA,gBAAO,EAACF,YAAY,CAACA,QAAQR,MAAM,EAAG;YACrDL,QAAQC,GAAG,CAAC,AAAC,iBAAwB,OAARC,IAAI,CAAC,EAAE;YACpC,OAAOI,IAAAA,aAAI,EAAC,CAAC;QACf;QAEAN,QAAQC,GAAG,CAAC;QACZ,IAAIc,IAAAA,gBAAO,EAACF,UAAU;YACpB,IAAK,IAAIG,QAAQ,GAAGA,QAAQH,QAAQR,MAAM,EAAEW,QAAShB,QAAQC,GAAG,CAAChB,UAAU4B,OAAO,CAACG,MAAM;QAC3F,OAAOhB,QAAQC,GAAG,CAAChB,UAAU4B;QAC7BP,IAAAA,aAAI,EAAC;IACP;AACF"}
1
+ {"version":3,"sources":["cli.ts"],"sourcesContent":["import exit from 'exit';\nimport getopts from 'getopts-compat';\nimport NodeVersions from './NodeVersions.js';\n\nimport isArray from 'isarray';\n// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>\nimport isNaN from './lib/isNaN.js';\n\nexport default (argv) => {\n const options = getopts(argv.slice(1), {\n alias: { path: 'p', range: 'r', now: 'n' },\n stopEarly: true,\n });\n if (typeof options.now !== 'undefined') options.now = new Date(isNaN(+options.now) ? Date.parse(options.now) : +options.now);\n\n // define.option('-p, --path [path]', 'path within version including raw for unprocessed version', 'version');\n // define.option('-r, --range [range]', 'range type of major, minor, or patch with filters of lts, even, odd for version string expressions', 'patch');\n // define.option('-n, --now [date]', 'use a specific time as a Date.parse');\n\n if (options.help) {\n console.log('');\n console.log('Example call:');\n console.log(' $ nv [version string]');\n console.log('');\n console.log('Version Strings:');\n console.log('Any command that calls for a version can be provided any of the');\n console.log('following \"version-ish\" identifies:');\n console.log('');\n console.log('- x.y.z A specific SemVer tuple');\n console.log('- x.y Major and minor version number');\n console.log('- x Just a major version number');\n console.log('- lts The most recent LTS (long-term support) node version');\n console.log('- lts/<name> The latest in a named LTS set. (argon, boron, etc.)');\n console.log('- lts/* Same as just \"lts\"');\n console.log('- latest The most recent (non-LTS) version');\n console.log('- stable Backwards-compatible alias for \"lts\"');\n console.log('- [expression] Engine and semver module expression like \"10.1.x || >=12.0.0\"');\n return;\n }\n\n const args = argv.slice(0, 1).concat(options._);\n if (args.length < 1) {\n console.log('Missing version string. Example usage: nv [version string]. Use nv --help for information on version strings');\n return exit(-1);\n }\n\n function stringify(value) {\n return typeof value === 'string' ? value : JSON.stringify(value);\n }\n\n NodeVersions.load(options, (err, semvers) => {\n if (err) {\n console.log(err.message);\n return exit(err.code || -1);\n }\n\n const version = semvers.resolve(args[0], options);\n if (!version || (isArray(version) && !version.length)) {\n console.log(`Unrecognized: ${args[0]}`);\n return exit(-1);\n }\n\n console.log('versions:');\n if (isArray(version)) {\n for (let index = 0; index < version.length; index++) console.log(stringify(version[index]));\n } else console.log(stringify(version));\n exit(0);\n });\n};\n"],"names":["argv","stringify","value","JSON","options","getopts","slice","alias","path","range","now","stopEarly","Date","isNaN","parse","help","console","log","args","concat","_","length","exit","NodeVersions","load","err","semvers","message","code","version","resolve","isArray","index"],"mappings":";;;;+BAQA;;;eAAA;;;2DARiB;oEACG;mEACK;8DAEL;4DAEF;;;;;;IAElB,WAAe,SAACA;QAsCLC,YAAT,SAASA,UAAUC,KAAK;QACtB,OAAO,OAAOA,UAAU,WAAWA,QAAQC,KAAKF,SAAS,CAACC;IAC5D;IAvCA,IAAME,UAAUC,IAAAA,sBAAO,EAACL,KAAKM,KAAK,CAA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AAI,CAACyB,WAAYE,IAAAA,gBAAO,EAACF,YAAY,CAACA,QAAQR,MAAM,EAAG;YACrDL,QAAQC,GAAG,CAAC,AAAC,iBAAwB,OAARC,IAAI,CAAC,EAAE;YACpC,OAAOI,IAAAA,aAAI,EAAC,CAAC;QACf;QAEAN,QAAQC,GAAG,CAAC;QACZ,IAAIc,IAAAA,gBAAO,EAACF,UAAU;YACpB,IAAK,IAAIG,QAAQ,GAAGA,QAAQH,QAAQR,MAAM,EAAEW,QAAShB,QAAQC,GAAG,CAAChB,UAAU4B,OAAO,CAACG,MAAM;QAC3F,OAAOhB,QAAQC,GAAG,CAAChB,UAAU4B;QAC7BP,IAAAA,aAAI,EAAC;IACP;AACF"}
@@ -1,13 +1,26 @@
1
1
  "use strict";
2
- var path = require("path");
3
- module.exports = {
4
- CACHE_DIRECTORY: path.resolve(path.join(__dirname, "..", "..", ".cache")),
5
- DISTS_URL: "https://nodejs.org/dist/index.json",
6
- SCHEDULES_URL: "https://raw.githubusercontent.com/nodejs/Release/master/schedule.json"
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _default;
9
+ }
10
+ });
11
+ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
+ var _url = /*#__PURE__*/ _interop_require_default(require("url"));
13
+ var _packageRoot = /*#__PURE__*/ _interop_require_default(require("./lib/packageRoot.js"));
14
+ function _interop_require_default(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
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, 'node-semvers');
21
+ var _default = {
22
+ CACHE_DIRECTORY: _path.default.resolve(_path.default.join(root, '.cache')),
23
+ DISTS_URL: 'https://nodejs.org/dist/index.json',
24
+ SCHEDULES_URL: 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json'
7
25
  };
8
-
9
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
10
- Object.defineProperty(exports.default, '__esModule', { value: true });
11
- for (var key in exports) exports.default[key] = exports[key];
12
- module.exports = exports.default;
13
- }
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":["constants.js"],"sourcesContent":["const path = require('path');\n\nmodule.exports = {\n CACHE_DIRECTORY: path.resolve(path.join(__dirname, '..', '..', '.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","require","module","exports","CACHE_DIRECTORY","resolve","join","__dirname","DISTS_URL","SCHEDULES_URL"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AAErBC,OAAOC,OAAO,GAAG;IACfC,iBAAiBJ,KAAKK,OAAO,CAACL,KAAKM,IAAI,CAACC,WAAW,MAAM,MAAM;IAC/DC,WAAW;IACXC,eAAe;AACjB"}
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, 'node-semvers');\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,WAAW;IAEpC,WAAe;IACbQ,iBAAiBP,aAAI,CAACQ,OAAO,CAACR,aAAI,CAACS,IAAI,CAACJ,MAAM;IAC9CK,WAAW;IACXC,eAAe;AACjB"}
package/dist/cjs/index.js CHANGED
@@ -1,104 +1,31 @@
1
1
  "use strict";
2
- var semver = require("semver");
3
- var Cache = require("fetch-json-cache");
4
- var constants = require("./constants");
5
- var keyFunctions = require("./keyFunctions");
6
- var lineFunctions = require("./lineFunctions");
7
- var normalizeSchedule = require("./normalizeSchedule");
8
- var normalizeVersion = require("./normalizeVersion");
9
- var match = require("./match");
10
- var parseExpression = require("./parseExpression");
11
- function NodeVersions(versions, schedule) {
12
- if (!versions) throw new Error("Missing option: versions");
13
- if (!schedule) throw new Error("Missing option: schedule");
14
- this.schedules = [];
15
- for(var name in schedule)this.schedules.push(normalizeSchedule(name, schedule[name]));
16
- this.schedules = this.schedules.sort(function(a, b) {
17
- return semver.gt(semver.coerce(a.semver), semver.coerce(b.semver)) ? 1 : -1;
18
- });
19
- this.versions = [];
20
- for(var index = 0; index < versions.length; index++)this.versions.push(normalizeVersion(versions[index], this.schedules));
21
- this.versions = this.versions.sort(function(a, b) {
22
- return semver.gt(a.semver, b.semver) ? -1 : 1;
23
- });
24
- }
25
- NodeVersions.load = function load(options, callback) {
26
- if (typeof options === "function") {
27
- callback = options;
28
- options = null;
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _NodeVersions.default;
29
9
  }
30
- if (typeof callback === "function") {
31
- options = options || {};
32
- var cache = new Cache(options.cacheDirectory || constants.CACHE_DIRECTORY);
33
- cache.get(constants.DISTS_URL, function(err, versions) {
34
- if (err) return callback(err);
35
- cache.get(constants.SCHEDULES_URL, function(err, schedule) {
36
- err ? callback(err) : callback(null, new NodeVersions(versions, schedule));
10
+ });
11
+ _export_star(require("./types.js"), exports);
12
+ var _NodeVersions = /*#__PURE__*/ _interop_require_default(require("./NodeVersions.js"));
13
+ function _export_star(from, to) {
14
+ Object.keys(from).forEach(function(k) {
15
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
16
+ Object.defineProperty(to, k, {
17
+ enumerable: true,
18
+ get: function() {
19
+ return from[k];
20
+ }
37
21
  });
38
- });
39
- } else {
40
- return new Promise(function(resolve, reject) {
41
- load(options, function loadCallback(err, NodeVersions) {
42
- err ? reject(err) : resolve(NodeVersions);
43
- });
44
- });
45
- }
46
- };
47
- NodeVersions.loadSync = function loadSync(options) {
48
- options = options || {};
49
- var cache = new Cache(options.cacheDirectory || constants.CACHE_DIRECTORY);
50
- var versions = cache.getSync(constants.DISTS_URL);
51
- var schedule = cache.getSync(constants.SCHEDULES_URL);
52
- if (!versions || !schedule) return null;
53
- return new NodeVersions(versions, schedule);
54
- };
55
- NodeVersions.prototype.resolve = function resolve(expression, options) {
56
- options = options || {};
57
- var path = options.path || "version";
58
- // normalize
59
- if (typeof expression === "number") expression = "".concat(expression);
60
- if (typeof expression !== "string") return null;
61
- expression = expression.trim();
62
- // single result, try a match
63
- var query = parseExpression.call(this, expression, options.now || new Date());
64
- if (query) {
65
- var version = null;
66
- for(var index = 0; index < this.versions.length; index++){
67
- var test = this.versions[index];
68
- if (options.now && options.now < test.date) continue;
69
- if (!match(test, query)) continue;
70
- version = test;
71
- break;
72
22
  }
73
- if (version) return version[path];
74
- }
75
- // filtered expression
76
- var range = options.range || "";
77
- var filters = {
78
- lts: !!~range.indexOf("lts")
23
+ });
24
+ return from;
25
+ }
26
+ function _interop_require_default(obj) {
27
+ return obj && obj.__esModule ? obj : {
28
+ default: obj
79
29
  };
80
- filters.key = ~range.indexOf("major") ? keyFunctions.major : ~range.indexOf("minor") ? keyFunctions.minor : undefined;
81
- filters.line = ~range.indexOf("even") ? lineFunctions.even : ~range.indexOf("odd") ? lineFunctions.odd : undefined;
82
- var results = [];
83
- var founds = {};
84
- for(var index1 = 0; index1 < this.versions.length; index1++){
85
- var test1 = this.versions[index1];
86
- if (options.now && options.now < test1.date) continue;
87
- if (filters.lts && !test1.lts) continue;
88
- if (filters.line && !filters.line(test1)) continue;
89
- if (!semver.satisfies(test1.semver, expression)) continue;
90
- if (filters.key) {
91
- if (founds[filters.key(test1)]) continue;
92
- founds[filters.key(test1)] = true;
93
- }
94
- results.unshift(test1[path]);
95
- }
96
- return results;
97
- };
98
- module.exports = NodeVersions;
99
-
100
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
101
- Object.defineProperty(exports.default, '__esModule', { value: true });
102
- for (var key in exports) exports.default[key] = exports[key];
103
- module.exports = exports.default;
104
- }
30
+ }
31
+ /* 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":["index.js"],"sourcesContent":["const semver = require('semver');\nconst Cache = require('fetch-json-cache');\n\nconst constants = require('./constants');\nconst keyFunctions = require('./keyFunctions');\nconst lineFunctions = require('./lineFunctions');\nconst normalizeSchedule = require('./normalizeSchedule');\nconst normalizeVersion = require('./normalizeVersion');\nconst match = require('./match');\nconst parseExpression = require('./parseExpression');\n\nfunction NodeVersions(versions, schedule) {\n if (!versions) throw new Error('Missing option: versions');\n if (!schedule) throw new Error('Missing option: schedule');\n\n this.schedules = [];\n for (const name in schedule) this.schedules.push(normalizeSchedule(name, schedule[name]));\n this.schedules = this.schedules.sort((a, b) => (semver.gt(semver.coerce(a.semver), semver.coerce(b.semver)) ? 1 : -1));\n\n this.versions = [];\n for (let index = 0; index < versions.length; index++) this.versions.push(normalizeVersion(versions[index], this.schedules));\n this.versions = this.versions.sort((a, b) => (semver.gt(a.semver, b.semver) ? -1 : 1));\n}\n\nNodeVersions.load = function load(options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n\n if (typeof callback === 'function') {\n options = options || {};\n\n const cache = new Cache(options.cacheDirectory || constants.CACHE_DIRECTORY);\n cache.get(constants.DISTS_URL, (err, versions) => {\n if (err) return callback(err);\n\n cache.get(constants.SCHEDULES_URL, (err, schedule) => {\n err ? callback(err) : callback(null, new NodeVersions(versions, schedule));\n });\n });\n } else {\n return new Promise((resolve, reject) => {\n load(options, function loadCallback(err, NodeVersions) {\n err ? reject(err) : resolve(NodeVersions);\n });\n });\n }\n};\n\nNodeVersions.loadSync = function loadSync(options) {\n options = options || {};\n const cache = new Cache(options.cacheDirectory || constants.CACHE_DIRECTORY);\n const versions = cache.getSync(constants.DISTS_URL);\n const schedule = cache.getSync(constants.SCHEDULES_URL);\n if (!versions || !schedule) return null;\n return new NodeVersions(versions, schedule);\n};\n\nNodeVersions.prototype.resolve = function resolve(expression, options) {\n options = options || {};\n const path = options.path || 'version';\n\n // normalize\n if (typeof expression === 'number') expression = `${expression}`;\n if (typeof expression !== 'string') return null;\n expression = expression.trim();\n\n // single result, try a match\n const query = parseExpression.call(this, expression, options.now || new Date());\n if (query) {\n let version = null;\n for (let index = 0; index < this.versions.length; index++) {\n const test = this.versions[index];\n if (options.now && options.now < test.date) continue;\n if (!match(test, query)) continue;\n version = test;\n break;\n }\n if (version) return version[path];\n }\n\n // filtered expression\n const range = options.range || '';\n const filters = { lts: !!~range.indexOf('lts') };\n filters.key = ~range.indexOf('major') ? keyFunctions.major : ~range.indexOf('minor') ? keyFunctions.minor : undefined;\n filters.line = ~range.indexOf('even') ? lineFunctions.even : ~range.indexOf('odd') ? lineFunctions.odd : undefined;\n\n const results = [];\n const founds = {};\n\n for (let index = 0; index < this.versions.length; index++) {\n const test = this.versions[index];\n if (options.now && options.now < test.date) continue;\n if (filters.lts && !test.lts) continue;\n if (filters.line && !filters.line(test)) continue;\n if (!semver.satisfies(test.semver, expression)) continue;\n if (filters.key) {\n if (founds[filters.key(test)]) continue;\n founds[filters.key(test)] = true;\n }\n results.unshift(test[path]);\n }\n return results;\n};\n\nmodule.exports = NodeVersions;\n"],"names":["semver","require","Cache","constants","keyFunctions","lineFunctions","normalizeSchedule","normalizeVersion","match","parseExpression","NodeVersions","versions","schedule","Error","schedules","name","push","sort","a","b","gt","coerce","index","length","load","options","callback","cache","cacheDirectory","CACHE_DIRECTORY","get","DISTS_URL","err","SCHEDULES_URL","Promise","resolve","reject","loadCallback","loadSync","getSync","prototype","expression","path","trim","query","call","now","Date","version","test","date","range","filters","lts","indexOf","key","major","minor","undefined","line","even","odd","results","founds","satisfies","unshift","module","exports"],"mappings":";AAAA,IAAMA,SAASC,QAAQ;AACvB,IAAMC,QAAQD,QAAQ;AAEtB,IAAME,YAAYF,QAAQ;AAC1B,IAAMG,eAAeH,QAAQ;AAC7B,IAAMI,gBAAgBJ,QAAQ;AAC9B,IAAMK,oBAAoBL,QAAQ;AAClC,IAAMM,mBAAmBN,QAAQ;AACjC,IAAMO,QAAQP,QAAQ;AACtB,IAAMQ,kBAAkBR,QAAQ;AAEhC,SAASS,aAAaC,QAAQ,EAAEC,QAAQ;IACtC,IAAI,CAACD,UAAU,MAAM,IAAIE,MAAM;IAC/B,IAAI,CAACD,UAAU,MAAM,IAAIC,MAAM;IAE/B,IAAI,CAACC,SAAS,GAAG,EAAE;IACnB,IAAK,IAAMC,QAAQH,SAAU,IAAI,CAACE,SAAS,CAACE,IAAI,CAACV,kBAAkBS,MAAMH,QAAQ,CAACG,KAAK;IACvF,IAAI,CAACD,SAAS,GAAG,IAAI,CAACA,SAAS,CAACG,IAAI,CAAC,SAACC,GAAGC;eAAOnB,OAAOoB,EAAE,CAACpB,OAAOqB,MAAM,CAACH,EAAElB,MAAM,GAAGA,OAAOqB,MAAM,CAACF,EAAEnB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AAMG,OAAO,CAAC,UAAUjD,cAAcuD,IAAI,GAAG,CAACT,MAAMG,OAAO,CAAC,SAASjD,cAAcwD,GAAG,GAAGH;IAEzG,IAAMI,UAAU,EAAE;IAClB,IAAMC,SAAS,CAAC;IAEhB,IAAK,IAAIzC,SAAQ,GAAGA,SAAQ,IAAI,CAACX,QAAQ,CAACY,MAAM,EAAED,SAAS;QACzD,IAAM2B,QAAO,IAAI,CAACtC,QAAQ,CAACW,OAAM;QACjC,IAAIG,QAAQqB,GAAG,IAAIrB,QAAQqB,GAAG,GAAGG,MAAKC,IAAI,EAAE;QAC5C,IAAIE,QAAQC,GAAG,IAAI,CAACJ,MAAKI,GAAG,EAAE;QAC9B,IAAID,QAAQO,IAAI,IAAI,CAACP,QAAQO,IAAI,CAACV,QAAO;QACzC,IAAI,CAACjD,OAAOgE,SAAS,CAACf,MAAKjD,MAAM,EAAEyC,aAAa;QAChD,IAAIW,QAAQG,GAAG,EAAE;YACf,IAAIQ,MAAM,CAACX,QAAQG,GAAG,CAACN,OAAM,EAAE;YAC/Bc,MAAM,CAACX,QAAQG,GAAG,CAACN,OAAM,GAAG;QAC9B;QACAa,QAAQG,OAAO,CAAChB,KAAI,CAACP,KAAK;IAC5B;IACA,OAAOoB;AACT;AAEAI,OAAOC,OAAO,GAAGzD"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './types.js';\nexport { default } from './NodeVersions.js';\n"],"names":["default"],"mappings":";;;;+BACSA;;;eAAAA,qBAAO;;;qBADF;mEACU"}
@@ -0,0 +1,16 @@
1
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function() {
9
+ return isNaN;
10
+ }
11
+ });
12
+ function isNaN(value) {
13
+ // biome-ignore lint/suspicious/noSelfCompare: <explanation>
14
+ return value !== value;
15
+ }
16
+ /* 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":["isNaN.ts"],"sourcesContent":["// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>\nexport default function isNaN(value) {\n // biome-ignore lint/suspicious/noSelfCompare: <explanation>\n return value !== value;\n}\n"],"names":["isNaN","value"],"mappings":"AAAA,sEAAsE;;;;;+BACtE;;;eAAwBA;;;AAAT,SAASA,MAAMC,KAAK;IACjC,4DAA4D;IAC5D,OAAOA,UAAUA;AACnB"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ major: function() {
13
+ return major;
14
+ },
15
+ minor: function() {
16
+ return minor;
17
+ }
18
+ });
19
+ var major = function major(version) {
20
+ return version.major === 0 ? "".concat(version.major, ".").concat(version.minor) : version.major;
21
+ };
22
+ var minor = function minor(version) {
23
+ return version.major === 0 ? "".concat(version.major, ".").concat(version.minor, ".").concat(version.patch) : "".concat(version.major, ".").concat(version.minor);
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":["keyFunctions.ts"],"sourcesContent":["export const major = function major(version) {\n return version.major === 0 ? `${version.major}.${version.minor}` : version.major;\n};\n\nexport const minor = function minor(version) {\n return version.major === 0 ? `${version.major}.${version.minor}.${version.patch}` : `${version.major}.${version.minor}`;\n};\n"],"names":["major","minor","version","patch"],"mappings":";;;;;;;;;;;IAAaA,KAAK;eAALA;;IAIAC,KAAK;eAALA;;;AAJN,IAAMD,QAAQ,SAASA,MAAME,OAAO;IACzC,OAAOA,QAAQF,KAAK,KAAK,IAAI,AAAC,GAAmBE,OAAjBA,QAAQF,KAAK,EAAC,KAAiB,OAAdE,QAAQD,KAAK,IAAKC,QAAQF,KAAK;AAClF;AAEO,IAAMC,QAAQ,SAASA,MAAMC,OAAO;IACzC,OAAOA,QAAQF,KAAK,KAAK,IAAI,AAAC,GAAmBE,OAAjBA,QAAQF,KAAK,EAAC,KAAoBE,OAAjBA,QAAQD,KAAK,EAAC,KAAiB,OAAdC,QAAQC,KAAK,IAAK,AAAC,GAAmBD,OAAjBA,QAAQF,KAAK,EAAC,KAAiB,OAAdE,QAAQD,KAAK;AACvH"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ even: function() {
13
+ return even;
14
+ },
15
+ odd: function() {
16
+ return odd;
17
+ }
18
+ });
19
+ var even = function even(version) {
20
+ var major = version.major === 0 ? version.minor : version.major;
21
+ return major % 2 === 0;
22
+ };
23
+ var odd = function odd(version) {
24
+ var major = version.major === 0 ? version.minor : version.major;
25
+ return major % 2 === 1;
26
+ };
27
+ /* 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":["lineFunctions.ts"],"sourcesContent":["export const even = function even(version) {\n const major = version.major === 0 ? version.minor : version.major;\n return major % 2 === 0;\n};\n\nexport const odd = function odd(version) {\n const major = version.major === 0 ? version.minor : version.major;\n return major % 2 === 1;\n};\n"],"names":["even","odd","version","major","minor"],"mappings":";;;;;;;;;;;IAAaA,IAAI;eAAJA;;IAKAC,GAAG;eAAHA;;;AALN,IAAMD,OAAO,SAASA,KAAKE,OAAO;IACvC,IAAMC,QAAQD,QAAQC,KAAK,KAAK,IAAID,QAAQE,KAAK,GAAGF,QAAQC,KAAK;IACjE,OAAOA,QAAQ,MAAM;AACvB;AAEO,IAAMF,MAAM,SAASA,IAAIC,OAAO;IACrC,IAAMC,QAAQD,QAAQC,KAAK,KAAK,IAAID,QAAQE,KAAK,GAAGF,QAAQC,KAAK;IACjE,OAAOA,QAAQ,MAAM;AACvB"}
@@ -0,0 +1,17 @@
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 match;
9
+ }
10
+ });
11
+ function match(test, query) {
12
+ for(var key in query){
13
+ if (test[key] !== query[key]) return false;
14
+ }
15
+ return true;
16
+ }
17
+ /* 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; }