import YAML file, RollupError: 'Legacy octal escape is not permitted in strict mode'
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- javascript, yaml
- Ambito
- build-system
Direzione di ricerca
Start with the StackBlitz reproduction and inspect /tosource/src/tosource.ts, especially legalKey, to determine how the quoted YAML key becomes the generated object key. Confirm the generated JavaScript is accepted by Rollup in strict mode and that the imported key remains "01" without the legacy-octal error.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
- Rollup Plugin Name: @rollup/plugin-yaml
- Rollup Plugin Version: 4.1.2
- Rollup Version: 4.60.1
- Operating System (or Browser): ubuntu 22.04
- Node Version: 24.14.0
- Link to reproduction: https://stackblitz.com/edit/rollup-repro-arqohgva
Expected Behavior
No errors occur.
Actual Behavior
[!] RollupError: src/data.yaml (1:13): Legacy octal escape is not permitted in strict mode (Note that you need plugins to import files that are not JavaScript)
src/data.yaml (1:13)
1: var data = { 01:"any value" };
^
2:
3: export default data;
Additional Information
I enclose key in quotes to indicate string.
On JS-YAML online demo, converted correctly.
input
# Enclose key in quotes to indicate string
'01': any value
output
{ '01': 'any value' }
Is this problem with tosource, not @rollup/plugin-yaml?
Is this problem in this code?
/tosource/src/tosource.ts
function legalKey(key: string) {
return (
- /^([a-z_$][0-9a-z_$]*|[0-9]+)$/gi.test(key) && !KEYWORD_REGEXP.test(key)
+ /^([a-z_$][0-9a-z_$]*|0|[1-9][0-9]*)$/gi.test(key) && !KEYWORD_REGEXP.test(key) // Like this?
);
}
- Lingua principale
- JavaScript
- Stelle
- 3.8k
- Fork
- 635
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
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 rollup/plugins
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
Support js-yaml v5 Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
Tutte le issue di rollup/plugins
Issue simili
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
apache/cloudstack#14222 ·
-
Browser Waiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
getsentry/sentry-javascript#24577 · 1 commento ·
-
curation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
amponce/archive-movie-browser#186 ·
-
light
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
aemdemos/patients-stryker#253 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
clerk/javascript#9852 ·