@rowanmanning/node-versions 1.0.3 → 1.0.5

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.
@@ -1,4 +1,5 @@
1
1
  [
2
+ "v22.8.0",
2
3
  "v22.7.0",
3
4
  "v22.6.0",
4
5
  "v22.5.1",
package/index.d.ts CHANGED
@@ -1,7 +1,17 @@
1
- export const nodeVersions: readonly string[];
2
- export function getEnginesNodeVersions(engines: string, options?: Options | undefined): string[];
3
- export function getPackageNodeVersions(path: string, options?: Options | undefined): Promise<string[]>;
4
- export type Options = {
5
- majorsOnly?: boolean | undefined;
6
- };
7
- //# sourceMappingURL=index.d.ts.map
1
+ declare module '@rowanmanning/node-versions' {
2
+ export interface Options {
3
+ majorsOnly?: boolean | undefined;
4
+ }
5
+
6
+ export const nodeVersions: readonly string[];
7
+
8
+ export function getEnginesNodeVersions(
9
+ engines: string,
10
+ options?: Options | undefined
11
+ ): string[];
12
+
13
+ export function getPackageNodeVersions(
14
+ path: string,
15
+ options?: Options | undefined
16
+ ): Promise<string[]>;
17
+ }
package/index.js CHANGED
@@ -4,18 +4,19 @@ const { loadPackage } = require('./lib/load-package');
4
4
  const possibleNodeVersions = require('./data/versions.json');
5
5
  const semver = require('semver');
6
6
 
7
+ /**
8
+ * @import nodeVersions from '@rowanmanning/node-versions'
9
+ */
10
+
7
11
  /**
8
12
  * @typedef {object} Options
9
13
  * @property {boolean} [majorsOnly]
10
14
  */
11
15
 
16
+ /** @type {nodeVersions['nodeVersions']} */
12
17
  exports.nodeVersions = Object.freeze(possibleNodeVersions);
13
18
 
14
- /**
15
- * @param {string} engines
16
- * @param {Options} [options]
17
- * @returns {string[]}
18
- */
19
+ /** @type {nodeVersions['getEnginesNodeVersions']} */
19
20
  exports.getEnginesNodeVersions = function getEnginesNodeVersions(engines, options = {}) {
20
21
  if (typeof engines !== 'string' || !semver.validRange(engines)) {
21
22
  return [];
@@ -36,11 +37,7 @@ exports.getEnginesNodeVersions = function getEnginesNodeVersions(engines, option
36
37
  return supportedNodeVersions;
37
38
  };
38
39
 
39
- /**
40
- * @param {string} path
41
- * @param {Options} [options]
42
- * @returns {Promise<string[]>}
43
- */
40
+ /** @type {nodeVersions['getPackageNodeVersions']} */
44
41
  exports.getPackageNodeVersions = async function getPackageNodeVersions(path, options) {
45
42
  const packageJson = await loadPackage(path);
46
43
  if (typeof packageJson.engines?.node !== 'string') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowanmanning/node-versions",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Get the Node.js versions that a repo says it supports",
5
5
  "keywords": [],
6
6
  "author": "Rowan Manning (https://rowanmanning.com/)",
@@ -20,6 +20,7 @@
20
20
  "postinstall": "node ./scripts/fetch-node-versions.js || true"
21
21
  },
22
22
  "main": "index.js",
23
+ "types": "index.d.ts",
23
24
  "dependencies": {
24
25
  "@npmcli/package-json": "^5.2.0",
25
26
  "semver": "^7.6.3"
package/index.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";AAkBiC,gDAJtB,MAAM,kCAEJ,MAAM,EAAE,CAoBpB;AAOgC,6CAJtB,MAAM,kCAEJ,OAAO,CAAC,MAAM,EAAE,CAAC,CAQ7B"}
@@ -1,2 +0,0 @@
1
- export function fetchNodeVersions(): Promise<string[]>;
2
- //# sourceMappingURL=fetch-node-versions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch-node-versions.d.ts","sourceRoot":"","sources":["fetch-node-versions.js"],"names":[],"mappings":"AAW4B,qCAFf,OAAO,CAAC,MAAM,EAAE,CAAC,CAsB7B"}
@@ -1,2 +0,0 @@
1
- export function loadPackage(path: string): Promise<PackageJson.Content>;
2
- //# sourceMappingURL=load-package.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"load-package.d.ts","sourceRoot":"","sources":["load-package.js"],"names":[],"mappings":"AAQsB,kCAHX,MAAM,GACJ,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAsBxC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=fetch-node-versions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch-node-versions.d.ts","sourceRoot":"","sources":["fetch-node-versions.js"],"names":[],"mappings":""}