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

@equinor/echo-base

Package Overview
Dependencies
Maintainers
9
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equinor/echo-base - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

esm/errors/toError.d.ts

1

esm/errors/index.d.ts

@@ -5,1 +5,2 @@ export * from './ArgumentError';

export * from './NetworkError';
export * from './toError';

@@ -5,2 +5,3 @@ export * from './ArgumentError';

export * from './NetworkError';
export * from './toError';
//# sourceMappingURL=index.js.map

2

esm/module/create.d.ts

@@ -17,3 +17,3 @@ import { EchoModulesLoading, LoadingModuleOptions } from '../types';

*/
export declare function startLoadingModules(options: LoadingModuleOptions): StartLoadingModules;
export declare function startLoadingModules(options: LoadingModuleOptions, currentPath: string): StartLoadingModules;
export {};

@@ -14,3 +14,3 @@ import { standardStrategy } from './strategies';

*/
export function startLoadingModules(options) {
export function startLoadingModules(options, currentPath) {
var state = {

@@ -33,3 +33,3 @@ loaded: false,

};
fireAndForget(function () { return standardStrategy(options, setAppModules).then(setLoaded, setLoaded); });
fireAndForget(function () { return standardStrategy(options, setAppModules, currentPath).then(setLoaded, setLoaded); });
return {

@@ -36,0 +36,0 @@ connect: function (notifier) {

@@ -11,3 +11,3 @@ import { AppDependencyGetter, AvailableDependencies, DefaultLoaderConfig, ModuleLoader } from '../types';

*/
export declare function createModuleLoader(config?: DefaultLoaderConfig, dependencies?: AvailableDependencies, getDependencies?: AppDependencyGetter): ModuleLoader;
export declare function createModuleLoader(currentPath: string, config?: DefaultLoaderConfig, dependencies?: AvailableDependencies, getDependencies?: AppDependencyGetter): ModuleLoader;
/**

@@ -22,2 +22,2 @@ * Loader for loading modules, with dependencies.

*/
export declare function getModuleLoader(getDependencies: AppDependencyGetter, config?: DefaultLoaderConfig): ModuleLoader;
export declare function getModuleLoader(currentPath: string, getDependencies: AppDependencyGetter, config?: DefaultLoaderConfig): ModuleLoader;

@@ -15,5 +15,5 @@ import { __assign, __awaiter, __generator } from "tslib";

*/
export function createModuleLoader(config, dependencies, getDependencies) {
export function createModuleLoader(currentPath, config, dependencies, getDependencies) {
var getDeps = getDependencyResolver(dependencies, getDependencies);
return getModuleLoader(getDeps, config);
return getModuleLoader(currentPath, getDeps, config);
}

@@ -29,6 +29,7 @@ /**

*/
export function getModuleLoader(getDependencies, config) {
export function getModuleLoader(currentPath, getDependencies, config) {
if (config === void 0) { config = {}; }
return function (meta) {
if (inBrowser && 'requireRef' in meta && meta.requireRef) {
var hasRequireRef = inBrowser && 'requireRef' in meta && meta.requireRef;
if (hasRequireRef && meta.path === currentPath) {
return loadModule(meta, getDependencies, function (deps) {

@@ -38,3 +39,3 @@ return includeModuleWithDependencies(meta, deps, config.crossOrigin);

}
console.warn('Empty Module found!', meta.name);
!hasRequireRef && console.warn('Empty Module found!', meta.name);
return Promise.resolve(createEmptyModule(meta));

@@ -41,0 +42,0 @@ };

@@ -11,2 +11,2 @@ import { EchoModuleLoaded, LoadingModuleOptions } from '../types';

*/
export declare function standardStrategy(options: LoadingModuleOptions, callback: EchoModuleLoaded): Promise<void>;
export declare function standardStrategy(options: LoadingModuleOptions, callback: EchoModuleLoaded, currentPath: string): Promise<void>;

@@ -54,3 +54,3 @@ import { __awaiter, __generator, __spreadArray } from "tslib";

*/
export function standardStrategy(options, callback) {
export function standardStrategy(options, callback, currentPath) {
return __awaiter(this, void 0, void 0, function () {

@@ -61,3 +61,3 @@ var loader, fetchedModules, allModules, error_1;

case 0:
loader = createModuleLoader(options.config, options.dependencies, options.getDependencies);
loader = createModuleLoader(currentPath, options.config, options.dependencies, options.getDependencies);
_a.label = 1;

@@ -64,0 +64,0 @@ case 1:

@@ -5,1 +5,2 @@ export * from './ArgumentError';

export * from './NetworkError';
export * from './toError';

@@ -8,2 +8,3 @@ "use strict";

tslib_1.__exportStar(require("./NetworkError"), exports);
tslib_1.__exportStar(require("./toError"), exports);
//# sourceMappingURL=index.js.map

@@ -17,3 +17,3 @@ import { EchoModulesLoading, LoadingModuleOptions } from '../types';

*/
export declare function startLoadingModules(options: LoadingModuleOptions): StartLoadingModules;
export declare function startLoadingModules(options: LoadingModuleOptions, currentPath: string): StartLoadingModules;
export {};

@@ -17,3 +17,3 @@ "use strict";

*/
function startLoadingModules(options) {
function startLoadingModules(options, currentPath) {
var state = {

@@ -36,3 +36,3 @@ loaded: false,

};
utils_1.fireAndForget(function () { return strategies_1.standardStrategy(options, setAppModules).then(setLoaded, setLoaded); });
utils_1.fireAndForget(function () { return strategies_1.standardStrategy(options, setAppModules, currentPath).then(setLoaded, setLoaded); });
return {

@@ -39,0 +39,0 @@ connect: function (notifier) {

@@ -11,3 +11,3 @@ import { AppDependencyGetter, AvailableDependencies, DefaultLoaderConfig, ModuleLoader } from '../types';

*/
export declare function createModuleLoader(config?: DefaultLoaderConfig, dependencies?: AvailableDependencies, getDependencies?: AppDependencyGetter): ModuleLoader;
export declare function createModuleLoader(currentPath: string, config?: DefaultLoaderConfig, dependencies?: AvailableDependencies, getDependencies?: AppDependencyGetter): ModuleLoader;
/**

@@ -22,2 +22,2 @@ * Loader for loading modules, with dependencies.

*/
export declare function getModuleLoader(getDependencies: AppDependencyGetter, config?: DefaultLoaderConfig): ModuleLoader;
export declare function getModuleLoader(currentPath: string, getDependencies: AppDependencyGetter, config?: DefaultLoaderConfig): ModuleLoader;

@@ -18,5 +18,5 @@ "use strict";

*/
function createModuleLoader(config, dependencies, getDependencies) {
function createModuleLoader(currentPath, config, dependencies, getDependencies) {
var getDeps = getDependencyResolver_1.getDependencyResolver(dependencies, getDependencies);
return getModuleLoader(getDeps, config);
return getModuleLoader(currentPath, getDeps, config);
}

@@ -33,6 +33,7 @@ exports.createModuleLoader = createModuleLoader;

*/
function getModuleLoader(getDependencies, config) {
function getModuleLoader(currentPath, getDependencies, config) {
if (config === void 0) { config = {}; }
return function (meta) {
if (inBrowser && 'requireRef' in meta && meta.requireRef) {
var hasRequireRef = inBrowser && 'requireRef' in meta && meta.requireRef;
if (hasRequireRef && meta.path === currentPath) {
return loadModule(meta, getDependencies, function (deps) {

@@ -42,3 +43,3 @@ return dependency_1.includeModuleWithDependencies(meta, deps, config.crossOrigin);

}
console.warn('Empty Module found!', meta.name);
!hasRequireRef && console.warn('Empty Module found!', meta.name);
return Promise.resolve(utils_1.createEmptyModule(meta));

@@ -45,0 +46,0 @@ };

@@ -11,2 +11,2 @@ import { EchoModuleLoaded, LoadingModuleOptions } from '../types';

*/
export declare function standardStrategy(options: LoadingModuleOptions, callback: EchoModuleLoaded): Promise<void>;
export declare function standardStrategy(options: LoadingModuleOptions, callback: EchoModuleLoaded, currentPath: string): Promise<void>;

@@ -57,3 +57,3 @@ "use strict";

*/
function standardStrategy(options, callback) {
function standardStrategy(options, callback, currentPath) {
return tslib_1.__awaiter(this, void 0, void 0, function () {

@@ -64,3 +64,3 @@ var loader, fetchedModules, allModules, error_1;

case 0:
loader = loader_1.createModuleLoader(options.config, options.dependencies, options.getDependencies);
loader = loader_1.createModuleLoader(currentPath, options.config, options.dependencies, options.getDependencies);
_a.label = 1;

@@ -67,0 +67,0 @@ case 1:

{
"name": "@equinor/echo-base",
"version": "0.3.3",
"version": "0.3.4",
"module": "esm/index.js",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -5,1 +5,2 @@ export * from './ArgumentError';

export * from './NetworkError';
export * from './toError';

@@ -21,3 +21,3 @@ import { EchoModulesLoading, LoadingModuleOptions } from '../types';

*/
export function startLoadingModules(options: LoadingModuleOptions): StartLoadingModules {
export function startLoadingModules(options: LoadingModuleOptions, currentPath: string): StartLoadingModules {
const state = {

@@ -43,3 +43,3 @@ loaded: false,

fireAndForget(() => standardStrategy(options, setAppModules).then(setLoaded, setLoaded));
fireAndForget(() => standardStrategy(options, setAppModules, currentPath).then(setLoaded, setLoaded));

@@ -46,0 +46,0 @@ return {

@@ -26,2 +26,3 @@ import {

export function createModuleLoader(
currentPath: string,
config?: DefaultLoaderConfig,

@@ -32,3 +33,3 @@ dependencies?: AvailableDependencies,

const getDeps = getDependencyResolver(dependencies, getDependencies);
return getModuleLoader(getDeps, config);
return getModuleLoader(currentPath, getDeps, config);
}

@@ -45,5 +46,10 @@

*/
export function getModuleLoader(getDependencies: AppDependencyGetter, config: DefaultLoaderConfig = {}): ModuleLoader {
export function getModuleLoader(
currentPath: string,
getDependencies: AppDependencyGetter,
config: DefaultLoaderConfig = {}
): ModuleLoader {
return (meta: ModuleMetaData): Promise<EchoModule> => {
if (inBrowser && 'requireRef' in meta && meta.requireRef) {
const hasRequireRef = inBrowser && 'requireRef' in meta && meta.requireRef;
if (hasRequireRef && meta.path === currentPath) {
return loadModule(meta, getDependencies, (deps) =>

@@ -54,3 +60,3 @@ includeModuleWithDependencies(meta, deps, config.crossOrigin)

console.warn('Empty Module found!', meta.name);
!hasRequireRef && console.warn('Empty Module found!', meta.name);
return Promise.resolve(createEmptyModule(meta));

@@ -57,0 +63,0 @@ };

@@ -54,4 +54,13 @@ import { EchoModule, EchoModuleApiCreator, EchoModuleLoaded, LoadingModuleOptions, ModuleLoader } from '../types';

*/
export async function standardStrategy(options: LoadingModuleOptions, callback: EchoModuleLoaded): Promise<void> {
const loader: ModuleLoader = createModuleLoader(options.config, options.dependencies, options.getDependencies);
export async function standardStrategy(
options: LoadingModuleOptions,
callback: EchoModuleLoaded,
currentPath: string
): Promise<void> {
const loader: ModuleLoader = createModuleLoader(
currentPath,
options.config,
options.dependencies,
options.getDependencies
);
try {

@@ -58,0 +67,0 @@ const fetchedModules = await loadModules(loader, options.fetchModules);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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