@groma/scanner-angular 0.1.3 → 0.1.5

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 (3) hide show
  1. package/README.md +93 -24
  2. package/dist/index.js +1985 -27919
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # Angular scanner
2
2
 
3
- The Angular scanner adds concrete external-template output bindings to the
4
- TypeScript scanner evidence. Enable it alongside the Java scanner for the
5
- supported Maven and Angular application. All enabled scanners must complete
6
- before Groma updates the map.
3
+ The Angular scanner adds explicit component source units and concrete
4
+ external-template output bindings to the TypeScript scanner evidence. Enable it alongside the Java scanner for the
5
+ supported Maven and Angular application. Healthy scanners update the map; failed scanners retain their saved evidence.
7
6
 
8
7
  ## Build and install
9
8
 
@@ -25,10 +24,10 @@ The package contains a bundled ESM entry and TypeScript standard-library
25
24
  declarations. Consumers do not run a package build or installation script.
26
25
  The prototype package name is not a public publication commitment.
27
26
 
28
- Prepare the application's ordinary dependencies using its package manager.
29
- The scanner reads each selected project's `tsconfig.json`, its configured source entry points,
30
- and the Angular resources reachable from that program. It does not install
31
- dependencies, compile application output, or run application code.
27
+ The scanner reads each selected project's `tsconfig.json`, source entry points
28
+ and external templates. The package supplies the compiler tools; project
29
+ `node_modules`, application compilation and dependency installation are not
30
+ required. Application code is never executed.
32
31
 
33
32
  ## Compiler tooling
34
33
 
@@ -39,14 +38,21 @@ The TypeScript scanner uses its own 7.1 SDK. The package build resolves every
39
38
  compiler TypeScript import to the scanner's 5.9.3 installation before bundling,
40
39
  so workspace dependency hoisting cannot substitute Groma's compiler.
41
40
 
