New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@apollo/client-react-streaming

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo/client-react-streaming - npm Package Compare versions

Comparing version 0.11.8 to 0.11.9

17

dist/stream-utils.node.js

@@ -16,3 +16,7 @@ import { renderToString } from 'react-dom/server';

let currentlyStreaming = false;
let tailOfLastChunk = "";
const textDecoder = new TextDecoder();
const textEncoder = new TextEncoder();
const HEAD_END = "</head>";
const KEEP_BYTES = HEAD_END.length;
const transformStream = new TransformStream({

@@ -25,7 +29,7 @@ async transform(chunk, controller) {

if (!headInserted) {
const content = textDecoder.decode(chunk, { stream: true });
const index = content.indexOf("</head>");
const content = tailOfLastChunk + textDecoder.decode(chunk, { stream: true });
const index = content.indexOf(HEAD_END);
if (index !== -1) {
const insertedHeadContent = content.slice(0, index) + await renderInjectedHtml() + content.slice(index);
controller.enqueue(new TextEncoder().encode(insertedHeadContent));
controller.enqueue(textEncoder.encode(insertedHeadContent));
currentlyStreaming = true;

@@ -37,8 +41,7 @@ setImmediate(() => {

} else {
controller.enqueue(chunk);
tailOfLastChunk = content.slice(-KEEP_BYTES);
controller.enqueue(textEncoder.encode(content.slice(0, -KEEP_BYTES)));
}
} else {
controller.enqueue(
new TextEncoder().encode(await renderInjectedHtml())
);
controller.enqueue(textEncoder.encode(await renderInjectedHtml()));
controller.enqueue(chunk);

@@ -45,0 +48,0 @@ currentlyStreaming = true;

{
"name": "@apollo/client-react-streaming",
"version": "0.11.8",
"version": "0.11.9",
"repository": {

@@ -117,3 +117,3 @@ "url": "git+https://github.com/apollographql/apollo-client-nextjs.git"

"scripts": {
"build": "rimraf dist; tsup",
"build": "rimraf dist .built; tsup && touch .built",
"test": "concurrently -c auto \"yarn:test:*(!base) $@\"",

@@ -126,3 +126,2 @@ "test:base": "TSX_TSCONFIG_PATH=./tsconfig.tests.json node --import tsx/esm --no-warnings --test \"$@\" src/**/*.test.(ts|tsx)",

"prepublishOnly": "yarn pack -o attw.tgz && attw attw.tgz && rm attw.tgz && yarn run test",
"postpublish": "touch .published",
"test-bundle": "yarn test-bundle:attw && yarn test-bundle:package && yarn test-bundle:publint && yarn test-bundle:shape",

@@ -129,0 +128,0 @@ "test-bundle:attw": "attw --pack .",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc