Compiled require(node:buffer) does not expose callable atob and btoa

Aperta
#3,824 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à
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp, typescript
Ambito
backend, compilers

Direzione di ricerca

Start by reproducing the issue with sharpts --no-tsconfig --noLib repro.js, then compare it with the standalone compile and verify commands in the issue. Trace how require('node:buffer') exposes Buffer, atob, and btoa in compiled output and compare that path with named ESM imports. Done when the standalone output reports all three values as callable functions, matching the interpreter and Node.js.

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

Descrizione

During #3816 verification I found that the CommonJS node:buffer object exposes unusable values for its Base64 helpers in compiled output.

const buffer = require('node:buffer');
console.log(typeof buffer.Buffer, typeof buffer.atob, typeof buffer.btoa);

Node.js v22.23.2 and the SharpTS interpreter print function function function. SharpTS IL-verified standalone prints function object object. In the same compiled mode, directly calling the helpers from a named ESM import works.

Run as sharpts --no-tsconfig --noLib repro.js. For standalone, run sharpts --no-tsconfig --noLib --compile repro.js --standalone --verify -o repro.dll and dotnet repro.dll.

Lingua principale
C#
Stelle
156
Fork
4
Merge medio
14h 45m
PR unite (30g)
40

Preparare l'ambiente

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 nickna/SharpTS

Tutte le issue di nickna/SharpTS

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.