@groma/scanner-angular 0.2.1 → 0.2.2

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 (2) hide show
  1. package/dist/index.js +15 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28400,13 +28400,13 @@ function compare(...values) {
28400
28400
  }
28401
28401
  function uniqueBy(values, key, label) {
28402
28402
  const seen = new Set;
28403
- for (const value of values) {
28404
- const id = key(value);
28403
+ const keyed = values.map((value) => ({ id: key(value), value }));
28404
+ for (const { id } of keyed) {
28405
28405
  if (seen.has(id))
28406
28406
  throw new Error(`duplicate ${label}: ${id}`);
28407
28407
  seen.add(id);
28408
28408
  }
28409
- return [...values].sort((left, right) => key(left).localeCompare(key(right)));
28409
+ return keyed.sort((left, right) => left.id.localeCompare(right.id)).map((entry) => entry.value);
28410
28410
  }
28411
28411
  function createScanObservation(input) {
28412
28412
  const roots = validateRoots(input.roots);
@@ -28417,9 +28417,7 @@ function createScanObservation(input) {
28417
28417
  symbols: [...new Map(file.symbols.map((symbol) => [
28418
28418
  compare(symbol.id, symbol.kind),
28419
28419
  symbol
28420
- ])).values()].sort((left, right) => {
28421
- return compare(left.id, left.kind).localeCompare(compare(right.id, right.kind));
28422
- })
28420
+ ]))].sort(([left], [right]) => left.localeCompare(right)).map(([, symbol]) => symbol)
28423
28421
  })), (file) => file.file, "file path");
28424
28422
  const filePaths = new Set(files.map((file) => file.file));
28425
28423
  for (const file of files) {
@@ -28430,8 +28428,6 @@ function createScanObservation(input) {
28430
28428
  throw new Error(`file references unknown root: ${root}`);
28431
28429
  }
28432
28430
  }
28433
- for (const diagnostic of input.diagnostics)
28434
- diagnosticLocation(diagnostic);
28435
28431
  return {
28436
28432
  schemaVersion: 1,
28437
28433
  scanner: input.scanner,
@@ -28441,14 +28437,14 @@ function createScanObservation(input) {
28441
28437
  ...entryPoints(input.entryPoints, filePaths),
28442
28438
  ...operationEvidence(input, filePaths),
28443
28439
  ...httpEvidence(input.httpEndpoints, input.httpRequests, input.operations && new Set(input.operations.map((operation) => operation.id))),
28444
- diagnostics: [...new Map(input.diagnostics.map((diagnostic) => [
28445
- diagnosticKey(diagnostic),
28446
- diagnostic
28447
- ])).values()].sort((left, right) => {
28448
- return diagnosticKey(left).localeCompare(diagnosticKey(right));
28449
- })
28440
+ diagnostics: normalizeScanDiagnostics(input.diagnostics)
28450
28441
  };
28451
28442
  }
28443
+ function normalizeScanDiagnostics(diagnostics) {
28444
+ for (const diagnostic of diagnostics)
28445
+ diagnosticLocation(diagnostic);
28446
+ return [...new Map(diagnostics.map((diagnostic) => [diagnosticKey(diagnostic), diagnostic]))].sort(([left], [right]) => left.localeCompare(right)).map(([, diagnostic]) => diagnostic);
28447
+ }
28452
28448
  function entryPoints(input, paths) {
28453
28449
  if (input === undefined)
28454
28450
  return {};
@@ -28557,10 +28553,14 @@ function operationTokens(operation) {
28557
28553
  const endLine = Number(operation.endLine);
28558
28554
  if (endLine < startLine)
28559
28555
  throw new Error("operation.endLine must be at or after startLine");
28556
+ const tokens = array(operation.tokens, "operation.tokens");
28557
+ tokens.forEach((token) => {
28558
+ string(token, "operation.token");
28559
+ });
28560
28560
  return {
28561
28561
  startLine,
28562
28562
  endLine,
28563
- tokens: array(operation.tokens, "operation.tokens").map((token) => string(token, "operation.token"))
28563
+ tokens
28564
28564
  };
28565
28565
  }
28566
28566
  function validateOperationTokens(operation) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@groma/scanner-angular",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Complementary Angular framework evidence with its own compatible TypeScript tooling.",
5
5
  "private": false,
6
6
  "type": "module",