@basemaps/lambda-tiler 7.12.0 → 7.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/build/routes/__tests__/tile.style.json.test.js +3 -1
  3. package/build/routes/__tests__/tile.style.json.test.js.map +1 -1
  4. package/build/routes/tile.style.json.d.ts +4 -0
  5. package/build/routes/tile.style.json.js +1 -1
  6. package/build/routes/tile.style.json.js.map +1 -1
  7. package/build/util/__test__/nztm.style.test.js +16 -7
  8. package/build/util/__test__/nztm.style.test.js.map +1 -1
  9. package/build/util/nztm.style.js +0 -3
  10. package/build/util/nztm.style.js.map +1 -1
  11. package/dist/index.js +86535 -0
  12. package/dist/node_modules/.package-lock.json +179 -0
  13. package/dist/node_modules/@img/sharp-libvips-linux-arm64/README.md +47 -0
  14. package/dist/node_modules/@img/sharp-libvips-linux-arm64/lib/glib-2.0/include/glibconfig.h +219 -0
  15. package/dist/node_modules/@img/sharp-libvips-linux-arm64/lib/index.js +1 -0
  16. package/dist/node_modules/@img/sharp-libvips-linux-arm64/lib/libvips-cpp.so.42 +0 -0
  17. package/dist/node_modules/@img/sharp-libvips-linux-arm64/package.json +45 -0
  18. package/dist/node_modules/@img/sharp-libvips-linux-arm64/versions.json +31 -0
  19. package/dist/node_modules/@img/sharp-linux-arm64/LICENSE +191 -0
  20. package/dist/node_modules/@img/sharp-linux-arm64/README.md +18 -0
  21. package/dist/node_modules/@img/sharp-linux-arm64/lib/sharp-linux-arm64.node +0 -0
  22. package/dist/node_modules/@img/sharp-linux-arm64/package.json +47 -0
  23. package/dist/node_modules/color/LICENSE +21 -0
  24. package/dist/node_modules/color/README.md +123 -0
  25. package/dist/node_modules/color/index.js +496 -0
  26. package/dist/node_modules/color/package.json +47 -0
  27. package/dist/node_modules/color-convert/CHANGELOG.md +54 -0
  28. package/dist/node_modules/color-convert/LICENSE +21 -0
  29. package/dist/node_modules/color-convert/README.md +68 -0
  30. package/dist/node_modules/color-convert/conversions.js +839 -0
  31. package/dist/node_modules/color-convert/index.js +81 -0
  32. package/dist/node_modules/color-convert/package.json +48 -0
  33. package/dist/node_modules/color-convert/route.js +97 -0
  34. package/dist/node_modules/color-name/LICENSE +8 -0
  35. package/dist/node_modules/color-name/README.md +11 -0
  36. package/dist/node_modules/color-name/index.js +152 -0
  37. package/dist/node_modules/color-name/package.json +28 -0
  38. package/dist/node_modules/color-string/LICENSE +21 -0
  39. package/dist/node_modules/color-string/README.md +62 -0
  40. package/dist/node_modules/color-string/index.js +242 -0
  41. package/dist/node_modules/color-string/package.json +39 -0
  42. package/dist/node_modules/detect-libc/LICENSE +201 -0
  43. package/dist/node_modules/detect-libc/README.md +163 -0
  44. package/dist/node_modules/detect-libc/index.d.ts +14 -0
  45. package/dist/node_modules/detect-libc/lib/detect-libc.js +267 -0
  46. package/dist/node_modules/detect-libc/lib/filesystem.js +41 -0
  47. package/dist/node_modules/detect-libc/lib/process.js +24 -0
  48. package/dist/node_modules/detect-libc/package.json +40 -0
  49. package/dist/node_modules/is-arrayish/LICENSE +21 -0
  50. package/dist/node_modules/is-arrayish/README.md +16 -0
  51. package/dist/node_modules/is-arrayish/index.js +9 -0
  52. package/dist/node_modules/is-arrayish/package.json +45 -0
  53. package/dist/node_modules/is-arrayish/yarn-error.log +1443 -0
  54. package/dist/node_modules/lerc/CHANGELOG.md +69 -0
  55. package/dist/node_modules/lerc/LercDecode.d.ts +61 -0
  56. package/dist/node_modules/lerc/LercDecode.es.d.ts +61 -0
  57. package/dist/node_modules/lerc/LercDecode.es.js +434 -0
  58. package/dist/node_modules/lerc/LercDecode.es.min.js +17 -0
  59. package/dist/node_modules/lerc/LercDecode.js +448 -0
  60. package/dist/node_modules/lerc/LercDecode.min.js +17 -0
  61. package/dist/node_modules/lerc/README.md +123 -0
  62. package/dist/node_modules/lerc/lerc-wasm.wasm +0 -0
  63. package/dist/node_modules/lerc/package.json +30 -0
  64. package/dist/node_modules/semver/LICENSE +15 -0
  65. package/dist/node_modules/semver/README.md +654 -0
  66. package/dist/node_modules/semver/bin/semver.js +188 -0
  67. package/dist/node_modules/semver/classes/comparator.js +141 -0
  68. package/dist/node_modules/semver/classes/index.js +5 -0
  69. package/dist/node_modules/semver/classes/range.js +554 -0
  70. package/dist/node_modules/semver/classes/semver.js +302 -0
  71. package/dist/node_modules/semver/functions/clean.js +6 -0
  72. package/dist/node_modules/semver/functions/cmp.js +52 -0
  73. package/dist/node_modules/semver/functions/coerce.js +60 -0
  74. package/dist/node_modules/semver/functions/compare-build.js +7 -0
  75. package/dist/node_modules/semver/functions/compare-loose.js +3 -0
  76. package/dist/node_modules/semver/functions/compare.js +5 -0
  77. package/dist/node_modules/semver/functions/diff.js +65 -0
  78. package/dist/node_modules/semver/functions/eq.js +3 -0
  79. package/dist/node_modules/semver/functions/gt.js +3 -0
  80. package/dist/node_modules/semver/functions/gte.js +3 -0
  81. package/dist/node_modules/semver/functions/inc.js +19 -0
  82. package/dist/node_modules/semver/functions/lt.js +3 -0
  83. package/dist/node_modules/semver/functions/lte.js +3 -0
  84. package/dist/node_modules/semver/functions/major.js +3 -0
  85. package/dist/node_modules/semver/functions/minor.js +3 -0
  86. package/dist/node_modules/semver/functions/neq.js +3 -0
  87. package/dist/node_modules/semver/functions/parse.js +16 -0
  88. package/dist/node_modules/semver/functions/patch.js +3 -0
  89. package/dist/node_modules/semver/functions/prerelease.js +6 -0
  90. package/dist/node_modules/semver/functions/rcompare.js +3 -0
  91. package/dist/node_modules/semver/functions/rsort.js +3 -0
  92. package/dist/node_modules/semver/functions/satisfies.js +10 -0
  93. package/dist/node_modules/semver/functions/sort.js +3 -0
  94. package/dist/node_modules/semver/functions/valid.js +6 -0
  95. package/dist/node_modules/semver/index.js +89 -0
  96. package/dist/node_modules/semver/internal/constants.js +35 -0
  97. package/dist/node_modules/semver/internal/debug.js +9 -0
  98. package/dist/node_modules/semver/internal/identifiers.js +23 -0
  99. package/dist/node_modules/semver/internal/lrucache.js +40 -0
  100. package/dist/node_modules/semver/internal/parse-options.js +15 -0
  101. package/dist/node_modules/semver/internal/re.js +217 -0
  102. package/dist/node_modules/semver/package.json +77 -0
  103. package/dist/node_modules/semver/preload.js +2 -0
  104. package/dist/node_modules/semver/range.bnf +16 -0
  105. package/dist/node_modules/semver/ranges/gtr.js +4 -0
  106. package/dist/node_modules/semver/ranges/intersects.js +7 -0
  107. package/dist/node_modules/semver/ranges/ltr.js +4 -0
  108. package/dist/node_modules/semver/ranges/max-satisfying.js +25 -0
  109. package/dist/node_modules/semver/ranges/min-satisfying.js +24 -0
  110. package/dist/node_modules/semver/ranges/min-version.js +61 -0
  111. package/dist/node_modules/semver/ranges/outside.js +80 -0
  112. package/dist/node_modules/semver/ranges/simplify.js +47 -0
  113. package/dist/node_modules/semver/ranges/subset.js +247 -0
  114. package/dist/node_modules/semver/ranges/to-comparators.js +8 -0
  115. package/dist/node_modules/semver/ranges/valid.js +11 -0
  116. package/dist/node_modules/sharp/LICENSE +191 -0
  117. package/dist/node_modules/sharp/README.md +118 -0
  118. package/dist/node_modules/sharp/install/check.js +36 -0
  119. package/dist/node_modules/sharp/lib/channel.js +174 -0
  120. package/dist/node_modules/sharp/lib/colour.js +182 -0
  121. package/dist/node_modules/sharp/lib/composite.js +210 -0
  122. package/dist/node_modules/sharp/lib/constructor.js +444 -0
  123. package/dist/node_modules/sharp/lib/index.d.ts +1717 -0
  124. package/dist/node_modules/sharp/lib/index.js +16 -0
  125. package/dist/node_modules/sharp/lib/input.js +657 -0
  126. package/dist/node_modules/sharp/lib/is.js +169 -0
  127. package/dist/node_modules/sharp/lib/libvips.js +171 -0
  128. package/dist/node_modules/sharp/lib/operation.js +919 -0
  129. package/dist/node_modules/sharp/lib/output.js +1561 -0
  130. package/dist/node_modules/sharp/lib/resize.js +582 -0
  131. package/dist/node_modules/sharp/lib/sharp.js +86 -0
  132. package/dist/node_modules/sharp/lib/utility.js +287 -0
  133. package/dist/node_modules/sharp/package.json +219 -0
  134. package/dist/node_modules/sharp/src/binding.gyp +277 -0
  135. package/dist/node_modules/sharp/src/common.cc +1090 -0
  136. package/dist/node_modules/sharp/src/common.h +393 -0
  137. package/dist/node_modules/sharp/src/metadata.cc +287 -0
  138. package/dist/node_modules/sharp/src/metadata.h +82 -0
  139. package/dist/node_modules/sharp/src/operations.cc +471 -0
  140. package/dist/node_modules/sharp/src/operations.h +125 -0
  141. package/dist/node_modules/sharp/src/pipeline.cc +1724 -0
  142. package/dist/node_modules/sharp/src/pipeline.h +385 -0
  143. package/dist/node_modules/sharp/src/sharp.cc +40 -0
  144. package/dist/node_modules/sharp/src/stats.cc +183 -0
  145. package/dist/node_modules/sharp/src/stats.h +59 -0
  146. package/dist/node_modules/sharp/src/utilities.cc +269 -0
  147. package/dist/node_modules/sharp/src/utilities.h +19 -0
  148. package/dist/node_modules/simple-swizzle/LICENSE +21 -0
  149. package/dist/node_modules/simple-swizzle/README.md +39 -0
  150. package/dist/node_modules/simple-swizzle/index.js +29 -0
  151. package/dist/node_modules/simple-swizzle/package.json +36 -0
  152. package/dist/package-lock.json +610 -0
  153. package/dist/package.json +40 -0
  154. package/dist/static/expected_tile_2193_153_255_z7.png +0 -0
  155. package/dist/static/expected_tile_NZTM2000Quad_30_33_z6.png +0 -0
  156. package/dist/static/expected_tile_WebMercatorQuad_252_156_z8.png +0 -0
  157. package/package.json +2 -2
  158. package/src/routes/__tests__/tile.style.json.test.ts +3 -2
  159. package/src/routes/tile.style.json.ts +1 -1
  160. package/src/util/__test__/nztm.style.test.ts +18 -8
  161. package/src/util/nztm.style.ts +0 -3
  162. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,89 @@
