Repository navigation
Commit 8838b9f
* fix(partial): give NgModule components their scope (#655)
A partial declaration of a component an NgModule declares had no
dependencies, so after linking it had no directives or pipes. The
NgModule's file now calls ɵɵsetComponentScope for each component it
declares, with the module's compilation scope read across files (source
@NgModule decorators and .d.ts ɵmod types). A standalone component that
imports an NgModule now lists the module's exported directives and pipes.
Partial declarations also carry a real version (the target Angular
version, else 22.2.3) instead of 0.0.0-PLACEHOLDER, which Angular's
published linker reads as 0.0.0 and so turns off block syntax.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(partial): run NgModule scopes after the file, list each class once
- Set component scopes at the end of the module's file with `() => [...]`
lists, and skip a component whose file imports the module's file back.
- A standalone component lists a class an imported NgModule exports once,
by declaration, not by name.
- Look up each `(file, name)` once per export search, so `export *`
cycles end in linear time.
- Import a workspace library class by path when its entry point doesn't
export it.
- Emit `isStandalone: true` for a linker before v19, which reads a missing
field as `false`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(partial): find import cycles through barrels and namespace re-exports
- Skip a component when the file its scope call imports it from loads
the module file back, not only the file that declares it.
- Follow `export * as ns from`, and not type-only imports and re-exports,
when looking for a cycle.
- List a module's classes as seen only once its list is kept: a module
with a pipe of no static name no longer hides them from later ones.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(partial): read a module's later-declared exports through forwardRef
A class an imported NgModule exports that the file declares after the
standalone component is listed as `forwardRef(() => X)`, as ngtsc does,
so creating the component's definition doesn't read it too early.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(partial): match the compiled file's path to the resolver's on Windows
`canonicalize` gives the compiled file a `\\?\` path, which the resolver's
paths don't have, so an import cycle back to it was never found.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(partial): read imported scope classes in a cycle through forwardRef
- A class an imported NgModule exports, whose file loads the standalone
component's file back, is listed as `forwardRef(() => i1.X)`: the
component's definition can be created before that file has run.
- Name a class imported by path from an `.mts`/`.cts` file by the `.mjs`
/`.cjs` file TypeScript writes for it.
- Compare canonical paths when looking for a cycle: a path through a
tsconfig alias can be spelled differently, as Windows short names are.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent b14c575 commit 8838b9f
36 files changed
Lines changed: 2794 additions & 172 deletions
File tree
- crates/oxc_angular_compiler
- src
- component
- cross_file_elision
- directive
- injectable
- ng_module
- partial
- pipe
- service
- tests
- snapshots
- napi/angular-compiler/test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| 107 | + | |
| 108 | + | |
105 | 109 | | |
106 | 110 | | |
107 | 111 | | |
| |||
250 | 254 | | |
251 | 255 | | |
252 | 256 | | |
| 257 | + | |
253 | 258 | | |
254 | 259 | | |
255 | 260 | | |
| |||
0 commit comments