react-streaming
Advanced tools
Comparing version 0.3.10 to 0.3.11-commit-4b29944
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.useStream = exports.useAsync = void 0; | ||
// We don't import from ./utils.ts because utils/debug.js contains a !isBrowser() assertion | ||
const assert_1 = require("../utils/assert"); | ||
const isBrowser_1 = require("../utils/isBrowser"); | ||
(0, assert_1.assertUsage)(!(0, isBrowser_1.isBrowser)(), 'node_modules/react-streaming/dist/{esm,cjs}/server/hooks.js loaded in browser'); | ||
var useAsync_1 = require("./useAsync"); | ||
@@ -5,0 +9,0 @@ Object.defineProperty(exports, "useAsync", { enumerable: true, get: function () { return useAsync_1.useAsync; } }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.disable = exports.renderToStream = void 0; | ||
// We don't import from ./utils.ts because utils/debug.js contains a !isBrowser() assertion | ||
const assert_1 = require("../utils/assert"); | ||
const isBrowser_1 = require("../utils/isBrowser"); | ||
(0, assert_1.assertUsage)(!(0, isBrowser_1.isBrowser)(), 'node_modules/react-streaming/dist/{esm,cjs}/server/index.js loaded in browser'); | ||
var renderToStream_1 = require("./renderToStream"); | ||
Object.defineProperty(exports, "renderToStream", { enumerable: true, get: function () { return renderToStream_1.renderToStream; } }); | ||
Object.defineProperty(exports, "disable", { enumerable: true, get: function () { return renderToStream_1.disable; } }); |
@@ -27,3 +27,9 @@ "use strict"; | ||
onBeforeWrite(chunk); | ||
writableFromUser.write(chunk, encoding, callback); | ||
if (!writableFromUser.destroyed) { | ||
writableFromUser.write(chunk, encoding, callback); | ||
} | ||
else { | ||
// Destroying twice is fine: https://github.com/brillout/react-streaming/pull/21#issuecomment-1554517163 | ||
writableForReact.destroy(); | ||
} | ||
}, | ||
@@ -30,0 +36,0 @@ final(callback) { |
@@ -5,1 +5,2 @@ export * from '../utils/assert'; | ||
export * from '../utils/isPromise'; | ||
export * from '../utils/isBrowser'; |
@@ -21,1 +21,2 @@ "use strict"; | ||
__exportStar(require("../utils/isPromise"), exports); | ||
__exportStar(require("../utils/isBrowser"), exports); |
@@ -9,4 +9,4 @@ "use strict"; | ||
// Ensure that this is never loaded in the browser. (In order to avoid this file to be included in the client-side bundle.) | ||
// For isomorphic code: instead of `import { createDebugger } from './utils'`, use `globalThis.createDebugger()`. | ||
(0, assert_1.assert)(!(0, isBrowser_1.isBrowser)()); | ||
// For isomorphic code: use `globalThis.createDebugger()` instead of `import { createDebugger } from './utils'`. | ||
(0, assert_1.assert)(!(0, isBrowser_1.isBrowser)(), 'utils/debug.js loaded in browser'); | ||
globalThis.__brillout_debug_createDebugger = createDebugger; | ||
@@ -13,0 +13,0 @@ function createDebugger(namespace, optionsGlobal) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.projectInfo = void 0; | ||
const PROJECT_VERSION = '0.3.10'; | ||
const PROJECT_VERSION = '0.3.11-commit-4b29944'; | ||
exports.projectInfo = { | ||
@@ -6,0 +6,0 @@ projectName: 'react-streaming', |
@@ -0,2 +1,6 @@ | ||
// We don't import from ./utils.ts because utils/debug.js contains a !isBrowser() assertion | ||
import { assertUsage } from '../utils/assert'; | ||
import { isBrowser } from '../utils/isBrowser'; | ||
assertUsage(!isBrowser(), 'node_modules/react-streaming/dist/{esm,cjs}/server/hooks.js loaded in browser'); | ||
export { useAsync } from './useAsync'; | ||
export { useStream } from './useStream'; |
@@ -0,1 +1,5 @@ | ||
// We don't import from ./utils.ts because utils/debug.js contains a !isBrowser() assertion | ||
import { assertUsage } from '../utils/assert'; | ||
import { isBrowser } from '../utils/isBrowser'; | ||
assertUsage(!isBrowser(), 'node_modules/react-streaming/dist/{esm,cjs}/server/index.js loaded in browser'); | ||
export { renderToStream, disable } from './renderToStream'; |
@@ -25,3 +25,9 @@ export { createPipeWrapper }; | ||
onBeforeWrite(chunk); | ||
writableFromUser.write(chunk, encoding, callback); | ||
if (!writableFromUser.destroyed) { | ||
writableFromUser.write(chunk, encoding, callback); | ||
} | ||
else { | ||
// Destroying twice is fine: https://github.com/brillout/react-streaming/pull/21#issuecomment-1554517163 | ||
writableForReact.destroy(); | ||
} | ||
}, | ||
@@ -28,0 +34,0 @@ final(callback) { |
@@ -5,1 +5,2 @@ export * from '../utils/assert'; | ||
export * from '../utils/isPromise'; | ||
export * from '../utils/isBrowser'; |
@@ -5,1 +5,2 @@ export * from '../utils/assert'; | ||
export * from '../utils/isPromise'; | ||
export * from '../utils/isBrowser'; |
@@ -8,4 +8,4 @@ export { createDebugger }; | ||
// Ensure that this is never loaded in the browser. (In order to avoid this file to be included in the client-side bundle.) | ||
// For isomorphic code: instead of `import { createDebugger } from './utils'`, use `globalThis.createDebugger()`. | ||
assert(!isBrowser()); | ||
// For isomorphic code: use `globalThis.createDebugger()` instead of `import { createDebugger } from './utils'`. | ||
assert(!isBrowser(), 'utils/debug.js loaded in browser'); | ||
globalThis.__brillout_debug_createDebugger = createDebugger; | ||
@@ -12,0 +12,0 @@ function createDebugger(namespace, optionsGlobal) { |
@@ -1,2 +0,2 @@ | ||
const PROJECT_VERSION = '0.3.10'; | ||
const PROJECT_VERSION = '0.3.11-commit-4b29944'; | ||
export const projectInfo = { | ||
@@ -3,0 +3,0 @@ projectName: 'react-streaming', |
{ | ||
"name": "react-streaming", | ||
"description": "React 18 Streaming. Full-fledged & Easy.", | ||
"version": "0.3.10", | ||
"version": "0.3.11-commit-4b29944", | ||
"main": "./dist/cjs/server/hooks.js", | ||
@@ -28,3 +28,4 @@ "peerDependencies": { | ||
"// === Release ===": "", | ||
"release": "release-me patch" | ||
"release": "release-me patch", | ||
"release:commit": "release-me commit" | ||
}, | ||
@@ -46,3 +47,3 @@ "exports": { | ||
"@brillout/part-regex": "^0.1.2", | ||
"@brillout/release-me": "^0.0.7", | ||
"@brillout/release-me": "^0.1.6", | ||
"@types/node": "^15.12.2", | ||
@@ -49,0 +50,0 @@ "@types/react": "^18.0.9", |
@@ -33,3 +33,3 @@ <p align="center"> | ||
Features (for React users): | ||
**Features (for React users)** | ||
@@ -42,3 +42,3 @@ - Unlocks `<Suspense>` for SSR apps. | ||
Features (for library authors): | ||
**Features (for library authors)** | ||
@@ -48,3 +48,3 @@ - `useAsync()`: add data fetching capabilities to your library. High-level and easy to use. | ||
Easy: | ||
**Easy** | ||
@@ -51,0 +51,0 @@ ```jsx |
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
119466
2640