Socket
Socket
Sign inDemoInstall

react-streaming

Package Overview
Dependencies
Maintainers
1
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.18 to 0.3.19

7

dist/cjs/server/useStream.js

@@ -32,10 +32,9 @@ "use strict";

});
const { StreamContext } = globalObject;
const StreamProvider = StreamContext.Provider;
const StreamProvider = globalObject.StreamContext.Provider;
exports.StreamProvider = StreamProvider;
function useStream() {
const streamUtils = (0, react_1.useContext)(StreamContext);
(0, utils_1.assert)(streamUtils);
const streamUtils = (0, react_1.useContext)(globalObject.StreamContext);
(0, utils_1.assertUsage)(streamUtils, `react-streaming isn't installed`);
return streamUtils;
}
exports.useStream = useStream;
export declare function getGlobalObject<T extends Record<string, unknown> = never>(key: `${string}.ts`, defaultValue: T): T;
declare global {
var __react_streaming: undefined | Record<string, Record<string, unknown>>;
}

@@ -5,8 +5,10 @@ "use strict";

function getGlobalObject(
// We use the filename as key; each `getGlobalObject()` call should live in a unique filename.
// We use the filename as key; each `getGlobalObject()` call should live inside a file with a unique filename.
key, defaultValue) {
const allGlobalObjects = (globalThis.__react_streaming = globalThis.__react_streaming || {});
const globalObject = (allGlobalObjects[key] = allGlobalObjects[key] || defaultValue);
// @ts-ignore
const globalObjectsAll = (globalThis[projectKey] = globalThis[projectKey] || {});
const globalObject = (globalObjectsAll[key] = globalObjectsAll[key] || defaultValue);
return globalObject;
}
exports.getGlobalObject = getGlobalObject;
const projectKey = '_react_streaming';

@@ -1,2 +0,3 @@

export declare const projectInfo: {
export { projectInfo };
declare const projectInfo: {
projectName: "react-streaming";

@@ -7,4 +8,1 @@ projectVersion: string;

};
declare global {
var __vite_plugin_ssr__instances: undefined | string[];
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.projectInfo = void 0;
const PROJECT_VERSION = '0.3.18';
exports.projectInfo = {
const getGlobalObject_1 = require("./getGlobalObject");
const PROJECT_VERSION = '0.3.19';
const projectInfo = {
projectName: 'react-streaming',

@@ -11,4 +12,12 @@ projectVersion: PROJECT_VERSION,

};
// Trick: since `utils/asserts.ts` depends on this file (`utils/projectInfo.ts`), we can have confidence that this file is always instantiated. So that we don't have to initialize this code snippet at every possible entry. (There are a *lot* of entries: `client/router/`, `client/`, `node/`, `node/plugin/`, `node/cli`, etc.)
globalThis.__vite_plugin_ssr__instances = globalThis.__vite_plugin_ssr__instances || [];
globalThis.__vite_plugin_ssr__instances.push(exports.projectInfo.projectVersion);
exports.projectInfo = projectInfo;
const { versions } = (0, getGlobalObject_1.getGlobalObject)('projectInfo.ts', {
versions: new Set()
});
versions.add(projectInfo.projectVersion);
if (versions.size >= 2) {
const versionsStr = Array.from(versions)
.map((v) => `${projectInfo.projectName}@${v}`)
.join('and');
throw new Error(`Using different versions is forbidden, but ${versionsStr} are loaded. Make sure only one version is loaded.`);
}
export { useStream };
export { StreamProvider };
import React, { useContext } from 'react';
import { assert, getGlobalObject } from './utils';
import { assertUsage, getGlobalObject } from './utils';
const globalObject = getGlobalObject('useStream.ts', {
StreamContext: React.createContext(null)
});
const { StreamContext } = globalObject;
const StreamProvider = StreamContext.Provider;
const StreamProvider = globalObject.StreamContext.Provider;
function useStream() {
const streamUtils = useContext(StreamContext);
assert(streamUtils);
const streamUtils = useContext(globalObject.StreamContext);
assertUsage(streamUtils, `react-streaming isn't installed`);
return streamUtils;
}
export declare function getGlobalObject<T extends Record<string, unknown> = never>(key: `${string}.ts`, defaultValue: T): T;
declare global {
var __react_streaming: undefined | Record<string, Record<string, unknown>>;
}
export function getGlobalObject(
// We use the filename as key; each `getGlobalObject()` call should live in a unique filename.
// We use the filename as key; each `getGlobalObject()` call should live inside a file with a unique filename.
key, defaultValue) {
const allGlobalObjects = (globalThis.__react_streaming = globalThis.__react_streaming || {});
const globalObject = (allGlobalObjects[key] = allGlobalObjects[key] || defaultValue);
// @ts-ignore
const globalObjectsAll = (globalThis[projectKey] = globalThis[projectKey] || {});
const globalObject = (globalObjectsAll[key] = globalObjectsAll[key] || defaultValue);
return globalObject;
}
const projectKey = '_react_streaming';

@@ -1,2 +0,3 @@

export declare const projectInfo: {
export { projectInfo };
declare const projectInfo: {
projectName: "react-streaming";

@@ -7,4 +8,1 @@ projectVersion: string;

};
declare global {
var __vite_plugin_ssr__instances: undefined | string[];
}

@@ -1,3 +0,5 @@

const PROJECT_VERSION = '0.3.18';
export const projectInfo = {
export { projectInfo };
import { getGlobalObject } from './getGlobalObject';
const PROJECT_VERSION = '0.3.19';
const projectInfo = {
projectName: 'react-streaming',

@@ -8,4 +10,11 @@ projectVersion: PROJECT_VERSION,

};
// Trick: since `utils/asserts.ts` depends on this file (`utils/projectInfo.ts`), we can have confidence that this file is always instantiated. So that we don't have to initialize this code snippet at every possible entry. (There are a *lot* of entries: `client/router/`, `client/`, `node/`, `node/plugin/`, `node/cli`, etc.)
globalThis.__vite_plugin_ssr__instances = globalThis.__vite_plugin_ssr__instances || [];
globalThis.__vite_plugin_ssr__instances.push(projectInfo.projectVersion);
const { versions } = getGlobalObject('projectInfo.ts', {
versions: new Set()
});
versions.add(projectInfo.projectVersion);
if (versions.size >= 2) {
const versionsStr = Array.from(versions)
.map((v) => `${projectInfo.projectName}@${v}`)
.join('and');
throw new Error(`Using different versions is forbidden, but ${versionsStr} are loaded. Make sure only one version is loaded.`);
}
{
"name": "react-streaming",
"description": "React 18 Streaming. Full-fledged & Easy.",
"version": "0.3.18",
"version": "0.3.19",
"main": "./dist/cjs/server/hooks.js",

@@ -6,0 +6,0 @@ "peerDependencies": {

@@ -70,3 +70,3 @@ <p align="center">

> `react-streaming` makes it easy to build the libraries of tomorrow, for example:
> - Use [Telefunc](https://telefunc.com/) to easily fetch data for your Next.js app or your Vite + [`vite-plugin-ssr`](https://vite-plugin-ssr.com/) app. (Replacing Next.js's `getServerSideProps()` and `vite-plugin-ssr`'s `onBeforeRender()`.)
> - Use [Telefunc](https://telefunc.com) to fetch data for your Next.js or [Vike](https://vike.dev) app. (Instead of Next.js's `getServerSideProps()` / `Vike`'s `data()`.)
> - Better GraphQL tools, e.g. [Vilay](https://github.com/XiNiHa/vilay).

@@ -73,0 +73,0 @@

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