1
+ // just pre-load all the stuff that index.js lazily exports
2
+ const internalRe = require('./internal/re')
3
+ const constants = require('./internal/constants')
4
+ const SemVer = require('./classes/semver')
5
+ const identifiers = require('./internal/identifiers')
6
+ const parse = require('./functions/parse')
7
+ const valid = require('./functions/valid')
8
+ const clean = require('./functions/clean')
9
+ const inc = require('./functions/inc')
10
+ const diff = require('./functions/diff')
11
+ const major = require('./functions/major')
12
+ const minor = require('./functions/minor')
13
+ const patch = require('./functions/patch')
14
+ const prerelease = require('./functions/prerelease')
15
+ const compare = require('./functions/compare')
16
+ const rcompare = require('./functions/rcompare')
17
+ const compareLoose = require('./functions/compare-loose')
18
+ const compareBuild = require('./functions/compare-build')
19
+ const sort = require('./functions/sort')
20
+ const rsort = require('./functions/rsort')
21
+ const gt = require('./functions/gt')
22
+ const lt = require('./functions/lt')
23
+ const eq = require('./functions/eq')
24
+ const neq = require('./functions/neq')
25
+ const gte = require('./functions/gte')
26
+ const lte = require('./functions/lte')
27
+ const cmp = require('./functions/cmp')
28
+ const coerce = require('./functions/coerce')
29
+ const Comparator = require('./classes/comparator')
30
+ const Range = require('./classes/range')
31
+ const satisfies = require('./functions/satisfies')
32
+ const toComparators = require('./ranges/to-comparators')
33
+ const maxSatisfying = require('./ranges/max-satisfying')
34
+ const minSatisfying = require('./ranges/min-satisfying')
35
+ const minVersion = require('./ranges/min-version')
36
+ const validRange = require('./ranges/valid')
37
+ const outside = require('./ranges/outside')
38
+ const gtr = require('./ranges/gtr')
39
+ const ltr = require('./ranges/ltr')
40
+ const intersects = require('./ranges/intersects')
41
+ const simplifyRange = require('./ranges/simplify')
42
+ const subset = require('./ranges/subset')
43
+ module.exports = {
44
+ parse,
45
+ valid,
46
+ clean,
47
+ inc,
48
+ diff,
49
+ major,
50
+ minor,
51
+ patch,
52
+ prerelease,
53
+ compare,
54
+ rcompare,
55
+ compareLoose,
56
+ compareBuild,
57
+ sort,
58
+ rsort,
59
+ gt,
60
+ lt,
61
+ eq,
62
+ neq,
63
+ gte,
64
+ lte,
65
+ cmp,
66
+ coerce,
67
+ Comparator,
68
+ Range,
69
+ satisfies,
70
+ toComparators,
71
+ maxSatisfying,
72
+ minSatisfying,
73
+ minVersion,
74
+ validRange,
75
+ outside,
76
+ gtr,
77
+ ltr,
78
+ intersects,
79
+ simplifyRange,
80
+ subset,
81
+ SemVer,
82
+ re: internalRe.re,
83
+ src: internalRe.src,
84
+ tokens: internalRe.t,
85
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
86
+ RELEASE_TYPES: constants.RELEASE_TYPES,
87
+ compareIdentifiers: identifiers.compareIdentifiers,
88
+ rcompareIdentifiers: identifiers.rcompareIdentifiers,
89
+ }
@@ -0,0 +1,35 @@
1
+ // Note: this is the semver.org version of the spec that it implements
2
+ // Not necessarily the package version of this code.
3
+ const SEMVER_SPEC_VERSION = '2.0.0'
4
+
5
+ const MAX_LENGTH = 256
6
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
7
+ /* istanbul ignore next */ 9007199254740991
8
+
9
+ // Max safe segment length for coercion.
10
+ const MAX_SAFE_COMPONENT_LENGTH = 16
11
+
12
+ // Max safe length for a build identifier. The max length minus 6 characters for
13
+ // the shortest version with a build 0.0.0+BUILD.
14
+ const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
15
+
16
+ const RELEASE_TYPES = [
17
+ 'major',
18
+ 'premajor',
19
+ 'minor',
20
+ 'preminor',
21
+ 'patch',
22
+ 'prepatch',
23
+ 'prerelease',
24
+ ]
25
+
26
+ module.exports = {
27
+ MAX_LENGTH,
28
+ MAX_SAFE_COMPONENT_LENGTH,
29
+ MAX_SAFE_BUILD_LENGTH,
30
+ MAX_SAFE_INTEGER,
31
+ RELEASE_TYPES,
32
+ SEMVER_SPEC_VERSION,
33
+ FLAG_INCLUDE_PRERELEASE: 0b001,
34
+ FLAG_LOOSE: 0b010,
35
+ }
@@ -0,0 +1,9 @@
1
+ const debug = (
2
+ typeof process === 'object' &&
3
+ process.env &&
4
+ process.env.NODE_DEBUG &&
5
+ /\bsemver\b/i.test(process.env.NODE_DEBUG)
6
+ ) ? (...args) => console.error('SEMVER', ...args)
7
+ : () => {}
8
+
9
+ module.exports = debug
@@ -0,0 +1,23 @@
1
+ const numeric = /^[0-9]+$/
2
+ const compareIdentifiers = (a, b) => {
3
+ const anum = numeric.test(a)
4
+ const bnum = numeric.test(b)
5
+
6
+ if (anum && bnum) {
7
+ a = +a
8
+ b = +b
9
+ }
10
+
11
+ return a === b ? 0
12
+ : (anum && !bnum) ? -1
13
+ : (bnum && !anum) ? 1
14
+ : a < b ? -1
15
+ : 1
16
+ }
17
+
18
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
19
+
20
+ module.exports = {
21
+ compareIdentifiers,
22
+ rcompareIdentifiers,
23
+ }
@@ -0,0 +1,40 @@
1
+ class LRUCache {
2
+ constructor () {
3
+ this.max = 1000
4
+ this.map = new Map()
5
+ }
6
+
7
+ get (key) {
8
+ const value = this.map.get(key)
9
+ if (value === undefined) {
10
+ return undefined
11
+ } else {
12
+ // Remove the key from the map and add it to the end
13
+ this.map.delete(key)
14
+ this.map.set(key, value)
15
+ return value
16
+ }
17
+ }
18
+
19
+ delete (key) {
20
+ return this.map.delete(key)
21
+ }
22
+
23
+ set (key, value) {
24
+ const deleted = this.delete(key)
25
+
26
+ if (!deleted && value !== undefined) {
27
+ // If cache is full, delete the least recently used item
28
+ if (this.map.size >= this.max) {
29
+ const firstKey = this.map.keys().next().value
30
+ this.delete(firstKey)
31
+ }
32
+
33
+ this.map.set(key, value)
34
+ }
35
+
36
+ return this
37
+ }
38
+ }
39
+
40
+ module.exports = LRUCache
@@ -0,0 +1,15 @@
1
+ // parse out just the options we care about
2
+ const looseOption = Object.freeze({ loose: true })
3
+ const emptyOpts = Object.freeze({ })
4
+ const parseOptions = options => {
5
+ if (!options) {
6
+ return emptyOpts
7
+ }
8
+
9
+ if (typeof options !== 'object') {
10
+ return looseOption
11
+ }
12
+
13
+ return options
14
+ }
15
+ module.exports = parseOptions
@@ -0,0 +1,217 @@
1
+ const {
2
+ MAX_SAFE_COMPONENT_LENGTH,
3
+ MAX_SAFE_BUILD_LENGTH,
4
+ MAX_LENGTH,
5
+ } = require('./constants')
6
+ const debug = require('./debug')
7
+ exports = module.exports = {}
8
+
9
+ // The actual regexps go on exports.re
10
+ const re = exports.re = []
11
+ const safeRe = exports.safeRe = []
12
+ const src = exports.src = []
13
+ const t = exports.t = {}
14
+ let R = 0
15
+
16
+ const LETTERDASHNUMBER = '[a-zA-Z0-9-]'
17
+
18
+ // Replace some greedy regex tokens to prevent regex dos issues. These regex are
19
+ // used internally via the safeRe object since all inputs in this library get
20
+ // normalized first to trim and collapse all extra whitespace. The original
21
+ // regexes are exported for userland consumption and lower level usage. A
22
+ // future breaking change could export the safer regex only with a note that
23
+ // all input should have extra whitespace removed.
24
+ const safeRegexReplacements = [
25
+ ['\\s', 1],
26
+ ['\\d', MAX_LENGTH],
27
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
28
+ ]
29
+
30
+ const makeSafeRegex = (value) => {
31
+ for (const [token, max] of safeRegexReplacements) {
32
+ value = value
33
+ .split(`${token}*`).join(`${token}{0,${max}}`)
34
+ .split(`${token}+`).join(`${token}{1,${max}}`)
35
+ }
36
+ return value
37
+ }
38
+
39
+ const createToken = (name, value, isGlobal) => {
40
+ const safe = makeSafeRegex(value)
41
+ const index = R++
42
+ debug(name, index, value)
43
+ t[name] = index
44
+ src[index] = value
45
+ re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
46
+ safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)
47
+ }
48
+
49
+ // The following Regular Expressions can be used for tokenizing,
50
+ // validating, and parsing SemVer version strings.
51
+
52
+ // ## Numeric Identifier
53
+ // A single `0`, or a non-zero digit followed by zero or more digits.
54
+
55
+ createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
56
+ createToken('NUMERICIDENTIFIERLOOSE', '\\d+')
57
+
58
+ // ## Non-numeric Identifier
59
+ // Zero or more digits, followed by a letter or hyphen, and then zero or
60
+ // more letters, digits, or hyphens.
61
+
62
+ createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)
63
+
64
+ // ## Main Version
65
+ // Three dot-separated numeric identifiers.
66
+
67
+ createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
68
+ `(${src[t.NUMERICIDENTIFIER]})\\.` +
69
+ `(${src[t.NUMERICIDENTIFIER]})`)
70
+
71
+ createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
72
+ `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
73
+ `(${src[t.NUMERICIDENTIFIERLOOSE]})`)
74
+
75
+ // ## Pre-release Version Identifier
76
+ // A numeric identifier, or a non-numeric identifier.
77
+
78
+ createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
79
+ }|${src[t.NONNUMERICIDENTIFIER]})`)
80
+
81
+ createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
82
+ }|${src[t.NONNUMERICIDENTIFIER]})`)
83
+
84
+ // ## Pre-release Version
85
+ // Hyphen, followed by one or more dot-separated pre-release version
86
+ // identifiers.
87
+
88
+ createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
89
+ }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
90
+
91
+ createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
92
+ }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
93
+
94
+ // ## Build Metadata Identifier
95
+ // Any combination of digits, letters, or hyphens.
96
+
97
+ createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)
98
+
99
+ // ## Build Metadata
100
+ // Plus sign, followed by one or more period-separated build metadata
101
+ // identifiers.
102
+
103
+ createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
104
+ }(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
105
+
106
+ // ## Full Version String
107
+ // A main version, followed optionally by a pre-release version and
108
+ // build metadata.
109
+
110
+ // Note that the only major, minor, patch, and pre-release sections of
111
+ // the version string are capturing groups. The build metadata is not a
112
+ // capturing group, because it should not ever be used in version
113
+ // comparison.
114
+
115
+ createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
116
+ }${src[t.PRERELEASE]}?${
117
+ src[t.BUILD]}?`)
118
+
119
+ createToken('FULL', `^${src[t.FULLPLAIN]}$`)
120
+
121
+ // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
122
+ // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
123
+ // common in the npm registry.
124
+ createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
125
+ }${src[t.PRERELEASELOOSE]}?${
126
+ src[t.BUILD]}?`)
127
+
128
+ createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
129
+
130
+ createToken('GTLT', '((?:<|>)?=?)')
131
+
132
+ // Something like "2.*" or "1.2.x".
133
+ // Note that "x.x" is a valid xRange identifer, meaning "any version"
134
+ // Only the first item is strictly required.
135
+ createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
136
+ createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
137
+
138
+ createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
139
+ `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
140
+ `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
141
+ `(?:${src[t.PRERELEASE]})?${
142
+ src[t.BUILD]}?` +
143
+ `)?)?`)
144
+
145
+ createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
146
+ `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
147
+ `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
148
+ `(?:${src[t.PRERELEASELOOSE]})?${
149
+ src[t.BUILD]}?` +
150
+ `)?)?`)
151
+
152
+ createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
153
+ createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
154
+
155
+ // Coercion.
156
+ // Extract anything that could conceivably be a part of a valid semver
157
+ createToken('COERCEPLAIN', `${'(^|[^\\d])' +
158
+ '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
159
+ `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
160
+ `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)
161
+ createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`)
162
+ createToken('COERCEFULL', src[t.COERCEPLAIN] +
163
+ `(?:${src[t.PRERELEASE]})?` +
164
+ `(?:${src[t.BUILD]})?` +
165
+ `(?:$|[^\\d])`)
166
+ createToken('COERCERTL', src[t.COERCE], true)
167
+ createToken('COERCERTLFULL', src[t.COERCEFULL], true)
168
+
169
+ // Tilde ranges.
170
+ // Meaning is "reasonably at or greater than"
171
+ createToken('LONETILDE', '(?:~>?)')
172
+
173
+ createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
174
+ exports.tildeTrimReplace = '$1~'
175
+
176
+ createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
177
+ createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
178
+
179
+ // Caret ranges.
180
+ // Meaning is "at least and backwards compatible with"
181
+ createToken('LONECARET', '(?:\\^)')
182
+
183
+ createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
184
+ exports.caretTrimReplace = '$1^'
185
+
186
+ createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
187
+ createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
188
+
189
+ // A simple gt/lt/eq thing, or just "" to indicate "any version"
190
+ createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
191
+ createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
192
+
193
+ // An expression to strip any whitespace between the gtlt and the thing
194
+ // it modifies, so that `> 1.2.3` ==> `>1.2.3`
195
+ createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
196
+ }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
197
+ exports.comparatorTrimReplace = '$1$2$3'
198
+
199
+ // Something like `1.2.3 - 1.2.4`
200
+ // Note that these all use the loose form, because they'll be
201
+ // checked against either the strict or loose comparator form
202
+ // later.
203
+ createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
204
+ `\\s+-\\s+` +
205
+ `(${src[t.XRANGEPLAIN]})` +
206
+ `\\s*$`)
207
+
208
+ createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
209
+ `\\s+-\\s+` +
210
+ `(${src[t.XRANGEPLAINLOOSE]})` +
211
+ `\\s*$`)
212
+
213
+ // Star ranges basically just allow anything at all.
214
+ createToken('STAR', '(<|>)?=?\\s*\\*')
215
+ // >=0.0.0 is like a star
216
+ createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$')
217
+ createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "semver",
3
+ "version": "7.6.3",
4
+ "description": "The semantic version parser used by npm.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "tap",
8
+ "snap": "tap",
9
+ "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
10
+ "postlint": "template-oss-check",
11
+ "lintfix": "npm run lint -- --fix",
12
+ "posttest": "npm run lint",
13
+ "template-oss-apply": "template-oss-apply --force"
14
+ },
15
+ "devDependencies": {
16
+ "@npmcli/eslint-config": "^4.0.0",
17
+ "@npmcli/template-oss": "4.22.0",
18
+ "benchmark": "^2.1.4",
19
+ "tap": "^16.0.0"
20
+ },
21
+ "license": "ISC",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/npm/node-semver.git"
25
+ },
26
+ "bin": {
27
+ "semver": "bin/semver.js"
28
+ },
29
+ "files": [
30
+ "bin/",
31
+ "lib/",
32
+ "classes/",
33
+ "functions/",
34
+ "internal/",
35
+ "ranges/",
36
+ "index.js",
37
+ "preload.js",
38
+ "range.bnf"
39
+ ],
40
+ "tap": {
41
+ "timeout": 30,
42
+ "coverage-map": "map.js",
43
+ "nyc-arg": [
44
+ "--exclude",
45
+ "tap-snapshots/**"
46
+ ]
47
+ },
48
+ "engines": {
49
+ "node": ">=10"
50
+ },
51
+ "author": "GitHub Inc.",
52
+ "templateOSS": {
53
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
54
+ "version": "4.22.0",
55
+ "engines": ">=10",
56
+ "distPaths": [
57
+ "classes/",
58
+ "functions/",
59
+ "internal/",
60
+ "ranges/",
61
+ "index.js",
62
+ "preload.js",
63
+ "range.bnf"
64
+ ],
65
+ "allowPaths": [
66
+ "/classes/",
67
+ "/functions/",
68
+ "/internal/",
69
+ "/ranges/",
70
+ "/index.js",
71
+ "/preload.js",
72
+ "/range.bnf",
73
+ "/benchmarks"
74
+ ],
75
+ "publish": "true"
76
+ }
77
+ }
@@ -0,0 +1,2 @@
1
+ // XXX remove in v8 or beyond
2
+ module.exports = require('./index.js')
@@ -0,0 +1,16 @@
1
+ range-set ::= range ( logical-or range ) *
2
+ logical-or ::= ( ' ' ) * '||' ( ' ' ) *
3
+ range ::= hyphen | simple ( ' ' simple ) * | ''
4
+ hyphen ::= partial ' - ' partial
5
+ simple ::= primitive | partial | tilde | caret
6
+ primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
7
+ partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
8
+ xr ::= 'x' | 'X' | '*' | nr
9
+ nr ::= '0' | [1-9] ( [0-9] ) *
10
+ tilde ::= '~' partial
11
+ caret ::= '^' partial
12
+ qualifier ::= ( '-' pre )? ( '+' build )?
13
+ pre ::= parts
14
+ build ::= parts
15
+ parts ::= part ( '.' part ) *
16
+ part ::= nr | [-0-9A-Za-z]+
@@ -0,0 +1,4 @@
1
+ // Determine if version is greater than all the versions possible in the range.
2
+ const outside = require('./outside')
3
+ const gtr = (version, range, options) => outside(version, range, '>', options)
4
+ module.exports = gtr
@@ -0,0 +1,7 @@
1
+ const Range = require('../classes/range')
2
+ const intersects = (r1, r2, options) => {
3
+ r1 = new Range(r1, options)
4
+ r2 = new Range(r2, options)
5
+ return r1.intersects(r2, options)
6
+ }
7
+ module.exports = intersects
@@ -0,0 +1,4 @@
1
+ const outside = require('./outside')
2
+ // Determine if version is less than all the versions possible in the range
3
+ const ltr = (version, range, options) => outside(version, range, '<', options)
4
+ module.exports = ltr
@@ -0,0 +1,25 @@
1
+ const SemVer = require('../classes/semver')
2
+ const Range = require('../classes/range')
3
+
4
+ const maxSatisfying = (versions, range, options) => {
5
+ let max = null
6
+ let maxSV = null
7
+ let rangeObj = null
8
+ try {
9
+ rangeObj = new Range(range, options)
10
+ } catch (er) {
11
+ return null
12
+ }
13
+ versions.forEach((v) => {
14
+ if (rangeObj.test(v)) {
15
+ // satisfies(v, range, options)
16
+ if (!max || maxSV.compare(v) === -1) {
17
+ // compare(max, v, true)
18
+ max = v
19
+ maxSV = new SemVer(max, options)
20
+ }
21
+ }
22
+ })
23
+ return max
24
+ }
25
+ module.exports = maxSatisfying
@@ -0,0 +1,24 @@
1
+ const SemVer = require('../classes/semver')
2
+ const Range = require('../classes/range')
3
+ const minSatisfying = (versions, range, options) => {
4
+ let min = null
5
+ let minSV = null
6
+ let rangeObj = null
7
+ try {
8
+ rangeObj = new Range(range, options)
9
+ } catch (er) {
10
+ return null
11
+ }
12
+ versions.forEach((v) => {
13
+ if (rangeObj.test(v)) {
14
+ // satisfies(v, range, options)
15
+ if (!min || minSV.compare(v) === 1) {
16
+ // compare(min, v, true)
17
+ min = v
18
+ minSV = new SemVer(min, options)
19
+ }
20
+ }
21
+ })
22
+ return min
23
+ }
24
+ module.exports = minSatisfying
@@ -0,0 +1,61 @@
1
+ const SemVer = require('../classes/semver')
2
+ const Range = require('../classes/range')
3
+ const gt = require('../functions/gt')
4
+
5
+ const minVersion = (range, loose) => {
6
+ range = new Range(range, loose)
7
+
8
+ let minver = new SemVer('0.0.0')
9
+ if (range.test(minver)) {
10
+ return minver
11
+ }
12
+
13
+ minver = new SemVer('0.0.0-0')
14
+ if (range.test(minver)) {
15
+ return minver
16
+ }
17
+
18
+ minver = null
19
+ for (let i = 0; i < range.set.length; ++i) {
20
+ const comparators = range.set[i]
21
+
22
+ let setMin = null
23
+ comparators.forEach((comparator) => {
24
+ // Clone to avoid manipulating the comparator's semver object.
25
+ const compver = new SemVer(comparator.semver.version)
26
+ switch (comparator.operator) {
27
+ case '>':
28
+ if (compver.prerelease.length === 0) {
29
+ compver.patch++
30
+ } else {
31
+ compver.prerelease.push(0)
32
+ }
33
+ compver.raw = compver.format()
34
+ /* fallthrough */
35
+ case '':
36
+ case '>=':
37
+ if (!setMin || gt(compver, setMin)) {
38
+ setMin = compver
39
+ }
40
+ break
41
+ case '<':
42
+ case '<=':
43
+ /* Ignore maximum versions */
44
+ break
45
+ /* istanbul ignore next */
46
+ default:
47
+ throw new Error(`Unexpected operation: ${comparator.operator}`)
48
+ }
49
+ })
50
+ if (setMin && (!minver || gt(minver, setMin))) {
51
+ minver = setMin
52
+ }
53
+ }
54
+
55
+ if (minver && range.test(minver)) {
56
+ return minver
57
+ }
58
+
59
+ return null
60
+ }
61
+ module.exports = minVersion