@aws-cdk/cloud-assembly-schema 2.84.0 → 2.85.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/.jsii CHANGED
@@ -16,7 +16,7 @@
16
16
  "stability": "stable"
17
17
  },
18
18
  "homepage": "https://github.com/aws/aws-cdk",
19
- "jsiiVersion": "5.0.8 (build b97c75a)",
19
+ "jsiiVersion": "5.0.11 (build 5e2d6be)",
20
20
  "keywords": [
21
21
  "aws",
22
22
  "cdk"
@@ -5860,6 +5860,6 @@
5860
5860
  "symbolId": "lib/cloud-assembly/context-queries:VpcContextQuery"
5861
5861
  }
5862
5862
  },
5863
- "version": "2.84.0",
5863
+ "version": "2.85.0",
5864
5864
  "fingerprint": "**********"
5865
5865
  }
Binary file
package/lib/manifest.js CHANGED
@@ -261,7 +261,7 @@ class Manifest {
261
261
  constructor() { }
262
262
  }
263
263
  _a = JSII_RTTI_SYMBOL_1;
264
- Manifest[_a] = { fqn: "@aws-cdk/cloud-assembly-schema.Manifest", version: "2.84.0" };
264
+ Manifest[_a] = { fqn: "@aws-cdk/cloud-assembly-schema.Manifest", version: "2.85.0" };
265
265
  exports.Manifest = Manifest;
