e039075a28
The compiler flag `compileNonExportedClasses` allows the Angular compiler to process classes which are not exported at the top level of a source file. This is often used to allow for AOT compilation of test classes inside `it()` test blocks, for example. Previously, the compiler would identify exported classes by looking for an `export` modifier on the class declaration itself. This works for the trivial case, but fails for indirectly exported classes: ```typescript // Component is declared unexported. @Component({...}) class FooCmp {...} // Indirect export of FooCmp export {FooCmp}; ``` This is not an immediate problem for most application builds, since the default value for `compileNonExportedClasses` is `true` and therefore such classes get compiled regardless. However, in the Angular Language Service now, `compileNonExportedClasses` is forcibly overridden to `false`. That's because the tsconfig used by the IDE and Language Service is often far broader than the application build's configuration, and pulls in test files that can contain unexported classes not designed with AOT compilation in mind. Therefore, the Language Service has trouble working with such structures. In this commit, the `ReflectionHost` gains a new API for detecting whether a class is exported. The implementation of this method now not only considers the `export` modifier, but also scans the `ts.SourceFile` for indirect exports like the example above. This ensures the above case will be processed directly in the Language Service. This new operation is cached using an expando symbol on the `ts.SourceFile`, ensuring good performance even when scanning large source files with lots of exports (e.g. a FESM file under `ngcc`). Fixes #42184. PR Close #42207 |
||
---|---|---|
.circleci | ||
.devcontainer | ||
.github | ||
.husky | ||
.ng-dev | ||
.vscode | ||
.yarn | ||
aio | ||
dev-infra | ||
docs | ||
goldens | ||
integration | ||
modules | ||
packages | ||
scripts | ||
third_party | ||
tools | ||
.bazelignore | ||
.bazelrc | ||
.bazelversion | ||
.clang-format | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
.gitmessage | ||
.mailmap | ||
.npmrc | ||
.nvmrc | ||
.prettierrc | ||
.pullapprove.yml | ||
.yarnrc | ||
BUILD.bazel | ||
CHANGELOG.md | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md | ||
WORKSPACE | ||
browser-providers.conf.js | ||
gulpfile.js | ||
karma-js.conf.js | ||
package.json | ||
renovate.json | ||
test-events.js | ||
test-main.js | ||
tslint.json | ||
yarn.lock | ||
yarn.lock.readme.md |
README.md
Angular - The modern web developer's platform.
Angular is a development platform for building mobile and desktop web applications
using Typescript/JavaScript and other languages.
Contributing Guidelines
·
Submit an Issue
·
Blog
Documentation
Get started with Angular, learn the fundamentals and explore advanced topics on our documentation website.
Advanced
Development Setup
Prerequisites
- Install Node.js which includes Node Package Manager
Setting Up a Project
Install the Angular CLI globally:
npm install -g @angular/cli
Create workspace:
ng new [PROJECT NAME]
Run the application:
cd [PROJECT NAME]
ng serve
Angular is cross-platform, fast, scalable, has incredible tooling, and is loved by millions.
Quickstart
Ecosystem
Changelog
Learn about the latest improvements.
Upgrading
Check out our upgrade guide to find out the best way to upgrade your project.
Contributing
Contributing Guidelines
Read through our contributing guidelines to learn about our submission process, coding rules and more.
Want to Help?
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues labeled as help wanted or good first issue.
Code of Conduct
Help us keep Angular open and inclusive. Please read and follow our Code of Conduct.
Community
Join the conversation and help the community.
Love Angular? Give our repo a star ⭐ ⬆️.