Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-streaming

Package Overview
Dependencies
Maintainers
0
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-streaming - npm Package Compare versions

Comparing version 0.3.33-commit-2cf1712 to 0.3.33-commit-cf9cdf3

22

dist/cjs/server/renderToStream/createBuffer.js

@@ -9,2 +9,3 @@ "use strict";

let state = 'UNSTARTED';
let writePermission = null; // Set to `null` because React fails to hydrate if something is injected before the first react write
return { injectToStream, onBeforeWrite, onBeforeEnd, hasStreamEnded };

@@ -22,2 +23,5 @@ function injectToStream(chunk, options) {

function flushBuffer() {
if (!writePermission) {
return;
}
if (buffer.length === 0) {

@@ -49,8 +53,22 @@ return;

if (debug.isEnabled) {
debug(`react write`, getChunkAsString(chunk));
debug(`react write${!writePermission ? '' : ' (allowed)'}`, getChunkAsString(chunk));
}
state = 'STREAMING';
flushBuffer();
if (writePermission) {
flushBuffer();
}
if (writePermission === null) {
writePermission = false;
debug('writePermission =', writePermission);
setTimeout(() => {
debug('>>> setTimeout()');
writePermission = true;
debug('writePermission =', writePermission);
flushBuffer();
}, 0);
}
}
function onBeforeEnd() {
writePermission = true;
debug('writePermission =', writePermission);
flushBuffer();

@@ -57,0 +75,0 @@ (0, utils_1.assert)(buffer.length === 0);

2

dist/cjs/utils/projectInfo.js

@@ -5,3 +5,3 @@ "use strict";

const getGlobalObject_1 = require("./getGlobalObject");
const PROJECT_VERSION = '0.3.33-commit-2cf1712';
const PROJECT_VERSION = '0.3.33-commit-cf9cdf3';
const projectInfo = {

@@ -8,0 +8,0 @@ projectName: 'react-streaming',

@@ -7,2 +7,3 @@ export { createBuffer };

let state = 'UNSTARTED';
let writePermission = null; // Set to `null` because React fails to hydrate if something is injected before the first react write
return { injectToStream, onBeforeWrite, onBeforeEnd, hasStreamEnded };

@@ -20,2 +21,5 @@ function injectToStream(chunk, options) {

function flushBuffer() {
if (!writePermission) {
return;
}
if (buffer.length === 0) {

@@ -47,8 +51,22 @@ return;

if (debug.isEnabled) {
debug(`react write`, getChunkAsString(chunk));
debug(`react write${!writePermission ? '' : ' (allowed)'}`, getChunkAsString(chunk));
}
state = 'STREAMING';
flushBuffer();
if (writePermission) {
flushBuffer();
}
if (writePermission === null) {
writePermission = false;
debug('writePermission =', writePermission);
setTimeout(() => {
debug('>>> setTimeout()');
writePermission = true;
debug('writePermission =', writePermission);
flushBuffer();
}, 0);
}
}
function onBeforeEnd() {
writePermission = true;
debug('writePermission =', writePermission);
flushBuffer();

@@ -55,0 +73,0 @@ assert(buffer.length === 0);

export { projectInfo };
import { getGlobalObject } from './getGlobalObject';
const PROJECT_VERSION = '0.3.33-commit-2cf1712';
const PROJECT_VERSION = '0.3.33-commit-cf9cdf3';
const projectInfo = {

@@ -5,0 +5,0 @@ projectName: 'react-streaming',

{
"name": "react-streaming",
"description": "React 18 Streaming. Full-fledged & Easy.",
"version": "0.3.33-commit-2cf1712",
"version": "0.3.33-commit-cf9cdf3",
"peerDependencies": {

@@ -6,0 +6,0 @@ "react": ">=18",

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