@apollo/client-react-streaming
Version:
This package provides building blocks to create framework-level integration of Apollo Client with React's streaming SSR. See the [@apollo/client-integration-nextjs](https://github.com/apollographql/apollo-client-integrations/tree/main/packages/nextjs) pac
27 lines (26 loc) • 706 B
JavaScript
// src/stream-utils/JSONTransformStreams.tsx
var JSONEncodeStream = class extends TransformStream {
constructor() {
super({
transform(chunk, controller) {
controller.enqueue(JSON.stringify(chunk));
}
});
}
};
var JSONDecodeStream = class extends TransformStream {
constructor() {
super({
transform(chunk, controller) {
if (typeof chunk !== "string") {
chunk = new TextDecoder().decode(chunk);
}
controller.enqueue(JSON.parse(chunk));
}
});
}
};
const built_for_browser = true;
export { JSONDecodeStream, JSONEncodeStream, built_for_browser };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=stream-utils.js.map