react-streaming
Advanced tools
Comparing version 0.1.7 to 0.1.8
export { renderToStream }; | ||
import React from 'react'; | ||
import { renderToReadableStream } from 'react-dom/server'; | ||
import { renderToPipeableStream, renderToReadableStream } from 'react-dom/server'; | ||
import { Pipe } from './renderToStream/createPipeWrapper'; | ||
@@ -13,2 +13,3 @@ import { SeoStrategy } from './renderToStream/resolveSeoStrategy'; | ||
renderToReadableStream?: typeof renderToReadableStream; | ||
renderToPipeableStream?: typeof renderToPipeableStream; | ||
}; | ||
@@ -15,0 +16,0 @@ declare type Result = { |
@@ -37,2 +37,3 @@ "use strict"; | ||
async function renderToNodeStream(element, disabled, options) { | ||
var _a; | ||
let resolve; | ||
@@ -49,3 +50,5 @@ const promise = new Promise((r) => { | ||
}; | ||
const { pipe: pipeOriginal } = (0, server_1.renderToPipeableStream)(element, { | ||
const renderToPipeableStream_ = (_a = options.renderToPipeableStream) !== null && _a !== void 0 ? _a : server_1.renderToPipeableStream; | ||
assertReactImport(renderToPipeableStream_, 'renderToPipeableStream'); | ||
const { pipe: pipeOriginal } = renderToPipeableStream_(element, { | ||
onAllReady() { | ||
@@ -84,3 +87,5 @@ resolve(); | ||
}; | ||
const readableOriginal = await ((_a = options.renderToReadableStream) !== null && _a !== void 0 ? _a : server_1.renderToReadableStream)(element, { onError }); | ||
const renderToReadableStream_ = (_a = options.renderToReadableStream) !== null && _a !== void 0 ? _a : server_1.renderToReadableStream; | ||
assertReactImport(renderToReadableStream_, 'renderToReadableStream'); | ||
const readableOriginal = await renderToReadableStream_(element, { onError }); | ||
if (didError) { | ||
@@ -107,1 +112,9 @@ throw firstErr; | ||
} | ||
function assertReactImport(fn, fnName) { | ||
(0, utils_1.assertUsage)(fn, [ | ||
'Your environment seems broken.', | ||
`(Could not import \`${fnName}\` from \`react-dom/server\`).`, | ||
'Create a new GitHub issue at https://github.com/brillout/react-streaming to discuss a solution.' | ||
].join(' ')); | ||
(0, utils_1.assert)(typeof fn === 'function'); | ||
} |
export { renderToStream }; | ||
import React from 'react'; | ||
import { renderToReadableStream } from 'react-dom/server'; | ||
import { renderToPipeableStream, renderToReadableStream } from 'react-dom/server'; | ||
import { Pipe } from './renderToStream/createPipeWrapper'; | ||
@@ -13,2 +13,3 @@ import { SeoStrategy } from './renderToStream/resolveSeoStrategy'; | ||
renderToReadableStream?: typeof renderToReadableStream; | ||
renderToPipeableStream?: typeof renderToPipeableStream; | ||
}; | ||
@@ -15,0 +16,0 @@ declare type Result = { |
@@ -31,2 +31,3 @@ export { renderToStream }; | ||
async function renderToNodeStream(element, disabled, options) { | ||
var _a; | ||
let resolve; | ||
@@ -43,3 +44,5 @@ const promise = new Promise((r) => { | ||
}; | ||
const { pipe: pipeOriginal } = renderToPipeableStream(element, { | ||
const renderToPipeableStream_ = (_a = options.renderToPipeableStream) !== null && _a !== void 0 ? _a : renderToPipeableStream; | ||
assertReactImport(renderToPipeableStream_, 'renderToPipeableStream'); | ||
const { pipe: pipeOriginal } = renderToPipeableStream_(element, { | ||
onAllReady() { | ||
@@ -78,3 +81,5 @@ resolve(); | ||
}; | ||
const readableOriginal = await ((_a = options.renderToReadableStream) !== null && _a !== void 0 ? _a : renderToReadableStream)(element, { onError }); | ||
const renderToReadableStream_ = (_a = options.renderToReadableStream) !== null && _a !== void 0 ? _a : renderToReadableStream; | ||
assertReactImport(renderToReadableStream_, 'renderToReadableStream'); | ||
const readableOriginal = await renderToReadableStream_(element, { onError }); | ||
if (didError) { | ||
@@ -101,1 +106,9 @@ throw firstErr; | ||
} | ||
function assertReactImport(fn, fnName) { | ||
assertUsage(fn, [ | ||
'Your environment seems broken.', | ||
`(Could not import \`${fnName}\` from \`react-dom/server\`).`, | ||
'Create a new GitHub issue at https://github.com/brillout/react-streaming to discuss a solution.' | ||
].join(' ')); | ||
assert(typeof fn === 'function'); | ||
} |
{ | ||
"name": "react-streaming", | ||
"description": "React 18 Streaming. Full-fledged & Easy.", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"main": "./dist/cjs/index.js", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
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
57519
1213