42
- The adapter uses `NgtscProgram`, its template type checker, and the compiler's
43
- template and TypeScript symbols. These version-specific compiler APIs are
44
- pinned with the package. Angular owns template parsing, directive matching,
45
- output binding, and handler resolution; the adapter does not recreate them.
46
- See [Angular template type checking](https://angular.dev/tools/cli/template-typecheck).
41
+ Angular's template parser and selector matcher read template syntax. TypeScript
42
+ resolves local class, property and handler identities. The adapter recognizes
43
+ literal `@Component` metadata, direct standalone imports and Angular output
44
+ API imports from source, even when the Angular package is absent.
47
45
 
48
46
  ## Supported evidence
49
47
 
48
+ Literal `templateUrl`, `styleUrl`, and `styleUrls` declarations associate a
49
+ component class with its directly named local template and stylesheet files.
50
+ Core uses that source unit to create one component, or attach new unowned files
51
+ to its existing owner. All member paths appear in Code details. Inline content
52
+ does not create files; ordinary imports, neighboring files, global styles, and
53
+ transitive stylesheet imports do not become companion files. Shared companions
54
+ and conflicting curated ownership follow the core source-unit review rules.
55
+
50
56
  A direct method call in an external template can bind a single resolved
51
57
  source output property to a source method with a body. TypeScript locates
52
58
  `emit()` calls on that exact property declaration. An emit inside an arrow
@@ -60,14 +66,78 @@ unresolved while Angular establishes the concrete binding.
60
66
 
61
67
  Angular reports `angular` Code provenance for its source contribution.
62
68
  The exact source path keeps one curated owner across both scanners. HTML edits
63
- participate in the existing watch lifecycle. Repeat scans retain authored
69
+ participate in the existing watch lifecycle, as do CSS, SCSS, Sass, Less, and Stylus
70
+ source edits. Repeat scans retain authored
64
71
  architecture, and compiler errors leave the previous complete map in place.
65
72
 
66
73
  In OKF, the result remains ordinary Code links and readable relationship rows.
67
- In C4, an Angular component is source evidence, not a new architecture level
68
- or an automatic architecture component. Core owns relationship interpretation;
74
+ In C4, an Angular declaration supplies source-unit evidence, not a new
75
+ architecture level. Core owns component ownership and relationship interpretation;
69
76
  the plugin does not write architecture or introduce metadata.
70
77
 
78
+ ## Source outline
79
+
80
+ The scanner outlines the TypeScript files in a component's Code with the
81
+ TypeScript rules of the [source outline contract](../creating-a-plugin.md#source-outline):
82
+ top-level functions and types (classes, interfaces, enums), including namespace
83
+ contents, and each type's constructors and methods. Every declaration has its
84
+ line and visibility, and `entry` marks the names the Code links give. Templates
85
+ and stylesheets have no outline. The package's own TypeScript parses each file
86
+ alone, without `tsconfig.json`, dependencies or compilation.
87
+
88
+ Core outlines each file once. For a source that the TypeScript scanner also
89
+ owns, the scanner with the lowest id among the file's Code links outlines it,
90
+ here Angular, with the symbols of all those links.
91
+
92
+ ## HTTP endpoints and requests
93
+
94
+ The scanner reports [HTTP facts](../evidence.md#http-endpoints-and-requests) for
95
+ Angular's `HttpClient`. An Angular application is a client: it serves no endpoint.
96
+
97
+ | Construct | Reported |
98
+ | --- | --- |
99
+ | `get`, `post`, `put`, `patch`, `delete`, `head`, `options` | Request with that method and the URL the first argument states |
100
+ | `request(method, url)` | Request with that literal method; a computed method leaves the method out |
101
+
102
+ The receiver must hold the injected client: a constructor parameter property, a
103
+ field, or a local whose declared type is `HttpClient`, or one that
104
+ `inject(HttpClient)` supplies, with `HttpClient` imported from
105
+ `@angular/common/http`. Both names are recognized from source, without the
106
+ Angular packages installed, so a `get` method on any other object is never a
107
+ request. `request(new HttpRequest(...))`, `jsonp`, and a client this scan never
108
+ sees injected report nothing.
109
+
110
+ The [producer decisions](../evidence.md#producer-checklist) for this
111
+ ecosystem:
112
+
113
+ 1. **Prefixes.** None to add: the scanner reports no endpoint, and a request's
114
+ path is the URL its own call states, after the base rule below.
115
+ 2. **Endpoints.** None. Angular's router routes navigate inside the browser, and
116
+ interceptors and guards answer no request; reporting either would claim an
117
+ answer nothing serves and could hide the file that really serves the path.
118
+ 3. **Dynamic or unknown.** `` `/talks/${id}` `` fills one whole segment, so it
119
+ is dynamic. `` `/talks/${id}-latest` ``, a path built from an unresolved
120
+ value, and a URL the scanner cannot read at the call are unknown. The query
121
+ and fragment are dropped, computed or not.
122
+ 4. **Local helpers.** Not supported: the URL is read at the client call, so a
123
+ helper that forwards a path parameter reports unknown text, and its callers
124
+ report nothing. Author those rows.
125
+ 5. **Bases.** The [React
126
+ scanner's](../react/index.md#http-endpoints-and-requests) decision 5 holds
127
+ unchanged, so an environment object holding `/api` reports `/api/talks`, and
128
+ a field read through `this` holds its one assignment, so `this.resourceUrl`
129
+ with `resourceUrl = API_ROOT + '/api/speakers'` reads as that configured base
130
+ and path, while an injected field is the service's own base setting. A
131
+ literal environment base is the value in the source file, which an Angular
132
+ build's `fileReplacements` can swap for another environment, so the reported
133
+ path is the development one.
134
+ 6. **File-location routes.** None: every request names the function that runs
135
+ the call, and a call outside any function reports nothing.
136
+ 7. **Constrained segments.** None: the scanner reports no endpoint, so it reads
137
+ no route pattern.
138
+ 8. **Registration order.** None: without endpoints there is no route order to
139
+ report.
140
+
71
141
  ## Coverage limits
72
142
 
73
143
  This revision qualifies the CompanyMergeDialog output-to-parent-handler flow.
@@ -77,16 +147,15 @@ expressions, output mutation, or exhaustive Angular runtime behavior.
77
147
  Unresolved or unsupported event bindings produce
78
148
  `unsupported-angular-binding` diagnostics rather than relationships.
79
149
  DOM events and dependency-library outputs have no supported source output
80
- provider in this rule. TypeScript semantic errors, including incompatible types,
81
- fail readiness and scanning alongside syntax and Angular compiler errors.
82
- Compiler errors fail the scan instead of yielding a
83
- partial observation. Template strictness follows the project's Angular compiler
84
- options. Groma enables the template-checker API to resolve output bindings but
85
- does not enable stricter template checks than the project requests.
150
+ provider in this rule. Missing external types and unsupported bindings remain
151
+ uncertain. Invalid TypeScript or template syntax fails the observation. Source
152
+ scanning does not perform Angular application type checking. Nonliteral
153
+ component metadata, module-based scopes and indirect imports are outside the
154
+ supported binding extraction.
86
155
 
87
156
  Independent fixture tests load the built package and cover concrete callback
88
157
  endpoints, complementary TypeScript evidence, curated ownership, HTML-triggered
89
- rescan, and failure preservation. See [validation](validation.md) for the
158
+ rescan, failure preservation, the source outline, and the HTTP requests. See [fresh-checkout validation](../fresh-checkout-validation.md) for the
90
159
  real-project result and remaining release gates.
91
160
 
92
161
  ## Nested projects
@@ -97,7 +166,7 @@ dev dependencies, peer dependencies and optional dependencies identify candidate
97
166
  A candidate also needs a tracked or unignored `tsconfig.json` and TypeScript source
98
167
  files belonging to that package, outside nested packages. Declaration files and
99
168
  inactive fixtures with a `.fixture` suffix do not qualify. Packages with only
100
- framework tooling dependencies are skipped. No matching project produces no evidence. Each compiler uses that project's configuration and installed dependencies;
169
+ framework tooling dependencies are skipped. No matching project produces no evidence. Each compiler uses that project's configuration and local source;
101
170
  imported source in sibling repository libraries keeps its original source path.
102
171
  Readiness checks all selected projects. An invalid selected project fails this scanner's observation; other scanners
103
172
  can still update the architecture.