Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

feat: honor `jit: true` in `@Component` / `@Directive` / `@NgModule` (skip AOT compile)

未关闭
#515 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
angular, rust
领域
compilers

调研方向

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 内容生成。

描述

enhancement

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.ts extractDirectiveMetadata: if (directive.has('jit')) return {jitForced: true};
  • annotations/directive/src/handler.ts and annotations/component/src/handler.ts: on jitForced, 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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

voidzero-dev/oxc-angular-compiler 的其他 Issue

查看 voidzero-dev/oxc-angular-compiler 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。