@legalplace/wizardx-core 4.42.10-nightly.20251125160329 → 4.42.10-nightly.20251125161109
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PluginLoader.d.ts +1 -1
- package/dist/PluginLoader.js +21 -5
- package/package.json +1 -1
package/dist/PluginLoader.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type ReplaceFragmentPropsType = {
|
|
|
18
18
|
};
|
|
19
19
|
export declare const ReplaceFragment: ({ replacerName, fragmentName, children, }: ReplaceFragmentPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export declare function registerReplacer(replacerName: string, Replacer: ReactComponent<any>): void;
|
|
21
|
-
export declare function loadPlugins(plugins?: Record<string, () => Promise<IPlugin
|
|
21
|
+
export declare function loadPlugins(plugins?: Record<string, (() => Promise<IPlugin>) | Promise<IPlugin> | IPlugin>): Promise<any>;
|
|
22
22
|
export declare function getPluginsReducers(): Record<string, Reducer<Record<string, any>, any>>;
|
|
23
23
|
export declare function getPluginsAdditionalRoutes(): IPluginConfig[];
|
|
24
24
|
export declare function getPluginsSagas(): Saga[];
|
package/dist/PluginLoader.js
CHANGED
|
@@ -83,13 +83,29 @@ export function loadPlugins(plugins) {
|
|
|
83
83
|
}
|
|
84
84
|
const store = getStore();
|
|
85
85
|
Object.keys(plugins).forEach((key) => {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
const pluginValue = plugins[key];
|
|
87
|
+
let pluginPromise;
|
|
88
|
+
if (typeof pluginValue === "function") {
|
|
89
|
+
try {
|
|
90
|
+
pluginPromise = Promise.resolve(pluginValue());
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
console.error(`Failed to execute plugin "${key}" loader:`, error);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else if (pluginValue && typeof pluginValue === "object" && "then" in pluginValue) {
|
|
98
|
+
pluginPromise = pluginValue;
|
|
99
|
+
}
|
|
100
|
+
else if (pluginValue && typeof pluginValue === "object") {
|
|
101
|
+
pluginPromise = Promise.resolve(pluginValue);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
console.warn(`Plugin "${key}" has invalid format, skipping...`);
|
|
89
105
|
return;
|
|
90
106
|
}
|
|
91
|
-
promises.push(
|
|
92
|
-
if (plugin.redux) {
|
|
107
|
+
promises.push(pluginPromise.then((plugin) => {
|
|
108
|
+
if (plugin && plugin.redux) {
|
|
93
109
|
pluginsStoreReducers = Object.assign(Object.assign({}, pluginsStoreReducers), { [key]: plugin.redux.reducer });
|
|
94
110
|
pluginsSagas = [...pluginsSagas, ...plugin.redux.sagas];
|
|
95
111
|
}
|