@mercurjs/dashboard-sdk 2.0.0-canary.85 → 2.0.0-canary.87

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.
Files changed (2) hide show
  1. package/dist/index.cjs +17 -16
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -679,25 +679,22 @@ function resolvePluginRoot(resolve, configDir, nodeModulesRoot) {
679
679
  return null;
680
680
  }
681
681
  }
682
- function resolvePluginExtensions(plugins, configDir) {
682
+ function resolvePluginExtensions(plugins, configDir, appType) {
683
683
  const nodeModulesRoot = findNodeModulesRoot(configDir);
684
684
  const extensions = [];
685
- const appTypes = ["admin", "vendor"];
686
685
  for (const plugin of plugins) {
687
686
  const resolve = typeof plugin === "string" ? plugin : plugin?.resolve;
688
687
  if (!resolve || typeof resolve !== "string") continue;
689
688
  const pluginRoot = resolvePluginRoot(resolve, configDir, nodeModulesRoot);
690
689
  if (!pluginRoot) continue;
691
- for (const appType of appTypes) {
692
- const extFile = import_path5.default.join(
693
- pluginRoot,
694
- ".medusa/server/src",
695
- appType,
696
- "index.mjs"
697
- );
698
- if (import_fs4.default.existsSync(extFile)) {
699
- extensions.push(extFile);
700
- }
690
+ const extFile = import_path5.default.join(
691
+ pluginRoot,
692
+ ".medusa/server/src",
693
+ appType,
694
+ "index.mjs"
695
+ );
696
+ if (import_fs4.default.existsSync(extFile)) {
697
+ extensions.push(extFile);
701
698
  }
702
699
  }
703
700
  return extensions;
@@ -709,6 +706,7 @@ async function loadMedusaConfig(medusaConfigPath, root) {
709
706
  const modules = medusaConfig?.modules ?? {};
710
707
  const configDir = import_path5.default.dirname(medusaConfigPath);
711
708
  let base;
709
+ let appType = "admin";
712
710
  for (const key of UI_MODULE_KEYS) {
713
711
  const value = modules[key];
714
712
  if (!value || typeof value !== "object" || !value.options?.appDir)
@@ -716,13 +714,12 @@ async function loadMedusaConfig(medusaConfigPath, root) {
716
714
  const appDir = import_path5.default.resolve(configDir, value.options.appDir);
717
715
  if (appDir === root) {
718
716
  base = value.options.path;
717
+ appType = key === "vendor_ui" ? "vendor" : "admin";
719
718
  break;
720
719
  }
721
720
  }
722
- const plugins = medusaConfig?.plugins?.filter(
723
- (plugin) => plugin.resolve !== "@medusajs/draft-order"
724
- ) ?? [];
725
- const pluginExtensions = resolvePluginExtensions(plugins, configDir);
721
+ const plugins = medusaConfig?.plugins ?? [];
722
+ const pluginExtensions = resolvePluginExtensions(plugins, configDir, appType);
726
723
  return { base, pluginExtensions };
727
724
  } catch {
728
725
  return { pluginExtensions: [] };
@@ -760,6 +757,10 @@ function mercurDashboardPlugin(pluginConfig) {
760
757
  __BASE__: JSON.stringify(config.base || "/")
761
758
  },
762
759
  optimizeDeps: {
760
+ entries: [
761
+ "index.html",
762
+ ...pluginExtensions
763
+ ],
763
764
  exclude: [
764
765
  "virtual:mercur/config",
765
766
  "virtual:mercur/routes",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mercurjs/dashboard-sdk",
3
- "version": "2.0.0-canary.85",
3
+ "version": "2.0.0-canary.87",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mercurjs/mercur",