New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hadron-app-registry

Package Overview
Dependencies
Maintainers
0
Versions
544
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hadron-app-registry - npm Package Compare versions

Comparing version 9.2.3 to 9.2.4

3

dist/app-registry.d.ts

@@ -1,6 +0,5 @@

import type { Store as RefluxStore } from 'reflux';
import type { Store as ReduxStore } from 'redux';
import EventEmitter from 'eventemitter3';
import type { ReactReduxContext } from 'react-redux';
export type Store = (ReduxStore | Partial<RefluxStore>) & {
export type Store = any & {
onActivated?: (appRegistry: AppRegistry) => void;

@@ -7,0 +6,0 @@ };

@@ -6,3 +6,4 @@ import { AppRegistry, globalAppRegistry } from './app-registry';

export { registerHadronPlugin, createActivateHelpers, createServiceLocator, createServiceProvider, } from './register-plugin';
export type { Plugin as HadronPlugin } from './app-registry';
export default AppRegistry;
//# sourceMappingURL=index.d.ts.map

@@ -19,2 +19,3 @@ import React from 'react';

}): JSX.Element;
export declare function useIsTopLevelProvider(): boolean;
export declare function AppRegistryProvider({ children, ...props }: AppRegistryProviderProps): JSX.Element;

@@ -21,0 +22,0 @@ export declare function useGlobalAppRegistry(): AppRegistry;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.useLocalAppRegistry = exports.useGlobalAppRegistry = exports.AppRegistryProvider = exports.GlobalAppRegistryProvider = exports.GlobalAppRegistryContext = void 0;
exports.useLocalAppRegistry = exports.useGlobalAppRegistry = exports.AppRegistryProvider = exports.useIsTopLevelProvider = exports.GlobalAppRegistryProvider = exports.GlobalAppRegistryContext = void 0;
const react_1 = __importStar(require("react"));

@@ -37,2 +37,6 @@ const app_registry_1 = require("./app-registry");

