feat: honor `jit: true` in `@Component` / `@Directive` / `@NgModule` (skip AOT compile)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by tracing the existing JIT downlevel path exposed by TransformOptions::jit, then compare it with the AOT handling for @Component, @Directive, and @NgModule. The issue points to ngtsc's extractDirectiveMetadata and the directive, component, and ng_module handlers as behavioral references. Done means jit: true preserves the decorator for runtime JIT, emits no Ivy .d.ts members for that class, and leaves the rest of the file AOT-compiled.
由索引模型根据 Issue 内容生成。
描述
jit: true in decorator metadata tells ngtsc not to compile the class ahead of time. ngtsc leaves the decorator in place (it is downleveled by TS) so the JIT compiler handles it at runtime. OXC ignores the flag and compiles the class AOT anyway.
Repro
import {Component} from '@angular/core';
@Component({jit: true, selector: 'c', template: '<div>{{x}}</div>'})
export class C { x = 1; }
OXC (main and #504 tip)
export class C { x = 1;
static ɵfac = function C_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || C)(); };
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({type:C,selectors:[["c"]],decls:2,vars:1,template:function C_Template(rf, ctx) {...},encapsulation:2});
}
// + ɵsetClassDebugInfo, ɵsetClassMetadata(C,[{type:Component,args:[{jit:true,selector:"c",template:"<div>{{x}}</div>"}]}],null,null)
.d.ts: ɵfac + ɵcmp declarations.
ngtsc 22.1.7
let C = class C {
x = 1;
};
C = __decorate([
Component({ jit: true, selector: 'c', template: '<div>{{x}}</div>' })
], C);
.d.ts: only x: number; (no Ivy fields).
@Directive({jit: true, ...}) and @NgModule({jit: true}) behave the same way: ngtsc leaves the decorator, OXC emits ɵdir / ɵmod.
ngtsc source (v22.0.0)
annotations/directive/src/shared.tsextractDirectiveMetadata:if (directive.has('jit')) return {jitForced: true};annotations/directive/src/handler.tsandannotations/component/src/handler.ts: onjitForced, register for JIT and skip analysis.annotations/ng_module/src/handler.ts:if (ngModule.has('jit')) ...
On main?
Yes.
Direction
When the decorator has jit: true, run that class through the existing JIT downlevel path (TransformOptions::jit) instead of AOT, and emit no Ivy .d.ts members for it. The rest of the file is still compiled AOT.
- 主要语言
- Rust
- 星标
- 232
- 派生
- 21
- 平均合并
- 2 天 14 小时
- 30 天内合并 PR
- 30
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
voidzero-dev/oxc-angular-compiler 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
voidzero-dev/oxc-angular-compiler#511 ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 78/100
voidzero-dev/oxc-angular-compiler#522 ·
维护者通常 1 天内回复
-
question
难度 5/5 一周以上 新手友好度 35/100
voidzero-dev/oxc-angular-compiler#521 ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 76/100
voidzero-dev/oxc-angular-compiler#520 ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 76/100
voidzero-dev/oxc-angular-compiler#519 ·
维护者通常 1 天内回复
查看 voidzero-dev/oxc-angular-compiler 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 80/100
Devolutions/picky-rs#546 · 1 条评论 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
zcashlabs/thus-spoke-zakura#153 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
topgrade-rs/topgrade#2395 ·
维护者通常 1 天内回复
-
app bug windows-os
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复