@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
30 lines (28 loc) • 748 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));
}
});
}
};
exports.built_for_browser = true;
exports.JSONDecodeStream = JSONDecodeStream;
exports.JSONEncodeStream = JSONEncodeStream;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=stream-utils.cjs.map