@eventcatalog/core 4.11.2 → 4.12.0-beta.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 +17 -11
- package/dist/analytics/log-build.js +4 -4
- package/dist/astro-config-path.cjs +51 -0
- package/dist/astro-config-path.d.cts +6 -0
- package/dist/astro-config-path.d.ts +6 -0
- package/dist/astro-config-path.js +6 -0
- package/dist/catalog-runtime.cjs +136 -0
- package/dist/catalog-runtime.d.cts +12 -0
- package/dist/catalog-runtime.d.ts +12 -0
- package/dist/catalog-runtime.js +8 -0
- package/dist/{chunk-B7HCX5HM.js → chunk-3SJDIENM.js} +1 -1
- package/dist/{chunk-AFPH6ERZ.js → chunk-5QRWGO2E.js} +1 -1
- package/dist/{chunk-6U72KINX.js → chunk-DJCOJ77J.js} +1 -0
- package/dist/{chunk-LHR4G2UO.js → chunk-EEZXGNF6.js} +1 -1
- package/dist/{chunk-XMRPNDXB.js → chunk-ISBBAOCD.js} +1 -1
- package/dist/{chunk-Z6OKCHWL.js → chunk-IUPFEQMU.js} +2 -2
- package/dist/{chunk-6QENHZZP.js → chunk-JE6RX7SJ.js} +11 -5
- package/dist/{chunk-LAWEGSJH.js → chunk-LU4GFIHH.js} +1 -1
- package/dist/{chunk-2YJRF4ZX.js → chunk-RYPZGCRN.js} +1 -1
- package/dist/chunk-SAN4U2WU.js +96 -0
- package/dist/{chunk-EGH3ALRY.js → chunk-TVLJNFDW.js} +4 -4
- package/dist/chunk-U63GDPPY.js +14 -0
- package/dist/chunk-VIJJ7JKH.js +17 -0
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog-config-file-utils.cjs +13 -7
- package/dist/eventcatalog-config-file-utils.d.cts +86 -2
- package/dist/eventcatalog-config-file-utils.d.ts +86 -2
- package/dist/eventcatalog-config-file-utils.js +1 -1
- package/dist/eventcatalog.cjs +227 -561
- package/dist/eventcatalog.js +62 -71
- package/dist/features.cjs +10 -6
- package/dist/features.js +2 -2
- package/dist/federation/federate.cjs +110 -106
- package/dist/federation/federate.js +4 -4
- package/dist/generate.cjs +11 -7
- package/dist/generate.js +4 -4
- package/dist/resolve-catalog-dependencies.cjs +12 -8
- package/dist/resolve-catalog-dependencies.js +2 -2
- package/dist/runtime-dependencies/@ai-sdk__react.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__markdown-remark.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__mdx.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__node.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__react.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__rss.mjs +3 -0
- package/dist/runtime-dependencies/@asyncapi__avro-schema-parser.mjs +3 -0
- package/dist/runtime-dependencies/@asyncapi__parser.mjs +3 -0
- package/dist/runtime-dependencies/@asyncapi__react-component.mjs +3 -0
- package/dist/runtime-dependencies/@asyncapi__react-component__styles__default.min.css.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__auth0.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__github.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__google.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__microsoft-entra-id.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__okta.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__types.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__license.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__linter.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__sdk.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__visualiser.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__visualiser__styles-core.css.mjs +3 -0
- package/dist/runtime-dependencies/@fontsource__inter.mjs +3 -0
- package/dist/runtime-dependencies/@fontsource__inter__400.css.mjs +3 -0
- package/dist/runtime-dependencies/@fontsource__inter__700.css.mjs +3 -0
- package/dist/runtime-dependencies/@headlessui__react.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__16__solid__EnvelopeIcon.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__20__solid.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__outline.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__outline__MagnifyingGlassIcon.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__outline__RectangleGroupIcon.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__outline__ServerIcon.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__solid.mjs +3 -0
- package/dist/runtime-dependencies/@iconify-json__logos.mjs +3 -0
- package/dist/runtime-dependencies/@mermaid-js__layout-elk.mjs +3 -0
- package/dist/runtime-dependencies/@mermaid-js__layout-elk__dist__mermaid-layout-elk.core.mjs.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__sdk.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__sdk__server__mcp.js.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__sdk__server__webStandardStreamableHttp.js.mjs +3 -0
- package/dist/runtime-dependencies/@nanostores__react.mjs +3 -0
- package/dist/runtime-dependencies/@parcel__watcher.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-context-menu.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-dialog.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-dropdown-menu.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-popover.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-tooltip.mjs +3 -0
- package/dist/runtime-dependencies/@scalar__api-reference-react.mjs +3 -0
- package/dist/runtime-dependencies/@scalar__api-reference-react__style.css.mjs +3 -0
- package/dist/runtime-dependencies/@tailwindcss__typography.mjs +3 -0
- package/dist/runtime-dependencies/@tailwindcss__vite.mjs +3 -0
- package/dist/runtime-dependencies/@tanstack__react-table.mjs +3 -0
- package/dist/runtime-dependencies/@xyflow__react.mjs +3 -0
- package/dist/runtime-dependencies/@xyflow__react__dist__style.css.mjs +3 -0
- package/dist/runtime-dependencies/ai.mjs +3 -0
- package/dist/runtime-dependencies/astro-expressive-code.mjs +3 -0
- package/dist/runtime-dependencies/astro-expressive-code__components.mjs +3 -0
- package/dist/runtime-dependencies/astro-seo.mjs +3 -0
- package/dist/runtime-dependencies/astro.mjs +3 -0
- package/dist/runtime-dependencies/astro__assets__services__sharp.mjs +3 -0
- package/dist/runtime-dependencies/astro__config.mjs +3 -0
- package/dist/runtime-dependencies/astro__jsx-runtime.mjs +3 -0
- package/dist/runtime-dependencies/astro__loaders.mjs +3 -0
- package/dist/runtime-dependencies/astro__logger__node.mjs +3 -0
- package/dist/runtime-dependencies/astro__types.mjs +3 -0
- package/dist/runtime-dependencies/astro__zod.mjs +3 -0
- package/dist/runtime-dependencies/auth-astro.mjs +3 -0
- package/dist/runtime-dependencies/auth-astro__client.mjs +3 -0
- package/dist/runtime-dependencies/auth-astro__server.mjs +3 -0
- package/dist/runtime-dependencies/boxen.mjs +3 -0
- package/dist/runtime-dependencies/commander.mjs +3 -0
- package/dist/runtime-dependencies/cross-env.mjs +3 -0
- package/dist/runtime-dependencies/d3-drag.mjs +3 -0
- package/dist/runtime-dependencies/d3-force.mjs +3 -0
- package/dist/runtime-dependencies/d3-selection.mjs +3 -0
- package/dist/runtime-dependencies/d3-zoom.mjs +3 -0
- package/dist/runtime-dependencies/dagre.mjs +3 -0
- package/dist/runtime-dependencies/diff.mjs +3 -0
- package/dist/runtime-dependencies/diff2html.mjs +3 -0
- package/dist/runtime-dependencies/diff2html__bundles__css__diff2html.min.css.mjs +3 -0
- package/dist/runtime-dependencies/dotenv.mjs +3 -0
- package/dist/runtime-dependencies/elkjs.mjs +3 -0
- package/dist/runtime-dependencies/elkjs__lib__elk.bundled.js.mjs +3 -0
- package/dist/runtime-dependencies/glob.mjs +3 -0
- package/dist/runtime-dependencies/gray-matter.mjs +3 -0
- package/dist/runtime-dependencies/hono.mjs +3 -0
- package/dist/runtime-dependencies/html-to-image.mjs +3 -0
- package/dist/runtime-dependencies/js-yaml.mjs +3 -0
- package/dist/runtime-dependencies/jsonpath-plus.mjs +3 -0
- package/dist/runtime-dependencies/jsonwebtoken.mjs +3 -0
- package/dist/runtime-dependencies/lodash.debounce.mjs +3 -0
- package/dist/runtime-dependencies/lodash.merge.mjs +3 -0
- package/dist/runtime-dependencies/lucide-react.mjs +3 -0
- package/dist/runtime-dependencies/manifest.json +136 -0
- package/dist/runtime-dependencies/marked.mjs +3 -0
- package/dist/runtime-dependencies/mdast-util-find-and-replace.mjs +3 -0
- package/dist/runtime-dependencies/mermaid.mjs +3 -0
- package/dist/runtime-dependencies/minisearch.mjs +3 -0
- package/dist/runtime-dependencies/nanostores.mjs +3 -0
- package/dist/runtime-dependencies/pagefind.mjs +3 -0
- package/dist/runtime-dependencies/pako.mjs +3 -0
- package/dist/runtime-dependencies/parse5.mjs +3 -0
- package/dist/runtime-dependencies/picocolors.mjs +3 -0
- package/dist/runtime-dependencies/picomatch.mjs +3 -0
- package/dist/runtime-dependencies/react-dom.mjs +3 -0
- package/dist/runtime-dependencies/react-dom__client.mjs +3 -0
- package/dist/runtime-dependencies/react-dom__server.mjs +3 -0
- package/dist/runtime-dependencies/react-markdown.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__cjs__styles__prism.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__cjs__styles__prism__index.js.mjs +3 -0
- package/dist/runtime-dependencies/react.mjs +3 -0
- package/dist/runtime-dependencies/react__jsx-dev-runtime.mjs +3 -0
- package/dist/runtime-dependencies/react__jsx-runtime.mjs +3 -0
- package/dist/runtime-dependencies/recast.mjs +3 -0
- package/dist/runtime-dependencies/recast__parsers__babel.js.mjs +3 -0
- package/dist/runtime-dependencies/rehype-autolink-headings.mjs +3 -0
- package/dist/runtime-dependencies/rehype-expressive-code.mjs +3 -0
- package/dist/runtime-dependencies/rehype-expressive-code__hast.mjs +3 -0
- package/dist/runtime-dependencies/rehype-slug.mjs +3 -0
- package/dist/runtime-dependencies/remark-comment.mjs +3 -0
- package/dist/runtime-dependencies/remark-directive.mjs +3 -0
- package/dist/runtime-dependencies/remark-gfm.mjs +3 -0
- package/dist/runtime-dependencies/rimraf.mjs +3 -0
- package/dist/runtime-dependencies/semver.mjs +3 -0
- package/dist/runtime-dependencies/shelljs.mjs +3 -0
- package/dist/runtime-dependencies/sonner.mjs +3 -0
- package/dist/runtime-dependencies/sql.js.mjs +3 -0
- package/dist/runtime-dependencies/tailwindcss.mjs +3 -0
- package/dist/runtime-dependencies/typescript.mjs +3 -0
- package/dist/runtime-dependencies/unist-util-visit.mjs +3 -0
- package/dist/runtime-dependencies/update-notifier.mjs +3 -0
- package/dist/runtime-dependencies/uuid.mjs +3 -0
- package/dist/runtime-dependencies/zod.mjs +3 -0
- package/dist/runtime-dependencies/zod__v4.mjs +3 -0
- package/dist/search-indexer.cjs +1 -0
- package/dist/search-indexer.js +1 -1
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/dist/watcher.cjs +5 -204
- package/dist/watcher.js +1 -2
- package/eventcatalog/astro.config.mjs +57 -31
- package/eventcatalog/integrations/catalog-assets.mjs +204 -0
- package/eventcatalog/integrations/config-loader.mjs +85 -0
- package/eventcatalog/integrations/ecstudio-watcher.mjs +11 -9
- package/eventcatalog/integrations/eventcatalog-runtime.mjs +252 -0
- package/eventcatalog/integrations/expressive-code-config.mjs +6 -0
- package/eventcatalog/integrations/runtime-dependencies.mjs +49 -0
- package/eventcatalog/integrations/runtime-dependency-manifest.mjs +15 -0
- package/eventcatalog/integrations/runtime-paths.mjs +16 -0
- package/eventcatalog/src/content.config.ts +33 -46
- package/eventcatalog/src/enterprise/custom-pages/routes.ts +3 -2
- package/eventcatalog/src/enterprise/feature.ts +2 -1
- package/eventcatalog/src/enterprise/fields/field-indexer.ts +5 -2
- package/eventcatalog/src/enterprise/fields/pages/api/fields.ts +4 -3
- package/eventcatalog/src/enterprise/integrations/eventcatalog-features.ts +32 -32
- package/eventcatalog/src/enterprise/mcp/mcp-auth.ts +1 -1
- package/eventcatalog/src/env.d.ts +7 -1
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +15 -3
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +1 -1
- package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/index.astro +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +1 -1
- package/eventcatalog/src/pages/docs/teams/[id]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/users/[id]/index.astro +2 -2
- package/eventcatalog/src/pages/index.astro +2 -3
- package/eventcatalog/src/styles/tailwind.css +3 -0
- package/eventcatalog/src/utils/eventcatalog-config/source.ts +9 -0
- package/eventcatalog/src/utils/feature.ts +2 -1
- package/eventcatalog/tsconfig.json +1 -4
- package/package.json +17 -4
- package/dist/catalog-to-astro-content-directory.cjs +0 -382
- package/dist/catalog-to-astro-content-directory.d.cts +0 -3
- package/dist/catalog-to-astro-content-directory.d.ts +0 -3
- package/dist/catalog-to-astro-content-directory.js +0 -9
- package/dist/chunk-BWN544LB.js +0 -73
- package/dist/chunk-DHH5U5PF.js +0 -53
- package/dist/chunk-KLOHNCNF.js +0 -101
- package/dist/chunk-T4RVWPIQ.js +0 -85
- package/dist/chunk-T5IUG523.js +0 -54
- package/dist/chunk-W5JQON7Z.js +0 -117
- package/dist/copy-core.cjs +0 -88
- package/dist/copy-core.d.cts +0 -4
- package/dist/copy-core.d.ts +0 -4
- package/dist/copy-core.js +0 -8
- package/dist/core-node-modules.cjs +0 -108
- package/dist/core-node-modules.d.cts +0 -7
- package/dist/core-node-modules.d.ts +0 -7
- package/dist/core-node-modules.js +0 -8
- package/dist/custom-components.cjs +0 -89
- package/dist/custom-components.d.cts +0 -4
- package/dist/custom-components.d.ts +0 -4
- package/dist/custom-components.js +0 -8
- package/dist/map-catalog-to-astro.cjs +0 -151
- package/dist/map-catalog-to-astro.d.cts +0 -28
- package/dist/map-catalog-to-astro.d.ts +0 -28
- package/dist/map-catalog-to-astro.js +0 -6
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { searchForWorkspaceRoot } from 'vite';
|
|
5
|
+
|
|
6
|
+
export const packageDirectory = fileURLToPath(new URL('../', import.meta.url));
|
|
7
|
+
|
|
8
|
+
export function getDevServerFileSystem({ projectDirectory, coreDirectory = packageDirectory }) {
|
|
9
|
+
// A linked Core can belong to a different workspace than the catalog. pnpm
|
|
10
|
+
// resolves its dependencies into that workspace's node_modules, outside Core
|
|
11
|
+
// itself. Preserve Vite's workspace boundary for both roots, including their
|
|
12
|
+
// real paths, instead of assuming dependencies are relative to process.cwd().
|
|
13
|
+
const allow = [projectDirectory, coreDirectory].flatMap((directory) => {
|
|
14
|
+
const absolute = path.resolve(directory);
|
|
15
|
+
const real = fs.realpathSync(absolute);
|
|
16
|
+
return [absolute, real, searchForWorkspaceRoot(real)];
|
|
17
|
+
});
|
|
18
|
+
return { strict: true, allow: [...new Set(allow)] };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Match Astro's file-based routing conventions, including endpoint suffixes
|
|
22
|
+
// (e.g. llms.txt.ts) and underscore-prefixed helpers beside page entrypoints.
|
|
23
|
+
export function getPackageRoutes(pagesDirectory = path.join(packageDirectory, 'src/pages')) {
|
|
24
|
+
const routes = [];
|
|
25
|
+
const visit = (directory, segments = []) => {
|
|
26
|
+
for (const entry of fs.readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
27
|
+
if (entry.name.startsWith('_') || (entry.name.startsWith('.') && !(entry.isDirectory() && entry.name === '.well-known')))
|
|
28
|
+
continue;
|
|
29
|
+
const entrypoint = path.join(directory, entry.name);
|
|
30
|
+
if (entry.isDirectory()) {
|
|
31
|
+
visit(entrypoint, [...segments, entry.name]);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (!entry.isFile() || !/\.(astro|md|mdx|js|ts)$/.test(entry.name)) continue;
|
|
35
|
+
if (/\.(test|spec|d)\.ts$/.test(entry.name)) continue;
|
|
36
|
+
const name = entry.name.replace(/\.(astro|md|mdx|js|ts)$/, '');
|
|
37
|
+
const parts = name === 'index' ? segments : [...segments, name];
|
|
38
|
+
routes.push({ pattern: `/${parts.join('/')}`, entrypoint });
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
visit(pagesDirectory);
|
|
42
|
+
return routes;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function getRuntimeAliases({ projectDirectory, runtimeDirectory, coreDirectory = packageDirectory }) {
|
|
46
|
+
// Keep package aliases aligned with ../tsconfig.json, ../../vitest.config.js
|
|
47
|
+
// and ../../../../examples/default/tsconfig.json. src/catalog-runtime.ts derives
|
|
48
|
+
// type-check paths from that tsconfig and overrides catalog-owned entries.
|
|
49
|
+
const source = (relative) => path.join(coreDirectory, 'src', relative);
|
|
50
|
+
return [
|
|
51
|
+
{ find: /^@config$/, replacement: path.join(projectDirectory, 'eventcatalog.config.js') },
|
|
52
|
+
{ find: /^@eventcatalog$/, replacement: source('utils/eventcatalog-config/catalog.ts') },
|
|
53
|
+
{ find: '@icons', replacement: source('icons') },
|
|
54
|
+
{ find: '@components', replacement: source('components') },
|
|
55
|
+
{ find: '@catalog/layouts', replacement: source('toolkit/layouts') },
|
|
56
|
+
{ find: /^@catalog\/utils$/, replacement: source('toolkit/utils/index.ts') },
|
|
57
|
+
{ find: '@catalog/utils', replacement: source('toolkit/utils') },
|
|
58
|
+
{ find: '@catalog/snippets', replacement: path.join(projectDirectory, 'snippets') },
|
|
59
|
+
{ find: /^@types$/, replacement: source('types/index.ts') },
|
|
60
|
+
{ find: '@utils', replacement: source('utils') },
|
|
61
|
+
{ find: '@layouts', replacement: source('layouts') },
|
|
62
|
+
{ find: '@enterprise', replacement: source('enterprise') },
|
|
63
|
+
{ find: /^auth:config$/, replacement: path.join(coreDirectory, 'auth.config.ts') },
|
|
64
|
+
{ find: '@stores', replacement: source('stores') },
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function packageDependenciesPlugin(coreDirectory = packageDirectory) {
|
|
69
|
+
const packageFile = path.join(coreDirectory, '../package.json');
|
|
70
|
+
const { dependencies = {} } = JSON.parse(fs.readFileSync(packageFile, 'utf-8'));
|
|
71
|
+
return {
|
|
72
|
+
name: 'eventcatalog:package-dependencies',
|
|
73
|
+
enforce: 'post',
|
|
74
|
+
async resolveId(source, importer, options) {
|
|
75
|
+
const dependency = source.startsWith('@') ? source.split('/').slice(0, 2).join('/') : source.split('/')[0];
|
|
76
|
+
if (!(dependency in dependencies)) return;
|
|
77
|
+
// pnpm does not hoist Core's dependencies into the catalog's node_modules.
|
|
78
|
+
// Resolve through Vite to preserve package exports and browser conditions.
|
|
79
|
+
return this.resolve(source, packageFile, { ...options, skipSelf: true });
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function userConfigPlugin(projectDirectory, coreDirectory = packageDirectory) {
|
|
85
|
+
const sourceModule = path.join(coreDirectory, 'src/utils/eventcatalog-config/source.ts');
|
|
86
|
+
return {
|
|
87
|
+
name: 'eventcatalog:user-config',
|
|
88
|
+
enforce: 'pre',
|
|
89
|
+
load(id) {
|
|
90
|
+
if (path.normalize(id.split('?')[0]) !== path.normalize(sourceModule)) return;
|
|
91
|
+
// Bundle the user's configuration into the application. The config-time
|
|
92
|
+
// loader uses a dynamic import, which must not survive into deployed SSR.
|
|
93
|
+
return `export { default } from ${JSON.stringify(path.join(projectDirectory, 'eventcatalog.config.js'))};`;
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function catalogStylesPlugin(projectDirectory, runtimeDirectory, coreDirectory = packageDirectory) {
|
|
99
|
+
const stylesheet = path.join(coreDirectory, 'src/styles/tailwind.css');
|
|
100
|
+
return {
|
|
101
|
+
name: 'eventcatalog:catalog-styles',
|
|
102
|
+
enforce: 'pre',
|
|
103
|
+
load(id) {
|
|
104
|
+
if (path.normalize(id.split('?')[0]) !== path.normalize(stylesheet)) return;
|
|
105
|
+
// Tailwind skips ignored folders and node_modules by default. Explicitly
|
|
106
|
+
// include user components and Markdown/MDX classes at their source.
|
|
107
|
+
const sources = [projectDirectory];
|
|
108
|
+
return `${fs.readFileSync(stylesheet, 'utf-8')}\n${sources
|
|
109
|
+
.map((source) => `@source ${JSON.stringify(source.replace(/\\/g, '/'))};`)
|
|
110
|
+
.join('\n')}\n`;
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const isWithin = (file, directory) => file === directory || file.startsWith(`${directory}${path.sep}`);
|
|
116
|
+
const toModuleId = (file) => file.replace(/\\/g, '/');
|
|
117
|
+
|
|
118
|
+
export function customSourcesPlugin(projectDirectory) {
|
|
119
|
+
const localDirectory = path.join(projectDirectory, 'components');
|
|
120
|
+
const federatedDirectory = path.join(projectDirectory, 'federated/components');
|
|
121
|
+
const stylePath = path.join(projectDirectory, 'eventcatalog.styles.css');
|
|
122
|
+
const emptyStyles = '\0eventcatalog:empty-styles.css';
|
|
123
|
+
const homepageModule = '\0virtual:eventcatalog/homepage';
|
|
124
|
+
const homepage = path.join(projectDirectory, 'pages/homepage.astro');
|
|
125
|
+
const resolveFile = (file) => {
|
|
126
|
+
const candidates = [
|
|
127
|
+
file,
|
|
128
|
+
...['.astro', '.tsx', '.ts', '.jsx', '.js', '.mjs', '.mdx', '.md'].map((extension) => file + extension),
|
|
129
|
+
];
|
|
130
|
+
for (const candidate of candidates) {
|
|
131
|
+
if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return candidate;
|
|
132
|
+
}
|
|
133
|
+
if (fs.existsSync(file) && fs.statSync(file).isDirectory()) {
|
|
134
|
+
return resolveFile(path.join(file, 'index'));
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
return {
|
|
138
|
+
name: 'eventcatalog:custom-sources',
|
|
139
|
+
enforce: 'pre',
|
|
140
|
+
configureServer(server) {
|
|
141
|
+
const componentDirectories = [localDirectory, federatedDirectory];
|
|
142
|
+
const knownFiles = new Set();
|
|
143
|
+
const scan = (directory) => {
|
|
144
|
+
if (!fs.existsSync(directory) || !fs.statSync(directory).isDirectory()) return;
|
|
145
|
+
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
146
|
+
const file = path.join(directory, entry.name);
|
|
147
|
+
if (entry.isDirectory()) scan(file);
|
|
148
|
+
else knownFiles.add(file);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
for (const directory of componentDirectories) scan(directory);
|
|
152
|
+
|
|
153
|
+
let restartTimer;
|
|
154
|
+
const scheduleRestart = () => {
|
|
155
|
+
clearTimeout(restartTimer);
|
|
156
|
+
// A newly added local override changes the resolution of an existing
|
|
157
|
+
// federated import. Restart Vite after coalescing filesystem events so
|
|
158
|
+
// its module graph is rebuilt against the current overlay.
|
|
159
|
+
restartTimer = setTimeout(() => {
|
|
160
|
+
server.restart().catch((error) => server.config.logger.error(`[EventCatalog] ${error.message}`));
|
|
161
|
+
}, 50);
|
|
162
|
+
};
|
|
163
|
+
const onAdd = (file) => {
|
|
164
|
+
file = path.resolve(file);
|
|
165
|
+
if (!componentDirectories.some((directory) => isWithin(file, directory)) || knownFiles.has(file)) return;
|
|
166
|
+
knownFiles.add(file);
|
|
167
|
+
scheduleRestart();
|
|
168
|
+
};
|
|
169
|
+
const onUnlink = (file) => {
|
|
170
|
+
if (!knownFiles.delete(path.resolve(file))) return;
|
|
171
|
+
scheduleRestart();
|
|
172
|
+
};
|
|
173
|
+
const cleanup = () => {
|
|
174
|
+
clearTimeout(restartTimer);
|
|
175
|
+
server.watcher.off('add', onAdd);
|
|
176
|
+
server.watcher.off('unlink', onUnlink);
|
|
177
|
+
server.watcher.off('close', cleanup);
|
|
178
|
+
server.httpServer?.off('close', cleanup);
|
|
179
|
+
};
|
|
180
|
+
server.watcher.on('add', onAdd);
|
|
181
|
+
server.watcher.on('unlink', onUnlink);
|
|
182
|
+
server.watcher.once('close', cleanup);
|
|
183
|
+
server.httpServer?.once('close', cleanup);
|
|
184
|
+
server.watcher.add(componentDirectories);
|
|
185
|
+
},
|
|
186
|
+
resolveId(id, importer) {
|
|
187
|
+
if (id === 'virtual:eventcatalog/homepage') return homepageModule;
|
|
188
|
+
if (id === '@catalog/styles') return fs.existsSync(stylePath) ? toModuleId(stylePath) : emptyStyles;
|
|
189
|
+
// Astro can turn an import from an original user component into a
|
|
190
|
+
// root-relative URL (e.g. /components/Card.astro?astro&type=style). Vite's
|
|
191
|
+
// root is Core, so retry those URL paths against the catalog. This is not
|
|
192
|
+
// a filesystem-drive-path rewrite; URL paths use '/' on Windows too.
|
|
193
|
+
if (id.startsWith('/') && !id.startsWith('/@') && !fs.existsSync(id.split('?')[0])) {
|
|
194
|
+
const [source, query] = id.split('?');
|
|
195
|
+
const projectFile = path.resolve(projectDirectory, `.${source}`);
|
|
196
|
+
if (fs.existsSync(projectFile) && fs.statSync(projectFile).isFile()) {
|
|
197
|
+
// Astro normalizes compiler filenames to forward slashes. Keep Vite's
|
|
198
|
+
// module IDs identical so its client-script manifest uses the same keys.
|
|
199
|
+
return toModuleId(projectFile) + (query === undefined ? '' : `?${query}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const [source, query] = id.split('?');
|
|
203
|
+
let relative;
|
|
204
|
+
if (source.startsWith('@catalog/components/')) {
|
|
205
|
+
relative = source.slice('@catalog/components/'.length);
|
|
206
|
+
} else if (source.startsWith('.') && importer) {
|
|
207
|
+
const parent = path.normalize(importer.split('?')[0]);
|
|
208
|
+
const directory = [localDirectory, federatedDirectory].find((directory) => isWithin(parent, directory));
|
|
209
|
+
if (directory) relative = path.relative(directory, path.resolve(path.dirname(parent), source));
|
|
210
|
+
}
|
|
211
|
+
if (relative === undefined) return;
|
|
212
|
+
const local = path.resolve(localDirectory, relative);
|
|
213
|
+
const federated = path.resolve(federatedDirectory, relative);
|
|
214
|
+
if (!isWithin(local, localDirectory) || !isWithin(federated, federatedDirectory)) return;
|
|
215
|
+
const resolved = resolveFile(local) || resolveFile(federated);
|
|
216
|
+
return resolved ? toModuleId(resolved) + (query === undefined ? '' : `?${query}`) : undefined;
|
|
217
|
+
},
|
|
218
|
+
load(id) {
|
|
219
|
+
if (id === emptyStyles) return '';
|
|
220
|
+
if (id === homepageModule) {
|
|
221
|
+
return fs.existsSync(homepage)
|
|
222
|
+
? `export { default } from ${JSON.stringify(toModuleId(homepage))};`
|
|
223
|
+
: 'export default null;';
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export default function eventCatalogRuntime({ projectDirectory, runtimeDirectory }) {
|
|
230
|
+
return {
|
|
231
|
+
name: 'eventcatalog:runtime',
|
|
232
|
+
hooks: {
|
|
233
|
+
'astro:config:setup': ({ injectRoute, updateConfig, addWatchFile }) => {
|
|
234
|
+
for (const route of getPackageRoutes()) injectRoute(route);
|
|
235
|
+
addWatchFile(path.join(projectDirectory, 'eventcatalog.config.js'));
|
|
236
|
+
addWatchFile(path.join(projectDirectory, 'eventcatalog.styles.css'));
|
|
237
|
+
addWatchFile(path.join(projectDirectory, 'pages/homepage.astro'));
|
|
238
|
+
updateConfig({
|
|
239
|
+
vite: {
|
|
240
|
+
resolve: { alias: getRuntimeAliases({ projectDirectory, runtimeDirectory }) },
|
|
241
|
+
plugins: [
|
|
242
|
+
userConfigPlugin(projectDirectory),
|
|
243
|
+
catalogStylesPlugin(projectDirectory, runtimeDirectory),
|
|
244
|
+
customSourcesPlugin(projectDirectory),
|
|
245
|
+
packageDependenciesPlugin(),
|
|
246
|
+
],
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
const dependenciesDirectory = new URL('../../dist/runtime-dependencies/', import.meta.url);
|
|
4
|
+
|
|
5
|
+
export function getRuntimeDependencyPath(specifier, environment, manifest, directory = dependenciesDirectory) {
|
|
6
|
+
if (!Object.hasOwn(manifest, specifier)) return specifier;
|
|
7
|
+
if ((specifier === 'astro' || specifier.startsWith('astro/')) && specifier !== 'astro/assets/services/sharp') return specifier;
|
|
8
|
+
if (/^@astrojs\/(react|node|internal-helpers)(?:\/|$)/.test(specifier)) return specifier;
|
|
9
|
+
const filename = manifest[specifier];
|
|
10
|
+
// Prerender imports need file URLs so Windows drive paths remain valid ESM.
|
|
11
|
+
// Prerender artifacts are temporary. Deployed SSR uses public package
|
|
12
|
+
// specifiers that survive moving/reinstalling the app.
|
|
13
|
+
return environment === 'prerender'
|
|
14
|
+
? new URL(filename, directory).href
|
|
15
|
+
: `@eventcatalog/core/dist/runtime-dependencies/${filename}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function runtimeDependencies() {
|
|
19
|
+
const manifest = JSON.parse(fs.readFileSync(new URL('manifest.json', dependenciesDirectory), 'utf-8'));
|
|
20
|
+
return {
|
|
21
|
+
name: 'eventcatalog:runtime-dependencies',
|
|
22
|
+
apply: 'build',
|
|
23
|
+
enforce: 'pre',
|
|
24
|
+
async resolveId(source, importer, options) {
|
|
25
|
+
if (this.environment.name !== 'prerender' || options.kind !== 'require-call') return;
|
|
26
|
+
const dependencyUrl = getRuntimeDependencyPath(source, 'prerender', manifest);
|
|
27
|
+
if (dependencyUrl === source) return;
|
|
28
|
+
const resolved = await this.resolve(source, importer, { ...options, skipSelf: true });
|
|
29
|
+
if (!resolved?.external) return;
|
|
30
|
+
// Node's require() needs a filesystem path, while ESM imports below need
|
|
31
|
+
// file URLs. Keep this ID distinct so output.paths leaves it untouched.
|
|
32
|
+
return { id: fileURLToPath(dependencyUrl), external: 'absolute' };
|
|
33
|
+
},
|
|
34
|
+
configEnvironment(name) {
|
|
35
|
+
if (name !== 'ssr' && name !== 'prerender') return;
|
|
36
|
+
return {
|
|
37
|
+
build: {
|
|
38
|
+
rolldownOptions: {
|
|
39
|
+
output: {
|
|
40
|
+
paths(specifier) {
|
|
41
|
+
return getRuntimeDependencyPath(specifier, name, manifest);
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function createRuntimeDependencyManifest(specifiers) {
|
|
2
|
+
const manifest = Object.create(null);
|
|
3
|
+
const filenames = new Map();
|
|
4
|
+
for (const specifier of [...new Set(specifiers)].sort()) {
|
|
5
|
+
// These characters have filesystem/URL meaning even without slash encoding.
|
|
6
|
+
if (/[\\%?#:]/.test(specifier)) throw new Error(`Unsupported runtime dependency specifier: ${specifier}`);
|
|
7
|
+
const filename = `${specifier.replaceAll('/', '__')}.mjs`;
|
|
8
|
+
const key = filename.toLowerCase();
|
|
9
|
+
const existing = filenames.get(key);
|
|
10
|
+
if (existing) throw new Error(`Runtime dependency filename collision: ${existing} and ${specifier} both map to ${filename}`);
|
|
11
|
+
filenames.set(key, specifier);
|
|
12
|
+
manifest[specifier] = filename;
|
|
13
|
+
}
|
|
14
|
+
return manifest;
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
// Shared by the CLI, Astro integrations, development scripts and runtime readers.
|
|
4
|
+
// Callers pass CATALOG_DIR explicitly when consuming the CLI's selected runtime;
|
|
5
|
+
// the CLI itself always selects the cache under its user's project.
|
|
6
|
+
export function getRuntimePaths(projectDirectory, runtimeDirectory) {
|
|
7
|
+
const project = path.resolve(projectDirectory);
|
|
8
|
+
const cacheDirectory = path.join(project, '.astro');
|
|
9
|
+
const runtime = runtimeDirectory ? path.resolve(runtimeDirectory) : path.join(cacheDirectory, 'eventcatalog');
|
|
10
|
+
return {
|
|
11
|
+
projectDirectory: project,
|
|
12
|
+
cacheDirectory,
|
|
13
|
+
runtimeDirectory: runtime,
|
|
14
|
+
fieldsDatabasePath: path.join(runtime, '.eventcatalog', 'fields.db'),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -15,30 +15,15 @@ import { withExtensionProperties } from './utils/collections/extension-propertie
|
|
|
15
15
|
// Enterprise Collections
|
|
16
16
|
import { customPagesSchema, resourceDocsSchema, resourceDocCategoriesSchema } from './enterprise/collections';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// If CATALOG_DIR is set (monorepo mode), compute relative path from catalog to project
|
|
23
|
-
// Otherwise fall back to absolute path (standalone mode)
|
|
24
|
-
if (catalogDir && projectDir) {
|
|
25
|
-
const relativePath = path.relative(catalogDir, projectDir);
|
|
26
|
-
// Ensure forward slashes for consistency
|
|
27
|
-
return relativePath.replace(/\\/g, '/');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Fallback to absolute path
|
|
31
|
-
if (process.platform === 'win32' && projectDir) {
|
|
32
|
-
const projectDirPath = projectDir.replace(/\\/g, '/');
|
|
33
|
-
return projectDirPath.startsWith('/') ? projectDirPath : `/${projectDirPath}`;
|
|
34
|
-
}
|
|
35
|
-
return projectDir;
|
|
36
|
-
})();
|
|
18
|
+
// Astro's root is the user's catalog. Keep loader paths relative to that root,
|
|
19
|
+
// independently of where generated metadata or the installed package lives.
|
|
20
|
+
export const catalogRoot = '.';
|
|
21
|
+
const projectDirectory = path.resolve(process.env.PROJECT_DIR || process.cwd());
|
|
37
22
|
|
|
38
23
|
const pages = defineCollection({
|
|
39
24
|
loader: globWithSafeWatcher({
|
|
40
25
|
pattern: withIgnoredBuildArtifacts(['**/pages/*.(md|mdx)']),
|
|
41
|
-
base:
|
|
26
|
+
base: catalogRoot,
|
|
42
27
|
}),
|
|
43
28
|
schema: z
|
|
44
29
|
.object({
|
|
@@ -125,7 +110,7 @@ const directoryEntrySource = z.object({
|
|
|
125
110
|
const changelogs = defineCollection({
|
|
126
111
|
loader: globWithSafeWatcher({
|
|
127
112
|
pattern: withIgnoredBuildArtifacts(['**/changelog.(md|mdx)']),
|
|
128
|
-
base:
|
|
113
|
+
base: catalogRoot,
|
|
129
114
|
}),
|
|
130
115
|
schema: z.object({
|
|
131
116
|
createdAt: z.date().optional(),
|
|
@@ -266,7 +251,7 @@ const flowStep = z
|
|
|
266
251
|
const flows = defineCollection({
|
|
267
252
|
loader: globWithSafeWatcher({
|
|
268
253
|
pattern: withIgnoredBuildArtifacts(['**/flows/**/index.(md|mdx)', '**/flows/**/versioned/*/index.(md|mdx)']),
|
|
269
|
-
base:
|
|
254
|
+
base: catalogRoot,
|
|
270
255
|
generateId: ({ data }) => {
|
|
271
256
|
return `${data.id}-${data.version}`;
|
|
272
257
|
},
|
|
@@ -378,7 +363,7 @@ const messageDetailsPanelPropertySchema = z.object({
|
|
|
378
363
|
const events = defineCollection({
|
|
379
364
|
loader: globWithSafeWatcher({
|
|
380
365
|
pattern: withIgnoredBuildArtifacts(['**/events/*/index.(md|mdx)', '**/events/*/versioned/*/index.(md|mdx)']),
|
|
381
|
-
base:
|
|
366
|
+
base: catalogRoot,
|
|
382
367
|
generateId: ({ data, ...rest }) => {
|
|
383
368
|
return `${data.id}-${data.version}`;
|
|
384
369
|
},
|
|
@@ -403,7 +388,7 @@ const events = defineCollection({
|
|
|
403
388
|
const commands = defineCollection({
|
|
404
389
|
loader: globWithSafeWatcher({
|
|
405
390
|
pattern: withIgnoredBuildArtifacts(['**/commands/*/index.(md|mdx)', '**/commands/*/versioned/*/index.(md|mdx)']),
|
|
406
|
-
base:
|
|
391
|
+
base: catalogRoot,
|
|
407
392
|
generateId: ({ data }) => {
|
|
408
393
|
return `${data.id}-${data.version}`;
|
|
409
394
|
},
|
|
@@ -428,7 +413,7 @@ const commands = defineCollection({
|
|
|
428
413
|
const queries = defineCollection({
|
|
429
414
|
loader: globWithSafeWatcher({
|
|
430
415
|
pattern: withIgnoredBuildArtifacts(['**/queries/*/index.(md|mdx)', '**/queries/*/versioned/*/index.(md|mdx)']),
|
|
431
|
-
base:
|
|
416
|
+
base: catalogRoot,
|
|
432
417
|
generateId: ({ data }) => {
|
|
433
418
|
return `${data.id}-${data.version}`;
|
|
434
419
|
},
|
|
@@ -465,7 +450,7 @@ const dataProductOutputPointer = z.object({
|
|
|
465
450
|
const dataProducts = defineCollection({
|
|
466
451
|
loader: globWithSafeWatcher({
|
|
467
452
|
pattern: withIgnoredBuildArtifacts(['**/data-products/*/index.(md|mdx)', '**/data-products/*/versioned/*/index.(md|mdx)']),
|
|
468
|
-
base:
|
|
453
|
+
base: catalogRoot,
|
|
469
454
|
generateId: ({ data }) => {
|
|
470
455
|
return `${data.id}-${data.version}`;
|
|
471
456
|
},
|
|
@@ -514,7 +499,7 @@ const services = defineCollection({
|
|
|
514
499
|
'services/*/versioned/*/index.(md|mdx)', // ✅ Capture versioned files inside services
|
|
515
500
|
])
|
|
516
501
|
),
|
|
517
|
-
base:
|
|
502
|
+
base: catalogRoot,
|
|
518
503
|
generateId: ({ data, ...rest }) => {
|
|
519
504
|
return `${data.id}-${data.version}`;
|
|
520
505
|
},
|
|
@@ -564,7 +549,7 @@ const agentModel = z.object({
|
|
|
564
549
|
const agents = defineCollection({
|
|
565
550
|
loader: globWithSafeWatcher({
|
|
566
551
|
pattern: withIgnoredBuildArtifacts(['**/agents/*/index.(md|mdx)', '**/agents/*/versioned/*/index.(md|mdx)']),
|
|
567
|
-
base:
|
|
552
|
+
base: catalogRoot,
|
|
568
553
|
generateId: ({ data }) => {
|
|
569
554
|
return `${data.id}-${data.version}`;
|
|
570
555
|
},
|
|
@@ -628,7 +613,7 @@ const adrResourcePointer = adrPointer.extend({
|
|
|
628
613
|
const adrs = defineCollection({
|
|
629
614
|
loader: globWithSafeWatcher({
|
|
630
615
|
pattern: withIgnoredBuildArtifacts(['**/adrs/*/index.(md|mdx)', '**/adrs/*/versioned/*/index.(md|mdx)']),
|
|
631
|
-
base:
|
|
616
|
+
base: catalogRoot,
|
|
632
617
|
generateId: ({ data }) => `${data.id}-${data.version}`,
|
|
633
618
|
}),
|
|
634
619
|
schema: withExtensionProperties(
|
|
@@ -680,7 +665,7 @@ const dataClassificationEnum = z.enum(['public', 'internal', 'confidential', 're
|
|
|
680
665
|
const containers = defineCollection({
|
|
681
666
|
loader: globWithSafeWatcher({
|
|
682
667
|
pattern: withIgnoredBuildArtifacts(['**/containers/**/index.(md|mdx)', '**/containers/**/versioned/*/index.(md|mdx)']),
|
|
683
|
-
base:
|
|
668
|
+
base: catalogRoot,
|
|
684
669
|
generateId: ({ data }) => {
|
|
685
670
|
return `${data.id}-${data.version}`;
|
|
686
671
|
},
|
|
@@ -723,7 +708,7 @@ const customPages = defineCollection({
|
|
|
723
708
|
loader: globWithSafeWatcher({
|
|
724
709
|
// any number of child folders
|
|
725
710
|
pattern: withIgnoredBuildArtifacts(['docs/*.(md|mdx)', 'docs/**/*.@(md|mdx)']),
|
|
726
|
-
base:
|
|
711
|
+
base: catalogRoot,
|
|
727
712
|
}),
|
|
728
713
|
schema: customPagesSchema,
|
|
729
714
|
});
|
|
@@ -742,7 +727,7 @@ const resourceDocs = defineCollection({
|
|
|
742
727
|
'domains/**/docs/*.@(md|mdx)',
|
|
743
728
|
])
|
|
744
729
|
),
|
|
745
|
-
base:
|
|
730
|
+
base: catalogRoot,
|
|
746
731
|
}),
|
|
747
732
|
schema: resourceDocsSchema,
|
|
748
733
|
});
|
|
@@ -761,7 +746,7 @@ const resourceDocCategories = defineCollection({
|
|
|
761
746
|
'domains/**/docs/_category_.json',
|
|
762
747
|
])
|
|
763
748
|
),
|
|
764
|
-
base:
|
|
749
|
+
base: catalogRoot,
|
|
765
750
|
}),
|
|
766
751
|
schema: resourceDocCategoriesSchema,
|
|
767
752
|
});
|
|
@@ -779,7 +764,7 @@ const domains = defineCollection({
|
|
|
779
764
|
'domains/*/subdomains/*/versioned/*/index.(md|mdx)',
|
|
780
765
|
])
|
|
781
766
|
),
|
|
782
|
-
base:
|
|
767
|
+
base: catalogRoot,
|
|
783
768
|
generateId: ({ data, ...rest }) => {
|
|
784
769
|
return `${data.id}-${data.version}`;
|
|
785
770
|
},
|
|
@@ -860,7 +845,7 @@ const systems = defineCollection({
|
|
|
860
845
|
'!**/systems/**/adrs/**',
|
|
861
846
|
'!**/systems/**/docs/**',
|
|
862
847
|
]),
|
|
863
|
-
base:
|
|
848
|
+
base: catalogRoot,
|
|
864
849
|
generateId: ({ data }) => {
|
|
865
850
|
return `${data.id}-${data.version}`;
|
|
866
851
|
},
|
|
@@ -900,7 +885,7 @@ const systems = defineCollection({
|
|
|
900
885
|
const channels = defineCollection({
|
|
901
886
|
loader: globWithSafeWatcher({
|
|
902
887
|
pattern: withIgnoredBuildArtifacts(['**/channels/**/index.(md|mdx)', '**/channels/**/versioned/*/index.(md|mdx)']),
|
|
903
|
-
base:
|
|
888
|
+
base: catalogRoot,
|
|
904
889
|
generateId: ({ data }) => {
|
|
905
890
|
return `${data.id}-${data.version}`;
|
|
906
891
|
},
|
|
@@ -949,7 +934,7 @@ const ubiquitousLanguages = defineCollection({
|
|
|
949
934
|
pattern: withIgnoredBuildArtifacts(
|
|
950
935
|
withFederatedContent(['domains/*/ubiquitous-language.(md|mdx)', 'domains/*/subdomains/*/ubiquitous-language.(md|mdx)'])
|
|
951
936
|
),
|
|
952
|
-
base:
|
|
937
|
+
base: catalogRoot,
|
|
953
938
|
generateId: ({ data }) => {
|
|
954
939
|
// File has no id, so we need to generate one
|
|
955
940
|
return uuidv4();
|
|
@@ -1013,7 +998,7 @@ const entityPropertySchema: z.ZodType<EntityPropertySchema> = z.lazy(() =>
|
|
|
1013
998
|
const entities = defineCollection({
|
|
1014
999
|
loader: globWithSafeWatcher({
|
|
1015
1000
|
pattern: withIgnoredBuildArtifacts(['**/entities/*/index.(md|mdx)', '**/entities/*/versioned/*/index.(md|mdx)']),
|
|
1016
|
-
base:
|
|
1001
|
+
base: catalogRoot,
|
|
1017
1002
|
generateId: ({ data, ...rest }) => {
|
|
1018
1003
|
return `${data.id}-${data.version}`;
|
|
1019
1004
|
},
|
|
@@ -1045,11 +1030,12 @@ const entities = defineCollection({
|
|
|
1045
1030
|
const users = defineCollection({
|
|
1046
1031
|
loader: userTeamDirectoryLoader({
|
|
1047
1032
|
collection: 'users',
|
|
1033
|
+
storePath: path.join(projectDirectory, '.eventcatalog/store/directory.json'),
|
|
1048
1034
|
sources: config.directory?.sources,
|
|
1049
1035
|
conflictStrategy: config.directory?.conflictStrategy,
|
|
1050
1036
|
local: {
|
|
1051
1037
|
pattern: withIgnoredBuildArtifacts(withFederatedContent('users/*.(md|mdx)')),
|
|
1052
|
-
base:
|
|
1038
|
+
base: catalogRoot,
|
|
1053
1039
|
generateId: ({ data }) => data.id as string,
|
|
1054
1040
|
},
|
|
1055
1041
|
}),
|
|
@@ -1077,11 +1063,12 @@ const users = defineCollection({
|
|
|
1077
1063
|
const teams = defineCollection({
|
|
1078
1064
|
loader: userTeamDirectoryLoader({
|
|
1079
1065
|
collection: 'teams',
|
|
1066
|
+
storePath: path.join(projectDirectory, '.eventcatalog/store/directory.json'),
|
|
1080
1067
|
sources: config.directory?.sources,
|
|
1081
1068
|
conflictStrategy: config.directory?.conflictStrategy,
|
|
1082
1069
|
local: {
|
|
1083
1070
|
pattern: withIgnoredBuildArtifacts(withFederatedContent('teams/*.(md|mdx)')),
|
|
1084
|
-
base:
|
|
1071
|
+
base: catalogRoot,
|
|
1085
1072
|
generateId: ({ data }) => data.id as string,
|
|
1086
1073
|
},
|
|
1087
1074
|
}),
|
|
@@ -1107,12 +1094,12 @@ const teams = defineCollection({
|
|
|
1107
1094
|
|
|
1108
1095
|
const designs = defineCollection({
|
|
1109
1096
|
loader: async () => {
|
|
1110
|
-
const data = await globPackage('**/**/*.ecstudio', { cwd:
|
|
1097
|
+
const data = await globPackage('**/**/*.ecstudio', { cwd: projectDirectory, ignore: ['dist/**', '**/node_modules/**'] });
|
|
1111
1098
|
// File all the files in the designs folder
|
|
1112
1099
|
// Limit 3 designs community edition?
|
|
1113
1100
|
const files = data.reduce<{ id: string; name: string }[]>((acc, filePath) => {
|
|
1114
1101
|
try {
|
|
1115
|
-
const data = fs.readFileSync(path.join(
|
|
1102
|
+
const data = fs.readFileSync(path.join(projectDirectory, filePath), 'utf-8');
|
|
1116
1103
|
const json = JSON.parse(data);
|
|
1117
1104
|
return [...acc, { ...json }];
|
|
1118
1105
|
} catch (error) {
|
|
@@ -1137,7 +1124,7 @@ const designs = defineCollection({
|
|
|
1137
1124
|
const diagrams = defineCollection({
|
|
1138
1125
|
loader: globWithSafeWatcher({
|
|
1139
1126
|
pattern: withIgnoredBuildArtifacts(['**/diagrams/**/index.(md|mdx)', '**/diagrams/**/versioned/*/index.(md|mdx)']),
|
|
1140
|
-
base:
|
|
1127
|
+
base: catalogRoot,
|
|
1141
1128
|
generateId: ({ data }) => `${data.id}-${data.version}`,
|
|
1142
1129
|
}),
|
|
1143
1130
|
schema: withExtensionProperties(
|
|
@@ -1163,7 +1150,7 @@ const schemas = defineCollection({
|
|
|
1163
1150
|
'**/queries/*/index.{md,mdx}',
|
|
1164
1151
|
'**/queries/*/versioned/*/index.{md,mdx}',
|
|
1165
1152
|
]) as string[],
|
|
1166
|
-
base:
|
|
1153
|
+
base: projectDirectory,
|
|
1167
1154
|
},
|
|
1168
1155
|
sources: config.schemas?.sources ?? [],
|
|
1169
1156
|
}),
|
|
@@ -1265,7 +1252,7 @@ const sidebars = defineCollection({
|
|
|
1265
1252
|
'domains/**/sidebar.json',
|
|
1266
1253
|
])
|
|
1267
1254
|
),
|
|
1268
|
-
base:
|
|
1255
|
+
base: catalogRoot,
|
|
1269
1256
|
}),
|
|
1270
1257
|
schema: sidebarSchema,
|
|
1271
1258
|
});
|
|
@@ -1284,7 +1271,7 @@ const examples = defineCollection({
|
|
|
1284
1271
|
'**/queries/*/examples/**/*.(md|mdx)',
|
|
1285
1272
|
'**/queries/*/versioned/*/examples/**/*.(md|mdx)',
|
|
1286
1273
|
]),
|
|
1287
|
-
base:
|
|
1274
|
+
base: catalogRoot,
|
|
1288
1275
|
generateId: ({ entry }) => entry,
|
|
1289
1276
|
}),
|
|
1290
1277
|
schema: z.object({
|
|
@@ -17,8 +17,9 @@ export interface CustomPageRoute {
|
|
|
17
17
|
export const DEFAULT_CUSTOM_PAGES_PREFIX = 'custom';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* Older Core versions wrote this file beside copied custom pages. Retain the
|
|
21
|
+
* exclusion so a leftover manifest can never become a JSON endpoint. The current
|
|
22
|
+
* manifest lives in .astro/eventcatalog, outside the user's pages directory.
|
|
22
23
|
*/
|
|
23
24
|
export const CUSTOM_PAGES_MANIFEST_FILENAME = '.routes-manifest.json';
|
|
24
25
|
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
import fs from 'fs';
|
|
13
13
|
import { join } from 'path';
|
|
14
|
-
|
|
14
|
+
// Feature checks also run during Astro config evaluation, before @config exists.
|
|
15
|
+
import config from '../utils/eventcatalog-config/source';
|
|
15
16
|
|
|
16
17
|
// Inline isSSR to avoid circular dependency with ../utils/feature (which re-exports from this file)
|
|
17
18
|
const isSSR = () => config?.output === 'server';
|
|
@@ -7,6 +7,7 @@ import path from 'node:path';
|
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import { FieldsDatabase } from './fields-db';
|
|
9
9
|
import { extractSchemaFieldsDeep } from './field-extractor';
|
|
10
|
+
import { getRuntimePaths } from '../../../integrations/runtime-paths.mjs';
|
|
10
11
|
|
|
11
12
|
function detectFormat(fileName: string): string {
|
|
12
13
|
const ext = path.extname(fileName).toLowerCase();
|
|
@@ -33,8 +34,10 @@ export async function buildFieldsIndex(catalogDir: string, outputDir?: string):
|
|
|
33
34
|
const sdkModule = await import('@eventcatalog/sdk');
|
|
34
35
|
const sdk = sdkModule.default(catalogDir);
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
// Preserve the public indexer's default output directory; CLI callers pass
|
|
38
|
+
// the generated runtime directory explicitly.
|
|
39
|
+
const { fieldsDatabasePath: dbPath } = getRuntimePaths(catalogDir, outputDir || catalogDir);
|
|
40
|
+
const dbDir = path.dirname(dbPath);
|
|
38
41
|
|
|
39
42
|
if (!fs.existsSync(dbDir)) {
|
|
40
43
|
fs.mkdirSync(dbDir, { recursive: true });
|