@basemaps/lambda-tiler 6.40.0 → 6.41.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.
- package/CHANGELOG.md +27 -0
- package/build/__tests__/wmts.capability.test.js +98 -65
- package/build/__tests__/wmts.capability.test.js.map +1 -1
- package/build/cli/render.tile.js +13 -10
- package/build/cli/render.tile.js.map +1 -1
- package/build/routes/__tests__/attribution.test.js +2 -2
- package/build/routes/__tests__/attribution.test.js.map +1 -1
- package/build/routes/attribution.d.ts +1 -2
- package/build/routes/attribution.d.ts.map +1 -1
- package/build/routes/attribution.js +16 -14
- package/build/routes/attribution.js.map +1 -1
- package/build/routes/tile.wmts.d.ts.map +1 -1
- package/build/routes/tile.wmts.js +11 -8
- package/build/routes/tile.wmts.js.map +1 -1
- package/build/util/validate.d.ts.map +1 -1
- package/build/util/validate.js +4 -3
- package/build/util/validate.js.map +1 -1
- package/build/wmts.capability.d.ts +58 -28
- package/build/wmts.capability.d.ts.map +1 -1
- package/build/wmts.capability.js +167 -93
- package/build/wmts.capability.js.map +1 -1
- package/dist/index.js +110 -82
- package/dist/node_modules/.package-lock.json +10 -10
- package/dist/node_modules/detect-libc/README.md +4 -1
- package/dist/node_modules/detect-libc/index.d.ts +3 -0
- package/dist/node_modules/detect-libc/lib/detect-libc.js +105 -4
- package/dist/node_modules/detect-libc/lib/filesystem.js +41 -0
- package/dist/node_modules/detect-libc/lib/process.js +3 -0
- package/dist/node_modules/detect-libc/package.json +7 -3
- package/dist/node_modules/node-abi/.github/workflows/semantic.yml +26 -0
- package/dist/node_modules/node-abi/abi_registry.json +25 -1
- package/dist/node_modules/node-abi/package.json +1 -1
- package/dist/node_modules/node-abi/scripts/update-abi-registry.js +2 -2
- package/dist/node_modules/semver/README.md +70 -1
- package/dist/node_modules/semver/bin/semver.js +16 -2
- package/dist/node_modules/semver/classes/comparator.js +39 -34
- package/dist/node_modules/semver/classes/range.js +45 -28
- package/dist/node_modules/semver/classes/semver.js +32 -17
- package/dist/node_modules/semver/functions/coerce.js +1 -1
- package/dist/node_modules/semver/functions/diff.js +58 -16
- package/dist/node_modules/semver/functions/inc.js +3 -2
- package/dist/node_modules/semver/functions/parse.js +5 -22
- package/dist/node_modules/semver/index.js +1 -0
- package/dist/node_modules/semver/internal/constants.js +20 -2
- package/dist/node_modules/semver/internal/parse-options.js +14 -10
- package/dist/node_modules/semver/internal/re.js +34 -4
- package/dist/node_modules/semver/package.json +8 -7
- package/dist/node_modules/semver/ranges/intersects.js +1 -1
- package/dist/node_modules/semver/ranges/subset.js +6 -3
- package/dist/package-lock.json +11 -11
- package/dist/package.json +1 -2
- package/package.json +9 -10
- package/src/__tests__/wmts.capability.test.ts +110 -65
- package/src/cli/render.tile.ts +13 -10
- package/src/routes/__tests__/attribution.test.ts +2 -2
- package/src/routes/attribution.ts +16 -12
- package/src/routes/tile.wmts.ts +12 -7
- package/src/util/validate.ts +4 -3
- package/src/wmts.capability.ts +209 -121
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basemaps/lambda-tiler",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.41.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
@@ -121,9 +121,9 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"node_modules/detect-libc": {
|
|
124
|
-
"version": "2.0.
|
|
125
|
-
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.
|
|
126
|
-
"integrity": "sha512-
|
|
124
|
+
"version": "2.0.2",
|
|
125
|
+
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz",
|
|
126
|
+
"integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==",
|
|
127
127
|
"engines": {
|
|
128
128
|
"node": ">=8"
|
|
129
129
|
}
|
|
@@ -229,9 +229,9 @@
|
|
|
229
229
|
"integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg=="
|
|
230
230
|
},
|
|
231
231
|
"node_modules/node-abi": {
|
|
232
|
-
"version": "3.
|
|
233
|
-
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.
|
|
234
|
-
"integrity": "sha512-
|
|
232
|
+
"version": "3.45.0",
|
|
233
|
+
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.45.0.tgz",
|
|
234
|
+
"integrity": "sha512-iwXuFrMAcFVi/ZoZiqq8BzAdsLw9kxDfTC0HMyjXfSL/6CSDAGD5UmR7azrAgWV1zKYq7dUUMj4owusBWKLsiQ==",
|
|
235
235
|
"dependencies": {
|
|
236
236
|
"semver": "^7.3.5"
|
|
237
237
|
},
|
|
@@ -333,9 +333,9 @@
|
|
|
333
333
|
]
|
|
334
334
|
},
|
|
335
335
|
"node_modules/semver": {
|
|
336
|
-
"version": "7.
|
|
337
|
-
"resolved": "https://registry.npmjs.org/semver/-/semver-7.
|
|
338
|
-
"integrity": "sha512-
|
|
336
|
+
"version": "7.5.4",
|
|
337
|
+
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
|
338
|
+
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
|
339
339
|
"dependencies": {
|
|
340
340
|
"lru-cache": "^6.0.0"
|
|
341
341
|
},
|
|
@@ -8,6 +8,9 @@ Currently supports detection of GNU glibc and MUSL libc.
|
|
|
8
8
|
Provides asychronous and synchronous functions for the
|
|
9
9
|
family (e.g. `glibc`, `musl`) and version (e.g. `1.23`, `1.2.3`).
|
|
10
10
|
|
|
11
|
+
The version numbers of libc implementations
|
|
12
|
+
are not guaranteed to be semver-compliant.
|
|
13
|
+
|
|
11
14
|
For previous v1.x releases, please see the
|
|
12
15
|
[v1](https://github.com/lovell/detect-libc/tree/v1) branch.
|
|
13
16
|
|
|
@@ -147,7 +150,7 @@ if (isNonGlibcLinuxSync()) { ... }
|
|
|
147
150
|
|
|
148
151
|
## Licensing
|
|
149
152
|
|
|
150
|
-
Copyright 2017
|
|
153
|
+
Copyright 2017 Lovell Fuller and others.
|
|
151
154
|
|
|
152
155
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
153
156
|
you may not use this file except in compliance with the License.
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
// Copyright 2017 Lovell Fuller and others.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
1
4
|
'use strict';
|
|
2
5
|
|
|
3
6
|
const childProcess = require('child_process');
|
|
4
7
|
const { isLinux, getReport } = require('./process');
|
|
8
|
+
const { LDD_PATH, readFile, readFileSync } = require('./filesystem');
|
|
9
|
+
|
|
10
|
+
let cachedFamilyFilesystem;
|
|
11
|
+
let cachedVersionFilesystem;
|
|
5
12
|
|
|
6
13
|
const command = 'getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true';
|
|
7
14
|
let commandOut = '';
|
|
@@ -36,6 +43,12 @@ const safeCommandSync = () => {
|
|
|
36
43
|
*/
|
|
37
44
|
const GLIBC = 'glibc';
|
|
38
45
|
|
|
46
|
+
/**
|
|
47
|
+
* A Regexp constant to get the GLIBC Version.
|
|
48
|
+
* @type {string}
|
|
49
|
+
*/
|
|
50
|
+
const RE_GLIBC_VERSION = /GLIBC\s(\d+\.\d+)/;
|
|
51
|
+
|
|
39
52
|
/**
|
|
40
53
|
* A String constant containing the value `musl`.
|
|
41
54
|
* @type {string}
|
|
@@ -43,6 +56,18 @@ const GLIBC = 'glibc';
|
|
|
43
56
|
*/
|
|
44
57
|
const MUSL = 'musl';
|
|
45
58
|
|
|
59
|
+
/**
|
|
60
|
+
* This string is used to find if the {@link LDD_PATH} is GLIBC
|
|
61
|
+
* @type {string}
|
|
62
|
+
*/
|
|
63
|
+
const GLIBC_ON_LDD = GLIBC.toUpperCase();
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* This string is used to find if the {@link LDD_PATH} is musl
|
|
67
|
+
* @type {string}
|
|
68
|
+
*/
|
|
69
|
+
const MUSL_ON_LDD = MUSL.toLowerCase();
|
|
70
|
+
|
|
46
71
|
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-');
|
|
47
72
|
|
|
48
73
|
const familyFromReport = () => {
|
|
@@ -69,6 +94,40 @@ const familyFromCommand = (out) => {
|
|
|
69
94
|
return null;
|
|
70
95
|
};
|
|
71
96
|
|
|
97
|
+
const getFamilyFromLddContent = (content) => {
|
|
98
|
+
if (content.includes(MUSL_ON_LDD)) {
|
|
99
|
+
return MUSL;
|
|
100
|
+
}
|
|
101
|
+
if (content.includes(GLIBC_ON_LDD)) {
|
|
102
|
+
return GLIBC;
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const familyFromFilesystem = async () => {
|
|
108
|
+
if (cachedFamilyFilesystem !== undefined) {
|
|
109
|
+
return cachedFamilyFilesystem;
|
|
110
|
+
}
|
|
111
|
+
cachedFamilyFilesystem = null;
|
|
112
|
+
try {
|
|
113
|
+
const lddContent = await readFile(LDD_PATH);
|
|
114
|
+
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
115
|
+
} catch (e) {}
|
|
116
|
+
return cachedFamilyFilesystem;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const familyFromFilesystemSync = () => {
|
|
120
|
+
if (cachedFamilyFilesystem !== undefined) {
|
|
121
|
+
return cachedFamilyFilesystem;
|
|
122
|
+
}
|
|
123
|
+
cachedFamilyFilesystem = null;
|
|
124
|
+
try {
|
|
125
|
+
const lddContent = readFileSync(LDD_PATH);
|
|
126
|
+
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
127
|
+
} catch (e) {}
|
|
128
|
+
return cachedFamilyFilesystem;
|
|
129
|
+
};
|
|
130
|
+
|
|
72
131
|
/**
|
|
73
132
|
* Resolves with the libc family when it can be determined, `null` otherwise.
|
|
74
133
|
* @returns {Promise<?string>}
|
|
@@ -76,7 +135,10 @@ const familyFromCommand = (out) => {
|
|
|
76
135
|
const family = async () => {
|
|
77
136
|
let family = null;
|
|
78
137
|
if (isLinux()) {
|
|
79
|
-
family =
|
|
138
|
+
family = await familyFromFilesystem();
|
|
139
|
+
if (!family) {
|
|
140
|
+
family = familyFromReport();
|
|
141
|
+
}
|
|
80
142
|
if (!family) {
|
|
81
143
|
const out = await safeCommand();
|
|
82
144
|
family = familyFromCommand(out);
|
|
@@ -92,7 +154,10 @@ const family = async () => {
|
|
|
92
154
|
const familySync = () => {
|
|
93
155
|
let family = null;
|
|
94
156
|
if (isLinux()) {
|
|
95
|
-
family =
|
|
157
|
+
family = familyFromFilesystemSync();
|
|
158
|
+
if (!family) {
|
|
159
|
+
family = familyFromReport();
|
|
160
|
+
}
|
|
96
161
|
if (!family) {
|
|
97
162
|
const out = safeCommandSync();
|
|
98
163
|
family = familyFromCommand(out);
|
|
@@ -113,6 +178,36 @@ const isNonGlibcLinux = async () => isLinux() && await family() !== GLIBC;
|
|
|
113
178
|
*/
|
|
114
179
|
const isNonGlibcLinuxSync = () => isLinux() && familySync() !== GLIBC;
|
|
115
180
|
|
|
181
|
+
const versionFromFilesystem = async () => {
|
|
182
|
+
if (cachedVersionFilesystem !== undefined) {
|
|
183
|
+
return cachedVersionFilesystem;
|
|
184
|
+
}
|
|
185
|
+
cachedVersionFilesystem = null;
|
|
186
|
+
try {
|
|
187
|
+
const lddContent = await readFile(LDD_PATH);
|
|
188
|
+
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
189
|
+
if (versionMatch) {
|
|
190
|
+
cachedVersionFilesystem = versionMatch[1];
|
|
191
|
+
}
|
|
192
|
+
} catch (e) {}
|
|
193
|
+
return cachedVersionFilesystem;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const versionFromFilesystemSync = () => {
|
|
197
|
+
if (cachedVersionFilesystem !== undefined) {
|
|
198
|
+
return cachedVersionFilesystem;
|
|
199
|
+
}
|
|
200
|
+
cachedVersionFilesystem = null;
|
|
201
|
+
try {
|
|
202
|
+
const lddContent = readFileSync(LDD_PATH);
|
|
203
|
+
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
204
|
+
if (versionMatch) {
|
|
205
|
+
cachedVersionFilesystem = versionMatch[1];
|
|
206
|
+
}
|
|
207
|
+
} catch (e) {}
|
|
208
|
+
return cachedVersionFilesystem;
|
|
209
|
+
};
|
|
210
|
+
|
|
116
211
|
const versionFromReport = () => {
|
|
117
212
|
const report = getReport();
|
|
118
213
|
if (report.header && report.header.glibcVersionRuntime) {
|
|
@@ -141,7 +236,10 @@ const versionFromCommand = (out) => {
|
|
|
141
236
|
const version = async () => {
|
|
142
237
|
let version = null;
|
|
143
238
|
if (isLinux()) {
|
|
144
|
-
version =
|
|
239
|
+
version = await versionFromFilesystem();
|
|
240
|
+
if (!version) {
|
|
241
|
+
version = versionFromReport();
|
|
242
|
+
}
|
|
145
243
|
if (!version) {
|
|
146
244
|
const out = await safeCommand();
|
|
147
245
|
version = versionFromCommand(out);
|
|
@@ -157,7 +255,10 @@ const version = async () => {
|
|
|
157
255
|
const versionSync = () => {
|
|
158
256
|
let version = null;
|
|
159
257
|
if (isLinux()) {
|
|
160
|
-
version =
|
|
258
|
+
version = versionFromFilesystemSync();
|
|
259
|
+
if (!version) {
|
|
260
|
+
version = versionFromReport();
|
|
261
|
+
}
|
|
161
262
|
if (!version) {
|
|
162
263
|
const out = safeCommandSync();
|
|
163
264
|
version = versionFromCommand(out);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2017 Lovell Fuller and others.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The path where we can find the ldd
|
|
10
|
+
*/
|
|
11
|
+
const LDD_PATH = '/usr/bin/ldd';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Read the content of a file synchronous
|
|
15
|
+
*
|
|
16
|
+
* @param {string} path
|
|
17
|
+
* @returns {string}
|
|
18
|
+
*/
|
|
19
|
+
const readFileSync = (path) => fs.readFileSync(path, 'utf-8');
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Read the content of a file
|
|
23
|
+
*
|
|
24
|
+
* @param {string} path
|
|
25
|
+
* @returns {Promise<string>}
|
|
26
|
+
*/
|
|
27
|
+
const readFile = (path) => new Promise((resolve, reject) => {
|
|
28
|
+
fs.readFile(path, 'utf-8', (err, data) => {
|
|
29
|
+
if (err) {
|
|
30
|
+
reject(err);
|
|
31
|
+
} else {
|
|
32
|
+
resolve(data);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
module.exports = {
|
|
38
|
+
LDD_PATH,
|
|
39
|
+
readFileSync,
|
|
40
|
+
readFile
|
|
41
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "detect-libc",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Node.js module to detect the C standard library (libc) implementation family and version",
|
|
5
5
|
"main": "lib/detect-libc.js",
|
|
6
6
|
"files": [
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
"index.d.ts"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "semistandard && nyc --reporter=lcov --check-coverage --branches=100 ava test/unit.js"
|
|
11
|
+
"test": "semistandard && nyc --reporter=lcov --check-coverage --branches=100 ava test/unit.js",
|
|
12
|
+
"bench": "node benchmark/detect-libc",
|
|
13
|
+
"bench:calls": "node benchmark/call-familySync.js && sleep 1 && node benchmark/call-isNonGlibcLinuxSync.js && sleep 1 && node benchmark/call-versionSync.js"
|
|
12
14
|
},
|
|
13
15
|
"repository": {
|
|
14
16
|
"type": "git",
|
|
@@ -21,11 +23,13 @@
|
|
|
21
23
|
],
|
|
22
24
|
"author": "Lovell Fuller <npm@lovell.info>",
|
|
23
25
|
"contributors": [
|
|
24
|
-
"Niklas Salmoukas <niklas@salmoukas.com>"
|
|
26
|
+
"Niklas Salmoukas <niklas@salmoukas.com>",
|
|
27
|
+
"Vinícius Lourenço <vinyygamerlol@gmail.com>"
|
|
25
28
|
],
|
|
26
29
|
"license": "Apache-2.0",
|
|
27
30
|
"devDependencies": {
|
|
28
31
|
"ava": "^2.4.0",
|
|
32
|
+
"benchmark": "^2.1.4",
|
|
29
33
|
"nyc": "^15.1.0",
|
|
30
34
|
"proxyquire": "^2.1.3",
|
|
31
35
|
"semistandard": "^14.2.3"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: "Check Semantic Commit"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
- edited
|
|
8
|
+
- synchronize
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
main:
|
|
15
|
+
permissions:
|
|
16
|
+
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
|
|
17
|
+
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
|
|
18
|
+
name: Validate PR Title
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- name: semantic-pull-request
|
|
22
|
+
uses: amannn/action-semantic-pull-request@c3cd5d1ea3580753008872425915e343e351ab54 # v5.2.0
|
|
23
|
+
env:
|
|
24
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
25
|
+
with:
|
|
26
|
+
validateSingleCommit: false
|
|
@@ -74,6 +74,16 @@
|
|
|
74
74
|
"future": false,
|
|
75
75
|
"abi": "111"
|
|
76
76
|
},
|
|
77
|
+
{
|
|
78
|
+
"runtime": "node",
|
|
79
|
+
"target": "20.0.0",
|
|
80
|
+
"lts": [
|
|
81
|
+
"2023-10-24",
|
|
82
|
+
"2024-10-22"
|
|
83
|
+
],
|
|
84
|
+
"future": false,
|
|
85
|
+
"abi": "115"
|
|
86
|
+
},
|
|
77
87
|
{
|
|
78
88
|
"abi": "70",
|
|
79
89
|
"future": false,
|
|
@@ -237,9 +247,23 @@
|
|
|
237
247
|
},
|
|
238
248
|
{
|
|
239
249
|
"abi": "114",
|
|
240
|
-
"future":
|
|
250
|
+
"future": false,
|
|
241
251
|
"lts": false,
|
|
242
252
|
"runtime": "electron",
|
|
243
253
|
"target": "24.0.0-alpha.1"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"abi": "116",
|
|
257
|
+
"future": true,
|
|
258
|
+
"lts": false,
|
|
259
|
+
"runtime": "electron",
|
|
260
|
+
"target": "26.0.0-alpha.1"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"abi": "116",
|
|
264
|
+
"future": false,
|
|
265
|
+
"lts": false,
|
|
266
|
+
"runtime": "electron",
|
|
267
|
+
"target": "25.0.0-alpha.1"
|
|
244
268
|
}
|
|
245
269
|
]
|
|
@@ -14,7 +14,7 @@ async function fetchElectronReleases () {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
async function fetchNodeVersions () {
|
|
17
|
-
const schedule = await getJSONFromCDN('nodejs/Release/schedule.json')
|
|
17
|
+
const schedule = await getJSONFromCDN('nodejs/Release@main/schedule.json')
|
|
18
18
|
const versions = {}
|
|
19
19
|
|
|
20
20
|
for (const [majorVersion, metadata] of Object.entries(schedule)) {
|
|
@@ -35,7 +35,7 @@ async function fetchNodeVersions () {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
async function fetchAbiVersions () {
|
|
38
|
-
return (await getJSONFromCDN('nodejs/node/doc/abi_version_registry.json'))
|
|
38
|
+
return (await getJSONFromCDN('nodejs/node@main/doc/abi_version_registry.json'))
|
|
39
39
|
.NODE_MODULE_VERSION
|
|
40
40
|
.filter(({ modules }) => modules > 66)
|
|
41
41
|
}
|
|
@@ -110,6 +110,9 @@ Options:
|
|
|
110
110
|
-l --loose
|
|
111
111
|
Interpret versions and ranges loosely
|
|
112
112
|
|
|
113
|
+
-n <0|1>
|
|
114
|
+
This is the base to be used for the prerelease identifier.
|
|
115
|
+
|
|
113
116
|
-p --include-prerelease
|
|
114
117
|
Always include prerelease versions in range matching
|
|
115
118
|
|
|
@@ -156,7 +159,9 @@ of primitive `operators` is:
|
|
|
156
159
|
|
|
157
160
|
For example, the comparator `>=1.2.7` would match the versions
|
|
158
161
|
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
|
|
159
|
-
or `1.1.0`.
|
|
162
|
+
or `1.1.0`. The comparator `>1` is equivalent to `>=2.0.0` and
|
|
163
|
+
would match the versions `2.0.0` and `3.1.0`, but not the versions
|
|
164
|
+
`1.0.1` or `1.1.0`.
|
|
160
165
|
|
|
161
166
|
Comparators can be joined by whitespace to form a `comparator set`,
|
|
162
167
|
which is satisfied by the **intersection** of all of the comparators
|
|
@@ -232,6 +237,35 @@ $ semver 1.2.4-beta.0 -i prerelease
|
|
|
232
237
|
1.2.4-beta.1
|
|
233
238
|
```
|
|
234
239
|
|
|
240
|
+
#### Prerelease Identifier Base
|
|
241
|
+
|
|
242
|
+
The method `.inc` takes an optional parameter 'identifierBase' string
|
|
243
|
+
that will let you let your prerelease number as zero-based or one-based.
|
|
244
|
+
Set to `false` to omit the prerelease number altogether.
|
|
245
|
+
If you do not specify this parameter, it will default to zero-based.
|
|
246
|
+
|
|
247
|
+
```javascript
|
|
248
|
+
semver.inc('1.2.3', 'prerelease', 'beta', '1')
|
|
249
|
+
// '1.2.4-beta.1'
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
```javascript
|
|
253
|
+
semver.inc('1.2.3', 'prerelease', 'beta', false)
|
|
254
|
+
// '1.2.4-beta'
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
command-line example:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
$ semver 1.2.3 -i prerelease --preid beta -n 1
|
|
261
|
+
1.2.4-beta.1
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
$ semver 1.2.3 -i prerelease --preid beta -n false
|
|
266
|
+
1.2.4-beta
|
|
267
|
+
```
|
|
268
|
+
|
|
235
269
|
### Advanced Range Syntax
|
|
236
270
|
|
|
237
271
|
Advanced range syntax desugars to primitive comparators in
|
|
@@ -513,6 +547,40 @@ ex.
|
|
|
513
547
|
* `s.clean(' 2.1.5 ')`: `'2.1.5'`
|
|
514
548
|
* `s.clean('~1.0.0')`: `null`
|
|
515
549
|
|
|
550
|
+
## Constants
|
|
551
|
+
|
|
552
|
+
As a convenience, helper constants are exported to provide information about what `node-semver` supports:
|
|
553
|
+
|
|
554
|
+
### `RELEASE_TYPES`
|
|
555
|
+
|
|
556
|
+
- major
|
|
557
|
+
- premajor
|
|
558
|
+
- minor
|
|
559
|
+
- preminor
|
|
560
|
+
- patch
|
|
561
|
+
- prepatch
|
|
562
|
+
- prerelease
|
|
563
|
+
|
|
564
|
+
```
|
|
565
|
+
const semver = require('semver');
|
|
566
|
+
|
|
567
|
+
if (semver.RELEASE_TYPES.includes(arbitraryUserInput)) {
|
|
568
|
+
console.log('This is a valid release type!');
|
|
569
|
+
} else {
|
|
570
|
+
console.warn('This is NOT a valid release type!');
|
|
571
|
+
}
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
### `SEMVER_SPEC_VERSION`
|
|
575
|
+
|
|
576
|
+
2.0.0
|
|
577
|
+
|
|
578
|
+
```
|
|
579
|
+
const semver = require('semver');
|
|
580
|
+
|
|
581
|
+
console.log('We are currently using the semver specification version:', semver.SEMVER_SPEC_VERSION);
|
|
582
|
+
```
|
|
583
|
+
|
|
516
584
|
## Exported Modules
|
|
517
585
|
|
|
518
586
|
<!--
|
|
@@ -566,3 +634,4 @@ The following modules are available:
|
|
|
566
634
|
* `require('semver/ranges/outside')`
|
|
567
635
|
* `require('semver/ranges/to-comparators')`
|
|
568
636
|
* `require('semver/ranges/valid')`
|
|
637
|
+
|
|
@@ -23,7 +23,10 @@ let rtl = false
|
|
|
23
23
|
|
|
24
24
|
let identifier
|
|
25
25
|
|
|
26
|
+
let identifierBase
|
|
27
|
+
|
|
26
28
|
const semver = require('../')
|
|
29
|
+
const parseOptions = require('../internal/parse-options')
|
|
27
30
|
|
|
28
31
|
let reverse = false
|
|
29
32
|
|
|
@@ -71,6 +74,12 @@ const main = () => {
|
|
|
71
74
|
case '-r': case '--range':
|
|
72
75
|
range.push(argv.shift())
|
|
73
76
|
break
|
|
77
|
+
case '-n':
|
|
78
|
+
identifierBase = argv.shift()
|
|
79
|
+
if (identifierBase === 'false') {
|
|
80
|
+
identifierBase = false
|
|
81
|
+
}
|
|
82
|
+
break
|
|
74
83
|
case '-c': case '--coerce':
|
|
75
84
|
coerce = true
|
|
76
85
|
break
|
|
@@ -88,7 +97,7 @@ const main = () => {
|
|
|
88
97
|
}
|
|
89
98
|
}
|
|
90
99
|
|
|
91
|
-
options = { loose
|
|
100
|
+
options = parseOptions({ loose, includePrerelease, rtl })
|
|
92
101
|
|
|
93
102
|
versions = versions.map((v) => {
|
|
94
103
|
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
|
|
@@ -127,7 +136,7 @@ const success = () => {
|
|
|
127
136
|
}).map((v) => {
|
|
128
137
|
return semver.clean(v, options)
|
|
129
138
|
}).map((v) => {
|
|
130
|
-
return inc ? semver.inc(v, inc, options, identifier) : v
|
|
139
|
+
return inc ? semver.inc(v, inc, options, identifier, identifierBase) : v
|
|
131
140
|
}).forEach((v, i, _) => {
|
|
132
141
|
console.log(v)
|
|
133
142
|
})
|
|
@@ -172,6 +181,11 @@ Options:
|
|
|
172
181
|
--ltr
|
|
173
182
|
Coerce version strings left to right (default)
|
|
174
183
|
|
|
184
|
+
-n <base>
|
|
185
|
+
Base number to be used for the prerelease identifier.
|
|
186
|
+
Can be either 0 or 1, or false to omit the number altogether.
|
|
187
|
+
Defaults to 0.
|
|
188
|
+
|
|
175
189
|
Program exits successfully if any valid version satisfies
|
|
176
190
|
all supplied ranges, and prints all satisfying versions.
|
|
177
191
|
|
|
@@ -16,6 +16,7 @@ class Comparator {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
comp = comp.trim().split(/\s+/).join(' ')
|
|
19
20
|
debug('comparator', comp, options)
|
|
20
21
|
this.options = options
|
|
21
22
|
this.loose = !!options.loose
|
|
@@ -78,13 +79,6 @@ class Comparator {
|
|
|
78
79
|
throw new TypeError('a Comparator is required')
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
if (!options || typeof options !== 'object') {
|
|
82
|
-
options = {
|
|
83
|
-
loose: !!options,
|
|
84
|
-
includePrerelease: false,
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
82
|
if (this.operator === '') {
|
|
89
83
|
if (this.value === '') {
|
|
90
84
|
return true
|
|
@@ -97,39 +91,50 @@ class Comparator {
|
|
|
97
91
|
return new Range(this.value, options).test(comp.semver)
|
|
98
92
|
}
|
|
99
93
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
(this.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
(this.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
94
|
+
options = parseOptions(options)
|
|
95
|
+
|
|
96
|
+
// Special cases where nothing can possibly be lower
|
|
97
|
+
if (options.includePrerelease &&
|
|
98
|
+
(this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
|
|
99
|
+
return false
|
|
100
|
+
}
|
|
101
|
+
if (!options.includePrerelease &&
|
|
102
|
+
(this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
|
|
103
|
+
return false
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Same direction increasing (> or >=)
|
|
107
|
+
if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
|
|
108
|
+
return true
|
|
109
|
+
}
|
|
110
|
+
// Same direction decreasing (< or <=)
|
|
111
|
+
if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
|
|
112
|
+
return true
|
|
113
|
+
}
|
|
114
|
+
// same SemVer and both sides are inclusive (<= or >=)
|
|
115
|
+
if (
|
|
116
|
+
(this.semver.version === comp.semver.version) &&
|
|
117
|
+
this.operator.includes('=') && comp.operator.includes('=')) {
|
|
118
|
+
return true
|
|
119
|
+
}
|
|
120
|
+
// opposite directions less than
|
|
121
|
+
if (cmp(this.semver, '<', comp.semver, options) &&
|
|
122
|
+
this.operator.startsWith('>') && comp.operator.startsWith('<')) {
|
|
123
|
+
return true
|
|
124
|
+
}
|
|
125
|
+
// opposite directions greater than
|
|
126
|
+
if (cmp(this.semver, '>', comp.semver, options) &&
|
|
127
|
+
this.operator.startsWith('<') && comp.operator.startsWith('>')) {
|
|
128
|
+
return true
|
|
129
|
+
}
|
|
130
|
+
return false
|
|
126
131
|
}
|
|
127
132
|
}
|
|
128
133
|
|
|
129
134
|
module.exports = Comparator
|
|
130
135
|
|
|
131
136
|
const parseOptions = require('../internal/parse-options')
|
|
132
|
-
const { re, t } = require('../internal/re')
|
|
137
|
+
const { safeRe: re, t } = require('../internal/re')
|
|
133
138
|
const cmp = require('../functions/cmp')
|
|
134
139
|
const debug = require('../internal/debug')
|
|
135
140
|
const SemVer = require('./semver')
|