Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@garfish/bridge-react-v18

Package Overview
Dependencies
Maintainers
8
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@garfish/bridge-react-v18 - npm Package Compare versions

Comparing version 1.6.0-beta-20220526030938.0 to 1.6.0

10

dist/esm/index.js

@@ -29,3 +29,2 @@ var __defProp = Object.defineProperty;

errorBoundary: null,
errorBoundaryClass: null,
el: null,

@@ -105,3 +104,3 @@ canUpdate: true,

if (React2 && typeof React2.version === "string" && React2.version.indexOf(".") >= 0) {
const majorVersionString = React2.version.slice(0, React2.version.indexOf("."));
const majorVersionString = React2.version.split(".")[0];
try {

@@ -131,5 +130,4 @@ return Number(majorVersionString) >= 18;

let elementToRender = rootComponentElement;
if (opts.errorBoundary || opts.errorBoundaryClass) {
opts.errorBoundaryClass = opts.errorBoundaryClass || opts.errorBoundaryClass || createErrorBoundary(opts);
elementToRender = opts.React.createElement(opts.errorBoundaryClass, appInfo, elementToRender);
if (opts.errorBoundary) {
elementToRender = opts.React.createElement(createErrorBoundary(opts), appInfo, elementToRender);
}

@@ -151,3 +149,3 @@ return elementToRender;

const errorBoundary = opts.errorBoundary;
return errorBoundary(this.state.caughtError, this.state.caughtErrorInfo, this.props);
return errorBoundary(this.state.caughtError, this.props);
} else {

@@ -154,0 +152,0 @@ return this.props.children;

18

dist/index.d.ts
import * as React from 'react';
import { createRoot, hydrateRoot, Root } from 'react-dom/client';
type AppInfo = {
type PropsInfo = {
appName: string;

@@ -12,3 +12,3 @@ dom: Element | ShadowRoot | Document;

type LoadRootComponent<T> = (opts: AppInfo) => Promise<T>;
type LoadRootComponent<T> = (opts: PropsInfo) => Promise<T>;

@@ -26,4 +26,3 @@ type TypeComponent<T> =

type ErrorBoundary<T> = (
caughtError: boolean,
info: string,
caughtError: Error | any,
props: any,

@@ -47,5 +46,2 @@ ) => T | null;

renderType: RenderTypes | (() => RenderTypes);
errorBoundaryClass:
| HTMLElement
| { (this: any, props: any): void; prototype: any };
el: string;

@@ -61,3 +57,3 @@ canUpdate: boolean; // by default, allow parcels created with garfish-react-bridge to be updated

declare type Options = UserOptions<typeof React, typeof createRoot, typeof hydrateRoot, Root, React.ComponentType, React.ReactNode>;
declare type Options = UserOptions<typeof React, typeof createRoot, typeof hydrateRoot, Root, any, React.ReactNode>;
declare global {

@@ -69,6 +65,6 @@ interface Window {

declare function reactBridge(this: any, userOpts: Options): (this: any, appInfo: any, props: any) => Promise<{
render: (appInfo: AppInfo) => any;
destroy: (appInfo: AppInfo) => any;
render: (appInfo: PropsInfo) => any;
destroy: (appInfo: PropsInfo) => any;
}>;
export { AppInfo, reactBridge };
export { PropsInfo, reactBridge };

@@ -55,3 +55,2 @@ var __create = Object.create;

errorBoundary: null,
errorBoundaryClass: null,
el: null,

@@ -131,3 +130,3 @@ canUpdate: true,

if (React2 && typeof React2.version === "string" && React2.version.indexOf(".") >= 0) {
const majorVersionString = React2.version.slice(0, React2.version.indexOf("."));
const majorVersionString = React2.version.split(".")[0];
try {

@@ -157,5 +156,4 @@ return Number(majorVersionString) >= 18;

let elementToRender = rootComponentElement;
if (opts.errorBoundary || opts.errorBoundaryClass) {
opts.errorBoundaryClass = opts.errorBoundaryClass || opts.errorBoundaryClass || createErrorBoundary(opts);
elementToRender = opts.React.createElement(opts.errorBoundaryClass, appInfo, elementToRender);
if (opts.errorBoundary) {
elementToRender = opts.React.createElement(createErrorBoundary(opts), appInfo, elementToRender);
}

@@ -177,3 +175,3 @@ return elementToRender;

const errorBoundary = opts.errorBoundary;
return errorBoundary(this.state.caughtError, this.state.caughtErrorInfo, this.props);
return errorBoundary(this.state.caughtError, this.props);
} else {

@@ -180,0 +178,0 @@ return this.props.children;

{
"name": "@garfish/bridge-react-v18",
"version": "1.6.0-beta-20220526030938.0",
"version": "1.6.0",
"description": "garfish module.",

@@ -49,3 +49,3 @@ "keywords": [

},
"readme": "# `@garfish/bridge`\n\n[![NPM version](https://img.shields.io/npm/v/@garfish/bridge.svg?style=flat-square)](https://www.npmjs.com/package/@garfish/bridge)\n\n## Usage\n\n```jsx\n// child app\nimport { reactBridge } from '@garfish/bridge-react-v18';\n\nfunction App() {\n return <div>content</div>;\n}\n\nreactBridge({\n el: '#root',\n rootComponent: App,\n});\n```\n"
"readme": "# `@garfish/bridge`\n\n[![NPM version](https://img.shields.io/npm/v/@garfish/bridge.svg?style=flat-square)](https://www.npmjs.com/package/@garfish/bridge)\n\n## Usage\n\n```jsx\n// child app\nimport { reactBridge } from '@garfish/bridge-react-v18';\n\nfunction App() {\n return <div>content</div>;\n}\n\nexport const provider = reactBridge({\n el: '#root',\n rootComponent: App,\n});\n```\n"
}

@@ -15,3 +15,3 @@ # `@garfish/bridge`

reactBridge({
export const provider = reactBridge({
el: '#root',

@@ -18,0 +18,0 @@ rootComponent: App,

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