Make React integration work with Deno (#4679)

* Remove removed packages folder

* fix

* Add a changeset
This commit is contained in:
Matthew Phillips 2022-09-08 12:30:49 -04:00 committed by GitHub
parent 9290b24143
commit 5986517b4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 5 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/react': patch
---
Prevent decoder from leaking

View file

@ -32,7 +32,6 @@
"packages/*",
"examples/*",
"examples/component/demo",
"examples/component/packages/*",
"scripts",
"packages/astro/test/fixtures/component-library-shared",
"packages/astro/test/fixtures/custom-elements/my-component-lib",

View file

@ -144,10 +144,17 @@ async function readResult(stream) {
let result = '';
const decoder = new TextDecoder('utf-8')
while (true) {
const { done, value } = await reader.read();
if (done) {
return result;
}
const { done, value } = await reader.read();
if (done) {
if(value) {
result += decoder.decode(value);
} else {
// This closes the decoder
decoder.decode(new Uint8Array());
}
return result;
}
result += decoder.decode(value, { stream: true });
}
}