reference-core by angular/angular
npx skills add https://github.com/angular/angular --skill reference-corepackages/core) 心智模型本文档概述了 Angular 框架核心 packages/core 的架构和心智模型。
packages/core 包含了 Angular 的运行时逻辑。其主要职责是:
渲染引擎(位于 packages/core/src/render3)采用一种基于指令的方法。
ɵɵelementStart、ɵɵtext、)。这些指令在运行时执行以创建和更新视图。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
ɵɵpropertypackages/core/src/render3/instructionsRElement, RText)。packages/core/src/render3/interfaces/view.tsLViews) 之间共享。它保存:
packages/core/src/render3/interfaces/view.tsLView 和 TView 是并行数组。LView 中的索引 i 对应 TView 中索引 i 处的元数据。
HEADER: 固定大小,包含上下文(父级、宿主等)。DECLS: 静态节点(元素、文本、管道)。VARS: 绑定值。EXPANDO: 动态数据(宿主绑定、注入器)。LView 中。LView 中的先前值进行比较。如果发生变化,则更新 DOM。Angular 中的 DI 是分层的,并由两个相互作用的系统组成:
R3Injector)@NgModule.providers 或 providedIn: 'root' 配置。R3Injector 实例的层级结构中。packages/core/src/di/r3_injector.ts@Component.providers 或 @Directive.providers 配置。LView("Expando" 部分)中的数据结构。TView.data) 在沿树向上遍历之前,快速检查特定节点索引处是否存在某个令牌。Default: 检查所有内容。OnPush: 仅在输入变更、事件触发或信号更新时检查。src/render3: Ivy 渲染引擎。
instructions: 编译后代码调用的运行时指令。interfaces: LView、TView、TNode 的定义。src/di: 依赖注入系统。src/change_detection: 变更检测逻辑。src/zone: Zone.js 集成。src/signal: Signals 实现(如果此版本中存在,否则可能在 primitives 中)。ɵ 开头。getLView()),以避免到处传递上下文参数。这是出于性能和代码大小的考虑。src/render3/instructions 中找到相应的指令。LView/TView 影响 : 如果添加状态,请理解它应放在 LView 数组的哪个位置。每周安装量
89
代码仓库
GitHub 星标
100.1K
首次出现
2026年2月11日
安全审计
已安装于
opencode87
gemini-cli86
github-copilot86
kimi-cli85
amp85
codex85
packages/core) Mental ModelThis document outlines the architecture and mental model for packages/core, the heart of the Angular framework.
packages/core contains the runtime logic for Angular. Its primary responsibilities are:
The rendering engine (located in packages/core/src/render3) uses an instruction-based approach.
Instructions : The Angular compiler transforms templates into a sequence of instruction calls (e.g., ɵɵelementStart, ɵɵtext, ɵɵproperty). These instructions are executed at runtime to create and update the view.
packages/core/src/render3/instructionsLView (Logical View) : An array containing the state of a specific view instance. It holds:
RElement, RText).packages/core/src/render3/interfaces/view.tsTView (Template View) : An array containing the static structure of a view. It is shared across all instances (LViews) of the same component/template. It holds:
packages/core/src/render3/interfaces/view.tsMemory Layout : LView and TView are parallel arrays. Index i in LView corresponds to metadata at index i in TView.
HEADER: Fixed size, contains context (Parent, Host, etc.).DECLS: Static nodes (elements, text, pipes).VARS: Binding values.EXPANDO: Dynamic data (host bindings, injectors).LView.LView. If changed, they update the DOM.DI in Angular is hierarchical and split into two systems that interact:
R3Injector)@NgModule.providers or providedIn: 'root'.R3Injector instances.packages/core/src/di/r3_injector.ts@Component.providers or @Directive.providers.LView ("Expando" section).TView.data) to quickly check if a token is present at a specific node index before traversing up the tree.Default: Checks everything.OnPush: Checks only if inputs change, events fire, or signals update.src/render3: The Ivy rendering engine.
instructions: The runtime instructions called by compiled code.interfaces: LView, TView, TNode definitions.src/di: Dependency injection system.src/change_detection: Change detection logic.src/zone: Zone.js integration.src/signal: Signals implementation (if present in this version, otherwise likely in ).ɵ.getLView()) during instruction execution to avoid passing context arguments everywhere. This is for performance and code size.src/render3/instructions.LView/TView Impact: If adding state, understand where it fits in the LView array.Weekly Installs
89
Repository
GitHub Stars
100.1K
First Seen
Feb 11, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode87
gemini-cli86
github-copilot86
kimi-cli85
amp85
codex85
Flutter应用架构设计指南:分层结构、数据层实现与最佳实践
4,300 周安装
Salesforce 开发者指南:Apex、LWC、SOQL 最佳实践与 DevOps 部署
1,100 周安装
小红书封面生成器 - 一键生成小红书风格封面图片,支持自定义主题,AI驱动
1,000 周安装
Claude AI技能模板 - 每周安装量841+的开发者工具,支持多种IDE集成
1,000 周安装
SwiftUI 视图重构指南:轻量级 MV 架构与最佳实践
1,000 周安装
GraphQL 操作最佳实践指南:查询、变更、订阅编写与优化技巧
1,000 周安装
WordPress安全与数据验证:三层防护模型,防止XSS、CSRF、SQL注入攻击
139 周安装
primitives