@mercurjs/dashboard-sdk 2.0.0-canary.69 → 2.0.0-canary.70
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/index.cjs +8 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -552,17 +552,20 @@ function resolvePluginRoot(resolve, configDir, nodeModulesRoot) {
|
|
|
552
552
|
return null;
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
|
-
function resolvePluginDirs(plugins, configDir
|
|
555
|
+
function resolvePluginDirs(plugins, configDir) {
|
|
556
556
|
const nodeModulesRoot = findNodeModulesRoot(configDir);
|
|
557
557
|
const dirs = [];
|
|
558
|
+
const appTypes = ["admin", "vendor"];
|
|
558
559
|
for (const plugin of plugins) {
|
|
559
560
|
const resolve = typeof plugin === "string" ? plugin : plugin?.resolve;
|
|
560
561
|
if (!resolve || typeof resolve !== "string") continue;
|
|
561
562
|
const pluginRoot = resolvePluginRoot(resolve, configDir, nodeModulesRoot);
|
|
562
563
|
if (!pluginRoot) continue;
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
|
|
564
|
+
for (const appType of appTypes) {
|
|
565
|
+
const extDir = import_path5.default.join(pluginRoot, ".medusa/server/src", appType);
|
|
566
|
+
if (import_fs4.default.existsSync(extDir) && import_fs4.default.statSync(extDir).isDirectory()) {
|
|
567
|
+
dirs.push(extDir);
|
|
568
|
+
}
|
|
566
569
|
}
|
|
567
570
|
}
|
|
568
571
|
return dirs;
|
|
@@ -574,19 +577,17 @@ async function loadMedusaConfig(medusaConfigPath, root) {
|
|
|
574
577
|
const modules = medusaConfig?.modules ?? {};
|
|
575
578
|
const configDir = import_path5.default.dirname(medusaConfigPath);
|
|
576
579
|
let base;
|
|
577
|
-
let appType;
|
|
578
580
|
for (const key of UI_MODULE_KEYS) {
|
|
579
581
|
const value = modules[key];
|
|
580
582
|
if (!value || typeof value !== "object" || !value.options?.appDir) continue;
|
|
581
583
|
const appDir = import_path5.default.resolve(configDir, value.options.appDir);
|
|
582
584
|
if (appDir === root) {
|
|
583
585
|
base = value.options.path;
|
|
584
|
-
appType = key === "admin_ui" ? "admin" : "vendor";
|
|
585
586
|
break;
|
|
586
587
|
}
|
|
587
588
|
}
|
|
588
589
|
const plugins = medusaConfig?.plugins ?? [];
|
|
589
|
-
const pluginDirs =
|
|
590
|
+
const pluginDirs = resolvePluginDirs(plugins, configDir);
|
|
590
591
|
return { base, pluginDirs };
|
|
591
592
|
} catch {
|
|
592
593
|
return { pluginDirs: [] };
|