node-semvers 1.2.8 → 1.3.1
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/constants.cjs +7 -0
- package/bin/cli.cjs +1 -1
- package/dist/cjs/{NodeVersions.js → NodeVersions.cjs} +8 -8
- package/dist/cjs/NodeVersions.cjs.map +1 -0
- package/dist/cjs/{cli.js → cli.cjs} +2 -2
- package/dist/cjs/cli.cjs.map +1 -0
- package/dist/cjs/constants.cjs +18 -0
- package/dist/cjs/constants.cjs.map +1 -0
- package/dist/cjs/index.cjs +17 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/lib/normalizeSchedule.cjs.map +1 -0
- package/dist/cjs/lib/normalizeVersion.cjs.map +1 -0
- package/dist/cjs/parseExpression/{index.js → index.cjs} +4 -4
- package/dist/cjs/parseExpression/index.cjs.map +1 -0
- package/dist/cjs/parseExpression/{schedulesLatest.js → schedulesLatest.cjs} +1 -1
- package/dist/cjs/parseExpression/schedulesLatest.cjs.map +1 -0
- package/dist/esm/NodeVersions.mjs +1 -3
- package/dist/esm/NodeVersions.mjs.map +1 -1
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/constants.mjs +2 -10
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/index.mjs +0 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/lib/normalizeSchedule.mjs.map +1 -1
- package/dist/esm/lib/normalizeVersion.mjs.map +1 -1
- package/dist/esm/parseExpression/index.mjs.map +1 -1
- package/dist/esm/parseExpression/schedulesLatest.mjs.map +1 -1
- package/dist/types/NodeVersions.d.ts +1 -1
- package/dist/types/constants.d.ts +1 -6
- package/dist/types/index.d.ts +2 -2
- package/dist/types/lib/normalizeSchedule.d.ts +1 -1
- package/dist/types/lib/normalizeVersion.d.ts +1 -1
- package/package.json +8 -14
- package/scripts/postinstall.cjs +19 -2
- package/assets/postinstall.cjs +0 -37
- package/dist/cjs/NodeVersions.js.map +0 -1
- package/dist/cjs/assets/postinstall.js +0 -37
- package/dist/cjs/assets/postinstall.js.map +0 -1
- package/dist/cjs/cli.js.map +0 -1
- package/dist/cjs/constants.js +0 -26
- package/dist/cjs/constants.js.map +0 -1
- package/dist/cjs/index.js +0 -31
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/lib/normalizeSchedule.js.map +0 -1
- package/dist/cjs/lib/normalizeVersion.js.map +0 -1
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/parseExpression/index.js.map +0 -1
- package/dist/cjs/parseExpression/schedulesLatest.js.map +0 -1
- package/dist/esm/assets/postinstall.mjs +0 -22
- package/dist/esm/assets/postinstall.mjs.map +0 -1
- package/dist/esm/package.json +0 -1
- package/dist/types/assets/postinstall.d.ts +0 -2
- package/scripts/assets.js +0 -19
- package/scripts/rollup.config.mjs +0 -19
- /package/dist/cjs/lib/{isNaN.js → isNaN.cjs} +0 -0
- /package/dist/cjs/lib/{isNaN.js.map → isNaN.cjs.map} +0 -0
- /package/dist/cjs/lib/{keyFunctions.js → keyFunctions.cjs} +0 -0
- /package/dist/cjs/lib/{keyFunctions.js.map → keyFunctions.cjs.map} +0 -0
- /package/dist/cjs/lib/{lineFunctions.js → lineFunctions.cjs} +0 -0
- /package/dist/cjs/lib/{lineFunctions.js.map → lineFunctions.cjs.map} +0 -0
- /package/dist/cjs/lib/{match.js → match.cjs} +0 -0
- /package/dist/cjs/lib/{match.js.map → match.cjs.map} +0 -0
- /package/dist/cjs/lib/{normalizeSchedule.js → normalizeSchedule.cjs} +0 -0
- /package/dist/cjs/lib/{normalizeVersion.js → normalizeVersion.cjs} +0 -0
- /package/dist/cjs/parseExpression/{isLTSFn.js → isLTSFn.cjs} +0 -0
- /package/dist/cjs/parseExpression/{isLTSFn.js.map → isLTSFn.cjs.map} +0 -0
- /package/dist/cjs/parseExpression/{isLatestFn.js → isLatestFn.cjs} +0 -0
- /package/dist/cjs/parseExpression/{isLatestFn.js.map → isLatestFn.cjs.map} +0 -0
- /package/dist/cjs/parseExpression/{schedulesForEach.js → schedulesForEach.cjs} +0 -0
- /package/dist/cjs/parseExpression/{schedulesForEach.js.map → schedulesForEach.cjs.map} +0 -0
- /package/dist/cjs/{types.js → types.cjs} +0 -0
- /package/dist/cjs/{types.js.map → types.cjs.map} +0 -0
package/bin/cli.cjs
CHANGED
|
@@ -10,13 +10,13 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
var _fetchjsoncache = /*#__PURE__*/ _interop_require_default(require("fetch-json-cache"));
|
|
12
12
|
var _semver = /*#__PURE__*/ _interop_require_default(require("semver"));
|
|
13
|
-
var _constants = /*#__PURE__*/ _interop_require_default(require("./constants.
|
|
14
|
-
var _keyFunctions = require("./lib/keyFunctions.
|
|
15
|
-
var _lineFunctions = require("./lib/lineFunctions.
|
|
16
|
-
var _match = /*#__PURE__*/ _interop_require_default(require("./lib/match.
|
|
17
|
-
var _normalizeSchedule = /*#__PURE__*/ _interop_require_default(require("./lib/normalizeSchedule.
|
|
18
|
-
var _normalizeVersion = /*#__PURE__*/ _interop_require_default(require("./lib/normalizeVersion.
|
|
19
|
-
var _index = /*#__PURE__*/ _interop_require_default(require("./parseExpression/index.
|
|
13
|
+
var _constants = /*#__PURE__*/ _interop_require_default(require("./constants.cjs"));
|
|
14
|
+
var _keyFunctions = require("./lib/keyFunctions.cjs");
|
|
15
|
+
var _lineFunctions = require("./lib/lineFunctions.cjs");
|
|
16
|
+
var _match = /*#__PURE__*/ _interop_require_default(require("./lib/match.cjs"));
|
|
17
|
+
var _normalizeSchedule = /*#__PURE__*/ _interop_require_default(require("./lib/normalizeSchedule.cjs"));
|
|
18
|
+
var _normalizeVersion = /*#__PURE__*/ _interop_require_default(require("./lib/normalizeVersion.cjs"));
|
|
19
|
+
var _index = /*#__PURE__*/ _interop_require_default(require("./parseExpression/index.cjs"));
|
|
20
20
|
function _class_call_check(instance, Constructor) {
|
|
21
21
|
if (!(instance instanceof Constructor)) {
|
|
22
22
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -108,7 +108,7 @@ var NodeVersions = /*#__PURE__*/ function() {
|
|
|
108
108
|
if (typeof callback === 'function') return worker(options, callback);
|
|
109
109
|
return new Promise(function(resolve, reject) {
|
|
110
110
|
return worker(options, function(err, versions) {
|
|
111
|
-
err ? reject(err) : resolve(versions);
|
|
111
|
+
return err ? reject(err) : resolve(versions);
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
114
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/NodeVersions.ts"],"sourcesContent":["import Cache from 'fetch-json-cache';\nimport semver from 'semver';\n\nimport constants from './constants';\nimport { major, minor } from './lib/keyFunctions';\nimport { even, odd } from './lib/lineFunctions';\nimport match from './lib/match';\nimport normalizeSchedule from './lib/normalizeSchedule';\nimport normalizeVersion from './lib/normalizeVersion';\nimport parseExpression from './parseExpression/index';\n\nimport type { LoadError, LoadOptions, ResolveOptions, Schedule, ScheduleRaw, Version, VersionRaw } from './types';\n\nexport type LoadCallback = (error?: LoadError, semvers?: NodeVersions) => void;\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?: LoadOptions | LoadCallback, callback?: LoadCallback): undefined | Promise<NodeVersions> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n function worker(options, callback) {\n const cache = new Cache((options as LoadOptions).cachePath || constants.CACHE_PATH);\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 }\n\n if (typeof callback === 'function') return worker(options, callback) as undefined;\n return new Promise((resolve, reject) => worker(options, (err, versions) => (err ? reject(err) : resolve(versions))));\n }\n\n static loadSync(options?: LoadOptions): NodeVersions | null {\n options = options || {};\n const cache = new Cache(options.cachePath || constants.CACHE_PATH);\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: string | number | Date, options?: ResolveOptions): string | string[] | Version | Version[] | null {\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","worker","cache","Cache","cachePath","constants","CACHE_PATH","get","DISTS_URL","err","SCHEDULES_URL","Promise","reject","loadSync","getSync"],"mappings":";;;;;;;eAeqBA;;;qEAfH;6DACC;gEAEG;4BACO;6BACH;4DACR;wEACY;uEACD;4DACD;;;;;;;;;;;AAMb,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,EAACF,MAAMH,QAAQ,CAACG,KAAK;QACvF,IAAI,CAACD,SAAS,GAAG,IAAI,CAACA,SAAS,CAACI,IAAI,CAAC,SAACC,GAAGC;mBAAOC,eAAM,CAACC,EAAE,CAACD,eAAM,CAACE,MAAM,CAACJ,EAAEE,MAAM,GAAGA,eAAM,CAACE,MAAM,CAACH,EAAEC,MAAM,KAAK,IAAI,CAAC;;QAEnH,IAAI,CAACV,QAAQ,GAAG,EAAE;QAClB,IAAK,IAAIa,QAAQ,GAAGA,QAAQb,SAASc,MAAM,EAAED,QAAS,IAAI,CAACb,QAAQ,CAACK,IAAI,CAACU,IAAAA,yBAAgB,EAACf,QAAQ,CAACa,MAAM,EAAE,IAAI,CAACV,SAAS;QACzH,IAAI,CAACH,QAAQ,GAAG,IAAI,CAACA,QAAQ,CAACO,IAAI,CAAC,SAACC,GAAGC;mBAAO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2CC,UAAUC;gBAClE;YACF;QACF;QAEA,IAAI,OAAO6C,aAAa,YAAY,OAAOC,OAAO7B,SAAS4B;QAC3D,OAAO,IAAIW,QAAQ,SAACzC,SAAS0C;mBAAWX,OAAO7B,SAAS,SAACqC,KAAKvD;uBAAcuD,MAAMG,OAAOH,OAAOvC,QAAQhB;;;IAC1G;IArCmBD,aAuCZ4D,QAON,GAPD,SAAOA,SAASzC,OAAqB;QACnCA,UAAUA,WAAW,CAAC;QACtB,IAAM8B,QAAQ,IAAIC,uBAAK,CAAC/B,QAAQgC,SAAS,IAAIC,kBAAS,CAACC,UAAU;QACjE,IAAMpD,WAAWgD,MAAMY,OAAO,CAACT,kBAAS,CAACG,SAAS;QAClD,IAAMrD,WAAW+C,MAAMY,OAAO,CAACT,kBAAS,CAACK,aAAa;QACtD,IAAI,CAACxD,YAAY,CAACC,UAAU,OAAO;QACnC,OAAO,IA7CUF,aA6COC,UAAUC;IACpC;WA9CmBF"}
|
|
@@ -10,8 +10,8 @@ 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.
|
|
14
|
-
var _isNaN = /*#__PURE__*/ _interop_require_default(require("./lib/isNaN.
|
|
13
|
+
var _index = /*#__PURE__*/ _interop_require_default(require("./index.cjs"));
|
|
14
|
+
var _isNaN = /*#__PURE__*/ _interop_require_default(require("./lib/isNaN.cjs"));
|
|
15
15
|
var _isarray = /*#__PURE__*/ _interop_require_default(require("isarray"));
|
|
16
16
|
function _interop_require_default(obj) {
|
|
17
17
|
return obj && obj.__esModule ? obj : {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/cli.ts"],"sourcesContent":["import exit from 'exit';\nimport getopts from 'getopts-compat';\nimport NodeVersions, { type LoadOptions, type ResolveOptions } from './index';\n// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>\nimport isNaN from './lib/isNaN';\n\nimport isArray from 'isarray';\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 as LoadOptions, (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 as ResolveOptions);\n if (!version || (isArray(version) && !(version as string[]).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 as string[]).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;4DACgD;4DAElD;8DAEE;;;;;;IAEpB,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,SAAwB,SAACqB,KAAKC;QAC9C,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,CAAC,AAACA,QAAqBR,MAAM,EAAG;YACnEL,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,QAAQ,AAACH,QAAqBR,MAAM,EAAEW,QAAShB,QAAQC,GAAG,CAAChB,UAAU4B,OAAO,CAACG,MAAM;QACzG,OAAOhB,QAAQC,GAAG,CAAChB,UAAU4B;QAC7BP,IAAAA,aAAI,EAAC;IACP;AACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// @ts-ignore
|
|
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 _constantscjs.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _constantscjs = /*#__PURE__*/ _interop_require_default(require("../../assets/constants.cjs"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
14
|
+
return obj && obj.__esModule ? obj : {
|
|
15
|
+
default: obj
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/* 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":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/constants.ts"],"sourcesContent":["// @ts-ignore\nexport { default } from '../../assets/constants.cjs';\n"],"names":["default"],"mappings":"AAAA,aAAa;;;;;+BACJA;;;eAAAA,qBAAO;;;mEAAQ"}
|
|
@@ -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 _NodeVersions.default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _NodeVersions = /*#__PURE__*/ _interop_require_default(require("./NodeVersions.cjs"));
|
|
12
|
+
function _interop_require_default(obj) {
|
|
13
|
+
return obj && obj.__esModule ? obj : {
|
|
14
|
+
default: obj
|
|
15
|
+
};
|
|
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; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/index.ts"],"sourcesContent":["export type * from './types';\nexport { default, type LoadCallback } from './NodeVersions';\n"],"names":["default"],"mappings":";;;;+BACSA;;;eAAAA,qBAAO;;;mEAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/lib/normalizeSchedule.ts"],"sourcesContent":["import type { Schedule, ScheduleRaw } from '../types';\n\nexport default function normalizeSchedule(name: string, raw: ScheduleRaw): Schedule {\n const schedule = {\n name,\n semver: name.slice(1),\n raw,\n } as unknown as Schedule;\n\n schedule.start = new Date(raw.start);\n schedule.end = new Date(raw.end);\n if (raw.codename) schedule.codename = raw.codename.toLowerCase();\n if (raw.lts) schedule.lts = new Date(raw.lts);\n if (raw.maintenance) schedule.maintenance = new Date(raw.maintenance);\n\n return schedule;\n}\n"],"names":["normalizeSchedule","name","raw","schedule","semver","slice","start","Date","end","codename","toLowerCase","lts","maintenance"],"mappings":";;;;+BAEA;;;eAAwBA;;;AAAT,SAASA,kBAAkBC,IAAY,EAAEC,GAAgB;IACtE,IAAMC,WAAW;QACfF,MAAAA;QACAG,QAAQH,KAAKI,KAAK,CAAC;QACnBH,KAAAA;IACF;IAEAC,SAASG,KAAK,GAAG,IAAIC,KAAKL,IAAII,KAAK;IACnCH,SAASK,GAAG,GAAG,IAAID,KAAKL,IAAIM,GAAG;IAC/B,IAAIN,IAAIO,QAAQ,EAAEN,SAASM,QAAQ,GAAGP,IAAIO,QAAQ,CAACC,WAAW;IAC9D,IAAIR,IAAIS,GAAG,EAAER,SAASQ,GAAG,GAAG,IAAIJ,KAAKL,IAAIS,GAAG;IAC5C,IAAIT,IAAIU,WAAW,EAAET,SAASS,WAAW,GAAG,IAAIL,KAAKL,IAAIU,WAAW;IAEpE,OAAOT;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/lib/normalizeVersion.ts"],"sourcesContent":["import type { Schedule, Version, VersionRaw } from '../types';\n\nexport default function normalizeVersion(raw: VersionRaw, schedules: Schedule[]): Version {\n const parts = raw.version.substr(1).split('.');\n\n const version = {\n version: raw.version,\n name: parts[0] !== '0' ? `v${+parts[0]}` : `v${+parts[0]}.${+parts[1]}`,\n semver: `${parts[0]}.${+parts[1]}.${+parts[2]}`,\n major: +parts[0],\n minor: +parts[1],\n patch: +parts[2],\n lts: raw.lts,\n date: new Date(raw.date),\n raw: raw,\n } as Version;\n\n let schedule = null;\n for (let index = 0; index < schedules.length; index++) {\n const test = schedules[index];\n if (test.name === version.name) {\n schedule = test;\n break;\n }\n }\n if (schedule && raw.lts) version.codename = schedule.codename;\n return version;\n}\n"],"names":["normalizeVersion","raw","schedules","parts","version","substr","split","name","semver","major","minor","patch","lts","date","Date","schedule","index","length","test","codename"],"mappings":";;;;+BAEA;;;eAAwBA;;;AAAT,SAASA,iBAAiBC,GAAe,EAAEC,SAAqB;IAC7E,IAAMC,QAAQF,IAAIG,OAAO,CAACC,MAAM,CAAC,GAAGC,KAAK,CAAC;IAE1C,IAAMF,UAAU;QACdA,SAASH,IAAIG,OAAO;QACpBG,MAAMJ,KAAK,CAAC,EAAE,KAAK,MAAM,AAAC,IAAa,OAAV,CAACA,KAAK,CAAC,EAAE,IAAK,AAAC,IAAgB,OAAb,CAACA,KAAK,CAAC,EAAE,EAAC,KAAa,OAAV,CAACA,KAAK,CAAC,EAAE;QACrEK,QAAQ,AAAC,GAAc,OAAZL,KAAK,CAAC,EAAE,EAAC,KAAgB,OAAb,CAACA,KAAK,CAAC,EAAE,EAAC,KAAa,OAAV,CAACA,KAAK,CAAC,EAAE;QAC7CM,OAAO,CAACN,KAAK,CAAC,EAAE;QAChBO,OAAO,CAACP,KAAK,CAAC,EAAE;QAChBQ,OAAO,CAACR,KAAK,CAAC,EAAE;QAChBS,KAAKX,IAAIW,GAAG;QACZC,MAAM,IAAIC,KAAKb,IAAIY,IAAI;QACvBZ,KAAKA;IACP;IAEA,IAAIc,WAAW;IACf,IAAK,IAAIC,QAAQ,GAAGA,QAAQd,UAAUe,MAAM,EAAED,QAAS;QACrD,IAAME,OAAOhB,SAAS,CAACc,MAAM;QAC7B,IAAIE,KAAKX,IAAI,KAAKH,QAAQG,IAAI,EAAE;YAC9BQ,WAAWG;YACX;QACF;IACF;IACA,IAAIH,YAAYd,IAAIW,GAAG,EAAER,QAAQe,QAAQ,GAAGJ,SAASI,QAAQ;IAC7D,OAAOf;AACT"}
|
|
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
return parseExpression;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var _isNaN = /*#__PURE__*/ _interop_require_default(require("../lib/isNaN.
|
|
13
|
-
var _isLTSFn = /*#__PURE__*/ _interop_require_default(require("./isLTSFn.
|
|
14
|
-
var _isLatestFn = /*#__PURE__*/ _interop_require_default(require("./isLatestFn.
|
|
15
|
-
var _schedulesLatest = /*#__PURE__*/ _interop_require_default(require("./schedulesLatest.
|
|
12
|
+
var _isNaN = /*#__PURE__*/ _interop_require_default(require("../lib/isNaN.cjs"));
|
|
13
|
+
var _isLTSFn = /*#__PURE__*/ _interop_require_default(require("./isLTSFn.cjs"));
|
|
14
|
+
var _isLatestFn = /*#__PURE__*/ _interop_require_default(require("./isLatestFn.cjs"));
|
|
15
|
+
var _schedulesLatest = /*#__PURE__*/ _interop_require_default(require("./schedulesLatest.cjs"));
|
|
16
16
|
function _interop_require_default(obj) {
|
|
17
17
|
return obj && obj.__esModule ? obj : {
|
|
18
18
|
default: obj
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/parseExpression/index.ts"],"sourcesContent":["// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>\nimport isNaN from '../lib/isNaN';\nimport isLTSFn from './isLTSFn';\nimport isLatestFn from './isLatestFn';\nimport schedulesLatest from './schedulesLatest';\n\nexport default function parseExpression(expression, now) {\n if (expression[0] === 'v' && !isNaN(+expression.substr(1, 1))) expression = expression.substr(1);\n if (expression.substr(0, 4) === 'lts/') expression = expression.substr(4) === '*' ? 'lts' : expression.substr(4);\n if (expression === 'stable') expression = 'lts';\n\n if (typeof expression === 'number') return { major: expression };\n if (~expression.indexOf('.')) {\n const parts = expression.split('.');\n if (parts.length === 1) return isNaN(+parts[0]) ? null : { major: +parts[0] };\n if (parts.length === 2) return isNaN(+parts[0]) && isNaN(+parts[1]) ? null : { major: +parts[0], minor: +parts[1] };\n return isNaN(+parts[0]) && isNaN(+parts[1]) && isNaN(+parts[2]) ? null : { major: +parts[0], minor: +parts[1], patch: +parts[2] };\n }\n if (!isNaN(+expression)) return { major: +expression };\n if (expression === 'lts') {\n const lts = schedulesLatest(this.schedules, isLTSFn(now));\n return lts ? { name: lts.name } : null;\n }\n if (expression === 'latest') {\n const latest = schedulesLatest(this.schedules, isLatestFn(now));\n return latest ? { name: latest.name } : null;\n }\n return { codename: expression.toLowerCase() };\n}\n"],"names":["parseExpression","expression","now","isNaN","substr","major","indexOf","parts","split","length","minor","patch","lts","schedulesLatest","schedules","isLTSFn","name","latest","isLatestFn","codename","toLowerCase"],"mappings":"AAAA,sEAAsE;;;;;+BAMtE;;;eAAwBA;;;4DALN;8DACE;iEACG;sEACK;;;;;;AAEb,SAASA,gBAAgBC,UAAU,EAAEC,GAAG;IACrD,IAAID,UAAU,CAAC,EAAE,KAAK,OAAO,CAACE,IAAAA,cAAK,EAAC,CAACF,WAAWG,MAAM,CAAC,GAAG,KAAKH,aAAaA,WAAWG,MAAM,CAAC;IAC9F,IAAIH,WAAWG,MAAM,CAAC,GAAG,OAAO,QAAQH,aAAaA,WAAWG,MAAM,CAAC,OAAO,MAAM,QAAQH,WAAWG,MAAM,CAAC;IAC9G,IAAIH,eAAe,UAAUA,aAAa;IAE1C,IAAI,OAAOA,eAAe,UAAU,OAAO;QAAEI,OAAOJ;IAAW;IAC/D,IAAI,CAACA,WAAWK,OAAO,CAAC,MAAM;QAC5B,IAAMC,QAAQN,WAAWO,KAAK,CAAC;QAC/B,IAAID,MAAME,MAAM,KAAK,GAAG,OAAON,IAAAA,cAAK,EAAC,CAACI,KAAK,CAAC,EAAE,IAAI,OAAO;YAAEF,OAAO,CAACE,KAAK,CAAC,EAAE;QAAC;QAC5E,IAAIA,MAAME,MAAM,KAAK,GAAG,OAAON,IAAAA,cAAK,EAAC,CAACI,KAAK,CAAC,EAAE,KAAKJ,IAAAA,cAAK,EAAC,CAACI,KAAK,CAAC,EAAE,IAAI,OAAO;YAAEF,OAAO,CAACE,KAAK,CAAC,EAAE;YAAEG,OAAO,CAACH,KAAK,CAAC,EAAE;QAAC;QAClH,OAAOJ,IAAAA,cAAK,EAAC,CAACI,KAAK,CAAC,EAAE,KAAKJ,IAAAA,cAAK,EAAC,CAACI,KAAK,CAAC,EAAE,KAAKJ,IAAAA,cAAK,EAAC,CAACI,KAAK,CAAC,EAAE,IAAI,OAAO;YAAEF,OAAO,CAACE,KAAK,CAAC,EAAE;YAAEG,OAAO,CAACH,KAAK,CAAC,EAAE;YAAEI,OAAO,CAACJ,KAAK,CAAC,EAAE;QAAC;IAClI;IACA,IAAI,CAACJ,IAAAA,cAAK,EAAC,CAACF,aAAa,OAAO;QAAEI,OAAO,CAACJ;IAAW;IACrD,IAAIA,eAAe,OAAO;QACxB,IAAMW,MAAMC,IAAAA,wBAAe,EAAC,IAAI,CAACC,SAAS,EAAEC,IAAAA,gBAAO,EAACb;QACpD,OAAOU,MAAM;YAAEI,MAAMJ,IAAII,IAAI;QAAC,IAAI;IACpC;IACA,IAAIf,eAAe,UAAU;QAC3B,IAAMgB,SAASJ,IAAAA,wBAAe,EAAC,IAAI,CAACC,SAAS,EAAEI,IAAAA,mBAAU,EAAChB;QAC1D,OAAOe,SAAS;YAAED,MAAMC,OAAOD,IAAI;QAAC,IAAI;IAC1C;IACA,OAAO;QAAEG,UAAUlB,WAAWmB,WAAW;IAAG;AAC9C"}
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return schedulesLatest;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
var _schedulesForEach = /*#__PURE__*/ _interop_require_default(require("./schedulesForEach.
|
|
11
|
+
var _schedulesForEach = /*#__PURE__*/ _interop_require_default(require("./schedulesForEach.cjs"));
|
|
12
12
|
function _interop_require_default(obj) {
|
|
13
13
|
return obj && obj.__esModule ? obj : {
|
|
14
14
|
default: obj
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/parseExpression/schedulesLatest.ts"],"sourcesContent":["import schedulesForEach from './schedulesForEach';\n\nexport default function schedulesLatest(schedules, filter) {\n let latest = null;\n schedulesForEach(schedules, filter, (schedule) => {\n if (!latest || latest.start < schedule.start) latest = schedule;\n });\n return latest;\n}\n"],"names":["schedulesLatest","schedules","filter","latest","schedulesForEach","schedule","start"],"mappings":";;;;+BAEA;;;eAAwBA;;;uEAFK;;;;;;AAEd,SAASA,gBAAgBC,SAAS,EAAEC,MAAM;IACvD,IAAIC,SAAS;IACbC,IAAAA,yBAAgB,EAACH,WAAWC,QAAQ,SAACG;QACnC,IAAI,CAACF,UAAUA,OAAOG,KAAK,GAAGD,SAASC,KAAK,EAAEH,SAASE;IACzD;IACA,OAAOF;AACT"}
|
|
@@ -24,9 +24,7 @@ let NodeVersions = class NodeVersions {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
if (typeof callback === 'function') return worker(options, callback);
|
|
27
|
-
return new Promise((resolve, reject)=>worker(options, (err, versions)=>
|
|
28
|
-
err ? reject(err) : resolve(versions);
|
|
29
|
-
}));
|
|
27
|
+
return new Promise((resolve, reject)=>worker(options, (err, versions)=>err ? reject(err) : resolve(versions)));
|
|
30
28
|
}
|
|
31
29
|
static loadSync(options) {
|
|
32
30
|
options = options || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/NodeVersions.ts"],"sourcesContent":["import Cache from 'fetch-json-cache';\nimport semver from 'semver';\n\nimport constants from './constants
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/NodeVersions.ts"],"sourcesContent":["import Cache from 'fetch-json-cache';\nimport semver from 'semver';\n\nimport constants from './constants';\nimport { major, minor } from './lib/keyFunctions';\nimport { even, odd } from './lib/lineFunctions';\nimport match from './lib/match';\nimport normalizeSchedule from './lib/normalizeSchedule';\nimport normalizeVersion from './lib/normalizeVersion';\nimport parseExpression from './parseExpression/index';\n\nimport type { LoadError, LoadOptions, ResolveOptions, Schedule, ScheduleRaw, Version, VersionRaw } from './types';\n\nexport type LoadCallback = (error?: LoadError, semvers?: NodeVersions) => void;\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?: LoadOptions | LoadCallback, callback?: LoadCallback): undefined | Promise<NodeVersions> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n function worker(options, callback) {\n const cache = new Cache((options as LoadOptions).cachePath || constants.CACHE_PATH);\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 }\n\n if (typeof callback === 'function') return worker(options, callback) as undefined;\n return new Promise((resolve, reject) => worker(options, (err, versions) => (err ? reject(err) : resolve(versions))));\n }\n\n static loadSync(options?: LoadOptions): NodeVersions | null {\n options = options || {};\n const cache = new Cache(options.cachePath || constants.CACHE_PATH);\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: string | number | Date, options?: ResolveOptions): string | string[] | Version | Version[] | null {\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":["Cache","semver","constants","major","minor","even","odd","match","normalizeSchedule","normalizeVersion","parseExpression","NodeVersions","load","options","callback","worker","cache","cachePath","CACHE_PATH","get","DISTS_URL","err","versions","SCHEDULES_URL","schedule","Promise","resolve","reject","loadSync","getSync","expression","path","trim","query","call","now","Date","version","index","length","test","date","range","filters","lts","indexOf","key","undefined","line","results","founds","satisfies","unshift","constructor","Error","schedules","name","push","sort","a","b","gt","coerce"],"mappings":"AAAA,OAAOA,WAAW,mBAAmB;A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AAChB,QAAQ,CAACmC,IAAI,CAAChD,iBAAiBa,QAAQ,CAACgB,MAAM,EAAE,IAAI,CAACiB,SAAS;QACzH,IAAI,CAACjC,QAAQ,GAAG,IAAI,CAACA,QAAQ,CAACoC,IAAI,CAAC,CAACC,GAAGC,IAAO3D,OAAO4D,EAAE,CAACF,EAAE1D,MAAM,EAAE2D,EAAE3D,MAAM,IAAI,CAAC,IAAI;IACrF;AA+EF;AA9FA,SAAqBU,0BA8FpB"}
|
package/dist/esm/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/cli.ts"],"sourcesContent":["import exit from 'exit';\nimport getopts from 'getopts-compat';\nimport NodeVersions, { type LoadOptions, type ResolveOptions } from './index
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/cli.ts"],"sourcesContent":["import exit from 'exit';\nimport getopts from 'getopts-compat';\nimport NodeVersions, { type LoadOptions, type ResolveOptions } from './index';\n// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>\nimport isNaN from './lib/isNaN';\n\nimport isArray from 'isarray';\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 as LoadOptions, (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 as ResolveOptions);\n if (!version || (isArray(version) && !(version as string[]).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 as string[]).length; index++) console.log(stringify(version[index]));\n } else console.log(stringify(version));\n exit(0);\n });\n};\n"],"names":["exit","getopts","NodeVersions","isNaN","isArray","argv","options","slice","alias","path","range","now","stopEarly","Date","parse","help","console","log","args","concat","_","length","stringify","value","JSON","load","err","semvers","message","code","version","resolve","index"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,aAAa,iBAAiB;AACrC,OAAOC,kBAA6D,UAAU;AAC9E,sEAAsE;AACtE,OAAOC,WAAW,cAAc;AAEhC,OAAOC,aAAa,UAAU;AAE9B,eAAe,CAAA,CAACC;IACd,MAAMC,UAAUL,QAAQI,KAAKE,KAAK,CAAC,IAAI;QACrCC,OAAO;YAAEC,MAAM;YAAKC,OAAO;YAAKC,KAAK;QAAI;QACzCC,WAAW;IACb;IACA,IAAI,OAAON,QAAQK,GAAG,KAAK,aAAaL,QAAQK,GAAG,GAAG,IAAIE,KAAKV,MAAM,CAACG,QAAQK,GAAG,IAAIE,KAAKC,KAAK,CAACR,QAAQK,G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gB,QAAQC,GAAG,CAAC;QACZ,IAAIb,QAAQ0B,UAAU;YACpB,IAAK,IAAIE,QAAQ,GAAGA,QAAQ,AAACF,QAAqBT,MAAM,EAAEW,QAAShB,QAAQC,GAAG,CAACK,UAAUQ,OAAO,CAACE,MAAM;QACzG,OAAOhB,QAAQC,GAAG,CAACK,UAAUQ;QAC7B9B,KAAK;IACP;AACF,CAAA,EAAE"}
|
package/dist/esm/constants.mjs
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import moduleRoot from 'module-root-sync';
|
|
4
|
-
const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
|
|
5
|
-
const root = moduleRoot(__dirname);
|
|
6
|
-
export default {
|
|
7
|
-
CACHE_PATH: path.resolve(path.join(root, '.cache')),
|
|
8
|
-
DISTS_URL: 'https://nodejs.org/dist/index.json',
|
|
9
|
-
SCHEDULES_URL: 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json'
|
|
10
|
-
};
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
export { default } from '../../assets/constants.cjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/constants.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/constants.ts"],"sourcesContent":["// @ts-ignore\nexport { default } from '../../assets/constants.cjs';\n"],"names":["default"],"mappings":"AAAA,aAAa;AACb,SAASA,OAAO,QAAQ,6BAA6B"}
|
package/dist/esm/index.mjs
CHANGED
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/index.ts"],"sourcesContent":["export * from './types
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/index.ts"],"sourcesContent":["export type * from './types';\nexport { default, type LoadCallback } from './NodeVersions';\n"],"names":["default"],"mappings":"AACA,SAASA,OAAO,QAA2B,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/lib/normalizeSchedule.ts"],"sourcesContent":["import type { Schedule, ScheduleRaw } from '../types
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/lib/normalizeSchedule.ts"],"sourcesContent":["import type { Schedule, ScheduleRaw } from '../types';\n\nexport default function normalizeSchedule(name: string, raw: ScheduleRaw): Schedule {\n const schedule = {\n name,\n semver: name.slice(1),\n raw,\n } as unknown as Schedule;\n\n schedule.start = new Date(raw.start);\n schedule.end = new Date(raw.end);\n if (raw.codename) schedule.codename = raw.codename.toLowerCase();\n if (raw.lts) schedule.lts = new Date(raw.lts);\n if (raw.maintenance) schedule.maintenance = new Date(raw.maintenance);\n\n return schedule;\n}\n"],"names":["normalizeSchedule","name","raw","schedule","semver","slice","start","Date","end","codename","toLowerCase","lts","maintenance"],"mappings":"AAEA,eAAe,SAASA,kBAAkBC,IAAY,EAAEC,GAAgB;IACtE,MAAMC,WAAW;QACfF;QACAG,QAAQH,KAAKI,KAAK,CAAC;QACnBH;IACF;IAEAC,SAASG,KAAK,GAAG,IAAIC,KAAKL,IAAII,KAAK;IACnCH,SAASK,GAAG,GAAG,IAAID,KAAKL,IAAIM,GAAG;IAC/B,IAAIN,IAAIO,QAAQ,EAAEN,SAASM,QAAQ,GAAGP,IAAIO,QAAQ,CAACC,WAAW;IAC9D,IAAIR,IAAIS,GAAG,EAAER,SAASQ,GAAG,GAAG,IAAIJ,KAAKL,IAAIS,GAAG;IAC5C,IAAIT,IAAIU,WAAW,EAAET,SAASS,WAAW,GAAG,IAAIL,KAAKL,IAAIU,WAAW;IAEpE,OAAOT;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/lib/normalizeVersion.ts"],"sourcesContent":["import type { Schedule, Version, VersionRaw } from '../types
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/lib/normalizeVersion.ts"],"sourcesContent":["import type { Schedule, Version, VersionRaw } from '../types';\n\nexport default function normalizeVersion(raw: VersionRaw, schedules: Schedule[]): Version {\n const parts = raw.version.substr(1).split('.');\n\n const version = {\n version: raw.version,\n name: parts[0] !== '0' ? `v${+parts[0]}` : `v${+parts[0]}.${+parts[1]}`,\n semver: `${parts[0]}.${+parts[1]}.${+parts[2]}`,\n major: +parts[0],\n minor: +parts[1],\n patch: +parts[2],\n lts: raw.lts,\n date: new Date(raw.date),\n raw: raw,\n } as Version;\n\n let schedule = null;\n for (let index = 0; index < schedules.length; index++) {\n const test = schedules[index];\n if (test.name === version.name) {\n schedule = test;\n break;\n }\n }\n if (schedule && raw.lts) version.codename = schedule.codename;\n return version;\n}\n"],"names":["normalizeVersion","raw","schedules","parts","version","substr","split","name","semver","major","minor","patch","lts","date","Date","schedule","index","length","test","codename"],"mappings":"AAEA,eAAe,SAASA,iBAAiBC,GAAe,EAAEC,SAAqB;IAC7E,MAAMC,QAAQF,IAAIG,OAAO,CAACC,MAAM,CAAC,GAAGC,KAAK,CAAC;IAE1C,MAAMF,UAAU;QACdA,SAASH,IAAIG,OAAO;QACpBG,MAAMJ,KAAK,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,EAAE,CAACA,KAAK,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,CAACA,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAACA,KAAK,CAAC,EAAE,EAAE;QACvEK,QAAQ,GAAGL,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAACA,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAACA,KAAK,CAAC,EAAE,EAAE;QAC/CM,OAAO,CAACN,KAAK,CAAC,EAAE;QAChBO,OAAO,CAACP,KAAK,CAAC,EAAE;QAChBQ,OAAO,CAACR,KAAK,CAAC,EAAE;QAChBS,KAAKX,IAAIW,GAAG;QACZC,MAAM,IAAIC,KAAKb,IAAIY,IAAI;QACvBZ,KAAKA;IACP;IAEA,IAAIc,WAAW;IACf,IAAK,IAAIC,QAAQ,GAAGA,QAAQd,UAAUe,MAAM,EAAED,QAAS;QACrD,MAAME,OAAOhB,SAAS,CAACc,MAAM;QAC7B,IAAIE,KAAKX,IAAI,KAAKH,QAAQG,IAAI,EAAE;YAC9BQ,WAAWG;YACX;QACF;IACF;IACA,IAAIH,YAAYd,IAAIW,GAAG,EAAER,QAAQe,QAAQ,GAAGJ,SAASI,QAAQ;IAC7D,OAAOf;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/parseExpression/index.ts"],"sourcesContent":["// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>\nimport isNaN from '../lib/isNaN
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/parseExpression/index.ts"],"sourcesContent":["// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>\nimport isNaN from '../lib/isNaN';\nimport isLTSFn from './isLTSFn';\nimport isLatestFn from './isLatestFn';\nimport schedulesLatest from './schedulesLatest';\n\nexport default function parseExpression(expression, now) {\n if (expression[0] === 'v' && !isNaN(+expression.substr(1, 1))) expression = expression.substr(1);\n if (expression.substr(0, 4) === 'lts/') expression = expression.substr(4) === '*' ? 'lts' : expression.substr(4);\n if (expression === 'stable') expression = 'lts';\n\n if (typeof expression === 'number') return { major: expression };\n if (~expression.indexOf('.')) {\n const parts = expression.split('.');\n if (parts.length === 1) return isNaN(+parts[0]) ? null : { major: +parts[0] };\n if (parts.length === 2) return isNaN(+parts[0]) && isNaN(+parts[1]) ? null : { major: +parts[0], minor: +parts[1] };\n return isNaN(+parts[0]) && isNaN(+parts[1]) && isNaN(+parts[2]) ? null : { major: +parts[0], minor: +parts[1], patch: +parts[2] };\n }\n if (!isNaN(+expression)) return { major: +expression };\n if (expression === 'lts') {\n const lts = schedulesLatest(this.schedules, isLTSFn(now));\n return lts ? { name: lts.name } : null;\n }\n if (expression === 'latest') {\n const latest = schedulesLatest(this.schedules, isLatestFn(now));\n return latest ? { name: latest.name } : null;\n }\n return { codename: expression.toLowerCase() };\n}\n"],"names":["isNaN","isLTSFn","isLatestFn","schedulesLatest","parseExpression","expression","now","substr","major","indexOf","parts","split","length","minor","patch","lts","schedules","name","latest","codename","toLowerCase"],"mappings":"AAAA,sEAAsE;AACtE,OAAOA,WAAW,eAAe;AACjC,OAAOC,aAAa,YAAY;AAChC,OAAOC,gBAAgB,eAAe;AACtC,OAAOC,qBAAqB,oBAAoB;AAEhD,eAAe,SAASC,gBAAgBC,UAAU,EAAEC,GAAG;IACrD,IAAID,UAAU,CAAC,EAAE,KAAK,OAAO,CAACL,MAAM,CAACK,WAAWE,MAAM,CAAC,GAAG,KAAKF,aAAaA,WAAWE,MAAM,CAAC;IAC9F,IAAIF,WAAWE,MAAM,CAAC,GAAG,OAAO,QAAQF,aAAaA,WAAWE,MAAM,CAAC,OAAO,MAAM,QAAQF,WAAWE,MAAM,CAAC;IAC9G,IAAIF,eAAe,UAAUA,aAAa;IAE1C,IAAI,OAAOA,eAAe,UAAU,OAAO;QAAEG,OAAOH;IAAW;IAC/D,IAAI,CAACA,WAAWI,OAAO,CAAC,MAAM;QAC5B,MAAMC,QAAQL,WAAWM,KAAK,CAAC;QAC/B,IAAID,MAAME,MAAM,KAAK,GAAG,OAAOZ,MAAM,CAACU,KAAK,CAAC,EAAE,IAAI,OAAO;YAAEF,OAAO,CAACE,KAAK,CAAC,EAAE;QAAC;QAC5E,IAAIA,MAAME,MAAM,KAAK,GAAG,OAAOZ,MAAM,CAACU,KAAK,CAAC,EAAE,KAAKV,MAAM,CAACU,KAAK,CAAC,EAAE,IAAI,OAAO;YAAEF,OAAO,CAACE,KAAK,CAAC,EAAE;YAAEG,OAAO,CAACH,KAAK,CAAC,EAAE;QAAC;QAClH,OAAOV,MAAM,CAACU,KAAK,CAAC,EAAE,KAAKV,MAAM,CAACU,KAAK,CAAC,EAAE,KAAKV,MAAM,CAACU,KAAK,CAAC,EAAE,IAAI,OAAO;YAAEF,OAAO,CAACE,KAAK,CAAC,EAAE;YAAEG,OAAO,CAACH,KAAK,CAAC,EAAE;YAAEI,OAAO,CAACJ,KAAK,CAAC,EAAE;QAAC;IAClI;IACA,IAAI,CAACV,MAAM,CAACK,aAAa,OAAO;QAAEG,OAAO,CAACH;IAAW;IACrD,IAAIA,eAAe,OAAO;QACxB,MAAMU,MAAMZ,gBAAgB,IAAI,CAACa,SAAS,EAAEf,QAAQK;QACpD,OAAOS,MAAM;YAAEE,MAAMF,IAAIE,IAAI;QAAC,IAAI;IACpC;IACA,IAAIZ,eAAe,UAAU;QAC3B,MAAMa,SAASf,gBAAgB,IAAI,CAACa,SAAS,EAAEd,WAAWI;QAC1D,OAAOY,SAAS;YAAED,MAAMC,OAAOD,IAAI;QAAC,IAAI;IAC1C;IACA,OAAO;QAAEE,UAAUd,WAAWe,WAAW;IAAG;AAC9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/parseExpression/schedulesLatest.ts"],"sourcesContent":["import schedulesForEach from './schedulesForEach
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/parseExpression/schedulesLatest.ts"],"sourcesContent":["import schedulesForEach from './schedulesForEach';\n\nexport default function schedulesLatest(schedules, filter) {\n let latest = null;\n schedulesForEach(schedules, filter, (schedule) => {\n if (!latest || latest.start < schedule.start) latest = schedule;\n });\n return latest;\n}\n"],"names":["schedulesForEach","schedulesLatest","schedules","filter","latest","schedule","start"],"mappings":"AAAA,OAAOA,sBAAsB,qBAAqB;AAElD,eAAe,SAASC,gBAAgBC,SAAS,EAAEC,MAAM;IACvD,IAAIC,SAAS;IACbJ,iBAAiBE,WAAWC,QAAQ,CAACE;QACnC,IAAI,CAACD,UAAUA,OAAOE,KAAK,GAAGD,SAASC,KAAK,EAAEF,SAASC;IACzD;IACA,OAAOD;AACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LoadError, LoadOptions, ResolveOptions, Schedule, ScheduleRaw, Version, VersionRaw } from './types
|
|
1
|
+
import type { LoadError, LoadOptions, ResolveOptions, Schedule, ScheduleRaw, Version, VersionRaw } from './types';
|
|
2
2
|
export type LoadCallback = (error?: LoadError, semvers?: NodeVersions) => void;
|
|
3
3
|
export default class NodeVersions {
|
|
4
4
|
versions: Version[];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './types
|
|
2
|
-
export { default, type LoadCallback } from './NodeVersions
|
|
1
|
+
export type * from './types';
|
|
2
|
+
export { default, type LoadCallback } from './NodeVersions';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Schedule, ScheduleRaw } from '../types
|
|
1
|
+
import type { Schedule, ScheduleRaw } from '../types';
|
|
2
2
|
export default function normalizeSchedule(name: string, raw: ScheduleRaw): Schedule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Schedule, Version, VersionRaw } from '../types
|
|
1
|
+
import type { Schedule, Version, VersionRaw } from '../types';
|
|
2
2
|
export default function normalizeVersion(raw: VersionRaw, schedules: Schedule[]): Version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-semvers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Utilities for managing versions of node including looking up codenames",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
23
23
|
"import": "./dist/esm/index.mjs",
|
|
24
|
-
"require": "./dist/cjs/index.
|
|
24
|
+
"require": "./dist/cjs/index.cjs",
|
|
25
25
|
"types": "./dist/types/index.d.ts"
|
|
26
26
|
},
|
|
27
27
|
"./*": "./*"
|
|
28
28
|
},
|
|
29
|
-
"main": "dist/cjs/index.
|
|
29
|
+
"main": "dist/cjs/index.cjs",
|
|
30
30
|
"module": "dist/esm/index.mjs",
|
|
31
31
|
"types": "dist/types/index.d.ts",
|
|
32
32
|
"bin": {
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"scripts"
|
|
40
40
|
],
|
|
41
41
|
"scripts": {
|
|
42
|
-
"build": "tsds build
|
|
42
|
+
"build": "tsds build",
|
|
43
43
|
"deploy": "tsds deploy",
|
|
44
|
-
"format": "biome check --write --unsafe src/
|
|
44
|
+
"format": "biome check --write --unsafe src/ && biome check --config-path biome.es5.json --write --unsafe assets/ scripts/",
|
|
45
45
|
"postinstall": "node scripts/postinstall.cjs",
|
|
46
46
|
"test": "tsds test:node --no-timeouts",
|
|
47
47
|
"test:engines": "nvu engines npm test",
|
|
@@ -52,23 +52,17 @@
|
|
|
52
52
|
"fetch-json-cache": "^1.2.5",
|
|
53
53
|
"getopts-compat": "^2.2.5",
|
|
54
54
|
"isarray": "^2.0.5",
|
|
55
|
-
"module-root-sync": "^0.1.1",
|
|
56
55
|
"semver": "^5.7.1"
|
|
57
56
|
},
|
|
58
57
|
"devDependencies": {
|
|
59
58
|
"@biomejs/biome": "^1.9.4",
|
|
60
|
-
"@rollup/plugin-commonjs": "^28.0.2",
|
|
61
59
|
"@types/mocha": "^10.0.10",
|
|
62
|
-
"@types/node": "^22.10.
|
|
60
|
+
"@types/node": "^22.10.4",
|
|
63
61
|
"cr": "^0.1.0",
|
|
64
|
-
"cross-spawn-cb": "^
|
|
65
|
-
"depcheck": "^1.4.7",
|
|
66
|
-
"get-tsconfig-compat": "^2.0.3",
|
|
62
|
+
"cross-spawn-cb": "^2.0.3",
|
|
67
63
|
"pinkie-promise": "^2.0.1",
|
|
68
64
|
"rimraf2": "^2.8.2",
|
|
69
|
-
"rollup": "^4.29.1"
|
|
70
|
-
"rollup-plugin-node-externals": "^8.0.0",
|
|
71
|
-
"ts-swc-rollup-plugin": "^1.6.7"
|
|
65
|
+
"rollup": "^4.29.1"
|
|
72
66
|
},
|
|
73
67
|
"engines": {
|
|
74
68
|
"node": ">=0.8"
|
package/scripts/postinstall.cjs
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
var Cache = require('fetch-json-cache');
|
|
2
|
+
var constants = require('../assets/constants.cjs');
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
function cache(callback) {
|
|
5
|
+
var cache = new Cache(constants.CACHE_PATH);
|
|
6
|
+
cache.get(constants.DISTS_URL, { force: true }, function (err) {
|
|
7
|
+
err ? callback(err) : cache.get(constants.SCHEDULES_URL, { force: true }, callback);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// run patch
|
|
12
|
+
cache(function (err) {
|
|
13
|
+
if (err) {
|
|
14
|
+
console.log('postinstall failed. Error: ' + err.message);
|
|
15
|
+
process.exit(-1);
|
|
16
|
+
} else {
|
|
17
|
+
console.log('postinstall succeeded');
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
});
|
package/assets/postinstall.cjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var Cache = require('fetch-json-cache');
|
|
4
|
-
var path = require('path');
|
|
5
|
-
var url = require('url');
|
|
6
|
-
var moduleRoot = require('module-root-sync');
|
|
7
|
-
|
|
8
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
9
|
-
var __dirname$1 = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('postinstall.cjs', document.baseURI).href))) : __filename);
|
|
10
|
-
var root = moduleRoot(__dirname$1);
|
|
11
|
-
var constants = {
|
|
12
|
-
CACHE_PATH: path.resolve(path.join(root, '.cache')),
|
|
13
|
-
DISTS_URL: 'https://nodejs.org/dist/index.json',
|
|
14
|
-
SCHEDULES_URL: 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json'
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
function postinstall() {
|
|
18
|
-
var cacheJSON = function cacheJSON(callback) {
|
|
19
|
-
cache.get(constants.DISTS_URL, {
|
|
20
|
-
force: true
|
|
21
|
-
}, function(err) {
|
|
22
|
-
err ? callback(err) : cache.get(constants.SCHEDULES_URL, {
|
|
23
|
-
force: true
|
|
24
|
-
}, callback);
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
var cache = new Cache(constants.CACHE_PATH);
|
|
28
|
-
cacheJSON(function(err) {
|
|
29
|
-
if (err) {
|
|
30
|
-
console.log("Failed to cache dists and schedules. Error: ".concat(err.message));
|
|
31
|
-
return process.exit(err.code || -1);
|
|
32
|
-
}
|
|
33
|
-
process.exit(0);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
module.exports = postinstall;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/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 { LoadError, LoadOptions, ResolveOptions, Schedule, ScheduleRaw, Version, VersionRaw } from './types.js';\n\nexport type LoadCallback = (error?: LoadError, semvers?: NodeVersions) => void;\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?: LoadOptions | LoadCallback, callback?: LoadCallback): undefined | Promise<NodeVersions> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n function worker(options, callback) {\n const cache = new Cache((options as LoadOptions).cachePath || constants.CACHE_PATH);\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 }\n\n if (typeof callback === 'function') return worker(options, callback) as undefined;\n return new Promise((resolve, reject) =>\n worker(options, (err, versions) => {\n err ? reject(err) : resolve(versions);\n })\n );\n }\n\n static loadSync(options?: LoadOptions): NodeVersions | null {\n options = options || {};\n const cache = new Cache(options.cachePath || constants.CACHE_PATH);\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: string | number | Date, options?: ResolveOptions): string | string[] | Version | Version[] | null {\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","worker","cache","Cache","cachePath","constants","CACHE_PATH","get","DISTS_URL","err","SCHEDULES_URL","Promise","reject","loadSync","getSync"],"mappings":";;;;;;;eAeqBA;;;qEAfH;6DACC;gEAEG;4BACO;6BACH;4DACR;wEACY;uEACD;4DACD;;;;;;;;;;;AAMb,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,EA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
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _fetchjsoncache = /*#__PURE__*/ _interop_require_default(require("fetch-json-cache"));
|
|
12
|
-
var _constantscjs = /*#__PURE__*/ _interop_require_default(require("../constants.js"));
|
|
13
|
-
function _interop_require_default(obj) {
|
|
14
|
-
return obj && obj.__esModule ? obj : {
|
|
15
|
-
default: obj
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
var _default = function() {
|
|
19
|
-
var cacheJSON = function cacheJSON(callback) {
|
|
20
|
-
cache.get(_constantscjs.default.DISTS_URL, {
|
|
21
|
-
force: true
|
|
22
|
-
}, function(err) {
|
|
23
|
-
err ? callback(err) : cache.get(_constantscjs.default.SCHEDULES_URL, {
|
|
24
|
-
force: true
|
|
25
|
-
}, callback);
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
var cache = new _fetchjsoncache.default(_constantscjs.default.CACHE_PATH);
|
|
29
|
-
cacheJSON(function(err) {
|
|
30
|
-
if (err) {
|
|
31
|
-
console.log("Failed to cache dists and schedules. Error: ".concat(err.message));
|
|
32
|
-
return process.exit(err.code || -1);
|
|
33
|
-
}
|
|
34
|
-
process.exit(0);
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
/* 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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/assets/postinstall.ts"],"sourcesContent":["import Cache from 'fetch-json-cache';\n// @ts-ignore\nimport constants from '../constants.cjs';\n\nexport default () => {\n const cache = new Cache(constants.CACHE_PATH);\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 process.exit(err.code || -1);\n }\n process.exit(0);\n });\n};\n"],"names":["cacheJSON","callback","cache","get","constants","DISTS_URL","force","err","SCHEDULES_URL","Cache","CACHE_PATH","console","log","message","process","exit","code"],"mappings":";;;;+BAIA;;;eAAA;;;qEAJkB;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,UAAU;IAQ5CV,UAAU,SAACO;QACT,IAAIA,KAAK;YACPI,QAAQC,GAAG,CAAC,AAAC,+CAA0D,OAAZL,IAAIM,OAAO;YACtE,OAAOC,QAAQC,IAAI,CAACR,IAAIS,IAAI,IAAI,CAAC;QACnC;QACAF,QAAQC,IAAI,CAAC;IACf;AACF"}
|
package/dist/cjs/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/cli.ts"],"sourcesContent":["import exit from 'exit';\nimport getopts from 'getopts-compat';\nimport NodeVersions, { type LoadOptions, type ResolveOptions } from './index.js';\n// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>\nimport isNaN from './lib/isNaN.js';\n\nimport isArray from 'isarray';\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 as LoadOptions, (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 as ResolveOptions);\n if (!version || (isArray(version) && !(version as string[]).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 as string[]).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;4DACgD;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QAC9C,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,CAAC,AAACA,QAAqBR,MAAM,EAAG;YACnEL,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,QAAQ,AAACH,QAAqBR,MAAM,EAAEW,QAAShB,QAAQC,GAAG,CAAChB,UAAU4B,OAAO,CAACG,MAAM;QACzG,OAAOhB,QAAQC,GAAG,CAAChB,UAAU4B;QAC7BP,IAAAA,aAAI,EAAC;IACP;AACF"}
|
package/dist/cjs/constants.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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 _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
12
|
-
var _url = /*#__PURE__*/ _interop_require_default(require("url"));
|
|
13
|
-
var _modulerootsync = /*#__PURE__*/ _interop_require_default(require("module-root-sync"));
|
|
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' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
|
|
20
|
-
var root = (0, _modulerootsync.default)(__dirname);
|
|
21
|
-
var _default = {
|
|
22
|
-
CACHE_PATH: _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'
|
|
25
|
-
};
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/constants.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport moduleRoot from 'module-root-sync';\n\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst root = moduleRoot(__dirname);\n\nexport default {\n CACHE_PATH: 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","moduleRoot","CACHE_PATH","resolve","join","DISTS_URL","SCHEDULES_URL"],"mappings":";;;;+BAOA;;;eAAA;;;2DAPiB;0DACD;qEACO;;;;;;AAEvB,IAAMA,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,OAAOC,IAAAA,uBAAU,EAACP;IAExB,WAAe;IACbQ,YAAYP,aAAI,CAACQ,OAAO,CAACR,aAAI,CAACS,IAAI,CAACJ,MAAM;IACzCK,WAAW;IACXC,eAAe;AACjB"}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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.default;
|
|
9
|
-
}
|
|
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
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return from;
|
|
25
|
-
}
|
|
26
|
-
function _interop_require_default(obj) {
|
|
27
|
-
return obj && obj.__esModule ? obj : {
|
|
28
|
-
default: obj
|
|
29
|
-
};
|
|
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; }
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/index.ts"],"sourcesContent":["export * from './types.js';\nexport { default, type LoadCallback } from './NodeVersions.js';\n"],"names":["default"],"mappings":";;;;+BACSA;;;eAAAA,qBAAO;;;qBADF;mEAC6B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/lib/normalizeSchedule.ts"],"sourcesContent":["import type { Schedule, ScheduleRaw } from '../types.js';\n\nexport default function normalizeSchedule(name: string, raw: ScheduleRaw): Schedule {\n const schedule = {\n name,\n semver: name.slice(1),\n raw,\n } as unknown as Schedule;\n\n schedule.start = new Date(raw.start);\n schedule.end = new Date(raw.end);\n if (raw.codename) schedule.codename = raw.codename.toLowerCase();\n if (raw.lts) schedule.lts = new Date(raw.lts);\n if (raw.maintenance) schedule.maintenance = new Date(raw.maintenance);\n\n return schedule;\n}\n"],"names":["normalizeSchedule","name","raw","schedule","semver","slice","start","Date","end","codename","toLowerCase","lts","maintenance"],"mappings":";;;;+BAEA;;;eAAwBA;;;AAAT,SAASA,kBAAkBC,IAAY,EAAEC,GAAgB;IACtE,IAAMC,WAAW;QACfF,MAAAA;QACAG,QAAQH,KAAKI,KAAK,CAAC;QACnBH,KAAAA;IACF;IAEAC,SAASG,KAAK,GAAG,IAAIC,KAAKL,IAAII,KAAK;IACnCH,SAASK,GAAG,GAAG,IAAID,KAAKL,IAAIM,GAAG;IAC/B,IAAIN,IAAIO,QAAQ,EAAEN,SAASM,QAAQ,GAAGP,IAAIO,QAAQ,CAACC,WAAW;IAC9D,IAAIR,IAAIS,GAAG,EAAER,SAASQ,GAAG,GAAG,IAAIJ,KAAKL,IAAIS,GAAG;IAC5C,IAAIT,IAAIU,WAAW,EAAET,SAASS,WAAW,GAAG,IAAIL,KAAKL,IAAIU,WAAW;IAEpE,OAAOT;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/lib/normalizeVersion.ts"],"sourcesContent":["import type { Schedule, Version, VersionRaw } from '../types.js';\n\nexport default function normalizeVersion(raw: VersionRaw, schedules: Schedule[]): Version {\n const parts = raw.version.substr(1).split('.');\n\n const version = {\n version: raw.version,\n name: parts[0] !== '0' ? `v${+parts[0]}` : `v${+parts[0]}.${+parts[1]}`,\n semver: `${parts[0]}.${+parts[1]}.${+parts[2]}`,\n major: +parts[0],\n minor: +parts[1],\n patch: +parts[2],\n lts: raw.lts,\n date: new Date(raw.date),\n raw: raw,\n } as Version;\n\n let schedule = null;\n for (let index = 0; index < schedules.length; index++) {\n const test = schedules[index];\n if (test.name === version.name) {\n schedule = test;\n break;\n }\n }\n if (schedule && raw.lts) version.codename = schedule.codename;\n return version;\n}\n"],"names":["normalizeVersion","raw","schedules","parts","version","substr","split","name","semver","major","minor","patch","lts","date","Date","schedule","index","length","test","codename"],"mappings":";;;;+BAEA;;;eAAwBA;;;AAAT,SAASA,iBAAiBC,GAAe,EAAEC,SAAqB;IAC7E,IAAMC,QAAQF,IAAIG,OAAO,CAACC,MAAM,CAAC,GAAGC,KAAK,CAAC;IAE1C,IAAMF,UAAU;QACdA,SAASH,IAAIG,OAAO;QACpBG,MAAMJ,KAAK,CAAC,EAAE,KAAK,MAAM,AAAC,IAAa,OAAV,CAACA,KAAK,CAAC,EAAE,IAAK,AAAC,IAAgB,OAAb,CAACA,KAAK,CAAC,EAAE,EAAC,KAAa,OAAV,CAACA,KAAK,CAAC,EAAE;QACrEK,QAAQ,AAAC,GAAc,OAAZL,KAAK,CAAC,EAAE,EAAC,KAAgB,OAAb,CAACA,KAAK,CAAC,EAAE,EAAC,KAAa,OAAV,CAACA,KAAK,CAAC,EAAE;QAC7CM,OAAO,CAACN,KAAK,CAAC,EAAE;QAChBO,OAAO,CAACP,KAAK,CAAC,EAAE;QAChBQ,OAAO,CAACR,KAAK,CAAC,EAAE;QAChBS,KAAKX,IAAIW,GAAG;QACZC,MAAM,IAAIC,KAAKb,IAAIY,IAAI;QACvBZ,KAAKA;IACP;IAEA,IAAIc,WAAW;IACf,IAAK,IAAIC,QAAQ,GAAGA,QAAQd,UAAUe,MAAM,EAAED,QAAS;QACrD,IAAME,OAAOhB,SAAS,CAACc,MAAM;QAC7B,IAAIE,KAAKX,IAAI,KAAKH,QAAQG,IAAI,EAAE;YAC9BQ,WAAWG;YACX;QACF;IACF;IACA,IAAIH,YAAYd,IAAIW,GAAG,EAAER,QAAQe,QAAQ,GAAGJ,SAASI,QAAQ;IAC7D,OAAOf;AACT"}
|
package/dist/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/parseExpression/index.ts"],"sourcesContent":["// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>\nimport isNaN from '../lib/isNaN.js';\nimport isLTSFn from './isLTSFn.js';\nimport isLatestFn from './isLatestFn.js';\nimport schedulesLatest from './schedulesLatest.js';\n\nexport default function parseExpression(expression, now) {\n if (expression[0] === 'v' && !isNaN(+expression.substr(1, 1))) expression = expression.substr(1);\n if (expression.substr(0, 4) === 'lts/') expression = expression.substr(4) === '*' ? 'lts' : expression.substr(4);\n if (expression === 'stable') expression = 'lts';\n\n if (typeof expression === 'number') return { major: expression };\n if (~expression.indexOf('.')) {\n const parts = expression.split('.');\n if (parts.length === 1) return isNaN(+parts[0]) ? null : { major: +parts[0] };\n if (parts.length === 2) return isNaN(+parts[0]) && isNaN(+parts[1]) ? null : { major: +parts[0], minor: +parts[1] };\n return isNaN(+parts[0]) && isNaN(+parts[1]) && isNaN(+parts[2]) ? null : { major: +parts[0], minor: +parts[1], patch: +parts[2] };\n }\n if (!isNaN(+expression)) return { major: +expression };\n if (expression === 'lts') {\n const lts = schedulesLatest(this.schedules, isLTSFn(now));\n return lts ? { name: lts.name } : null;\n }\n if (expression === 'latest') {\n const latest = schedulesLatest(this.schedules, isLatestFn(now));\n return latest ? { name: latest.name } : null;\n }\n return { codename: expression.toLowerCase() };\n}\n"],"names":["parseExpression","expression","now","isNaN","substr","major","indexOf","parts","split","length","minor","patch","lts","schedulesLatest","schedules","isLTSFn","name","latest","isLatestFn","codename","toLowerCase"],"mappings":"AAAA,sEAAsE;;;;;+BAMtE;;;eAAwBA;;;4DALN;8DACE;iEACG;sEACK;;;;;;AAEb,SAASA,gBAAgBC,UAAU,EAAEC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AMC,IAAAA,wBAAe,EAAC,IAAI,CAACC,SAAS,EAAEC,IAAAA,gBAAO,EAACb;QACpD,OAAOU,MAAM;YAAEI,MAAMJ,IAAII,IAAI;QAAC,IAAI;IACpC;IACA,IAAIf,eAAe,UAAU;QAC3B,IAAMgB,SAASJ,IAAAA,wBAAe,EAAC,IAAI,CAACC,SAAS,EAAEI,IAAAA,mBAAU,EAAChB;QAC1D,OAAOe,SAAS;YAAED,MAAMC,OAAOD,IAAI;QAAC,IAAI;IAC1C;IACA,OAAO;QAAEG,UAAUlB,WAAWmB,WAAW;IAAG;AAC9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/parseExpression/schedulesLatest.ts"],"sourcesContent":["import schedulesForEach from './schedulesForEach.js';\n\nexport default function schedulesLatest(schedules, filter) {\n let latest = null;\n schedulesForEach(schedules, filter, (schedule) => {\n if (!latest || latest.start < schedule.start) latest = schedule;\n });\n return latest;\n}\n"],"names":["schedulesLatest","schedules","filter","latest","schedulesForEach","schedule","start"],"mappings":";;;;+BAEA;;;eAAwBA;;;uEAFK;;;;;;AAEd,SAASA,gBAAgBC,SAAS,EAAEC,MAAM;IACvD,IAAIC,SAAS;IACbC,IAAAA,yBAAgB,EAACH,WAAWC,QAAQ,SAACG;QACnC,IAAI,CAACF,UAAUA,OAAOG,KAAK,GAAGD,SAASC,KAAK,EAAEH,SAASE;IACzD;IACA,OAAOF;AACT"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import Cache from 'fetch-json-cache';
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import constants from '../constants.cjs';
|
|
4
|
-
export default (()=>{
|
|
5
|
-
const cache = new Cache(constants.CACHE_PATH);
|
|
6
|
-
function cacheJSON(callback) {
|
|
7
|
-
cache.get(constants.DISTS_URL, {
|
|
8
|
-
force: true
|
|
9
|
-
}, (err)=>{
|
|
10
|
-
err ? callback(err) : cache.get(constants.SCHEDULES_URL, {
|
|
11
|
-
force: true
|
|
12
|
-
}, callback);
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
cacheJSON((err)=>{
|
|
16
|
-
if (err) {
|
|
17
|
-
console.log(`Failed to cache dists and schedules. Error: ${err.message}`);
|
|
18
|
-
return process.exit(err.code || -1);
|
|
19
|
-
}
|
|
20
|
-
process.exit(0);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-semvers/src/assets/postinstall.ts"],"sourcesContent":["import Cache from 'fetch-json-cache';\n// @ts-ignore\nimport constants from '../constants.cjs';\n\nexport default () => {\n const cache = new Cache(constants.CACHE_PATH);\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 process.exit(err.code || -1);\n }\n process.exit(0);\n });\n};\n"],"names":["Cache","constants","cache","CACHE_PATH","cacheJSON","callback","get","DISTS_URL","force","err","SCHEDULES_URL","console","log","message","process","exit","code"],"mappings":"AAAA,OAAOA,WAAW,mBAAmB;AACrC,aAAa;AACb,OAAOC,eAAe,mBAAmB;AAEzC,eAAe,CAAA;IACb,MAAMC,QAAQ,IAAIF,MAAMC,UAAUE,UAAU;IAE5C,SAASC,UAAUC,QAAQ;QACzBH,MAAMI,GAAG,CAACL,UAAUM,SAAS,EAAE;YAAEC,OAAO;QAAK,GAAG,CAACC;YAC/CA,MAAMJ,SAASI,OAAOP,MAAMI,GAAG,CAACL,UAAUS,aAAa,EAAE;gBAAEF,OAAO;YAAK,GAAGH;QAC5E;IACF;IAEAD,UAAU,CAACK;QACT,IAAIA,KAAK;YACPE,QAAQC,GAAG,CAAC,CAAC,4CAA4C,EAAEH,IAAII,OAAO,EAAE;YACxE,OAAOC,QAAQC,IAAI,CAACN,IAAIO,IAAI,IAAI,CAAC;QACnC;QACAF,QAAQC,IAAI,CAAC;IACf;AACF,CAAA,EAAE"}
|
package/dist/esm/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
package/scripts/assets.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import url from 'url';
|
|
5
|
-
import spawn from 'cross-spawn-cb';
|
|
6
|
-
|
|
7
|
-
const __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));
|
|
8
|
-
const src = path.resolve(__dirname, '..', 'src', 'assets', 'postinstall.ts');
|
|
9
|
-
const dest = path.join(__dirname, '..', 'assets', 'postinstall.cjs');
|
|
10
|
-
|
|
11
|
-
function build(callback) {
|
|
12
|
-
const config = path.resolve(__dirname, 'rollup.config.mjs');
|
|
13
|
-
const args = ['rollup', '--config', config, '--input', src, '--file', dest];
|
|
14
|
-
spawn(args[0], args.slice(1), { cwd: path.dirname(__dirname), stdio: 'inherit' }, callback);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
build((err) => {
|
|
18
|
-
!err || console.error(err);
|
|
19
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
2
|
-
import externals from 'rollup-plugin-node-externals';
|
|
3
|
-
import swc from 'ts-swc-rollup-plugin';
|
|
4
|
-
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import url from 'url';
|
|
7
|
-
const __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));
|
|
8
|
-
|
|
9
|
-
import * as getTS from 'get-tsconfig-compat';
|
|
10
|
-
const tsconfig = getTS.getTsconfig(path.resolve(__dirname, '..', 'tsconfig.json'));
|
|
11
|
-
tsconfig.config.compilerOptions.target = 'ES4';
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
output: {
|
|
15
|
-
format: 'cjs',
|
|
16
|
-
name: 'tsdsBuild',
|
|
17
|
-
},
|
|
18
|
-
plugins: [commonjs({ extensions: '.cts' }), externals({ deps: false, devDeps: false, builtinsPrefix: 'strip' }), swc({ tsconfig })],
|
|
19
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|