@eventcatalog/core 2.54.3 → 2.54.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.
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "2.54.3";
40
+ var version = "2.54.4";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-YXXP2UQA.js";
4
- import "../chunk-VH23O4GO.js";
3
+ } from "../chunk-QTOY4HR4.js";
4
+ import "../chunk-ILYNXPYT.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -106,7 +106,7 @@ var import_axios = __toESM(require("axios"), 1);
106
106
  var import_os = __toESM(require("os"), 1);
107
107
 
108
108
  // package.json
109
- var version = "2.54.3";
109
+ var version = "2.54.4";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-JQS6ADYS.js";
4
- import "../chunk-YXXP2UQA.js";
5
- import "../chunk-VH23O4GO.js";
3
+ } from "../chunk-RSPVRELK.js";
4
+ import "../chunk-QTOY4HR4.js";
5
+ import "../chunk-ILYNXPYT.js";
6
6
  import "../chunk-E7TXTI7G.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.54.3";
2
+ var version = "2.54.4";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-VH23O4GO.js";
3
+ } from "./chunk-ILYNXPYT.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-YXXP2UQA.js";
3
+ } from "./chunk-QTOY4HR4.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.54.3";
28
+ var version = "2.54.4";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-VH23O4GO.js";
3
+ } from "./chunk-ILYNXPYT.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -157,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
157
157
  var import_os = __toESM(require("os"), 1);
158
158
 
159
159
  // package.json
160
- var version = "2.54.3";
160
+ var version = "2.54.4";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-XE6PFSH5.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-JQS6ADYS.js";
10
- import "./chunk-YXXP2UQA.js";
9
+ } from "./chunk-RSPVRELK.js";
10
+ import "./chunk-QTOY4HR4.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
@@ -15,7 +15,7 @@ import {
15
15
  import "./chunk-LDBRNJIL.js";
16
16
  import {
17
17
  VERSION
18
- } from "./chunk-VH23O4GO.js";
18
+ } from "./chunk-ILYNXPYT.js";
19
19
  import {
20
20
  getProjectOutDir,
21
21
  isAuthEnabled,
@@ -7,12 +7,12 @@ import path from 'path';
7
7
  import SchemaViewerClient from './SchemaViewer.astro';
8
8
  import Admonition from '../Admonition';
9
9
  import { getMDXComponentsByName } from '@utils/markdown';
10
- import { getAbsoluteFilePathForAstroFile } from '@utils/files';
10
+ import { getAbsoluteFilePathForAstroFile, resolveProjectPath } from '@utils/files';
11
11
 
12
12
  let schemas = [];
13
13
 
14
14
  try {
15
- const absoluteFilePath = getAbsoluteFilePathForAstroFile(filePath, filePath.split(path.sep).pop());
15
+ const absoluteFilePath = resolveProjectPath(filePath);
16
16
  const file = await fs.readFile(absoluteFilePath, 'utf-8');
17
17
  const schemaViewers = getMDXComponentsByName(file, 'SchemaViewer');
18
18
 
@@ -1,5 +1,28 @@
1
1
  import path from 'node:path';
2
2
 
3
+ /**
4
+ * Resolves a file path relative to PROJECT_DIR, handling ../ paths correctly
5
+ * @param filePath - The path to resolve
6
+ * @param projectDir - The project directory to resolve relative to
7
+ * @returns The resolved absolute path
8
+ */
9
+ export const resolveProjectPath = (filePath: string, projectDir: string = process.env.PROJECT_DIR || process.cwd()): string => {
10
+ if (filePath.startsWith('../')) {
11
+ const pathAfterDotDot = filePath.substring(3);
12
+ const projectDirName = path.basename(projectDir);
13
+ const projectParentName = path.basename(path.dirname(projectDir));
14
+
15
+ if (pathAfterDotDot.startsWith(`${projectParentName}/${projectDirName}/`)) {
16
+ const remainingPath = pathAfterDotDot.substring(`${projectParentName}/${projectDirName}/`.length);
17
+ return path.join(projectDir, remainingPath);
18
+ } else {
19
+ const projectParent = path.dirname(projectDir);
20
+ return path.join(projectParent, pathAfterDotDot);
21
+ }
22
+ }
23
+ return path.join(projectDir, filePath);
24
+ };
25
+
3
26
  /**
4
27
  * Using the Astro filePath, this returns the absolute path to the file
5
28
  *
@@ -14,30 +37,10 @@ export const getAbsoluteFilePathForAstroFile = (filePath: string, fileName?: str
14
37
  const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
15
38
 
16
39
  if (fileName) {
17
- const safeRelativePath = path.posix.relative('/', path.resolve('/', filePath));
18
-
19
- // Check for overlapping path segments
20
- const projectDirSegments = PROJECT_DIR.split(path.sep);
21
- const relativePathSegments = safeRelativePath.split(path.posix.sep);
22
-
23
- // Find the longest matching suffix of PROJECT_DIR with prefix of relative path
24
- let overlapLength = 0;
25
- for (let i = 1; i <= Math.min(projectDirSegments.length, relativePathSegments.length); i++) {
26
- const projectSuffix = projectDirSegments.slice(-i);
27
- const relativPrefix = relativePathSegments.slice(0, i);
28
-
29
- if (projectSuffix.join(path.sep) === relativPrefix.join(path.posix.sep)) {
30
- overlapLength = i;
31
- }
32
- }
33
-
34
- // Remove overlapping segments from the relative path
35
- const cleanedRelativePath = relativePathSegments.slice(overlapLength).join(path.posix.sep);
36
- const absoluteFilePath = path.join(PROJECT_DIR, cleanedRelativePath);
37
-
38
- const directory = path.dirname(absoluteFilePath || '');
40
+ const resolvedFilePath = resolveProjectPath(filePath, PROJECT_DIR);
41
+ const directory = path.dirname(resolvedFilePath);
39
42
  return path.join(directory, fileName);
40
43
  }
41
44
 
42
- return path.join(PROJECT_DIR, filePath);
45
+ return resolveProjectPath(filePath, PROJECT_DIR);
43
46
  };
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/event-catalog/eventcatalog.git"
7
7
  },
8
8
  "type": "module",
9
- "version": "2.54.3",
9
+ "version": "2.54.4",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },