fix(directive): input names with lone surrogates are emitted in oxc's internal U+FFFD encoding
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 68/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- angular, rust, typescript
- Domínio
- compilers
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Rust
- Estrelas
- 232
- Forks
- 21
- Merge médio
- 1d 18h
- PRs com merge (30d)
- 59
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de voidzero-dev/oxc-angular-compiler
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
voidzero-dev/oxc-angular-compiler#563 ·
Mantenedores costumam responder em até 1 dia
-
e2e compare: setClassMetadata extraction regex never matches (ɵɵ vs ɵ) — classMetadataDiffs is dead codeTalvez já em andamento @Brooooooklyn assumiu hoje. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 38/100
voidzero-dev/oxc-angular-compiler#561 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 68/100
voidzero-dev/oxc-angular-compiler#506 ·
Mantenedores costumam responder em até 1 dia
-
bug rust
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 56/100
voidzero-dev/oxc-angular-compiler#313 ·
Mantenedores costumam responder em até 1 dia
-
Support useDefineForClassFields: false (Class Field Lowering)Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
voidzero-dev/oxc-angular-compiler#73 · 11 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de voidzero-dev/oxc-angular-compiler
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
-
curator: add tutros/sbxmAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 75/100
ajeetraina/awesome-docker-sbx#220 ·
-
`helios / deploy`: switch zone wait in `deploy.sh` has almost no headroom over healthy startup timesTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. AbertaTest Flake
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
oxidecomputer/omicron#11453 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
microsoft/adaptive-apps#58 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia