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.7.2 to 1.8.0

40

dist/esm/index.js

@@ -26,7 +26,7 @@ var __defProp = Object.defineProperty;

var defaultOpts = {
rootComponent: null,
loadRootComponent: null,
renderType: null,
errorBoundary: null,
el: null,
rootComponent: void 0,
loadRootComponent: void 0,
renderType: void 0,
errorBoundary: void 0,
el: void 0,
canUpdate: true,

@@ -94,10 +94,16 @@ suppressComponentDidCatchWarning: false,

});
opts.domElements[appInfo.appName] = domElement;
opts.renderResults[appInfo.appName] = renderResult;
if (opts.domElements) {
opts.domElements[appInfo.appName] = domElement;
}
if (opts.renderResults) {
opts.renderResults[appInfo.appName] = renderResult;
}
}
function unmount(opts, appInfo) {
const root = opts.renderResults[appInfo.appName];
root.unmount();
delete opts.domElements[appInfo.appName];
delete opts.renderResults[appInfo.appName];
if (opts.renderResults) {
const root = opts.renderResults[appInfo.appName];
root.unmount();
opts.domElements && delete opts.domElements[appInfo.appName];
delete opts.renderResults[appInfo.appName];
}
}

@@ -129,6 +135,7 @@ function atLeastReact18(React2) {

function getElementToRender(opts, appInfo) {
const rootComponentElement = opts.React.createElement(opts.rootComponent, appInfo);
var _a, _b;
const rootComponentElement = (_a = opts.React) == null ? void 0 : _a.createElement(opts.rootComponent, appInfo);
let elementToRender = rootComponentElement;
if (opts.errorBoundary) {
elementToRender = opts.React.createElement(createErrorBoundary(opts), appInfo, elementToRender);
elementToRender = (_b = opts.React) == null ? void 0 : _b.createElement(createErrorBoundary(opts), appInfo, elementToRender);
}

@@ -139,3 +146,4 @@ return elementToRender;

function GarfishSubAppReactErrorBoundary(appInfo) {
opts.React.Component.apply(this, arguments);
var _a;
(_a = opts.React) == null ? void 0 : _a.Component.apply(this, arguments);
this.state = {

@@ -147,7 +155,7 @@ caughtError: null,

}
GarfishSubAppReactErrorBoundary.prototype = Object.create(opts.React.Component.prototype);
GarfishSubAppReactErrorBoundary.prototype = opts.React && Object.create(opts.React.Component.prototype);
GarfishSubAppReactErrorBoundary.prototype.render = function() {
if (this.state.caughtError) {
const errorBoundary = opts.errorBoundary;
return errorBoundary(this.state.caughtError, this.props);
return errorBoundary && errorBoundary(this.state.caughtError, this.props);
} else {

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

@@ -52,7 +52,7 @@ var __create = Object.create;

var defaultOpts = {
rootComponent: null,
loadRootComponent: null,
renderType: null,
errorBoundary: null,
el: null,
rootComponent: void 0,
loadRootComponent: void 0,
renderType: void 0,
errorBoundary: void 0,
el: void 0,
canUpdate: true,

@@ -120,10 +120,16 @@ suppressComponentDidCatchWarning: false,

});
opts.domElements[appInfo.appName] = domElement;
opts.renderResults[appInfo.appName] = renderResult;
if (opts.domElements) {
opts.domElements[appInfo.appName] = domElement;
}
if (opts.renderResults) {
opts.renderResults[appInfo.appName] = renderResult;
}
}
function unmount(opts, appInfo) {
const root = opts.renderResults[appInfo.appName];
root.unmount();
delete opts.domElements[appInfo.appName];
delete opts.renderResults[appInfo.appName];
if (opts.renderResults) {
const root = opts.renderResults[appInfo.appName];
root.unmount();
opts.domElements && delete opts.domElements[appInfo.appName];
delete opts.renderResults[appInfo.appName];
}
}

@@ -155,6 +161,7 @@ function atLeastReact18(React2) {

function getElementToRender(opts, appInfo) {
const rootComponentElement = opts.React.createElement(opts.rootComponent, appInfo);
var _a, _b;
const rootComponentElement = (_a = opts.React) == null ? void 0 : _a.createElement(opts.rootComponent, appInfo);
let elementToRender = rootComponentElement;
if (opts.errorBoundary) {
elementToRender = opts.React.createElement(createErrorBoundary(opts), appInfo, elementToRender);
elementToRender = (_b = opts.React) == null ? void 0 : _b.createElement(createErrorBoundary(opts), appInfo, elementToRender);
}

@@ -165,3 +172,4 @@ return elementToRender;

function GarfishSubAppReactErrorBoundary(appInfo) {
opts.React.Component.apply(this, arguments);
var _a;
(_a = opts.React) == null ? void 0 : _a.Component.apply(this, arguments);
this.state = {

@@ -173,7 +181,7 @@ caughtError: null,

}
GarfishSubAppReactErrorBoundary.prototype = Object.create(opts.React.Component.prototype);
GarfishSubAppReactErrorBoundary.prototype = opts.React && Object.create(opts.React.Component.prototype);
GarfishSubAppReactErrorBoundary.prototype.render = function() {
if (this.state.caughtError) {
const errorBoundary = opts.errorBoundary;
return errorBoundary(this.state.caughtError, this.props);
return errorBoundary && errorBoundary(this.state.caughtError, this.props);
} else {

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

4

package.json
{
"name": "@garfish/bridge-react-v18",
"version": "1.7.2",
"version": "1.8.0",
"description": "garfish module.",

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

"dependencies": {
"@garfish/utils": "1.7.2"
"@garfish/utils": "1.8.0"
},

@@ -36,0 +36,0 @@ "devDependencies": {

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