@eventcatalog/core 2.50.0 → 2.50.1
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/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/{chunk-O4GURJKI.js → chunk-BTQCPTER.js} +1 -1
- package/dist/{chunk-URM4QMOV.js → chunk-SDBKZ3UM.js} +1 -1
- package/dist/{chunk-5VLU23SZ.js → chunk-UG5JRBOA.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +3 -3
- package/eventcatalog/src/components/MDX/SchemaViewer/SchemaViewerRoot.astro +1 -1
- package/eventcatalog/src/utils/files.ts +29 -3
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-UG5JRBOA.js";
|
|
4
|
+
import "../chunk-BTQCPTER.js";
|
|
5
|
+
import "../chunk-SDBKZ3UM.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
package/dist/eventcatalog.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from "./chunk-XE6PFSH5.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-UG5JRBOA.js";
|
|
10
|
+
import "./chunk-BTQCPTER.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-
|
|
18
|
+
} from "./chunk-SDBKZ3UM.js";
|
|
19
19
|
import {
|
|
20
20
|
isAuthEnabled,
|
|
21
21
|
isBackstagePluginEnabled,
|
|
@@ -12,7 +12,7 @@ import { getAbsoluteFilePathForAstroFile } from '@utils/files';
|
|
|
12
12
|
let schemas = [];
|
|
13
13
|
|
|
14
14
|
try {
|
|
15
|
-
const absoluteFilePath = getAbsoluteFilePathForAstroFile(filePath);
|
|
15
|
+
const absoluteFilePath = getAbsoluteFilePathForAstroFile(filePath, filePath.split(path.sep).pop());
|
|
16
16
|
const file = await fs.readFile(absoluteFilePath, 'utf-8');
|
|
17
17
|
const schemaViewers = getMDXComponentsByName(file, 'SchemaViewer');
|
|
18
18
|
|
|
@@ -2,6 +2,11 @@ import path from 'node:path';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Using the Astro filePath, this returns the absolute path to the file
|
|
5
|
+
*
|
|
6
|
+
* The astro file path does not return the absolute path to the file, it returns the relative path to the file.
|
|
7
|
+
*
|
|
8
|
+
* This function will return the absolute path to the file, and it will also remove any overlapping path segments, issues seen with local development and also docker
|
|
9
|
+
*
|
|
5
10
|
* @param filePath
|
|
6
11
|
* @returns
|
|
7
12
|
*/
|
|
@@ -9,9 +14,30 @@ export const getAbsoluteFilePathForAstroFile = (filePath: string, fileName?: str
|
|
|
9
14
|
const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
|
|
10
15
|
|
|
11
16
|
if (fileName) {
|
|
12
|
-
const
|
|
13
|
-
|
|
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 || '');
|
|
39
|
+
return path.join(directory, fileName);
|
|
14
40
|
}
|
|
15
41
|
|
|
16
|
-
return path.join(PROJECT_DIR,
|
|
42
|
+
return path.join(PROJECT_DIR, filePath);
|
|
17
43
|
};
|