cdk-real-drift 0.2.52 → 0.2.53
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/README.md +13 -3
- package/dist/cli.js +19 -4
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -473,9 +473,19 @@ ignore:
|
|
|
473
473
|
non-CDK stack). Rules written with the older full `<stack>/<constructPath>.<path>`
|
|
474
474
|
form still match. Widening a stamped scope to a `*` glob (to intentionally ignore a
|
|
475
475
|
path across every stack/account/region) stays a hand-edit.
|
|
476
|
-
- All four fields accept
|
|
477
|
-
|
|
478
|
-
|
|
476
|
+
- All four fields accept `*` / `?` globs, but the `path` axis is **segment-aware**
|
|
477
|
+
while the scope axes are not. In `path`, `*` / `?` match within a single `.`-delimited
|
|
478
|
+
segment (`*.DesiredCount` matches `<anyId>.DesiredCount`, not a deeper
|
|
479
|
+
`Tbl.Config.DesiredCount`) — a parent `path` still covers child paths via the subtree
|
|
480
|
+
walk, so the segment bound does not under-match. Inside a `[...]` bracket key a `*` /
|
|
481
|
+
`?` is **unbounded within that bracket** (the brackets delimit the key, so a `.`
|
|
482
|
+
between them is data): `Alb.LoadBalancerAttributes[*]` and
|
|
483
|
+
`Alb.LoadBalancerAttributes[routing.*]` both match the dotted key
|
|
484
|
+
`[routing.http2.enabled]`. On **stack / account / region**, `*` / `?` are unbounded
|
|
485
|
+
(those names carry no `.`). The three scope axes are exactly the
|
|
486
|
+
baseline file's identity axes; each is **omitted to leave that axis unscoped**
|
|
487
|
+
(match-all) — a present-but-empty `""` is rejected (it would match nothing).
|
|
488
|
+
**Account** keeps a `stack: "Prod*"` rule from
|
|
479
489
|
leaking into a same-named stack in another account (stack-name uniqueness only
|
|
480
490
|
holds within one account / App); **region** is independent the same way — the same
|
|
481
491
|
stack in several accounts or regions may drift in only one.
|
package/dist/cli.js
CHANGED
|
@@ -353,12 +353,24 @@ function matchesGlob(pattern, name) {
|
|
|
353
353
|
* (`X.Policies` covering `X.Policies[Mp].Name`) is handled separately by the ancestor
|
|
354
354
|
* walk in `pathMatches`, so bounding `*` here does not under-match. The stack/region
|
|
355
355
|
* axes keep `matchesGlob` (their names contain no `.`/`[`, so it is equivalent there).
|
|
356
|
+
*
|
|
357
|
+
* INSIDE a `[...]` bracket segment a `*` / `?` is UNBOUNDED within that bracket: the
|
|
358
|
+
* brackets already delimit the key, so a `.` between them is DATA, not a segment
|
|
359
|
+
* boundary — cdkrd's own canonical paths carry dotted bracket keys such as
|
|
360
|
+
* `Alb.LoadBalancerAttributes[routing.http2.enabled]`. So `...[*]` and `...[routing.*]`
|
|
361
|
+
* match those keys, while `.` OUTSIDE brackets stays a hard segment boundary. A `*`/`?`
|
|
362
|
+
* inside a bracket may not cross the closing `]` (still one bracket segment).
|
|
356
363
|
*/
|
|
357
364
|
function matchesPathGlob(pattern, target) {
|
|
358
365
|
let out = "^";
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
else out +=
|
|
366
|
+
let inBracket = false;
|
|
367
|
+
for (const ch of pattern.replace(/\*+/g, "*")) if (ch === "*") out += inBracket ? "[^\\]]*" : "[^.[]*";
|
|
368
|
+
else if (ch === "?") out += inBracket ? "[^\\]]" : "[^.[]";
|
|
369
|
+
else {
|
|
370
|
+
if (ch === "[") inBracket = true;
|
|
371
|
+
else if (ch === "]") inBracket = false;
|
|
372
|
+
out += ch.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
373
|
+
}
|
|
362
374
|
out += "$";
|
|
363
375
|
return new RegExp(out).test(target);
|
|
364
376
|
}
|
|
@@ -434,7 +446,10 @@ function validateIgnoreEntry(entry, index) {
|
|
|
434
446
|
"stack",
|
|
435
447
|
"account",
|
|
436
448
|
"region"
|
|
437
|
-
])
|
|
449
|
+
]) {
|
|
450
|
+
if (obj[k] !== void 0 && typeof obj[k] !== "string") throw new Error(`${at}: "${k}" must be a string`);
|
|
451
|
+
if (obj[k] === "") throw new Error(`${at}: "${k}" must not be empty (omit it to leave the axis unscoped)`);
|
|
452
|
+
}
|
|
438
453
|
}
|
|
439
454
|
/**
|
|
440
455
|
* The exact ignore rule the `ignore` verb (and check's inline ignore) writes for a
|