Socket
Socket
Sign inDemoInstall

react-arbiter

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-arbiter - npm Package Compare versions

Comparing version 0.7.2 to 0.8.0

7

CHANGELOG.md
# React Arbiter Changelog
## 0.8.0
- Removed `dependencies` field from metadata
- Added `custom` field to metadata
## 0.7.2
- Expose package typings
- Expose package typings

@@ -7,0 +12,0 @@ ## 0.7.1

14

dist/types/index.d.ts

@@ -12,12 +12,2 @@ import { ComponentType, Ref } from 'react';

/**
* The dependency map of the module.
*/
dependencies: {
/**
* The name of the dependency and the related location, which
* defines where to get (i.e., fetch) it from.
*/
[name: string]: string;
};
/**
* The content of the module. If the content is not available

@@ -43,2 +33,6 @@ * the link will be used (unless caching has been activated).

noCache?: boolean | string;
/**
* Optionally provides some custom metadata for the module.
*/
custom?: any;
}

@@ -45,0 +39,0 @@ export interface ArbiterModuleApp<TApi> {

@@ -7,28 +7,7 @@ "use strict";

}
function loadDependencies(meta, fetchDependency, getDependencies) {
function loadFromContent(meta, content, getDependencies, link) {
const dependencies = Object.assign({}, (getDependencies(meta) || {}));
const existingDependencies = Object.keys(dependencies);
const dependencyMap = Object.keys(meta.dependencies || {})
.filter(name => existingDependencies.indexOf(name) === -1)
.map(name => ({
name,
url: meta.dependencies[name],
content: '',
}));
return Promise.all(dependencyMap.map(m => fetchDependency(m.url).then(c => (m.content = c)))).then(() => {
for (const item of dependencyMap) {
dependencies[item.name] = dependency_1.evalDependency(item.name, item.content, item.url, dependencies);
}
return dependencies;
});
const app = dependency_1.compileDependency(meta.name, content, link, dependencies);
return Object.assign({}, app, meta);
}
function loadFromContent(meta, content, fetchDependency, getDependencies, link) {
return loadDependencies(meta, fetchDependency, getDependencies).then(dependencies => {
const app = dependency_1.compileDependency(meta.name, content, link, dependencies);
return Object.assign({}, app, meta);
}, error => {
console.error(`Could not load the dependencies of ${meta.name}.`, error);
return createEmptyModule(meta);
});
}
/**

@@ -44,8 +23,6 @@ * Loads the given raw module content by resolving its dependencies and

const { link, content } = meta;
if (link) {
return fetchDependency(link).then(content => loadFromContent(meta, content, fetchDependency, getDependencies, link));
const retrieve = link ? fetchDependency(link) : content ? Promise.resolve(content) : undefined;
if (retrieve) {
return retrieve.then(content => loadFromContent(meta, content, getDependencies, link));
}
else if (content) {
return loadFromContent(meta, content, fetchDependency, getDependencies);
}
else {

@@ -52,0 +29,0 @@ console.warn('Empty module found!', meta.name);

{
"name": "react-arbiter",
"version": "0.7.2",
"version": "0.8.0",
"description": "Recall all your modules to extend your SPA dynamically at runtime.",

@@ -35,7 +35,7 @@ "main": "dist/index.js",

"devDependencies": {
"@types/enzyme": "^3.10.2",
"@types/enzyme": "^3.10.3",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/jest": "^24.0.15",
"@types/react": "^16.8.23",
"@types/react-dom": "^16.8.4",
"@types/react-dom": "^16.8.5",
"enzyme": "^3.10.0",

@@ -42,0 +42,0 @@ "enzyme-adapter-react-16": "^1.14.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