stackblitz / core

Online IDE powered by Visual Studio Code ⚡️
https://stackblitz.com
MIT License
10.18k stars 885 forks source link

ReadableStream not supports AsyncIterator #3041

Open himself65 opened 2 months ago

himself65 commented 2 months ago

Description of Bug

const r = new ReadableStream({
  start: (controller) => {
    controller.enqueue('1');
    controller.enqueue('2');
    controller.enqueue('3');
    controller.close();
  },
});

for await (const v of r) {
  console.log('v', v);
}
node ./index.js
SyntaxError: Unexpected reserved word
    at __global_eval__ (https://node5guajt-1lt4.w-credentialless-staticblitz.com/blitz.0314a412.js:1:263)
    at _0x508ec2 (https://node5guajt-1lt4.w-credentialless-staticblitz.com/blitz.0314a412.js:352:199586)
    at _0x4e27ea._compile (https://node5guajt-1lt4.w-credentialless-staticblitz.com/blitz.0314a412.js:352:197534)
    at _0x4ee9b2.instantiate (https://node5guajt-1lt4.w-credentialless-staticblitz.com/blitz.0314a412.js:352:376808)
    at _0x555b21._instantiate (https://node5guajt-1lt4.w-credentialless-staticblitz.com/blitz.0314a412.js:352:381436)
    at _0x555b21.instantiate (https://node5guajt-1lt4.w-credentialless-staticblitz.com/blitz.0314a412.js:352:379740)
    at ModuleJob._instantiate (https://node5guajt-1lt4.w-credentialless-staticblitz.com/blitz.0314a412.js:181:1509)
    at async ModuleJob.run (https://node5guajt-1lt4.w-credentialless-staticblitz.com/blitz.0314a412.js:181:2327)

Steps to Reproduce

  1. Go to https://stackblitz.com/edit/node-5guajt?file=index.js
  2. node index.js

Expected Behavior

A clear and concise description of what you expected to happen.

Screenshots/Screencast

If applicable, add screenshots to help explain your problem.

Additional Context/Questions Add any other context or questions regarding this bug.

Nemikolh commented 2 months ago

Hey @himself65! Thanks for the report! This is indeed a bug.

I'll add it to our internal tracker and keep you updated 👍