@constela/start 1.8.2 → 1.8.4

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.
@@ -938,6 +938,18 @@ function loadComponentDefinitions(baseDir, componentsPath) {
938
938
  throw new Error(`Invalid JSON in MDX components file: ${fullPath}`);
939
939
  }
940
940
  }
941
+ function extractGlobBasePath(pattern) {
942
+ const starIndex = pattern.indexOf("*");
943
+ if (starIndex === -1) {
944
+ return "";
945
+ }
946
+ const beforeStar = pattern.substring(0, starIndex);
947
+ const lastSlash = beforeStar.lastIndexOf("/");
948
+ if (lastSlash === -1) {
949
+ return "";
950
+ }
951
+ return beforeStar.substring(0, lastSlash + 1);
952
+ }
941
953
  async function transformMdx(content, file, options) {
942
954
  const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
943
955
  let frontmatter = {};
@@ -957,12 +969,15 @@ async function transformMdx(content, file, options) {
957
969
  if (typeof fmSlug === "string") {
958
970
  slug = fmSlug;
959
971
  } else {
960
- const filename = basename(file, extname2(file));
972
+ const basePath = options?.basePath ?? "";
973
+ const relativePath = file.startsWith(basePath) ? file.substring(basePath.length) : file;
974
+ const filename = basename(relativePath, extname2(relativePath));
961
975
  if (filename === "index") {
962
- const dir = dirname(file);
963
- slug = dir === "." ? "index" : basename(dir);
976
+ const dir = dirname(relativePath);
977
+ slug = dir === "." ? "index" : dir;
964
978
  } else {
965
- slug = filename;
979
+ const dir = dirname(relativePath);
980
+ slug = dir === "." ? filename : `${dir}/${filename}`;
966
981
  }
967
982
  }
968
983
  return {
@@ -1034,11 +1049,15 @@ function applyTransform(content, transform, filename) {
1034
1049
  async function loadGlob(baseDir, pattern, transform, options) {
1035
1050
  const files = await fg2(pattern, { cwd: baseDir });
1036
1051
  if (transform === "mdx") {
1052
+ const basePath = extractGlobBasePath(pattern);
1037
1053
  const results2 = [];
1038
1054
  for (const file of files) {
1039
1055
  const fullPath = join3(baseDir, file);
1040
1056
  const content = readFileSync(fullPath, "utf-8");
1041
- const transformed = await transformMdx(content, file, options);
1057
+ const transformed = await transformMdx(content, file, {
1058
+ ...options,
1059
+ basePath
1060
+ });
1042
1061
  results2.push(transformed);
1043
1062
  }
1044
1063
  return results2;
package/dist/cli/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  hyperlink,
5
5
  loadConfig,
6
6
  resolveConfig
7
- } from "../chunk-T3HWPPLG.js";
7
+ } from "../chunk-4Q7CF76Z.js";
8
8
  import "../chunk-3GFRJEKD.js";
9
9
 
10
10
  // src/cli/index.ts
package/dist/index.d.ts CHANGED
@@ -476,6 +476,7 @@ declare function loadComponentDefinitions(baseDir: string, componentsPath: strin
476
476
  */
477
477
  declare function transformMdx(content: string, file: string, options?: {
478
478
  components?: Record<string, ComponentDef>;
479
+ basePath?: string;
479
480
  }): Promise<MdxGlobResult>;
480
481
  /**
481
482
  * Transform YAML content
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  transformCsv,
29
29
  transformMdx,
30
30
  transformYaml
31
- } from "./chunk-T3HWPPLG.js";
31
+ } from "./chunk-4Q7CF76Z.js";
32
32
  import {
33
33
  evaluateMetaExpression,
34
34
  generateHydrationScript,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/start",
3
- "version": "1.8.2",
3
+ "version": "1.8.4",
4
4
  "description": "Meta-framework for Constela applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -45,8 +45,8 @@
45
45
  "tailwindcss": "^4.0.0",
46
46
  "ws": "^8.18.0",
47
47
  "@constela/compiler": "0.12.0",
48
- "@constela/core": "0.13.0",
49
48
  "@constela/router": "15.0.0",
49
+ "@constela/core": "0.13.0",
50
50
  "@constela/runtime": "0.16.5",
51
51
  "@constela/server": "9.0.0"
52
52
  },