exports.GlobalAppRegistryProvider = GlobalAppRegistryProvider;
function useIsTopLevelProvider() {
return (0, react_1.useContext)(LocalAppRegistryContext) === null;
}
exports.useIsTopLevelProvider = useIsTopLevelProvider;
function AppRegistryProvider({ children, ...props }) {

@@ -42,3 +46,3 @@ const initialPropsRef = (0, react_1.useRef)(props);

const globalAppRegistry = useGlobalAppRegistry();
const isTopLevelProvider = (0, react_1.useContext)(LocalAppRegistryContext) === null;
const isTopLevelProvider = useIsTopLevelProvider();
const [localAppRegistry] = (0, react_1.useState)(() => {

@@ -45,0 +49,0 @@ return (initialLocalAppRegistry ??

@@ -25,6 +25,6 @@ import React from 'react';

};
export type HadronPluginConfig<T, S extends Record<string, () => unknown>> = {
export type HadronPluginConfig<T, S extends Record<string, () => unknown>, A extends Plugin> = {
name: string;
component: React.ComponentType<T>;
activate: (initialProps: T, services: Registries & Services<S>, helpers: ActivateHelpers) => Plugin;
activate: (initialProps: T, services: Registries & Services<S>, helpers: ActivateHelpers) => A;
};

@@ -39,9 +39,9 @@ type MockOptions = {

export declare function createServiceProvider<T extends React.FunctionComponent<any>>(fn: T): T;
export type HadronPluginComponent<T, S extends Record<string, () => unknown>> = React.FunctionComponent<T> & {
export type HadronPluginComponent<T, S extends Record<string, () => unknown>, A extends Plugin> = React.FunctionComponent<T> & {
displayName: string;
useActivate(props: T): void;
withMockServices(mocks: Partial<Registries & Services<S>>, options?: Partial<Pick<MockOptions, 'disableChildPluginRendering'>>): React.FunctionComponent<T>;
useActivate(props: T): A;
withMockServices(mocks: Partial<Registries & Services<S>>, options?: Partial<Pick<MockOptions, 'disableChildPluginRendering'>>): HadronPluginComponent<T, S, A>;
};
export declare function registerHadronPlugin<T, S extends Record<string, () => unknown>>(config: HadronPluginConfig<T, S>, services?: S): HadronPluginComponent<T, S>;
export declare function registerHadronPlugin<T, S extends Record<string, () => unknown>, A extends Plugin>(config: HadronPluginConfig<T, S, A>, services?: S): HadronPluginComponent<T, S, A>;
export {};
//# sourceMappingURL=register-plugin.d.ts.map

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

}
const defaultMockOptions = {
const DEFAULT_MOCK_OPTIONS = {
pluginName: '$$root',

@@ -82,5 +82,5 @@ mockedEnvironment: false,

};
const MockOptionsContext = react_1.default.createContext(defaultMockOptions);
const useMockOption = (key) => {
return (0, react_1.useContext)(MockOptionsContext)[key];
const MockOptionsContext = react_1.default.createContext(null);
const useMockOption = (key, defaultMockOptions = DEFAULT_MOCK_OPTIONS) => {
return (0, react_1.useContext)(MockOptionsContext)?.[key] ?? defaultMockOptions[key];
};

@@ -119,6 +119,6 @@ let serviceLocationInProgress = false;

}
function useHadronPluginActivate(config, services, props) {
function useHadronPluginActivate(config, services, props, mockOptions) {
const registryName = `${config.name}.Plugin`;
const isMockedEnvironment = useMockOption('mockedEnvironment');
const mockServices = useMockOption('mockServices');
const isMockedEnvironment = useMockOption('mockedEnvironment', mockOptions);
const mockServices = useMockOption('mockServices', mockOptions);
const globalAppRegistry = (0, react_context_1.useGlobalAppRegistry)();

@@ -191,3 +191,3 @@ const localAppRegistry = (0, react_context_1.useLocalAppRegistry)();

useActivate: (props) => {
useHadronPluginActivate(config, services, props);
return useHadronPluginActivate(config, services, props);
},

@@ -197,3 +197,3 @@ withMockServices(mocks = {}, options) {

const mockOptions = {
...defaultMockOptions,
...DEFAULT_MOCK_OPTIONS,
mockedEnvironment: true,

@@ -204,8 +204,19 @@ pluginName: config.name,

};
return function MockPluginWithContext(props) {
return (react_1.default.createElement(MockOptionsContext.Provider, { value: mockOptions },
react_1.default.createElement(react_context_1.GlobalAppRegistryContext.Provider, { value: globalAppRegistry },
react_1.default.createElement(react_context_1.AppRegistryProvider, { localAppRegistry: localAppRegistry },
react_1.default.createElement(Plugin, { ...props })))));
};
function MockPluginWithContext(props) {
const isTopLevelProvider = (0, react_context_1.useIsTopLevelProvider)();
const hasCustomAppRegistries = !!mockServices.localAppRegistry || !!mockServices.globalAppRegistry;
const shouldRenderRegistryProviders = isTopLevelProvider || hasCustomAppRegistries;
return (react_1.default.createElement(MockOptionsContext.Provider, { value: mockOptions }, shouldRenderRegistryProviders ? (react_1.default.createElement(react_context_1.GlobalAppRegistryContext.Provider, { value: globalAppRegistry },
react_1.default.createElement(react_context_1.AppRegistryProvider, { localAppRegistry: localAppRegistry },
react_1.default.createElement(Plugin, { ...props })))) : (react_1.default.createElement(Plugin, { ...props }))));
}
return Object.assign(MockPluginWithContext, {
displayName: config.name,
useActivate: (props) => {
return useHadronPluginActivate(config, services, props, mockOptions);
},
withMockServices() {
return MockPluginWithContext;
},
});
},

@@ -212,0 +223,0 @@ });

@@ -10,3 +10,3 @@ {

"homepage": "https://github.com/mongodb-js/compass",
"version": "9.2.3",
"version": "9.2.4",
"repository": {

@@ -71,3 +71,3 @@ "type": "git",

},
"gitHead": "36ab9850539afa17c602487d440cdfa07bade181"
"gitHead": "7f83eae627de08d740b1546adcf21816b1f21ec7"
}

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

import type { Store as RefluxStore } from 'reflux';
import type { Store as ReduxStore } from 'redux';

@@ -6,3 +5,7 @@ import EventEmitter from 'eventemitter3';

export type Store = (ReduxStore | Partial<RefluxStore>) & {
// This type is very generic on purpose so that registerPlugin function generic
// type can derive it automatically based on the passed activate function. This
// is helpful when using useActivate hook to get the stricter type of returned
// activate store elsewhere in the code
export type Store = any & {
onActivated?: (appRegistry: AppRegistry) => void;

@@ -9,0 +12,0 @@ };

@@ -20,2 +20,3 @@ import { AppRegistry, globalAppRegistry } from './app-registry';

} from './register-plugin';
export type { Plugin as HadronPlugin } from './app-registry';
export default AppRegistry;

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

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