fix(directive): input names with lone surrogates are emitted in oxc's internal U+FFFD encoding
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
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- angular, rust, typescript
- Ambito
- compilers
Direzione di ricerca
Start with get_property_key_name in directive/property_decorators.rs and its copied decorator helpers, then trace class_metadata/builders.rs and the JS and dts.rs emitters. Use the lone-surrogate repro to compare OXC output with ngtsc; done means names and string values preserve lone code units as writable \uXXXX escapes and the generated TypeScript is valid.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
A member name written with a lone surrogate escape ('x-\uD800') comes out of OXC as x-<U+FFFD>d800: U+FFFD followed by the hex code unit. This is how oxc_ast stores lone surrogates in StringLiteral::value when lone_surrogates is true. We use value as a normal string and never decode it. ngtsc writes \uD800.
So the binding name at runtime (x-<U+FFFD>d800) doesn't match the class field (x-\uD800).
Repro
import {Directive, Input} from '@angular/core';
@Directive({selector: '[d]'})
export class D {
@Input() 'x-\uD800': any;
@Input({transform: (v: string) => 1}) 'y-\uD800': number = 0;
}
OXC (#504 tip, 3e0b07f). � below is the U+FFFD character
static ɵdir = i0.ɵɵdefineDirective({type:D,selectors:[["","d",""]],inputs:{"x-�d800":"x-�d800",
"y-�d800":[2,"y-�d800","y-�d800",(v) =>1]}});
// setClassMetadata
{"x-�d800":[{type:Input}],"y-�d800":[{type:Input,args:[{transform:(v) =>1}]}]}
static ɵdir: i0.ɵɵDirectiveDeclaration<D, "[d]", never, { "x-�d800": { "alias": "x-�d800"; "required": false; }; "y-�d800": { "alias": "y-�d800"; "required": false; }; }, {}, never, never, true, never>;
static "ngAcceptInputType_y-�d800": string;
ngtsc 22.1.7
static ɵdir = i0.ɵɵdefineDirective({ type: D, selectors: [["", "d", ""]], inputs: { "x-\uD800": "x-\uD800", "y-\uD800": [2, "y-\uD800", "y-\uD800", (v) => 1] } });
// setClassMetadata
{ "x-\uD800": [{ type: Input }], "y-\uD800": [{ type: Input, args: [{ transform: (v) => 1 }] }] }
static ɵdir: i0.ɵɵDirectiveDeclaration<D, "[d]", never, { "x-\uD800": { "alias": "x-\uD800"; "required": false; }; "y-\uD800": { "alias": "y-\uD800"; "required": false; }; }, {}, never, never, true, never>;
static "ngAcceptInputType_y-\uD800": string;
Where
- Main and the stack both read the key with
.value:directive/property_decorators.rs(get_property_key_name) andclass_metadata/builders.rs(get_property_key_name). The same helper is copied into the component, pipe, NgModule, injectable and service decorator modules. - Strings are printed by the JS emitter and by
dts.rs(escape_dts_string, and thengAcceptInputType_quoting ingenerate_input_transform_fields). None of them handle the encoding.
On main?
Yes. On main the field is printed unquoted, static ngAcceptInputType_y-�d800: unknown;, which is not valid TS. The stack (#496) quotes it and types it, but the name still uses the internal encoding.
Direction
Decode lone_surrogates strings when reading names and string values. Keep the lone code units in a form the emitters can write back as \uXXXX.
- 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di voidzero-dev/oxc-angular-compiler
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
voidzero-dev/oxc-angular-compiler#563 ·
I maintainer di solito rispondono entro 1 giorno
-
e2e compare: setClassMetadata extraction regex never matches (ɵɵ vs ɵ) — classMetadataDiffs is dead codeForse già presa @Brooooooklyn l’ha presa oggi. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
voidzero-dev/oxc-angular-compiler#561 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
voidzero-dev/oxc-angular-compiler#506 ·
I maintainer di solito rispondono entro 1 giorno
-
bug rust
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
voidzero-dev/oxc-angular-compiler#313 ·
I maintainer di solito rispondono entro 1 giorno
-
Support useDefineForClassFields: false (Class Field Lowering)Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
voidzero-dev/oxc-angular-compiler#73 · 11 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di voidzero-dev/oxc-angular-compiler
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
agentic-os-org/ANOLISA#6742 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
api: storage
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
googleapis/google-cloud-rust#7153 ·
I maintainer di solito rispondono entro 1 giorno
-
comp-mysql
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ClickHouse/ClickHouse#124749 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
oracle/rust-oracledb#43 · 1 commento ·