react-streaming
Advanced tools
Comparing version 0.3.31 to 0.3.32
@@ -33,2 +33,3 @@ export { renderToStream }; | ||
streamEnd: Promise<boolean>; | ||
hasStreamEnded: () => boolean; | ||
disabled: boolean; | ||
@@ -35,0 +36,0 @@ injectToStream: InjectToStream; |
@@ -6,3 +6,3 @@ export { createBuffer }; | ||
flush?: boolean; | ||
expectStreamEnd?: boolean; | ||
tolerateStreamEnded?: boolean; | ||
}; | ||
@@ -20,2 +20,3 @@ declare type InjectToStream = (chunk: unknown, options?: InjectToStreamOptions) => boolean; | ||
onBeforeEnd: () => void; | ||
hasStreamEnded: () => boolean; | ||
}; |
@@ -10,3 +10,3 @@ "use strict"; | ||
let writePermission = null; // Set to `null` because React fails to hydrate if something is injected before the first react write | ||
return { injectToStream, onBeforeWrite, onBeforeEnd }; | ||
return { injectToStream, onBeforeWrite, onBeforeEnd, hasStreamEnded }; | ||
function injectToStream(chunk, options) { | ||
@@ -16,4 +16,4 @@ if (debug.isEnabled) { | ||
} | ||
if (state === 'ENDED') { | ||
if (!(options === null || options === void 0 ? void 0 : options.expectStreamEnd)) { | ||
if (hasStreamEnded()) { | ||
if (!(options === null || options === void 0 ? void 0 : options.tolerateStreamEnded)) { | ||
(0, utils_1.assertUsage)(state, `Cannot inject following chunk after stream has ended:\n${getChunkAsString(chunk)}`); | ||
@@ -82,2 +82,5 @@ } | ||
} | ||
function hasStreamEnded() { | ||
return state === 'ENDED'; | ||
} | ||
} | ||
@@ -84,0 +87,0 @@ exports.createBuffer = createBuffer; |
@@ -13,2 +13,3 @@ /// <reference types="node" /> | ||
injectToStream: import("./createBuffer").InjectToStream; | ||
hasStreamEnded: () => boolean; | ||
}>; |
@@ -13,4 +13,4 @@ "use strict"; | ||
}; | ||
const { injectToStream, onBeforeWrite, onBeforeEnd } = (0, createBuffer_1.createBuffer)(streamOperations); | ||
return { pipeForUser, streamEnd, injectToStream }; | ||
const { injectToStream, onBeforeWrite, onBeforeEnd, hasStreamEnded } = (0, createBuffer_1.createBuffer)(streamOperations); | ||
return { pipeForUser, streamEnd, injectToStream, hasStreamEnded }; | ||
function createPipeForUser() { | ||
@@ -17,0 +17,0 @@ debug('createPipeForUser()'); |
@@ -8,2 +8,3 @@ export { createReadableWrapper }; | ||
injectToStream: import("./createBuffer").InjectToStream; | ||
hasStreamEnded: () => boolean; | ||
}; |
@@ -23,4 +23,4 @@ "use strict"; | ||
}); | ||
const { injectToStream, onBeforeWrite, onBeforeEnd } = (0, createBuffer_1.createBuffer)(streamOperations); | ||
return { readableForUser, streamEnd, injectToStream }; | ||
const { injectToStream, onBeforeWrite, onBeforeEnd, hasStreamEnded } = (0, createBuffer_1.createBuffer)(streamOperations); | ||
return { readableForUser, streamEnd, injectToStream, hasStreamEnded }; | ||
async function onReady(onEnded) { | ||
@@ -27,0 +27,0 @@ streamOperations.operations = { |
@@ -18,2 +18,3 @@ export { renderToNodeStream }; | ||
injectToStream: import("./createBuffer").InjectToStream; | ||
hasStreamEnded: () => boolean; | ||
}>; |
@@ -50,3 +50,3 @@ "use strict"; | ||
let promiseResolved = false; | ||
const { pipeForUser, injectToStream, streamEnd } = await (0, createPipeWrapper_1.createPipeWrapper)(pipeOriginal, { | ||
const { pipeForUser, injectToStream, streamEnd, hasStreamEnded } = await (0, createPipeWrapper_1.createPipeWrapper)(pipeOriginal, { | ||
stopTimeout, | ||
@@ -78,4 +78,5 @@ onReactBug(err) { | ||
injectToStream, | ||
hasStreamEnded, | ||
}; | ||
} | ||
exports.renderToNodeStream = renderToNodeStream; |
@@ -21,2 +21,3 @@ export { renderToWebStream }; | ||
injectToStream: import("./createBuffer").InjectToStream; | ||
hasStreamEnded: () => boolean; | ||
}>; |
@@ -52,3 +52,5 @@ "use strict"; | ||
throw firstErr; | ||
const { readableForUser, streamEnd, injectToStream } = (0, createReadableWrapper_1.createReadableWrapper)(readableOriginal, { stopTimeout }); | ||
const { readableForUser, streamEnd, injectToStream, hasStreamEnded } = (0, createReadableWrapper_1.createReadableWrapper)(readableOriginal, { | ||
stopTimeout, | ||
}); | ||
promiseResolved = true; | ||
@@ -61,4 +63,5 @@ return { | ||
injectToStream, | ||
hasStreamEnded, | ||
}; | ||
} | ||
exports.renderToWebStream = renderToWebStream; |
@@ -5,3 +5,3 @@ "use strict"; | ||
const getGlobalObject_1 = require("./getGlobalObject"); | ||
const PROJECT_VERSION = '0.3.31'; | ||
const PROJECT_VERSION = '0.3.32'; | ||
const projectInfo = { | ||
@@ -8,0 +8,0 @@ projectName: 'react-streaming', |
@@ -33,2 +33,3 @@ export { renderToStream }; | ||
streamEnd: Promise<boolean>; | ||
hasStreamEnded: () => boolean; | ||
disabled: boolean; | ||
@@ -35,0 +36,0 @@ injectToStream: InjectToStream; |
@@ -6,3 +6,3 @@ export { createBuffer }; | ||
flush?: boolean; | ||
expectStreamEnd?: boolean; | ||
tolerateStreamEnded?: boolean; | ||
}; | ||
@@ -20,2 +20,3 @@ declare type InjectToStream = (chunk: unknown, options?: InjectToStreamOptions) => boolean; | ||
onBeforeEnd: () => void; | ||
hasStreamEnded: () => boolean; | ||
}; |
@@ -8,3 +8,3 @@ export { createBuffer }; | ||
let writePermission = null; // Set to `null` because React fails to hydrate if something is injected before the first react write | ||
return { injectToStream, onBeforeWrite, onBeforeEnd }; | ||
return { injectToStream, onBeforeWrite, onBeforeEnd, hasStreamEnded }; | ||
function injectToStream(chunk, options) { | ||
@@ -14,4 +14,4 @@ if (debug.isEnabled) { | ||
} | ||
if (state === 'ENDED') { | ||
if (!(options === null || options === void 0 ? void 0 : options.expectStreamEnd)) { | ||
if (hasStreamEnded()) { | ||
if (!(options === null || options === void 0 ? void 0 : options.tolerateStreamEnded)) { | ||
assertUsage(state, `Cannot inject following chunk after stream has ended:\n${getChunkAsString(chunk)}`); | ||
@@ -80,2 +80,5 @@ } | ||
} | ||
function hasStreamEnded() { | ||
return state === 'ENDED'; | ||
} | ||
} | ||
@@ -82,0 +85,0 @@ function getChunkAsString(chunk) { |
@@ -13,2 +13,3 @@ /// <reference types="node" /> | ||
injectToStream: import("./createBuffer").InjectToStream; | ||
hasStreamEnded: () => boolean; | ||
}>; |
@@ -11,4 +11,4 @@ export { createPipeWrapper }; | ||
}; | ||
const { injectToStream, onBeforeWrite, onBeforeEnd } = createBuffer(streamOperations); | ||
return { pipeForUser, streamEnd, injectToStream }; | ||
const { injectToStream, onBeforeWrite, onBeforeEnd, hasStreamEnded } = createBuffer(streamOperations); | ||
return { pipeForUser, streamEnd, injectToStream, hasStreamEnded }; | ||
function createPipeForUser() { | ||
@@ -15,0 +15,0 @@ debug('createPipeForUser()'); |
@@ -8,2 +8,3 @@ export { createReadableWrapper }; | ||
injectToStream: import("./createBuffer").InjectToStream; | ||
hasStreamEnded: () => boolean; | ||
}; |
@@ -21,4 +21,4 @@ export { createReadableWrapper }; | ||
}); | ||
const { injectToStream, onBeforeWrite, onBeforeEnd } = createBuffer(streamOperations); | ||
return { readableForUser, streamEnd, injectToStream }; | ||
const { injectToStream, onBeforeWrite, onBeforeEnd, hasStreamEnded } = createBuffer(streamOperations); | ||
return { readableForUser, streamEnd, injectToStream, hasStreamEnded }; | ||
async function onReady(onEnded) { | ||
@@ -25,0 +25,0 @@ streamOperations.operations = { |
@@ -18,2 +18,3 @@ export { renderToNodeStream }; | ||
injectToStream: import("./createBuffer").InjectToStream; | ||
hasStreamEnded: () => boolean; | ||
}>; |
@@ -53,3 +53,3 @@ export { renderToNodeStream }; | ||
let promiseResolved = false; | ||
const { pipeForUser, injectToStream, streamEnd } = await createPipeWrapper(pipeOriginal, { | ||
const { pipeForUser, injectToStream, streamEnd, hasStreamEnded } = await createPipeWrapper(pipeOriginal, { | ||
stopTimeout, | ||
@@ -81,3 +81,4 @@ onReactBug(err) { | ||
injectToStream, | ||
hasStreamEnded, | ||
}; | ||
} |
@@ -21,2 +21,3 @@ export { renderToWebStream }; | ||
injectToStream: import("./createBuffer").InjectToStream; | ||
hasStreamEnded: () => boolean; | ||
}>; |
@@ -54,3 +54,5 @@ export { renderToWebStream }; | ||
throw firstErr; | ||
const { readableForUser, streamEnd, injectToStream } = createReadableWrapper(readableOriginal, { stopTimeout }); | ||
const { readableForUser, streamEnd, injectToStream, hasStreamEnded } = createReadableWrapper(readableOriginal, { | ||
stopTimeout, | ||
}); | ||
promiseResolved = true; | ||
@@ -63,3 +65,4 @@ return { | ||
injectToStream, | ||
hasStreamEnded, | ||
}; | ||
} |
export { projectInfo }; | ||
import { getGlobalObject } from './getGlobalObject'; | ||
const PROJECT_VERSION = '0.3.31'; | ||
const PROJECT_VERSION = '0.3.32'; | ||
const projectInfo = { | ||
@@ -5,0 +5,0 @@ projectName: 'react-streaming', |
{ | ||
"name": "react-streaming", | ||
"description": "React 18 Streaming. Full-fledged & Easy.", | ||
"version": "0.3.31", | ||
"version": "0.3.32", | ||
"peerDependencies": { | ||
@@ -6,0 +6,0 @@ "react": ">=18", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143994
3065