266
266
  function mapValues(xs, fn) {
267
267
  if (!xs) {
@@ -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
@@ -133,7 +134,7 @@ class Comparator {
133
134
  module.exports = Comparator
134
135
 
135
136
  const parseOptions = require('../internal/parse-options')
136
- const { re, t } = require('../internal/re')
137
+ const { safeRe: re, t } = require('../internal/re')
137
138
  const cmp = require('../functions/cmp')
138
139
  const debug = require('../internal/debug')
139
140
  const SemVer = require('./semver')
@@ -26,19 +26,26 @@ class Range {
26
26
  this.loose = !!options.loose
27
27
  this.includePrerelease = !!options.includePrerelease
28
28
 
29
- // First, split based on boolean or ||
29
+ // First reduce all whitespace as much as possible so we do not have to rely
30
+ // on potentially slow regexes like \s*. This is then stored and used for
31
+ // future error messages as well.
30
32
  this.raw = range
31
- this.set = range
33
+ .trim()
34
+ .split(/\s+/)
35
+ .join(' ')
36
+
37
+ // First, split on ||
38
+ this.set = this.raw
32
39
  .split('||')
33
40
  // map the range to a 2d array of comparators
34
- .map(r => this.parseRange(r.trim()))
41
+ .map(r => this.parseRange(r))
35
42
  // throw out any comparator lists that are empty
36
43
  // this generally means that it was not a valid range, which is allowed
37
44
  // in loose mode, but will still throw if the WHOLE range is invalid.
38
45
  .filter(c => c.length)
39
46
 
40
47
  if (!this.set.length) {
41
- throw new TypeError(`Invalid SemVer Range: ${range}`)
48
+ throw new TypeError(`Invalid SemVer Range: ${this.raw}`)
42
49
  }
43
50
 
44
51
  // if we have any that are not the null set, throw out null sets.
@@ -64,9 +71,7 @@ class Range {
64
71
 
65
72
  format () {
66
73
  this.range = this.set
67
- .map((comps) => {
68
- return comps.join(' ').trim()
69
- })
74
+ .map((comps) => comps.join(' ').trim())
70
75
  .join('||')
71
76
  .trim()
72
77
  return this.range
@@ -77,8 +82,6 @@ class Range {
77
82
  }
78
83
 
79
84
  parseRange (range) {
80
- range = range.trim()
81
-
82
85
  // memoize range parsing for performance.
83
86
  // this is a very hot path, and fully deterministic.
84
87
  const memoOpts =
@@ -105,9 +108,6 @@ class Range {
105
108
  // `^ 1.2.3` => `^1.2.3`
106
109
  range = range.replace(re[t.CARETTRIM], caretTrimReplace)
107
110
 
108
- // normalize spaces
109
- range = range.split(/\s+/).join(' ')
110
-
111
111
  // At this point, the range is completely trimmed and
112
112
  // ready to be split into comparators.
113
113
 
@@ -203,7 +203,7 @@ const Comparator = require('./comparator')
203
203
  const debug = require('../internal/debug')
204
204
  const SemVer = require('./semver')
205
205
  const {
206
- re,
206
+ safeRe: re,
207
207
  t,
208
208
  comparatorTrimReplace,
209
209
  tildeTrimReplace,
@@ -257,10 +257,13 @@ const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
257
257
  // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
258
258
  // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
259
259
  // ~0.0.1 --> >=0.0.1 <0.1.0-0
260
- const replaceTildes = (comp, options) =>
261
- comp.trim().split(/\s+/).map((c) => {
262
- return replaceTilde(c, options)
263
- }).join(' ')
260
+ const replaceTildes = (comp, options) => {
261
+ return comp
262
+ .trim()
263
+ .split(/\s+/)
264
+ .map((c) => replaceTilde(c, options))
265
+ .join(' ')
266
+ }
264
267
 
265
268
  const replaceTilde = (comp, options) => {
266
269
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
@@ -298,10 +301,13 @@ const replaceTilde = (comp, options) => {
298
301
  // ^1.2.0 --> >=1.2.0 <2.0.0-0
299
302
  // ^0.0.1 --> >=0.0.1 <0.0.2-0
300
303
  // ^0.1.0 --> >=0.1.0 <0.2.0-0
301
- const replaceCarets = (comp, options) =>
302
- comp.trim().split(/\s+/).map((c) => {
303
- return replaceCaret(c, options)
304
- }).join(' ')
304
+ const replaceCarets = (comp, options) => {
305
+ return comp
306
+ .trim()
307
+ .split(/\s+/)
308
+ .map((c) => replaceCaret(c, options))
309
+ .join(' ')
310
+ }
305
311
 
306
312
  const replaceCaret = (comp, options) => {
307
313
  debug('caret', comp, options)
@@ -358,9 +364,10 @@ const replaceCaret = (comp, options) => {
358
364
 
359
365
  const replaceXRanges = (comp, options) => {
360
366
  debug('replaceXRanges', comp, options)
361
- return comp.split(/\s+/).map((c) => {
362
- return replaceXRange(c, options)
363
- }).join(' ')
367
+ return comp
368
+ .split(/\s+/)
369
+ .map((c) => replaceXRange(c, options))
370
+ .join(' ')
364
371
  }
365
372
 
366
373
  const replaceXRange = (comp, options) => {
@@ -443,12 +450,15 @@ const replaceXRange = (comp, options) => {
443
450
  const replaceStars = (comp, options) => {
444
451
  debug('replaceStars', comp, options)
445
452
  // Looseness is ignored here. star is always as loose as it gets!
446
- return comp.trim().replace(re[t.STAR], '')
453
+ return comp
454
+ .trim()
455
+ .replace(re[t.STAR], '')
447
456
  }
448
457
 
449
458
  const replaceGTE0 = (comp, options) => {
450
459
  debug('replaceGTE0', comp, options)
451
- return comp.trim()
460
+ return comp
461
+ .trim()
452
462
  .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
453
463
  }
454
464
 
@@ -486,7 +496,7 @@ const hyphenReplace = incPr => ($0,
486
496
  to = `<=${to}`
487
497
  }
488
498
 
489
- return (`${from} ${to}`).trim()
499
+ return `${from} ${to}`.trim()
490
500
  }
491
501
 
492
502
  const testSet = (set, version, options) => {
@@ -1,6 +1,6 @@
1
1
  const debug = require('../internal/debug')
2
2
  const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')
3
- const { re, t } = require('../internal/re')
3
+ const { safeRe: re, t } = require('../internal/re')
4
4
 
5
5
  const parseOptions = require('../internal/parse-options')
6
6
  const { compareIdentifiers } = require('../internal/identifiers')
@@ -291,8 +291,10 @@ class SemVer {
291
291
  default:
292
292
  throw new Error(`invalid increment argument: ${release}`)
293
293
  }
294
- this.format()
295
- this.raw = this.version
294
+ this.raw = this.format()
295
+ if (this.build.length) {
296
+ this.raw += `+${this.build.join('.')}`
297
+ }
296
298
  return this
297
299
  }
298
300
  }
@@ -1,6 +1,6 @@
1
1
  const SemVer = require('../classes/semver')
2
2
  const parse = require('./parse')
3
- const { re, t } = require('../internal/re')
3
+ const { safeRe: re, t } = require('../internal/re')
4
4
 
5
5
  const coerce = (version, options) => {
6
6
  if (version instanceof SemVer) {
@@ -13,6 +13,35 @@ const diff = (version1, version2) => {
13
13
  const highVersion = v1Higher ? v1 : v2
14
14
  const lowVersion = v1Higher ? v2 : v1
15
15
  const highHasPre = !!highVersion.prerelease.length
16
+ const lowHasPre = !!lowVersion.prerelease.length
17
+
18
+ if (lowHasPre && !highHasPre) {
19
+ // Going from prerelease -> no prerelease requires some special casing
20
+
21
+ // If the low version has only a major, then it will always be a major
22
+ // Some examples:
23
+ // 1.0.0-1 -> 1.0.0
24
+ // 1.0.0-1 -> 1.1.1
25
+ // 1.0.0-1 -> 2.0.0
26
+ if (!lowVersion.patch && !lowVersion.minor) {
27
+ return 'major'
28
+ }
29
+
30
+ // Otherwise it can be determined by checking the high version
31
+
32
+ if (highVersion.patch) {
33
+ // anything higher than a patch bump would result in the wrong version
34
+ return 'patch'
35
+ }
36
+
37
+ if (highVersion.minor) {
38
+ // anything higher than a minor bump would result in the wrong version
39
+ return 'minor'
40
+ }
41
+
42
+ // bumping major/minor/patch all have same result
43
+ return 'major'
44
+ }
16
45
 
17
46
  // add the `pre` prefix if we are going to a prerelease version
18
47
  const prefix = highHasPre ? 'pre' : ''
@@ -29,26 +58,8 @@ const diff = (version1, version2) => {
29
58
  return prefix + 'patch'
30
59
  }
31
60
 
32
- // at this point we know stable versions match but overall versions are not equal,
33
- // so either they are both prereleases, or the lower version is a prerelease
34
-
35
- if (highHasPre) {
36
- // high and low are preleases
37
- return 'prerelease'
38
- }
39
-
40
- if (lowVersion.patch) {
41
- // anything higher than a patch bump would result in the wrong version
42
- return 'patch'
43
- }
44
-
45
- if (lowVersion.minor) {
46
- // anything higher than a minor bump would result in the wrong version
47
- return 'minor'
48
- }
49
-
50
- // bumping major/minor/patch all have same result
51
- return 'major'
61
+ // high and low are preleases
62
+ return 'prerelease'
52
63
  }
53
64
 
54
65
  module.exports = diff
@@ -4,16 +4,27 @@ exports = module.exports = {}
4
4
 
5
5
  // The actual regexps go on exports.re
6
6
  const re = exports.re = []
7
+ const safeRe = exports.safeRe = []
7
8
  const src = exports.src = []
8
9
  const t = exports.t = {}
9
10
  let R = 0
10
11
 
11
12
  const createToken = (name, value, isGlobal) => {
13
+ // Replace all greedy whitespace to prevent regex dos issues. These regex are
14
+ // used internally via the safeRe object since all inputs in this library get
15
+ // normalized first to trim and collapse all extra whitespace. The original
16
+ // regexes are exported for userland consumption and lower level usage. A
17
+ // future breaking change could export the safer regex only with a note that
18
+ // all input should have extra whitespace removed.
19
+ const safe = value
20
+ .split('\\s*').join('\\s{0,1}')
21
+ .split('\\s+').join('\\s')
12
22
  const index = R++
13
23
  debug(name, index, value)
14
24
  t[name] = index
15
25
  src[index] = value
16
26
  re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
27
+ safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)
17
28
  }
18
29
 
19
30
  // The following Regular Expressions can be used for tokenizing,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semver",
3
- "version": "7.5.1",
3
+ "version": "7.5.2",
4
4
  "description": "The semantic version parser used by npm.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "devDependencies": {
16
16
  "@npmcli/eslint-config": "^4.0.0",
17
- "@npmcli/template-oss": "4.14.1",
17
+ "@npmcli/template-oss": "4.15.1",
18
18
  "tap": "^16.0.0"
19
19
  },
20
20
  "license": "ISC",
@@ -37,7 +37,7 @@
37
37
  "range.bnf"
38
38
  ],
39
39
  "tap": {
40
- "check-coverage": true,
40
+ "timeout": 30,
41
41
  "coverage-map": "map.js",
42
42
  "nyc-arg": [
43
43
  "--exclude",
@@ -53,7 +53,7 @@
53
53
  "author": "GitHub Inc.",
54
54
  "templateOSS": {
55
55
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
56
- "version": "4.14.1",
56
+ "version": "4.15.1",
57
57
  "engines": ">=10",
58
58
  "ciVersions": [
59
59
  "10.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-cdk/cloud-assembly-schema",
3
- "version": "2.84.0",
3
+ "version": "2.85.0",
4
4
  "description": "Cloud Assembly Schema",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -77,12 +77,12 @@
77
77
  },
78
78
  "license": "Apache-2.0",
79
79
  "devDependencies": {
80
- "@aws-cdk/cdk-build-tools": "2.84.0-alpha.0",
81
- "@aws-cdk/pkglint": "2.84.0-alpha.0",
80
+ "@aws-cdk/cdk-build-tools": "2.85.0-alpha.0",
81
+ "@aws-cdk/pkglint": "2.85.0-alpha.0",
82
82
  "@types/jest": "^29.5.1",
83
83
  "@types/mock-fs": "^4.13.1",
84
84
  "@types/semver": "^7.5.0",
85
- "aws-cdk-lib": "2.84.0",
85
+ "aws-cdk-lib": "2.85.0",
86
86
  "jest": "^29.5.0",
87
87
  "mock-fs": "^4.14.0",
88
88
  "typescript-json-schema": "^0.56.0"