@spree/dashboard-core 1.0.0-rc.1 → 1.0.0-rc.2

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.
@@ -23,7 +23,7 @@ function discoverDashboardPluginManifests({ root, onWarn }, names) {
23
23
  const routes = pkg.spree?.dashboard?.routes;
24
24
  manifests.push({
25
25
  name,
26
- routesDir: routes ? linkedPackagePath(root, name, path.resolve(path.dirname(manifestPath), routes)) : void 0
26
+ routesDir: routes ? path.resolve(path.dirname(manifestPath), routes) : void 0
27
27
  });
28
28
  }
29
29
  return manifests;
@@ -63,17 +63,9 @@ function discoverDashboardPlugins({ root, onWarn }) {
63
63
  }
64
64
  return discovered;
65
65
  }
66
- function linkedPackagePath(root, packageName, resolvedPath) {
67
- const realPath = fs.realpathSync(resolvedPath);
68
- for (let dir = root; ; dir = path.dirname(dir)) {
69
- const link = path.join(dir, "node_modules", packageName);
70
- if (fs.existsSync(path.join(link, "package.json"))) {
71
- const inside = path.relative(fs.realpathSync(link), realPath);
72
- if (inside.startsWith("..") || path.isAbsolute(inside)) return resolvedPath;
73
- return path.join(link, inside);
74
- }
75
- if (path.dirname(dir) === dir) return resolvedPath;
76
- }
66
+ function resolveShellRoutesDir(root, packageName) {
67
+ const require2 = createRequire(path.join(root, "package.json"));
68
+ return path.join(path.dirname(fs.realpathSync(require2.resolve(packageName))), "routes");
77
69
  }
78
70
  function resolveManifest(pkg, require2) {
79
71
  try {
@@ -98,5 +90,5 @@ function resolveManifest(pkg, require2) {
98
90
  export {
99
91
  discoverDashboardPluginManifests,
100
92
  discoverDashboardPlugins,
101
- linkedPackagePath
93
+ resolveShellRoutesDir
102
94
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spree/dashboard-core",
3
3
  "license": "MIT",
4
- "version": "1.0.0-rc.1",
4
+ "version": "1.0.0-rc.2",
5
5
  "description": "Spree Dashboard framework — registries (table, nav, slot, settings-nav), providers (auth, permission, store), admin SDK client, generic infra hooks, and the defineDashboardPlugin extension API. Developer Preview.",
6
6
  "author": "Vendo Connect Inc.",
7
7
  "homepage": "https://spreecommerce.org",
@@ -82,7 +82,7 @@
82
82
  "vite": "^8.0.16",
83
83
  "vitest": "^4.1.5",
84
84
  "@spree/admin-sdk": "^1.0.0-rc.1",
85
- "@spree/dashboard-ui": "^1.0.0-rc.1"
85
+ "@spree/dashboard-ui": "^1.0.0-rc.2"
86
86
  },
87
87
  "scripts": {
88
88
  "lint": "biome check src",
@@ -71,9 +71,7 @@ export function discoverDashboardPluginManifests(
71
71
  const routes = pkg.spree?.dashboard?.routes
72
72
  manifests.push({
73
73
  name,
74
- routesDir: routes
75
- ? linkedPackagePath(root, name, path.resolve(path.dirname(manifestPath), routes))
76
- : undefined,
74
+ routesDir: routes ? path.resolve(path.dirname(manifestPath), routes) : undefined,
77
75
  })
78
76
  }
79
77
  return manifests
@@ -128,34 +126,24 @@ export function discoverDashboardPlugins({ root, onWarn }: DiscoverOptions): str
128
126
  }
129
127
 
130
128
  /**
131
- * Re-expresses a path inside an installed package through the package's
132
- * `node_modules/<name>` link, rather than the real location Node resolves to.
129
+ * The routes directory of an installed dashboard shell (`@spree/dashboard`,
130
+ * `@spree/seller-dashboard`), at its real location. The shell's `.` export
131
+ * maps to a file in `src/`, so `routes/` is its sibling directory.
133
132
  *
134
- * Under pnpm the real location is `node_modules/.pnpm/<name>@<version>_<hash>/…`,
135
- * which changes with every install. The route generator writes these paths
136
- * into the host's committed `routeTree.gen.ts`, so a real location made the
137
- * file differ on a new project's first dev start and after every upgrade —
138
- * and each rewrite reloaded the open page. The link stays put across installs
139
- * and is the same inside the monorepo, so the file only changes when the
140
- * routes do.
133
+ * The route generator imports these files from the host's `routeTree.gen.ts`.
134
+ * Under pnpm a package is reached through a `node_modules/<name>` link, while
135
+ * its own dependencies sit next to its real location under
136
+ * `node_modules/.pnpm/`. TypeScript does not follow the link for a relative
137
+ * import, so a route file imported through it cannot see the shell's
138
+ * dependencies and the host's type check fails. Plugin routes directories
139
+ * resolve to their real location for the same reason.
141
140
  *
142
141
  * @param root host project root
143
- * @param packageName the package the path belongs to
144
- * @param resolvedPath a path inside that package, as Node resolved it
145
- * @returns the same path through the link, or `resolvedPath` when no link
146
- * leads to it (the package resolving itself, an unusual layout)
142
+ * @param packageName the shell package the host depends on
147
143
  */
148
- export function linkedPackagePath(root: string, packageName: string, resolvedPath: string): string {
149
- const realPath = fs.realpathSync(resolvedPath)
150
- for (let dir = root; ; dir = path.dirname(dir)) {
151
- const link = path.join(dir, 'node_modules', packageName)
152
- if (fs.existsSync(path.join(link, 'package.json'))) {
153
- const inside = path.relative(fs.realpathSync(link), realPath)
154
- if (inside.startsWith('..') || path.isAbsolute(inside)) return resolvedPath
155
- return path.join(link, inside)
156
- }
157
- if (path.dirname(dir) === dir) return resolvedPath
158
- }
144
+ export function resolveShellRoutesDir(root: string, packageName: string): string {
145
+ const require = createRequire(path.join(root, 'package.json'))
146
+ return path.join(path.dirname(fs.realpathSync(require.resolve(packageName))), 'routes')
159
147
  }
160
148
 
161
149
  interface HostManifest {