@mercurjs/dashboard-sdk 2.0.0-canary.4 → 2.0.0-canary.41

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 CHANGED
@@ -136,6 +136,14 @@ function hasDefaultExport(filePath) {
136
136
  return false;
137
137
  }
138
138
  }
139
+ function hasConfigPublic(filePath) {
140
+ try {
141
+ const content = import_fs.default.readFileSync(filePath, "utf-8");
142
+ return /export\s+const\s+config\s*=\s*\{[^}]*public\s*:\s*true/.test(content);
143
+ } catch {
144
+ return false;
145
+ }
146
+ }
139
147
  function getNamedExports(filePath) {
140
148
  try {
141
149
  const content = import_fs.default.readFileSync(filePath, "utf-8");
@@ -170,12 +178,13 @@ function generateImports(file, index, hasHandle, hasLoader) {
170
178
  }
171
179
  return imports;
172
180
  }
173
- function generateRouteObject(routePath, index, hasHandle, hasLoader) {
181
+ function generateRouteObject(routePath, index, hasHandle, hasLoader, isPublic) {
174
182
  return {
175
183
  Component: generateRouteComponentName(index),
176
184
  path: routePath,
177
185
  handle: hasHandle ? generateHandleName(index) : void 0,
178
- loader: hasLoader ? generateLoaderName(index) : void 0
186
+ loader: hasLoader ? generateLoaderName(index) : void 0,
187
+ isPublic
179
188
  };
180
189
  }
181
190
  function formatRoute(route, indent = " ") {
@@ -191,6 +200,10 @@ ${indent} handle: ${route.handle}`;
191
200
  if (route.loader) {
192
201
  result += `,
193
202
  ${indent} loader: ${route.loader}`;
203
+ }
204
+ if (route.isPublic) {
205
+ result += `,
206
+ ${indent} isPublic: true`;
194
207
  }
195
208
  if (route.children?.length) {
196
209
  result += `,
@@ -209,9 +222,10 @@ function parseFile(file, pagesDir, index) {
209
222
  return null;
210
223
  }
211
224
  const { hasHandle, hasLoader } = getNamedExports(file);
225
+ const isPublic = hasConfigPublic(file);
212
226
  const routePath = getRoute(file, pagesDir);
213
227
  const imports = generateImports(file, index, hasHandle, hasLoader);
214
- const route = generateRouteObject(routePath, index, hasHandle, hasLoader);
228
+ const route = generateRouteObject(routePath, index, hasHandle, hasLoader, isPublic);
215
229
  return {
216
230
  imports,
217
231
  route
@@ -530,6 +544,9 @@ function dashboardPlugin() {
530
544
  return {
531
545
  define: {
532
546
  "__BACKEND_URL__": JSON.stringify(config.backendUrl)
547
+ },
548
+ optimizeDeps: {
549
+ exclude: ["virtual:mercur/config", "virtual:mercur/routes", "virtual:mercur/components", "virtual:mercur/menu-items", "virtual:mercur/i18n"]
533
550
  }
534
551
  };
535
552
  },
package/dist/index.d.cts CHANGED
@@ -9,6 +9,7 @@ interface MercurConfig {
9
9
  components?: {
10
10
  MainSidebar?: string;
11
11
  SettingsSidebar?: string;
12
+ TopbarActions?: string;
12
13
  };
13
14
  i18n?: {
14
15
  defaultLanguage: string;
@@ -27,6 +28,7 @@ type RouteConfig = {
27
28
  rank?: number;
28
29
  nested?: string;
29
30
  translationNs?: string;
31
+ public?: boolean;
30
32
  };
31
33
 
32
34
  declare function defineConfig(config: MercurConfig): MercurConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mercurjs/dashboard-sdk",
3
- "version": "2.0.0-canary.4",
3
+ "version": "2.0.0-canary.41",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mercurjs/mercur",