Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Chiusa
#515 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
angular, rust
Ambito
compilers

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Rust
Stelle
232
Fork
21
Merge medio
1g 18h
PR unite (30g)
59

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di voidzero-dev/oxc-angular-compiler

Tutte le issue di voidzero-dev/oxc-angular-compiler

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.