Socket
Socket
Sign inDemoInstall

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.29 to 0.3.30

6

dist/cjs/server/renderToStream/createBuffer.d.ts
export { createBuffer };
export type { InjectToStream };
export type { StreamOperations };
declare type InjectToStream = (chunk: unknown, options?: {
declare type InjectToStreamOptions = {
flush?: boolean;
}) => void;
expectStreamEnd?: boolean;
};
declare type InjectToStream = (chunk: unknown, options?: InjectToStreamOptions) => boolean;
declare type StreamOperations = {

@@ -8,0 +10,0 @@ operations: null | {

@@ -12,8 +12,14 @@ "use strict";

function injectToStream(chunk, options) {
(0, utils_1.assertUsage)(state !== 'ENDED', `Cannot inject following chunk after stream has ended: \`${chunk}\``);
if (debug.isEnabled) {
debug('injectToStream()', String(chunk));
debug('injectToStream()', getChunkAsString(chunk));
}
if (state === 'ENDED') {
if (!(options === null || options === void 0 ? void 0 : options.expectStreamEnd)) {
(0, utils_1.assertUsage)(state, `Cannot inject following chunk after stream has ended:\n${getChunkAsString(chunk)}`);
}
return false;
}
buffer.push({ chunk, flush: options === null || options === void 0 ? void 0 : options.flush });
flushBuffer();
return true;
}

@@ -50,3 +56,3 @@ function flushBuffer() {

if (debug.isEnabled) {
debug(`react write${!writePermission ? '' : ' (allowed)'}`, String(chunk));
debug(`react write${!writePermission ? '' : ' (allowed)'}`, getChunkAsString(chunk));
}

@@ -78,1 +84,9 @@ state = 'STREAMING';

exports.createBuffer = createBuffer;
function getChunkAsString(chunk) {
try {
return new TextDecoder().decode(chunk);
}
catch (err) {
return String(chunk);
}
}

@@ -10,3 +10,4 @@ export { createDebugger };

};
declare function createDebugger(namespace: string, optionsGlobal?: Options): ((msg: string, info?: unknown) => void) & {
declare type Namespace = 'react-streaming:createPipeWrapper' | 'react-streaming:buffer' | 'react-streaming:flow';
declare function createDebugger(namespace: Namespace, optionsGlobal?: Options): ((msg: string, info?: unknown) => void) & {
options: (options: Options) => (msg: string, info?: unknown) => void;

@@ -13,0 +14,0 @@ isEnabled: boolean;

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

const getGlobalObject_1 = require("./getGlobalObject");
const PROJECT_VERSION = '0.3.29';
const PROJECT_VERSION = '0.3.30';
const projectInfo = {

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

export { createBuffer };
export type { InjectToStream };
export type { StreamOperations };
declare type InjectToStream = (chunk: unknown, options?: {
declare type InjectToStreamOptions = {
flush?: boolean;
}) => void;
expectStreamEnd?: boolean;
};
declare type InjectToStream = (chunk: unknown, options?: InjectToStreamOptions) => boolean;
declare type StreamOperations = {

@@ -8,0 +10,0 @@ operations: null | {

@@ -10,8 +10,14 @@ export { createBuffer };

function injectToStream(chunk, options) {
assertUsage(state !== 'ENDED', `Cannot inject following chunk after stream has ended: \`${chunk}\``);
if (debug.isEnabled) {
debug('injectToStream()', String(chunk));
debug('injectToStream()', getChunkAsString(chunk));
}
if (state === 'ENDED') {
if (!(options === null || options === void 0 ? void 0 : options.expectStreamEnd)) {
assertUsage(state, `Cannot inject following chunk after stream has ended:\n${getChunkAsString(chunk)}`);
}
return false;
}
buffer.push({ chunk, flush: options === null || options === void 0 ? void 0 : options.flush });
flushBuffer();
return true;
}

@@ -48,3 +54,3 @@ function flushBuffer() {

if (debug.isEnabled) {
debug(`react write${!writePermission ? '' : ' (allowed)'}`, String(chunk));
debug(`react write${!writePermission ? '' : ' (allowed)'}`, getChunkAsString(chunk));
}

@@ -75,1 +81,9 @@ state = 'STREAMING';

}
function getChunkAsString(chunk) {
try {
return new TextDecoder().decode(chunk);
}
catch (err) {
return String(chunk);
}
}

@@ -10,3 +10,4 @@ export { createDebugger };

};
declare function createDebugger(namespace: string, optionsGlobal?: Options): ((msg: string, info?: unknown) => void) & {
declare type Namespace = 'react-streaming:createPipeWrapper' | 'react-streaming:buffer' | 'react-streaming:flow';
declare function createDebugger(namespace: Namespace, optionsGlobal?: Options): ((msg: string, info?: unknown) => void) & {
options: (options: Options) => (msg: string, info?: unknown) => void;

@@ -13,0 +14,0 @@ isEnabled: boolean;

export { projectInfo };
import { getGlobalObject } from './getGlobalObject';
const PROJECT_VERSION = '0.3.29';
const PROJECT_VERSION = '0.3.30';
const projectInfo = {

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

{
"name": "react-streaming",
"description": "React 18 Streaming. Full-fledged & Easy.",
"version": "0.3.29",
"version": "0.3.30",
"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