@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.
Files changed (243) hide show
  1. package/dist/analytics/analytics.cjs +1 -1
  2. package/dist/analytics/analytics.js +2 -2
  3. package/dist/analytics/log-build.cjs +17 -11
  4. package/dist/analytics/log-build.js +4 -4
  5. package/dist/astro-config-path.cjs +51 -0
  6. package/dist/astro-config-path.d.cts +6 -0
  7. package/dist/astro-config-path.d.ts +6 -0
  8. package/dist/astro-config-path.js +6 -0
  9. package/dist/catalog-runtime.cjs +136 -0
  10. package/dist/catalog-runtime.d.cts +12 -0
  11. package/dist/catalog-runtime.d.ts +12 -0
  12. package/dist/catalog-runtime.js +8 -0
  13. package/dist/{chunk-B7HCX5HM.js → chunk-3SJDIENM.js} +1 -1
  14. package/dist/{chunk-AFPH6ERZ.js → chunk-5QRWGO2E.js} +1 -1
  15. package/dist/{chunk-6U72KINX.js → chunk-DJCOJ77J.js} +1 -0
  16. package/dist/{chunk-LHR4G2UO.js → chunk-EEZXGNF6.js} +1 -1
  17. package/dist/{chunk-XMRPNDXB.js → chunk-ISBBAOCD.js} +1 -1
  18. package/dist/{chunk-Z6OKCHWL.js → chunk-IUPFEQMU.js} +2 -2
  19. package/dist/{chunk-6QENHZZP.js → chunk-JE6RX7SJ.js} +11 -5
  20. package/dist/{chunk-LAWEGSJH.js → chunk-LU4GFIHH.js} +1 -1
  21. package/dist/{chunk-2YJRF4ZX.js → chunk-RYPZGCRN.js} +1 -1
  22. package/dist/chunk-SAN4U2WU.js +96 -0
  23. package/dist/{chunk-EGH3ALRY.js → chunk-TVLJNFDW.js} +4 -4
  24. package/dist/chunk-U63GDPPY.js +14 -0
  25. package/dist/chunk-VIJJ7JKH.js +17 -0
  26. package/dist/constants.cjs +1 -1
  27. package/dist/constants.js +1 -1
  28. package/dist/eventcatalog-config-file-utils.cjs +13 -7
  29. package/dist/eventcatalog-config-file-utils.d.cts +86 -2
  30. package/dist/eventcatalog-config-file-utils.d.ts +86 -2
  31. package/dist/eventcatalog-config-file-utils.js +1 -1
  32. package/dist/eventcatalog.cjs +227 -561
  33. package/dist/eventcatalog.js +62 -71
  34. package/dist/features.cjs +10 -6
  35. package/dist/features.js +2 -2
  36. package/dist/federation/federate.cjs +110 -106
  37. package/dist/federation/federate.js +4 -4
  38. package/dist/generate.cjs +11 -7
  39. package/dist/generate.js +4 -4
  40. package/dist/resolve-catalog-dependencies.cjs +12 -8
  41. package/dist/resolve-catalog-dependencies.js +2 -2
  42. package/dist/runtime-dependencies/@ai-sdk__react.mjs +3 -0
  43. package/dist/runtime-dependencies/@astrojs__markdown-remark.mjs +3 -0
  44. package/dist/runtime-dependencies/@astrojs__mdx.mjs +3 -0
  45. package/dist/runtime-dependencies/@astrojs__node.mjs +3 -0
  46. package/dist/runtime-dependencies/@astrojs__react.mjs +3 -0
  47. package/dist/runtime-dependencies/@astrojs__rss.mjs +3 -0
  48. package/dist/runtime-dependencies/@asyncapi__avro-schema-parser.mjs +3 -0
  49. package/dist/runtime-dependencies/@asyncapi__parser.mjs +3 -0
  50. package/dist/runtime-dependencies/@asyncapi__react-component.mjs +3 -0
  51. package/dist/runtime-dependencies/@asyncapi__react-component__styles__default.min.css.mjs +3 -0
  52. package/dist/runtime-dependencies/@auth__core.mjs +3 -0
  53. package/dist/runtime-dependencies/@auth__core__providers__auth0.mjs +3 -0
  54. package/dist/runtime-dependencies/@auth__core__providers__github.mjs +3 -0
  55. package/dist/runtime-dependencies/@auth__core__providers__google.mjs +3 -0
  56. package/dist/runtime-dependencies/@auth__core__providers__microsoft-entra-id.mjs +3 -0
  57. package/dist/runtime-dependencies/@auth__core__providers__okta.mjs +3 -0
  58. package/dist/runtime-dependencies/@auth__core__types.mjs +3 -0
  59. package/dist/runtime-dependencies/@eventcatalog__license.mjs +3 -0
  60. package/dist/runtime-dependencies/@eventcatalog__linter.mjs +3 -0
  61. package/dist/runtime-dependencies/@eventcatalog__sdk.mjs +3 -0
  62. package/dist/runtime-dependencies/@eventcatalog__visualiser.mjs +3 -0
  63. package/dist/runtime-dependencies/@eventcatalog__visualiser__styles-core.css.mjs +3 -0
  64. package/dist/runtime-dependencies/@fontsource__inter.mjs +3 -0
  65. package/dist/runtime-dependencies/@fontsource__inter__400.css.mjs +3 -0
  66. package/dist/runtime-dependencies/@fontsource__inter__700.css.mjs +3 -0
  67. package/dist/runtime-dependencies/@headlessui__react.mjs +3 -0
  68. package/dist/runtime-dependencies/@heroicons__react.mjs +3 -0
  69. package/dist/runtime-dependencies/@heroicons__react__16__solid__EnvelopeIcon.mjs +3 -0
  70. package/dist/runtime-dependencies/@heroicons__react__20__solid.mjs +3 -0
  71. package/dist/runtime-dependencies/@heroicons__react__24__outline.mjs +3 -0
  72. package/dist/runtime-dependencies/@heroicons__react__24__outline__MagnifyingGlassIcon.mjs +3 -0
  73. package/dist/runtime-dependencies/@heroicons__react__24__outline__RectangleGroupIcon.mjs +3 -0
  74. package/dist/runtime-dependencies/@heroicons__react__24__outline__ServerIcon.mjs +3 -0
  75. package/dist/runtime-dependencies/@heroicons__react__24__solid.mjs +3 -0
  76. package/dist/runtime-dependencies/@iconify-json__logos.mjs +3 -0
  77. package/dist/runtime-dependencies/@mermaid-js__layout-elk.mjs +3 -0
  78. package/dist/runtime-dependencies/@mermaid-js__layout-elk__dist__mermaid-layout-elk.core.mjs.mjs +3 -0
  79. package/dist/runtime-dependencies/@modelcontextprotocol__sdk.mjs +3 -0
  80. package/dist/runtime-dependencies/@modelcontextprotocol__sdk__server__mcp.js.mjs +3 -0
  81. package/dist/runtime-dependencies/@modelcontextprotocol__sdk__server__webStandardStreamableHttp.js.mjs +3 -0
  82. package/dist/runtime-dependencies/@nanostores__react.mjs +3 -0
  83. package/dist/runtime-dependencies/@parcel__watcher.mjs +3 -0
  84. package/dist/runtime-dependencies/@radix-ui__react-context-menu.mjs +3 -0
  85. package/dist/runtime-dependencies/@radix-ui__react-dialog.mjs +3 -0
  86. package/dist/runtime-dependencies/@radix-ui__react-dropdown-menu.mjs +3 -0
  87. package/dist/runtime-dependencies/@radix-ui__react-popover.mjs +3 -0
  88. package/dist/runtime-dependencies/@radix-ui__react-tooltip.mjs +3 -0
  89. package/dist/runtime-dependencies/@scalar__api-reference-react.mjs +3 -0
  90. package/dist/runtime-dependencies/@scalar__api-reference-react__style.css.mjs +3 -0
  91. package/dist/runtime-dependencies/@tailwindcss__typography.mjs +3 -0
  92. package/dist/runtime-dependencies/@tailwindcss__vite.mjs +3 -0
  93. package/dist/runtime-dependencies/@tanstack__react-table.mjs +3 -0
  94. package/dist/runtime-dependencies/@xyflow__react.mjs +3 -0
  95. package/dist/runtime-dependencies/@xyflow__react__dist__style.css.mjs +3 -0
  96. package/dist/runtime-dependencies/ai.mjs +3 -0
  97. package/dist/runtime-dependencies/astro-expressive-code.mjs +3 -0
  98. package/dist/runtime-dependencies/astro-expressive-code__components.mjs +3 -0
  99. package/dist/runtime-dependencies/astro-seo.mjs +3 -0
  100. package/dist/runtime-dependencies/astro.mjs +3 -0
  101. package/dist/runtime-dependencies/astro__assets__services__sharp.mjs +3 -0
  102. package/dist/runtime-dependencies/astro__config.mjs +3 -0
  103. package/dist/runtime-dependencies/astro__jsx-runtime.mjs +3 -0
  104. package/dist/runtime-dependencies/astro__loaders.mjs +3 -0
  105. package/dist/runtime-dependencies/astro__logger__node.mjs +3 -0
  106. package/dist/runtime-dependencies/astro__types.mjs +3 -0
  107. package/dist/runtime-dependencies/astro__zod.mjs +3 -0
  108. package/dist/runtime-dependencies/auth-astro.mjs +3 -0
  109. package/dist/runtime-dependencies/auth-astro__client.mjs +3 -0
  110. package/dist/runtime-dependencies/auth-astro__server.mjs +3 -0
  111. package/dist/runtime-dependencies/boxen.mjs +3 -0
  112. package/dist/runtime-dependencies/commander.mjs +3 -0
  113. package/dist/runtime-dependencies/cross-env.mjs +3 -0
  114. package/dist/runtime-dependencies/d3-drag.mjs +3 -0
  115. package/dist/runtime-dependencies/d3-force.mjs +3 -0
  116. package/dist/runtime-dependencies/d3-selection.mjs +3 -0
  117. package/dist/runtime-dependencies/d3-zoom.mjs +3 -0
  118. package/dist/runtime-dependencies/dagre.mjs +3 -0
  119. package/dist/runtime-dependencies/diff.mjs +3 -0
  120. package/dist/runtime-dependencies/diff2html.mjs +3 -0
  121. package/dist/runtime-dependencies/diff2html__bundles__css__diff2html.min.css.mjs +3 -0
  122. package/dist/runtime-dependencies/dotenv.mjs +3 -0
  123. package/dist/runtime-dependencies/elkjs.mjs +3 -0
  124. package/dist/runtime-dependencies/elkjs__lib__elk.bundled.js.mjs +3 -0
  125. package/dist/runtime-dependencies/glob.mjs +3 -0
  126. package/dist/runtime-dependencies/gray-matter.mjs +3 -0
  127. package/dist/runtime-dependencies/hono.mjs +3 -0
  128. package/dist/runtime-dependencies/html-to-image.mjs +3 -0
  129. package/dist/runtime-dependencies/js-yaml.mjs +3 -0
  130. package/dist/runtime-dependencies/jsonpath-plus.mjs +3 -0
  131. package/dist/runtime-dependencies/jsonwebtoken.mjs +3 -0
  132. package/dist/runtime-dependencies/lodash.debounce.mjs +3 -0
  133. package/dist/runtime-dependencies/lodash.merge.mjs +3 -0
  134. package/dist/runtime-dependencies/lucide-react.mjs +3 -0
  135. package/dist/runtime-dependencies/manifest.json +136 -0
  136. package/dist/runtime-dependencies/marked.mjs +3 -0
  137. package/dist/runtime-dependencies/mdast-util-find-and-replace.mjs +3 -0
  138. package/dist/runtime-dependencies/mermaid.mjs +3 -0
  139. package/dist/runtime-dependencies/minisearch.mjs +3 -0
  140. package/dist/runtime-dependencies/nanostores.mjs +3 -0
  141. package/dist/runtime-dependencies/pagefind.mjs +3 -0
  142. package/dist/runtime-dependencies/pako.mjs +3 -0
  143. package/dist/runtime-dependencies/parse5.mjs +3 -0
  144. package/dist/runtime-dependencies/picocolors.mjs +3 -0
  145. package/dist/runtime-dependencies/picomatch.mjs +3 -0
  146. package/dist/runtime-dependencies/react-dom.mjs +3 -0
  147. package/dist/runtime-dependencies/react-dom__client.mjs +3 -0
  148. package/dist/runtime-dependencies/react-dom__server.mjs +3 -0
  149. package/dist/runtime-dependencies/react-markdown.mjs +3 -0
  150. package/dist/runtime-dependencies/react-syntax-highlighter.mjs +3 -0
  151. package/dist/runtime-dependencies/react-syntax-highlighter__dist__cjs__styles__prism.mjs +3 -0
  152. package/dist/runtime-dependencies/react-syntax-highlighter__dist__cjs__styles__prism__index.js.mjs +3 -0
  153. package/dist/runtime-dependencies/react.mjs +3 -0
  154. package/dist/runtime-dependencies/react__jsx-dev-runtime.mjs +3 -0
  155. package/dist/runtime-dependencies/react__jsx-runtime.mjs +3 -0
  156. package/dist/runtime-dependencies/recast.mjs +3 -0
  157. package/dist/runtime-dependencies/recast__parsers__babel.js.mjs +3 -0
  158. package/dist/runtime-dependencies/rehype-autolink-headings.mjs +3 -0
  159. package/dist/runtime-dependencies/rehype-expressive-code.mjs +3 -0
  160. package/dist/runtime-dependencies/rehype-expressive-code__hast.mjs +3 -0
  161. package/dist/runtime-dependencies/rehype-slug.mjs +3 -0
  162. package/dist/runtime-dependencies/remark-comment.mjs +3 -0
  163. package/dist/runtime-dependencies/remark-directive.mjs +3 -0
  164. package/dist/runtime-dependencies/remark-gfm.mjs +3 -0
  165. package/dist/runtime-dependencies/rimraf.mjs +3 -0
  166. package/dist/runtime-dependencies/semver.mjs +3 -0
  167. package/dist/runtime-dependencies/shelljs.mjs +3 -0
  168. package/dist/runtime-dependencies/sonner.mjs +3 -0
  169. package/dist/runtime-dependencies/sql.js.mjs +3 -0
  170. package/dist/runtime-dependencies/tailwindcss.mjs +3 -0
  171. package/dist/runtime-dependencies/typescript.mjs +3 -0
  172. package/dist/runtime-dependencies/unist-util-visit.mjs +3 -0
  173. package/dist/runtime-dependencies/update-notifier.mjs +3 -0
  174. package/dist/runtime-dependencies/uuid.mjs +3 -0
  175. package/dist/runtime-dependencies/zod.mjs +3 -0
  176. package/dist/runtime-dependencies/zod__v4.mjs +3 -0
  177. package/dist/search-indexer.cjs +1 -0
  178. package/dist/search-indexer.js +1 -1
  179. package/dist/utils/cli-logger.cjs +1 -1
  180. package/dist/utils/cli-logger.js +2 -2
  181. package/dist/watcher.cjs +5 -204
  182. package/dist/watcher.js +1 -2
  183. package/eventcatalog/astro.config.mjs +57 -31
  184. package/eventcatalog/integrations/catalog-assets.mjs +204 -0
  185. package/eventcatalog/integrations/config-loader.mjs +85 -0
  186. package/eventcatalog/integrations/ecstudio-watcher.mjs +11 -9
  187. package/eventcatalog/integrations/eventcatalog-runtime.mjs +252 -0
  188. package/eventcatalog/integrations/expressive-code-config.mjs +6 -0
  189. package/eventcatalog/integrations/runtime-dependencies.mjs +49 -0
  190. package/eventcatalog/integrations/runtime-dependency-manifest.mjs +15 -0
  191. package/eventcatalog/integrations/runtime-paths.mjs +16 -0
  192. package/eventcatalog/src/content.config.ts +33 -46
  193. package/eventcatalog/src/enterprise/custom-pages/routes.ts +3 -2
  194. package/eventcatalog/src/enterprise/feature.ts +2 -1
  195. package/eventcatalog/src/enterprise/fields/field-indexer.ts +5 -2
  196. package/eventcatalog/src/enterprise/fields/pages/api/fields.ts +4 -3
  197. package/eventcatalog/src/enterprise/integrations/eventcatalog-features.ts +32 -32
  198. package/eventcatalog/src/enterprise/mcp/mcp-auth.ts +1 -1
  199. package/eventcatalog/src/env.d.ts +7 -1
  200. package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +15 -3
  201. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +1 -1
  202. package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +2 -2
  203. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +2 -2
  204. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +2 -2
  205. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +1 -1
  206. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +2 -2
  207. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/index.astro +1 -1
  208. package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +1 -1
  209. package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +1 -1
  210. package/eventcatalog/src/pages/docs/teams/[id]/index.astro +2 -2
  211. package/eventcatalog/src/pages/docs/users/[id]/index.astro +2 -2
  212. package/eventcatalog/src/pages/index.astro +2 -3
  213. package/eventcatalog/src/styles/tailwind.css +3 -0
  214. package/eventcatalog/src/utils/eventcatalog-config/source.ts +9 -0
  215. package/eventcatalog/src/utils/feature.ts +2 -1
  216. package/eventcatalog/tsconfig.json +1 -4
  217. package/package.json +17 -4
  218. package/dist/catalog-to-astro-content-directory.cjs +0 -382
  219. package/dist/catalog-to-astro-content-directory.d.cts +0 -3
  220. package/dist/catalog-to-astro-content-directory.d.ts +0 -3
  221. package/dist/catalog-to-astro-content-directory.js +0 -9
  222. package/dist/chunk-BWN544LB.js +0 -73
  223. package/dist/chunk-DHH5U5PF.js +0 -53
  224. package/dist/chunk-KLOHNCNF.js +0 -101
  225. package/dist/chunk-T4RVWPIQ.js +0 -85
  226. package/dist/chunk-T5IUG523.js +0 -54
  227. package/dist/chunk-W5JQON7Z.js +0 -117
  228. package/dist/copy-core.cjs +0 -88
  229. package/dist/copy-core.d.cts +0 -4
  230. package/dist/copy-core.d.ts +0 -4
  231. package/dist/copy-core.js +0 -8
  232. package/dist/core-node-modules.cjs +0 -108
  233. package/dist/core-node-modules.d.cts +0 -7
  234. package/dist/core-node-modules.d.ts +0 -7
  235. package/dist/core-node-modules.js +0 -8
  236. package/dist/custom-components.cjs +0 -89
  237. package/dist/custom-components.d.cts +0 -4
  238. package/dist/custom-components.d.ts +0 -4
  239. package/dist/custom-components.js +0 -8
  240. package/dist/map-catalog-to-astro.cjs +0 -151
  241. package/dist/map-catalog-to-astro.d.cts +0 -28
  242. package/dist/map-catalog-to-astro.d.ts +0 -28
  243. package/dist/map-catalog-to-astro.js +0 -6
@@ -31,21 +31,26 @@ var import_commander = require("commander");
31
31
  var import_node_child_process2 = require("child_process");
32
32
  var import_node_path19 = require("path");
33
33
  var import_node_http = __toESM(require("http"), 1);
34
- var import_fs3 = __toESM(require("fs"), 1);
34
+ var import_fs = __toESM(require("fs"), 1);
35
35
  var import_node_path20 = __toESM(require("path"), 1);
36
- var import_node_url = require("url");
36
+ var import_node_url2 = require("url");
37
+ var import_node_module2 = require("module");
37
38
 
38
39
  // src/generate.js
39
- var import_node_path2 = __toESM(require("path"), 1);
40
+ var import_node_path3 = __toESM(require("path"), 1);
40
41
 
41
42
  // src/eventcatalog-config-file-utils.js
43
+ var import_promises2 = require("fs/promises");
44
+ var import_node_path2 = __toESM(require("path"), 1);
45
+ var import_uuid = require("uuid");
46
+ var import_gray_matter = __toESM(require("gray-matter"), 1);
47
+
48
+ // eventcatalog/integrations/config-loader.mjs
42
49
  var import_promises = require("fs/promises");
43
50
  var import_node_fs = require("fs");
44
51
  var import_node_path = __toESM(require("path"), 1);
45
- var import_uuid = require("uuid");
46
- var import_url = require("url");
52
+ var import_node_url = require("url");
47
53
  var import_node_os = require("os");
48
- var import_gray_matter = __toESM(require("gray-matter"), 1);
49
54
  async function cleanup(projectDirectory) {
50
55
  const filePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
51
56
  if ((0, import_node_fs.existsSync)(filePath)) {
@@ -93,7 +98,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
93
98
  configFilePath = import_node_path.default.join(tempDir, "eventcatalog.config.mjs");
94
99
  await (0, import_promises.copyFile)(import_node_path.default.join(projectDirectory, "eventcatalog.config.js"), configFilePath);
95
100
  }
96
- const configFileURL = `${(0, import_url.pathToFileURL)(configFilePath).href}?t=${Date.now()}`;
101
+ const configFileURL = `${(0, import_node_url.pathToFileURL)(configFilePath).href}?t=${Date.now()}`;
97
102
  const config = await import(
98
103
  /* @vite-ignore */
99
104
  configFileURL
@@ -106,10 +111,12 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
106
111
  }
107
112
  }
108
113
  };
114
+
115
+ // src/eventcatalog-config-file-utils.js
109
116
  var writeEventCatalogConfigFile = async (projectDirectory, newConfig) => {
110
117
  try {
111
- const configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.js");
112
- let content = await (0, import_promises.readFile)(configFilePath, "utf8");
118
+ const configFilePath = import_node_path2.default.join(projectDirectory, "eventcatalog.config.js");
119
+ let content = await (0, import_promises2.readFile)(configFilePath, "utf8");
113
120
  const startIndex = content.indexOf("export default {");
114
121
  if (startIndex === -1) {
115
122
  return;
@@ -125,7 +132,7 @@ var writeEventCatalogConfigFile = async (projectDirectory, newConfig) => {
125
132
  ${key}: ${valueString},` + content.slice(insertPosition);
126
133
  }
127
134
  });
128
- await (0, import_promises.writeFile)(configFilePath, content);
135
+ await (0, import_promises2.writeFile)(configFilePath, content);
129
136
  } finally {
130
137
  await cleanup(projectDirectory);
131
138
  }
@@ -144,7 +151,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
144
151
  var import_picocolors = __toESM(require("picocolors"), 1);
145
152
 
146
153
  // package.json
147
- var version = "4.11.2";
154
+ var version = "4.12.0-beta.1";
148
155
 
149
156
  // src/constants.ts
150
157
  var VERSION = version;
@@ -237,7 +244,7 @@ var generate = async (PROJECT_DIRECTORY) => {
237
244
  let plugin = generator[0];
238
245
  const pluginConfig = generator[1];
239
246
  if (plugin.startsWith("./")) {
240
- plugin = import_node_path2.default.join(PROJECT_DIRECTORY, plugin);
247
+ plugin = import_node_path3.default.join(PROJECT_DIRECTORY, plugin);
241
248
  }
242
249
  if (plugin.includes("<rootDir>")) {
243
250
  plugin = plugin.replace("<rootDir>", PROJECT_DIRECTORY);
@@ -300,8 +307,8 @@ async function raiseEvent(eventData) {
300
307
  // src/analytics/count-resources.js
301
308
  var import_glob = require("glob");
302
309
  var import_node_crypto = require("crypto");
303
- var import_promises2 = require("fs/promises");
304
- var import_node_path3 = __toESM(require("path"), 1);
310
+ var import_promises3 = require("fs/promises");
311
+ var import_node_path4 = __toESM(require("path"), 1);
305
312
  var RESOURCE_PATTERNS = {
306
313
  adrs: ["**/adrs/*/index.@(md|mdx)"],
307
314
  agents: ["**/agents/*/index.@(md|mdx)"],
@@ -353,7 +360,7 @@ async function hashCatalogContent(projectDir) {
353
360
  for (const file of [...files].sort()) {
354
361
  try {
355
362
  hash.update(file);
356
- hash.update(await (0, import_promises2.readFile)(import_node_path3.default.join(projectDir, file)));
363
+ hash.update(await (0, import_promises3.readFile)(import_node_path4.default.join(projectDir, file)));
357
364
  } catch {
358
365
  }
359
366
  }
@@ -473,340 +480,18 @@ var log_build_default = main;
473
480
 
474
481
  // src/watcher.js
475
482
  var import_watcher = __toESM(require("@parcel/watcher"), 1);
476
- var import_node_fs2 = __toESM(require("fs"), 1);
477
-
478
- // src/map-catalog-to-astro.js
479
- var import_node_path4 = __toESM(require("path"), 1);
480
- var CUSTOM_PAGE_EXTENSIONS = [".astro", ".ts", ".js", ".mjs"];
481
- var COLLECTION_KEYS = [
482
- "agents",
483
- "events",
484
- "commands",
485
- "services",
486
- "domains",
487
- "flows",
488
- "pages",
489
- "changelogs",
490
- "queries",
491
- "channels",
492
- "ubiquitousLanguages",
493
- "dependencies"
494
- ];
495
- function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
496
- const relativeFilePath = removeBasePath(filePath, projectDir);
497
- if (isLikeC4Source(relativeFilePath)) {
498
- return [];
499
- }
500
- if (!isCatalogRelated(relativeFilePath)) {
501
- return [];
502
- }
503
- const customPageTargetPaths = getCustomPageTargetPaths(relativeFilePath, astroDir);
504
- if (customPageTargetPaths) {
505
- return customPageTargetPaths;
506
- }
507
- const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
508
- const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
509
- return baseTargetPaths.map((base) => import_node_path4.default.join(astroDir, base, relativeTargetPath));
510
- }
511
- function removeBasePath(fullPath, basePath) {
512
- const relativePath = import_node_path4.default.relative(basePath, fullPath);
513
- return relativePath.startsWith("..") ? fullPath : relativePath;
514
- }
515
- function isCollectionKey(key) {
516
- return COLLECTION_KEYS.includes(key);
517
- }
518
- function isLikeC4Source(filePath) {
519
- return filePath.endsWith(".c4") || filePath.endsWith(".likec4");
520
- }
521
- var hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
522
- function getCustomPageTargetPaths(filePath, astroDir) {
523
- const filePathArr = filePath.split(import_node_path4.default.sep).filter(Boolean);
524
- if (filePathArr[0] !== "pages") {
525
- return null;
526
- }
527
- const customPagePath = import_node_path4.default.join(astroDir, "src", "custom-pages", ...filePathArr.slice(1));
528
- if (CUSTOM_PAGE_EXTENSIONS.includes(import_node_path4.default.extname(filePath).toLowerCase())) {
529
- return [customPagePath];
530
- }
531
- if (!hasExtension(filePath)) {
532
- return [customPagePath, import_node_path4.default.join(astroDir, "public", "generated", ...filePathArr)];
533
- }
534
- return [import_node_path4.default.join(astroDir, "public", "generated", ...filePathArr)];
535
- }
536
- function isCatalogRelated(filePath) {
537
- const filePathArr = filePath.split(import_node_path4.default.sep).filter(Boolean);
538
- if ([
539
- "eventcatalog.config.js",
540
- // config file at root
541
- "eventcatalog.styles.css",
542
- // custom styles file at root
543
- "components",
544
- // custom components
545
- "snippets",
546
- // custom snippets
547
- "public",
548
- // public assets
549
- ".env",
550
- // env file
551
- ...COLLECTION_KEYS
552
- ].includes(filePathArr[0])) {
553
- return true;
554
- }
555
- return false;
556
- }
557
- function getBaseTargetPaths(filePath) {
558
- const filePathArr = filePath.split(import_node_path4.default.sep).filter(Boolean);
559
- if (isCollectionKey(filePathArr[0])) {
560
- if (hasExtension(filePath)) {
561
- return [import_node_path4.default.join("public", "generated")];
562
- }
563
- return [import_node_path4.default.join("public", "generated")];
564
- }
565
- if (filePathArr[0] == "components") {
566
- return [import_node_path4.default.join("src", "custom-defined-components")];
567
- }
568
- if (filePathArr[0] == "snippets") {
569
- return [import_node_path4.default.join("src")];
570
- }
571
- if (filePathArr[0] == "public") {
572
- return [import_node_path4.default.join("public")];
573
- }
574
- return [import_node_path4.default.join("/")];
575
- }
576
- function getRelativeTargetPath(filePath) {
577
- const filePathArr = filePath.split(import_node_path4.default.sep).filter(Boolean);
578
- if (filePathArr[0] == "public" || filePathArr[0] == "components") {
579
- filePathArr.shift();
580
- }
581
- if (filePathArr[0] == "snippets") {
582
- return import_node_path4.default.join("snippets", ...filePathArr.slice(1));
583
- }
584
- const relativePath = [];
585
- for (let i = filePathArr.length - 1; i >= 0; i--) {
586
- relativePath.unshift(filePathArr[i]);
587
- if (isCollectionKey(filePathArr[i]) && filePathArr[i] != "snippets") break;
588
- }
589
- return import_node_path4.default.join(...relativePath);
590
- }
591
-
592
- // src/watcher.js
593
- var import_rimraf = require("rimraf");
594
483
  var toPosixPath = (p) => p.replace(/\\/g, "/");
595
- async function watch(projectDirectory, catalogDirectory, callback = void 0) {
596
- const subscription = await import_watcher.default.subscribe(
597
- projectDirectory,
598
- compose(
599
- /**
600
- * @param {Error|null} err
601
- * @param {Event[]} events
602
- * @returns {unknown}
603
- */
604
- (err, events) => {
605
- if (err) {
606
- return;
607
- }
608
- for (let event of events) {
609
- const { path: filePath, type } = event;
610
- if (filePath.endsWith(".lock")) {
611
- continue;
612
- }
613
- if ((filePath.endsWith(".mdx") || filePath.endsWith(".md")) && !filePath.includes("snippets")) {
614
- continue;
615
- }
616
- const astroPaths = mapCatalogToAstro({
617
- filePath,
618
- astroDir: catalogDirectory,
619
- projectDir: projectDirectory
620
- });
621
- for (const astroPath of astroPaths) {
622
- switch (type) {
623
- case "create":
624
- case "update": {
625
- let stat;
626
- try {
627
- stat = import_node_fs2.default.statSync(filePath);
628
- } catch (err2) {
629
- if (err2.code === "ENOENT") break;
630
- throw err2;
631
- }
632
- if (stat.isDirectory()) {
633
- import_node_fs2.default.mkdirSync(astroPath, { recursive: true });
634
- } else {
635
- retryEPERM(import_node_fs2.default.cpSync)(filePath, astroPath);
636
- }
637
- break;
638
- }
639
- case "delete":
640
- retryEPERM(import_rimraf.rimrafSync)(astroPath);
641
- break;
642
- }
643
- }
644
- }
645
- },
646
- callback
647
- ),
648
- {
649
- ignore: [`**/${toPosixPath(catalogDirectory)}/!(${toPosixPath(projectDirectory)})**`]
650
- }
651
- );
484
+ async function watch(projectDirectory, catalogDirectory, callback = () => {
485
+ }) {
486
+ const subscription = await import_watcher.default.subscribe(projectDirectory, callback, {
487
+ ignore: [`**/${toPosixPath(catalogDirectory)}/!(${toPosixPath(projectDirectory)})**`]
488
+ });
652
489
  return () => subscription.unsubscribe();
653
490
  }
654
- function compose(...fns) {
655
- return function(err, events) {
656
- fns.filter(Boolean).forEach((fn, i) => {
657
- try {
658
- fn(err, events);
659
- } catch (error) {
660
- console.error({ error });
661
- throw error;
662
- }
663
- });
664
- };
665
- }
666
- var MAX_RETRIES = 5;
667
- var DELAY_MS = 100;
668
- function retryEPERM(fn) {
669
- return (...args) => {
670
- let retries = 0;
671
- while (retries < MAX_RETRIES) {
672
- try {
673
- return fn(...args);
674
- } catch (err) {
675
- if (err.code !== "EPERM") throw err;
676
- setTimeout(() => {
677
- }, DELAY_MS);
678
- retries += 1;
679
- }
680
- }
681
- };
682
- }
683
-
684
- // src/catalog-to-astro-content-directory.js
685
- var import_glob2 = require("glob");
686
- var path6 = __toESM(require("path"), 1);
687
- var import_fs = __toESM(require("fs"), 1);
688
- var import_url2 = require("url");
689
- var import_node_os2 = __toESM(require("os"), 1);
690
-
691
- // src/custom-components.js
692
- var import_promises3 = __toESM(require("fs/promises"), 1);
693
- var import_node_path5 = __toESM(require("path"), 1);
694
- var isCustomComponentPath = (projectDirectory, filePath) => {
695
- const [rootDirectory, childDirectory] = import_node_path5.default.relative(projectDirectory, filePath).split(import_node_path5.default.sep);
696
- return rootDirectory === "components" || rootDirectory === "federated" && childDirectory === "components";
697
- };
698
- var readDirectory = async (directory) => {
699
- try {
700
- return await import_promises3.default.readdir(directory, { withFileTypes: true });
701
- } catch (error) {
702
- if (error.code === "ENOENT") return [];
703
- throw error;
704
- }
705
- };
706
- var mergeDirectory = async (sourceDirectory, destinationDirectory) => {
707
- for (const entry of await readDirectory(sourceDirectory)) {
708
- const sourcePath = import_node_path5.default.join(sourceDirectory, entry.name);
709
- const destinationPath = import_node_path5.default.join(destinationDirectory, entry.name);
710
- if (entry.isDirectory()) {
711
- const destinationEntry = await import_promises3.default.stat(destinationPath).catch((error) => {
712
- if (error.code === "ENOENT") return void 0;
713
- throw error;
714
- });
715
- if (destinationEntry && !destinationEntry.isDirectory()) {
716
- await import_promises3.default.rm(destinationPath, { recursive: true, force: true });
717
- }
718
- await import_promises3.default.mkdir(destinationPath, { recursive: true });
719
- await mergeDirectory(sourcePath, destinationPath);
720
- continue;
721
- }
722
- await import_promises3.default.rm(destinationPath, { recursive: true, force: true });
723
- await import_promises3.default.copyFile(sourcePath, destinationPath);
724
- }
725
- };
726
- var syncCustomComponents = async (projectDirectory, catalogDirectory) => {
727
- const destinationDirectory = import_node_path5.default.join(catalogDirectory, "src", "custom-defined-components");
728
- const destinationParent = import_node_path5.default.dirname(destinationDirectory);
729
- await import_promises3.default.mkdir(destinationParent, { recursive: true });
730
- const stagingDirectory = await import_promises3.default.mkdtemp(import_node_path5.default.join(destinationParent, ".custom-defined-components.staging-"));
731
- try {
732
- await mergeDirectory(import_node_path5.default.join(projectDirectory, "federated", "components"), stagingDirectory);
733
- await mergeDirectory(import_node_path5.default.join(projectDirectory, "components"), stagingDirectory);
734
- await import_promises3.default.rm(destinationDirectory, { recursive: true, force: true });
735
- await import_promises3.default.rename(stagingDirectory, destinationDirectory);
736
- } finally {
737
- await import_promises3.default.rm(stagingDirectory, { recursive: true, force: true });
738
- }
739
- };
740
-
741
- // src/catalog-to-astro-content-directory.js
742
- var __filename2 = (0, import_url2.fileURLToPath)(importMetaUrl);
743
- var rootPkg = path6.resolve(path6.dirname(__filename2), "../");
744
- var copyFiles = async (source, target) => {
745
- const files = await (0, import_glob2.glob)(path6.join(source, "**"), {
746
- nodir: true,
747
- windowsPathsNoEscape: import_node_os2.default.platform() == "win32",
748
- ignore: ["node_modules/**", "**/dist/**", "**/teams", "**/users", "**/*.mdx", "**/*.md", "**/package.json", "**/Dockerfile"]
749
- });
750
- const snippets = await (0, import_glob2.glob)(path6.join(source, "snippets/**/*.mdx"), {
751
- nodir: true,
752
- windowsPathsNoEscape: import_node_os2.default.platform() == "win32"
753
- });
754
- if (snippets.length > 0) {
755
- files.push(...snippets);
756
- }
757
- if (import_fs.default.existsSync(path6.join(source, ".env"))) {
758
- files.push(path6.join(source, ".env"));
759
- }
760
- for (const file of files) {
761
- if (isCustomComponentPath(source, file)) continue;
762
- mapCatalogToAstro({
763
- filePath: file,
764
- astroDir: target,
765
- projectDir: source
766
- }).map((astroPath) => {
767
- import_fs.default.cpSync(file, astroPath);
768
- return { oldPath: file, newPath: astroPath };
769
- });
770
- }
771
- };
772
- var clearCustomPages = async (target) => {
773
- const customPagesDir = path6.join(target, "src", "custom-pages");
774
- if (import_fs.default.existsSync(customPagesDir)) import_fs.default.rmSync(customPagesDir, { recursive: true });
775
- const staleCodeFiles = await (0, import_glob2.glob)(path6.join(target, "public", "generated", "pages", "**/*.{astro,ts,js,mjs}"), {
776
- nodir: true,
777
- windowsPathsNoEscape: import_node_os2.default.platform() == "win32"
778
- });
779
- for (const file of staleCodeFiles) {
780
- import_fs.default.rmSync(file);
781
- }
782
- };
783
- var removeGeneratedLikeC4Sources = async (target) => {
784
- const generatedDir = path6.join(target, "public", "generated");
785
- const files = await (0, import_glob2.glob)(path6.join(generatedDir, "**/*.{c4,likec4}"), {
786
- nodir: true,
787
- windowsPathsNoEscape: import_node_os2.default.platform() == "win32"
788
- });
789
- for (const file of files) {
790
- import_fs.default.rmSync(file);
791
- }
792
- };
793
- var catalogToAstro = async (source, astroDir) => {
794
- const astroContentDir = path6.join(astroDir, "src/content/");
795
- if (import_fs.default.existsSync(astroContentDir)) import_fs.default.rmSync(astroContentDir, { recursive: true });
796
- import_fs.default.mkdirSync(astroContentDir);
797
- await verifyRequiredFieldsAreInCatalogConfigFile(source);
798
- if (!import_fs.default.existsSync(path6.join(source, "eventcatalog.styles.css"))) {
799
- import_fs.default.writeFileSync(path6.join(source, "eventcatalog.styles.css"), "");
800
- }
801
- await clearCustomPages(astroDir);
802
- await removeGeneratedLikeC4Sources(astroDir);
803
- await syncCustomComponents(source, astroDir);
804
- await copyFiles(source, astroDir);
805
- };
806
491
 
807
492
  // src/resolve-catalog-dependencies.js
808
- var import_node_path6 = __toESM(require("path"), 1);
809
- var import_node_fs3 = __toESM(require("fs"), 1);
493
+ var import_node_path5 = __toESM(require("path"), 1);
494
+ var import_node_fs2 = __toESM(require("fs"), 1);
810
495
  var import_gray_matter2 = __toESM(require("gray-matter"), 1);
811
496
  var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
812
497
  const catalogConfig = await getEventCatalogConfigFile(catalogDir);
@@ -814,11 +499,11 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
814
499
  if (!dependencies) {
815
500
  return;
816
501
  }
817
- const dependenciesDir = import_node_path6.default.join(catalogDir, "dependencies");
818
- if (import_node_fs3.default.existsSync(dependenciesDir)) {
819
- import_node_fs3.default.rmSync(dependenciesDir, { recursive: true, force: true });
502
+ const dependenciesDir = import_node_path5.default.join(catalogDir, "dependencies");
503
+ if (import_node_fs2.default.existsSync(dependenciesDir)) {
504
+ import_node_fs2.default.rmSync(dependenciesDir, { recursive: true, force: true });
820
505
  }
821
- import_node_fs3.default.mkdirSync(dependenciesDir, { recursive: true });
506
+ import_node_fs2.default.mkdirSync(dependenciesDir, { recursive: true });
822
507
  const resourceTypes = Object.keys(dependencies);
823
508
  for (const resourceType of resourceTypes) {
824
509
  for (const dependency of dependencies[resourceType]) {
@@ -838,9 +523,9 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
838
523
  },
839
524
  frontmatter
840
525
  );
841
- const resourceFile = import_node_path6.default.join(dependenciesDir, resourceType, dependency.id, `index.md`);
842
- import_node_fs3.default.mkdirSync(import_node_path6.default.dirname(resourceFile), { recursive: true });
843
- import_node_fs3.default.writeFileSync(resourceFile, markdown);
526
+ const resourceFile = import_node_path5.default.join(dependenciesDir, resourceType, dependency.id, `index.md`);
527
+ import_node_fs2.default.mkdirSync(import_node_path5.default.dirname(resourceFile), { recursive: true });
528
+ import_node_fs2.default.writeFileSync(resourceFile, markdown);
844
529
  }
845
530
  }
846
531
  return;
@@ -850,8 +535,8 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
850
535
  var import_boxen = __toESM(require("boxen"), 1);
851
536
 
852
537
  // src/features.ts
853
- var import_node_path7 = require("path");
854
- var import_node_fs4 = __toESM(require("fs"), 1);
538
+ var import_node_path6 = require("path");
539
+ var import_node_fs3 = __toESM(require("fs"), 1);
855
540
  var getProjectOutDir = async () => {
856
541
  const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
857
542
  return config?.outDir || "dist";
@@ -866,7 +551,7 @@ var isIndexedSearchEnabled = async () => {
866
551
  };
867
552
  var isAuthEnabled = async () => {
868
553
  const directory = process.env.PROJECT_DIR || process.cwd();
869
- const hasAuthConfig = import_node_fs4.default.existsSync((0, import_node_path7.join)(directory, "eventcatalog.auth.js"));
554
+ const hasAuthConfig = import_node_fs3.default.existsSync((0, import_node_path6.join)(directory, "eventcatalog.auth.js"));
870
555
  return hasAuthConfig;
871
556
  };
872
557
 
@@ -875,11 +560,11 @@ var import_update_notifier = __toESM(require("update-notifier"), 1);
875
560
  var import_dotenv = __toESM(require("dotenv"), 1);
876
561
 
877
562
  // src/migrations/message-channels-to-service-channels.ts
878
- var import_node_fs5 = __toESM(require("fs"), 1);
879
- var import_glob3 = require("glob");
880
- var import_node_os3 = __toESM(require("os"), 1);
563
+ var import_node_fs4 = __toESM(require("fs"), 1);
564
+ var import_glob2 = require("glob");
565
+ var import_node_os2 = __toESM(require("os"), 1);
881
566
  var import_gray_matter3 = __toESM(require("gray-matter"), 1);
882
- var import_node_path8 = __toESM(require("path"), 1);
567
+ var import_node_path7 = __toESM(require("path"), 1);
883
568
  var DISABLE_CHANNEL_MIGRATION_ENV = "EVENTCATALOG_DISABLE_CHANNEL_MIGRATION";
884
569
  var isChannelMigrationDisabled = () => {
885
570
  return ["true", "1", "yes"].includes((process.env[DISABLE_CHANNEL_MIGRATION_ENV] ?? "").toLowerCase());
@@ -888,8 +573,8 @@ var message_channels_to_service_channels_default = async (dir2) => {
888
573
  if (isChannelMigrationDisabled()) {
889
574
  return { status: "skipped", message: `Channel migration disabled by ${DISABLE_CHANNEL_MIGRATION_ENV}` };
890
575
  }
891
- const PROJECT_DIR = import_node_path8.default.join(dir2 || process.env.PROJECT_DIR);
892
- const messages = await (0, import_glob3.glob)(
576
+ const PROJECT_DIR = import_node_path7.default.join(dir2 || process.env.PROJECT_DIR);
577
+ const messages = await (0, import_glob2.glob)(
893
578
  [
894
579
  "**/events/*/index.mdx",
895
580
  "**/events/*/index.md",
@@ -911,11 +596,11 @@ var message_channels_to_service_channels_default = async (dir2) => {
911
596
  cwd: PROJECT_DIR,
912
597
  absolute: true,
913
598
  nodir: true,
914
- windowsPathsNoEscape: import_node_os3.default.platform() == "win32",
599
+ windowsPathsNoEscape: import_node_os2.default.platform() == "win32",
915
600
  ignore: ["node_modules/**", "**/dist/**", "**/teams", "**/users", "**/package.json", "**/Dockerfile"]
916
601
  }
917
602
  );
918
- const services = await (0, import_glob3.glob)(
603
+ const services = await (0, import_glob2.glob)(
919
604
  [
920
605
  "**/services/*/index.mdx",
921
606
  "**/services/*/index.md",
@@ -928,7 +613,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
928
613
  }
929
614
  );
930
615
  const messagesWithChannels = messages.reduce((acc, message) => {
931
- const file = import_node_fs5.default.readFileSync(message, "utf8");
616
+ const file = import_node_fs4.default.readFileSync(message, "utf8");
932
617
  const { data } = (0, import_gray_matter3.default)(file);
933
618
  if (data.channels?.length > 0) {
934
619
  acc.push({
@@ -942,7 +627,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
942
627
  return { status: "success", message: "No messages with channels found in the catalog" };
943
628
  }
944
629
  const servicesWithChannels = services.reduce((acc, service) => {
945
- const file = import_node_fs5.default.readFileSync(service, "utf8");
630
+ const file = import_node_fs4.default.readFileSync(service, "utf8");
946
631
  const { data } = (0, import_gray_matter3.default)(file);
947
632
  const isSending = data.sends?.some((send) => messagesWithChannels.some((message) => message.id === send.id));
948
633
  const isReceiving = data.receives?.some(
@@ -957,7 +642,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
957
642
  return acc;
958
643
  }, []);
959
644
  for (const service of servicesWithChannels) {
960
- const file = import_node_fs5.default.readFileSync(service.path, "utf8");
645
+ const file = import_node_fs4.default.readFileSync(service.path, "utf8");
961
646
  const { data } = (0, import_gray_matter3.default)(file);
962
647
  const messagesTheServiceSendsThatNeedUpdating = data.sends?.filter((send) => messagesWithChannels.some((message) => message.id === send.id)) ?? [];
963
648
  const messagesTheServiceReceivesThatNeedUpdating = data.receives?.filter((receive) => messagesWithChannels.some((message) => message.id === receive.id)) ?? [];
@@ -977,14 +662,14 @@ var message_channels_to_service_channels_default = async (dir2) => {
977
662
  ...newSends.length > 0 ? { sends: newSends } : {},
978
663
  ...newReceives.length > 0 ? { receives: newReceives } : {}
979
664
  };
980
- import_node_fs5.default.writeFileSync(service.path, import_gray_matter3.default.stringify(file, newData));
665
+ import_node_fs4.default.writeFileSync(service.path, import_gray_matter3.default.stringify(file, newData));
981
666
  }
982
667
  }
983
668
  for (const message of messagesWithChannels) {
984
- const file = import_node_fs5.default.readFileSync(message.path, "utf8");
669
+ const file = import_node_fs4.default.readFileSync(message.path, "utf8");
985
670
  const parsed = (0, import_gray_matter3.default)(file);
986
671
  const { channels, ...newData } = parsed.data;
987
- import_node_fs5.default.writeFileSync(message.path, import_gray_matter3.default.stringify(parsed.content, newData));
672
+ import_node_fs4.default.writeFileSync(message.path, import_gray_matter3.default.stringify(parsed.content, newData));
988
673
  }
989
674
  console.log("\u2714 Channels migrated to new services API");
990
675
  };
@@ -996,11 +681,11 @@ var runMigrations = async (dir2) => {
996
681
 
997
682
  // eventcatalog/src/enterprise/fields/field-indexer.ts
998
683
  var import_node_path9 = __toESM(require("path"), 1);
999
- var import_node_fs7 = __toESM(require("fs"), 1);
684
+ var import_node_fs6 = __toESM(require("fs"), 1);
1000
685
 
1001
686
  // eventcatalog/src/enterprise/fields/fields-db.ts
1002
687
  var import_sql = __toESM(require("sql.js"), 1);
1003
- var import_node_fs6 = __toESM(require("fs"), 1);
688
+ var import_node_fs5 = __toESM(require("fs"), 1);
1004
689
  var SCHEMA_SQL = `
1005
690
  CREATE TABLE IF NOT EXISTS fields (
1006
691
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1069,13 +754,13 @@ var FieldsDatabase = class _FieldsDatabase {
1069
754
  this.dbPath = dbPath;
1070
755
  }
1071
756
  static async create(dbPath, options) {
1072
- if (options?.recreate && import_node_fs6.default.existsSync(dbPath)) {
1073
- import_node_fs6.default.unlinkSync(dbPath);
757
+ if (options?.recreate && import_node_fs5.default.existsSync(dbPath)) {
758
+ import_node_fs5.default.unlinkSync(dbPath);
1074
759
  }
1075
760
  const SQL = await (0, import_sql.default)();
1076
761
  let db;
1077
- if (!options?.recreate && import_node_fs6.default.existsSync(dbPath)) {
1078
- const buffer = import_node_fs6.default.readFileSync(dbPath);
762
+ if (!options?.recreate && import_node_fs5.default.existsSync(dbPath)) {
763
+ const buffer = import_node_fs5.default.readFileSync(dbPath);
1079
764
  db = new SQL.Database(buffer);
1080
765
  } else {
1081
766
  db = new SQL.Database();
@@ -1136,7 +821,7 @@ var FieldsDatabase = class _FieldsDatabase {
1136
821
  save() {
1137
822
  const data = this.db.export();
1138
823
  const buffer = Buffer.from(data);
1139
- import_node_fs6.default.writeFileSync(this.dbPath, buffer);
824
+ import_node_fs5.default.writeFileSync(this.dbPath, buffer);
1140
825
  }
1141
826
  queryFields(params) {
1142
827
  const {
@@ -1361,22 +1046,22 @@ function getAvroTypeName(type) {
1361
1046
  function walkAvroRecord(schema, prefix, fields) {
1362
1047
  if (!schema.fields || !Array.isArray(schema.fields)) return;
1363
1048
  for (const field of schema.fields) {
1364
- const path20 = prefix ? `${prefix}.${field.name}` : field.name;
1049
+ const path19 = prefix ? `${prefix}.${field.name}` : field.name;
1365
1050
  const isOptional = Array.isArray(field.type) && field.type.includes("null");
1366
1051
  const typeName = getAvroTypeName(field.type);
1367
1052
  fields.push({
1368
- path: path20,
1053
+ path: path19,
1369
1054
  type: typeName,
1370
1055
  description: field.doc || "",
1371
1056
  required: !isOptional
1372
1057
  });
1373
1058
  const innerType = Array.isArray(field.type) ? field.type.find((t) => typeof t === "object" && t.type === "record") : typeof field.type === "object" && field.type.type === "record" ? field.type : null;
1374
1059
  if (innerType) {
1375
- walkAvroRecord(innerType, path20, fields);
1060
+ walkAvroRecord(innerType, path19, fields);
1376
1061
  }
1377
1062
  const arrayType = Array.isArray(field.type) ? field.type.find((t) => typeof t === "object" && t.type === "array") : typeof field.type === "object" && field.type.type === "array" ? field.type : null;
1378
1063
  if (arrayType && typeof arrayType.items === "object" && arrayType.items.type === "record") {
1379
- walkAvroRecord(arrayType.items, `${path20}[]`, fields);
1064
+ walkAvroRecord(arrayType.items, `${path19}[]`, fields);
1380
1065
  }
1381
1066
  }
1382
1067
  }
@@ -1407,32 +1092,32 @@ function walkJsonSchema(node, prefix, requiredList, rootSchema, fields) {
1407
1092
  }
1408
1093
  if (!node.properties) return;
1409
1094
  for (const [name, prop] of Object.entries(node.properties)) {
1410
- const path20 = prefix ? `${prefix}.${name}` : name;
1095
+ const path19 = prefix ? `${prefix}.${name}` : name;
1411
1096
  const isRequired = requiredList.includes(name);
1412
1097
  if (prop.$ref) {
1413
1098
  const resolved = resolveLocalRef(prop.$ref, rootSchema);
1414
1099
  if (resolved) {
1415
1100
  const rawRefType = resolved.type || "object";
1416
1101
  const type2 = Array.isArray(rawRefType) ? [...rawRefType].sort().join(" | ") : rawRefType;
1417
- fields.push({ path: path20, type: type2, description: resolved.description || "", required: isRequired });
1102
+ fields.push({ path: path19, type: type2, description: resolved.description || "", required: isRequired });
1418
1103
  if (resolved.properties) {
1419
- walkJsonSchema(resolved, path20, resolved.required || [], rootSchema, fields);
1104
+ walkJsonSchema(resolved, path19, resolved.required || [], rootSchema, fields);
1420
1105
  }
1421
1106
  } else {
1422
- fields.push({ path: path20, type: "$ref", description: "", required: isRequired });
1107
+ fields.push({ path: path19, type: "$ref", description: "", required: isRequired });
1423
1108
  }
1424
1109
  continue;
1425
1110
  }
1426
1111
  const rawType = prop.type || (prop.enum ? "enum" : prop.$ref ? "$ref" : "object");
1427
1112
  const typeList = Array.isArray(rawType) ? rawType : [rawType];
1428
1113
  const type = Array.isArray(rawType) ? [...rawType].sort().join(" | ") : rawType;
1429
- fields.push({ path: path20, type, description: prop.description || "", required: isRequired });
1114
+ fields.push({ path: path19, type, description: prop.description || "", required: isRequired });
1430
1115
  if (typeList.includes("object") && prop.properties) {
1431
- walkJsonSchema(prop, path20, prop.required || [], rootSchema, fields);
1116
+ walkJsonSchema(prop, path19, prop.required || [], rootSchema, fields);
1432
1117
  }
1433
1118
  if (typeList.includes("array") && prop.items) {
1434
1119
  if (prop.items.type === "object" && prop.items.properties) {
1435
- walkJsonSchema(prop.items, `${path20}[]`, prop.items.required || [], rootSchema, fields);
1120
+ walkJsonSchema(prop.items, `${path19}[]`, prop.items.required || [], rootSchema, fields);
1436
1121
  }
1437
1122
  }
1438
1123
  }
@@ -1448,6 +1133,20 @@ function resolveLocalRef(ref, rootSchema) {
1448
1133
  return current;
1449
1134
  }
1450
1135
 
1136
+ // eventcatalog/integrations/runtime-paths.mjs
1137
+ var import_node_path8 = __toESM(require("path"), 1);
1138
+ function getRuntimePaths(projectDirectory, runtimeDirectory) {
1139
+ const project = import_node_path8.default.resolve(projectDirectory);
1140
+ const cacheDirectory = import_node_path8.default.join(project, ".astro");
1141
+ const runtime = runtimeDirectory ? import_node_path8.default.resolve(runtimeDirectory) : import_node_path8.default.join(cacheDirectory, "eventcatalog");
1142
+ return {
1143
+ projectDirectory: project,
1144
+ cacheDirectory,
1145
+ runtimeDirectory: runtime,
1146
+ fieldsDatabasePath: import_node_path8.default.join(runtime, ".eventcatalog", "fields.db")
1147
+ };
1148
+ }
1149
+
1451
1150
  // eventcatalog/src/enterprise/fields/field-indexer.ts
1452
1151
  function detectFormat(fileName) {
1453
1152
  const ext = import_node_path9.default.extname(fileName).toLowerCase();
@@ -1458,10 +1157,10 @@ function detectFormat(fileName) {
1458
1157
  async function buildFieldsIndex(catalogDir, outputDir) {
1459
1158
  const sdkModule = await import("@eventcatalog/sdk");
1460
1159
  const sdk = sdkModule.default(catalogDir);
1461
- const dbDir = import_node_path9.default.join(outputDir || catalogDir, ".eventcatalog");
1462
- const dbPath = import_node_path9.default.join(dbDir, "fields.db");
1463
- if (!import_node_fs7.default.existsSync(dbDir)) {
1464
- import_node_fs7.default.mkdirSync(dbDir, { recursive: true });
1160
+ const { fieldsDatabasePath: dbPath } = getRuntimePaths(catalogDir, outputDir || catalogDir);
1161
+ const dbDir = import_node_path9.default.dirname(dbPath);
1162
+ if (!import_node_fs6.default.existsSync(dbDir)) {
1163
+ import_node_fs6.default.mkdirSync(dbDir, { recursive: true });
1465
1164
  }
1466
1165
  const db = await FieldsDatabase.create(dbPath, { recreate: true });
1467
1166
  const warnings = [];
@@ -1546,7 +1245,7 @@ async function buildFieldsIndex(catalogDir, outputDir) {
1546
1245
  // src/search-indexer.ts
1547
1246
  var import_promises4 = __toESM(require("fs/promises"), 1);
1548
1247
  var import_node_path10 = __toESM(require("path"), 1);
1549
- var import_glob4 = require("glob");
1248
+ var import_glob3 = require("glob");
1550
1249
  var import_gray_matter4 = __toESM(require("gray-matter"), 1);
1551
1250
  var RESOURCE_COLLECTIONS = {
1552
1251
  adrs: { docsPath: "adrs", type: "Architecture Decision" },
@@ -1566,6 +1265,7 @@ var RESOURCE_COLLECTIONS = {
1566
1265
  var IGNORED_GLOBS = [
1567
1266
  "**/.git/**",
1568
1267
  "**/.eventcatalog-core/**",
1268
+ "**/.astro/**",
1569
1269
  "**/dist/**",
1570
1270
  "**/node_modules/**",
1571
1271
  "**/public/**",
@@ -1760,7 +1460,7 @@ var collectSearchRecords = async ({
1760
1460
  projectDir,
1761
1461
  config
1762
1462
  }) => {
1763
- const files = await (0, import_glob4.glob)("**/*.{md,mdx}", {
1463
+ const files = await (0, import_glob3.glob)("**/*.{md,mdx}", {
1764
1464
  cwd: projectDir,
1765
1465
  absolute: true,
1766
1466
  nodir: true,
@@ -1872,122 +1572,79 @@ ${errors.join("\n")}`);
1872
1572
  };
1873
1573
  };
1874
1574
 
1875
- // src/core-node-modules.ts
1876
- var import_fs2 = __toESM(require("fs"), 1);
1575
+ // src/catalog-runtime.ts
1576
+ var import_node_fs7 = __toESM(require("fs"), 1);
1877
1577
  var import_node_path11 = __toESM(require("path"), 1);
1878
- var isDirectory = (directory) => {
1879
- try {
1880
- return import_fs2.default.statSync(directory).isDirectory();
1881
- } catch (error) {
1882
- return false;
1883
- }
1884
- };
1885
- var hasAstroDependency = (nodeModulesDirectory) => {
1886
- const astroBin = process.platform === "win32" ? "astro.cmd" : "astro";
1887
- return import_fs2.default.existsSync(import_node_path11.default.join(nodeModulesDirectory, "astro", "package.json")) || import_fs2.default.existsSync(import_node_path11.default.join(nodeModulesDirectory, ".bin", astroBin));
1888
- };
1889
- var isSymbolicLink = (targetPath) => {
1890
- try {
1891
- return import_fs2.default.lstatSync(targetPath).isSymbolicLink();
1892
- } catch (error) {
1893
- return false;
1894
- }
1895
- };
1896
- var isSameDirectory = (a, b) => {
1897
- try {
1898
- return import_fs2.default.realpathSync.native(a) === import_fs2.default.realpathSync.native(b);
1899
- } catch (error) {
1900
- return false;
1901
- }
1902
- };
1903
- var resolveInstalledCoreNodeModules = (currentDir2) => {
1904
- const candidates = [];
1905
- const seen = /* @__PURE__ */ new Set();
1906
- const addCandidate = (candidate) => {
1907
- const resolvedCandidate = import_node_path11.default.resolve(candidate);
1908
- if (!seen.has(resolvedCandidate)) {
1909
- candidates.push(resolvedCandidate);
1910
- seen.add(resolvedCandidate);
1911
- }
1912
- };
1913
- addCandidate(import_node_path11.default.resolve(currentDir2, "..", "node_modules"));
1914
- let directory = import_node_path11.default.resolve(currentDir2);
1915
- while (true) {
1916
- if (import_node_path11.default.basename(directory) === "node_modules") {
1917
- addCandidate(directory);
1918
- }
1919
- addCandidate(import_node_path11.default.join(directory, "node_modules"));
1920
- const parentDirectory = import_node_path11.default.dirname(directory);
1921
- if (parentDirectory === directory) {
1922
- break;
1923
- }
1924
- directory = parentDirectory;
1925
- }
1926
- return candidates.find((candidate) => isDirectory(candidate) && hasAstroDependency(candidate)) ?? candidates.find(isDirectory);
1927
- };
1928
- var linkCoreNodeModules = ({
1929
- coreNodeModules,
1930
- installedCoreNodeModules
1931
- }) => {
1932
- if (!installedCoreNodeModules) return;
1933
- if (isSymbolicLink(coreNodeModules)) {
1934
- if (isSameDirectory(coreNodeModules, installedCoreNodeModules)) {
1935
- return;
1936
- }
1937
- import_fs2.default.unlinkSync(coreNodeModules);
1938
- } else if (import_fs2.default.existsSync(coreNodeModules)) {
1939
- return;
1578
+ var import_node_module = require("module");
1579
+ var require2 = (0, import_node_module.createRequire)(importMetaUrl);
1580
+ var writeIfChanged = (file, content) => {
1581
+ if (import_node_fs7.default.existsSync(file) && import_node_fs7.default.readFileSync(file, "utf8") === content) return;
1582
+ import_node_fs7.default.mkdirSync(import_node_path11.default.dirname(file), { recursive: true });
1583
+ import_node_fs7.default.writeFileSync(file, content);
1584
+ };
1585
+ var importPath = (file) => file.replace(/\\/g, "/");
1586
+ var clearCatalogCache = (projectDirectory) => {
1587
+ const { cacheDirectory } = getRuntimePaths(projectDirectory);
1588
+ import_node_fs7.default.rmSync(cacheDirectory, { recursive: true, force: true });
1589
+ };
1590
+ var prepareCatalogRuntime = ({ projectDirectory, catalogDirectory, packageDirectory }) => {
1591
+ const runtime = import_node_path11.default.resolve(catalogDirectory);
1592
+ const source = import_node_path11.default.resolve(packageDirectory);
1593
+ const project = import_node_path11.default.resolve(projectDirectory);
1594
+ if (runtime === source || runtime === project) {
1595
+ throw new Error("The catalog runtime must be separate from the project and installed application directories.");
1596
+ }
1597
+ import_node_fs7.default.mkdirSync(runtime, { recursive: true });
1598
+ writeIfChanged(
1599
+ import_node_path11.default.join(runtime, "content.config.ts"),
1600
+ `export { collections } from ${JSON.stringify(importPath(import_node_path11.default.join(source, "src/content.config.ts")))};
1601
+ `
1602
+ );
1603
+ const packageTsconfig = JSON.parse(import_node_fs7.default.readFileSync(import_node_path11.default.join(source, "tsconfig.json"), "utf8"));
1604
+ const paths = Object.fromEntries(
1605
+ Object.entries(packageTsconfig.compilerOptions.paths).map(([alias, targets]) => [
1606
+ alias,
1607
+ targets.map((target) => importPath(import_node_path11.default.resolve(source, target)))
1608
+ ])
1609
+ );
1610
+ paths["@config"] = [importPath(import_node_path11.default.join(project, "eventcatalog.config.js"))];
1611
+ paths["@catalog/styles"] = [importPath(import_node_path11.default.join(project, "eventcatalog.styles.css"))];
1612
+ paths["@catalog/components/*"] = [
1613
+ importPath(import_node_path11.default.join(project, "components/*")),
1614
+ importPath(import_node_path11.default.join(project, "federated/components/*"))
1615
+ ];
1616
+ paths["@catalog/snippets/*"] = [importPath(import_node_path11.default.join(project, "snippets/*"))];
1617
+ for (const specifier of ["astro", "astro/zod", "astro/loaders", "astro/runtime/server/index.js"]) {
1618
+ paths[specifier] = [importPath(require2.resolve(specifier).replace(/\.js$/, ".d.ts"))];
1940
1619
  }
1941
- import_fs2.default.symlinkSync(installedCoreNodeModules, coreNodeModules, process.platform === "win32" ? "junction" : "dir");
1942
- };
1943
-
1944
- // src/copy-core.ts
1945
- var import_node_fs8 = __toESM(require("fs"), 1);
1946
- var import_node_path12 = __toESM(require("path"), 1);
1947
- var IGNORED_CORE_DIRECTORIES = /* @__PURE__ */ new Set([".astro", "dist", "node_modules", "__tests__"]);
1948
- var COLOCATED_TEST_SUFFIXES = [
1949
- ".spec.js",
1950
- ".spec.jsx",
1951
- ".spec.cjs",
1952
- ".spec.mjs",
1953
- ".spec.ts",
1954
- ".spec.tsx",
1955
- ".spec.cts",
1956
- ".spec.mts",
1957
- ".test.js",
1958
- ".test.jsx",
1959
- ".test.cjs",
1960
- ".test.mjs",
1961
- ".test.ts",
1962
- ".test.tsx",
1963
- ".test.cts",
1964
- ".test.mts"
1965
- ];
1966
- var isColocatedTestFile = (fileName) => COLOCATED_TEST_SUFFIXES.some((suffix) => fileName.endsWith(suffix));
1967
- var shouldCopyCoreEntry = (sourceRoot, sourcePath) => {
1968
- const relativePath = import_node_path12.default.relative(sourceRoot, sourcePath);
1969
- if (relativePath === "") return true;
1970
- const pathParts = relativePath.split(import_node_path12.default.sep);
1971
- if (pathParts.some((part) => IGNORED_CORE_DIRECTORIES.has(part))) return false;
1972
- const fileName = pathParts[pathParts.length - 1] ?? "";
1973
- return !isColocatedTestFile(fileName);
1974
- };
1975
- var PRUNE_SKIPPED_DIRECTORIES = /* @__PURE__ */ new Set([".astro", "dist", "node_modules"]);
1976
- var pruneExcludedCoreEntries = (coreDir) => {
1977
- if (!import_node_fs8.default.existsSync(coreDir)) return;
1978
- const visit = (directory) => {
1979
- for (const entry of import_node_fs8.default.readdirSync(directory, { withFileTypes: true })) {
1980
- const entryPath = import_node_path12.default.join(directory, entry.name);
1981
- if (entry.name === "__tests__" || isColocatedTestFile(entry.name)) {
1982
- import_node_fs8.default.rmSync(entryPath, { recursive: true, force: true });
1983
- continue;
1984
- }
1985
- if (entry.isDirectory() && !PRUNE_SKIPPED_DIRECTORIES.has(entry.name)) {
1986
- visit(entryPath);
1987
- }
1988
- }
1989
- };
1990
- visit(coreDir);
1620
+ writeIfChanged(
1621
+ import_node_path11.default.join(runtime, "tsconfig.json"),
1622
+ JSON.stringify(
1623
+ {
1624
+ extends: importPath(import_node_path11.default.join(source, "tsconfig.json")),
1625
+ compilerOptions: {
1626
+ baseUrl: ".",
1627
+ paths,
1628
+ typeRoots: [
1629
+ importPath(import_node_path11.default.join(project, "node_modules/@types")),
1630
+ importPath(import_node_path11.default.join(source, "../node_modules/@types")),
1631
+ importPath(import_node_path11.default.join(source, "../node_modules")),
1632
+ importPath(import_node_path11.default.join(project, "node_modules"))
1633
+ ]
1634
+ },
1635
+ include: [
1636
+ importPath(import_node_path11.default.join(project, ".astro/types.d.ts")),
1637
+ "content.config.ts",
1638
+ importPath(import_node_path11.default.join(project, "components/**/*")),
1639
+ importPath(import_node_path11.default.join(source, "src/**/*"))
1640
+ ],
1641
+ // Keep legacy generated files out of checks on an existing checkout.
1642
+ exclude: (packageTsconfig.exclude ?? []).map((entry) => importPath(import_node_path11.default.resolve(source, entry)))
1643
+ },
1644
+ null,
1645
+ 2
1646
+ ) + "\n"
1647
+ );
1991
1648
  };
1992
1649
 
1993
1650
  // eventcatalog/src/plugins/empty-collection-warning.mjs
@@ -2061,6 +1718,20 @@ var createAstroDevLineFilter = () => {
2061
1718
  };
2062
1719
  };
2063
1720
 
1721
+ // src/astro-config-path.ts
1722
+ var import_node_path12 = __toESM(require("path"), 1);
1723
+ var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path12.default) => {
1724
+ const relative = paths.relative(projectDirectory, configFile);
1725
+ const projectRoot = paths.parse(paths.resolve(projectDirectory)).root.toLowerCase();
1726
+ const configRoot = paths.parse(paths.resolve(configFile)).root.toLowerCase();
1727
+ if (projectRoot !== configRoot || paths.isAbsolute(relative)) {
1728
+ throw new Error(
1729
+ "EventCatalog cannot load its Astro configuration across filesystem drives. Install or link @eventcatalog/core on the same drive as the catalog."
1730
+ );
1731
+ }
1732
+ return relative.replace(/\\/g, "/");
1733
+ };
1734
+
2064
1735
  // src/federation/federate.ts
2065
1736
  var import_node_crypto5 = require("crypto");
2066
1737
  var import_promises10 = __toESM(require("fs/promises"), 1);
@@ -2599,7 +2270,7 @@ var createFileSystemSourceProvider = (projectDirectory) => ({
2599
2270
  // src/federation/github-source-provider.ts
2600
2271
  var import_node_child_process = require("child_process");
2601
2272
  var import_promises9 = __toESM(require("fs/promises"), 1);
2602
- var import_node_os4 = __toESM(require("os"), 1);
2273
+ var import_node_os3 = __toESM(require("os"), 1);
2603
2274
  var import_node_path17 = __toESM(require("path"), 1);
2604
2275
  var import_node_util = require("util");
2605
2276
  var import_sdk2 = __toESM(require("@eventcatalog/sdk"), 1);
@@ -2656,7 +2327,7 @@ var getGitEnvironment = (token) => {
2656
2327
  var createCheckout = (executeFile, token) => async (source, ref, callback) => {
2657
2328
  const { owner, repository } = parseGitHubSource(source);
2658
2329
  const catalogPath = import_node_path17.default.posix.normalize(source.path ?? ".");
2659
- const directory = await import_promises9.default.mkdtemp(import_node_path17.default.join(import_node_os4.default.tmpdir(), "eventcatalog-federation-"));
2330
+ const directory = await import_promises9.default.mkdtemp(import_node_path17.default.join(import_node_os3.default.tmpdir(), "eventcatalog-federation-"));
2660
2331
  const env = getGitEnvironment(token);
2661
2332
  try {
2662
2333
  const git = (args) => executeFile("git", args, { cwd: directory, env, encoding: "utf8" });
@@ -2999,14 +2670,16 @@ Run npm i @eventcatalog/core to update`;
2999
2670
 
3000
2671
  // src/eventcatalog.ts
3001
2672
  var import_license2 = require("@eventcatalog/license");
3002
- var currentDir = import_node_path20.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
2673
+ var currentDir = import_node_path20.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
2674
+ var astroCli = import_node_path20.default.join(import_node_path20.default.dirname((0, import_node_module2.createRequire)(importMetaUrl).resolve("astro/package.json")), "bin/astro.mjs");
3003
2675
  var program = new import_commander.Command().version(VERSION);
3004
2676
  var dir = import_node_path20.default.resolve(process.env.PROJECT_DIR || process.cwd());
3005
- var core = import_node_path20.default.resolve(process.env.CATALOG_DIR || (0, import_node_path19.join)(dir, ".eventcatalog-core"));
3006
2677
  var eventCatalogDir = import_node_path20.default.resolve((0, import_node_path19.join)(currentDir, "../eventcatalog/"));
2678
+ var astroConfigPath = () => getAstroConfigPath(dir, (0, import_node_path19.join)(eventCatalogDir, "astro.config.mjs"));
2679
+ var { runtimeDirectory: core } = getRuntimePaths(dir);
3007
2680
  var getInstalledEventCatalogVersion = () => {
3008
2681
  try {
3009
- const pkg = import_fs3.default.readFileSync((0, import_node_path19.join)(dir, "package.json"), "utf8");
2682
+ const pkg = import_fs.default.readFileSync((0, import_node_path19.join)(dir, "package.json"), "utf8");
3010
2683
  const json = JSON.parse(pkg);
3011
2684
  return json.dependencies["@eventcatalog/core"];
3012
2685
  } catch (error) {
@@ -3015,8 +2688,8 @@ var getInstalledEventCatalogVersion = () => {
3015
2688
  };
3016
2689
  program.name("eventcatalog").description("Documentation tool for event-driven architectures");
3017
2690
  var ensureDir = (dir2) => {
3018
- if (!import_fs3.default.existsSync(dir2)) {
3019
- import_fs3.default.mkdirSync(dir2);
2691
+ if (!import_fs.default.existsSync(dir2)) {
2692
+ import_fs.default.mkdirSync(dir2);
3020
2693
  }
3021
2694
  };
3022
2695
  var resolveDevPort = async ({ projectDir }) => {
@@ -3036,7 +2709,7 @@ var startDevPrewarm = ({
3036
2709
  initialDelayMs = 500
3037
2710
  }) => {
3038
2711
  let attempt = 0;
3039
- const hit = (requestPath) => new Promise((resolve3) => {
2712
+ const hit = (requestPath) => new Promise((resolve2) => {
3040
2713
  const req = import_node_http.default.get(
3041
2714
  {
3042
2715
  hostname: "127.0.0.1",
@@ -3046,13 +2719,13 @@ var startDevPrewarm = ({
3046
2719
  },
3047
2720
  (res) => {
3048
2721
  res.resume();
3049
- resolve3(true);
2722
+ resolve2(true);
3050
2723
  }
3051
2724
  );
3052
- req.on("error", () => resolve3(false));
2725
+ req.on("error", () => resolve2(false));
3053
2726
  req.on("timeout", () => {
3054
2727
  req.destroy();
3055
- resolve3(false);
2728
+ resolve2(false);
3056
2729
  });
3057
2730
  });
3058
2731
  const tick = async () => {
@@ -3129,19 +2802,19 @@ var replaceAstroReadyVersionLine = (line) => {
3129
2802
  };
3130
2803
  var runCommandWithFilteredOutput = async ({
3131
2804
  command,
2805
+ args = [],
3132
2806
  cwd,
3133
2807
  env,
3134
2808
  shouldFilterLine,
3135
2809
  transformLine = (line) => line
3136
2810
  }) => {
3137
- await new Promise((resolve3, reject) => {
3138
- const child = (0, import_node_child_process2.spawn)(command, {
2811
+ await new Promise((resolve2, reject) => {
2812
+ const child = (0, import_node_child_process2.spawn)(command, args, {
3139
2813
  cwd,
3140
2814
  env: {
3141
2815
  ...process.env,
3142
2816
  ...env
3143
2817
  },
3144
- shell: true,
3145
2818
  stdio: ["inherit", "pipe", "pipe"]
3146
2819
  });
3147
2820
  let stdoutBuffer = "";
@@ -3177,29 +2850,20 @@ var runCommandWithFilteredOutput = async ({
3177
2850
  stdoutBuffer = flush(stdoutBuffer, process.stdout, true);
3178
2851
  stderrBuffer = flush(stderrBuffer, process.stderr, true);
3179
2852
  if (code === 0) {
3180
- resolve3();
2853
+ resolve2();
3181
2854
  return;
3182
2855
  }
3183
- reject(new Error(`Command failed with exit code ${code}: ${command}`));
2856
+ reject(new Error(`Command failed with exit code ${code}: ${command} ${args.join(" ")}`));
3184
2857
  });
3185
2858
  });
3186
2859
  };
3187
- var copyCore = () => {
3188
- ensureDir(core);
3189
- if (eventCatalogDir === core) {
3190
- return;
3191
- }
3192
- import_fs3.default.cpSync(eventCatalogDir, core, {
3193
- recursive: true,
3194
- filter: (src) => shouldCopyCoreEntry(eventCatalogDir, src)
3195
- });
3196
- pruneExcludedCoreEntries(core);
3197
- const coreNodeModules = import_node_path20.default.join(core, "node_modules");
3198
- const installedCoreNodeModules = resolveInstalledCoreNodeModules(currentDir);
3199
- linkCoreNodeModules({ coreNodeModules, installedCoreNodeModules });
3200
- };
2860
+ var prepareCore = () => prepareCatalogRuntime({
2861
+ projectDirectory: dir,
2862
+ catalogDirectory: core,
2863
+ packageDirectory: eventCatalogDir
2864
+ });
3201
2865
  var clearCore = () => {
3202
- if (import_fs3.default.existsSync(core)) import_fs3.default.rmSync(core, { recursive: true });
2866
+ clearCatalogCache(dir);
3203
2867
  };
3204
2868
  var checkForUpdate = () => {
3205
2869
  const declaredVersion = getInstalledEventCatalogVersion();
@@ -3249,12 +2913,12 @@ Upgrade now: npm i @eventcatalog/core@beta`;
3249
2913
  );
3250
2914
  }
3251
2915
  };
3252
- program.command("dev").description("Run development server of EventCatalog").option("-d, --debug", "Output EventCatalog application information into your terminal").option("--force-recreate", "Recreate the eventcatalog-core directory", false).option("--no-prewarm", "Disable automatic dev prewarm request").action(async (options, command) => {
2916
+ program.command("dev").description("Run development server of EventCatalog").option("-d, --debug", "Output EventCatalog application information into your terminal").option("--force-recreate", "Clear and regenerate the entire .astro cache, including content and metadata", false).option("--no-prewarm", "Disable automatic dev prewarm request").action(async (options, command) => {
3253
2917
  logger.welcome();
3254
2918
  logger.info("Setting up EventCatalog...", "eventcatalog");
3255
2919
  const isServer = await isOutputServer();
3256
2920
  logger.info(isServer ? "EventCatalog is running in Server Mode" : "EventCatalog is running in Static Mode", "config");
3257
- if (import_fs3.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
2921
+ if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3258
2922
  import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3259
2923
  }
3260
2924
  if (options.debug) {
@@ -3264,10 +2928,9 @@ program.command("dev").description("Run development server of EventCatalog").opt
3264
2928
  }
3265
2929
  if (options.forceRecreate) clearCore();
3266
2930
  await verifyRequiredFieldsAreInCatalogConfigFile(dir);
3267
- copyCore();
2931
+ prepareCore();
3268
2932
  await resolve_catalog_dependencies_default(dir, core);
3269
2933
  await runMigrations(dir);
3270
- await catalogToAstro(dir, core);
3271
2934
  const config = await getEventCatalogConfigFile(dir);
3272
2935
  const canEmbedPages = await (0, import_license2.isFeatureEnabled)(
3273
2936
  "@eventcatalog/backstage-plugin-eventcatalog",
@@ -3303,8 +2966,9 @@ program.command("dev").description("Run development server of EventCatalog").opt
3303
2966
  checkForUpdate();
3304
2967
  let watchUnsub;
3305
2968
  try {
3306
- watchUnsub = await watch(dir, core, shouldBuildIndexedSearch ? createDevSearchIndexWatcher({ config }) : void 0);
3307
- const args = command.args.join(" ").trim();
2969
+ if (shouldBuildIndexedSearch) {
2970
+ watchUnsub = await watch(dir, core, createDevSearchIndexWatcher({ config }));
2971
+ }
3308
2972
  if (options.prewarm) {
3309
2973
  const prewarmPort = await resolveDevPort({
3310
2974
  projectDir: dir
@@ -3315,8 +2979,9 @@ program.command("dev").description("Run development server of EventCatalog").opt
3315
2979
  });
3316
2980
  }
3317
2981
  await runCommandWithFilteredOutput({
3318
- command: `npx astro dev ${args}`,
3319
- cwd: core,
2982
+ command: process.execPath,
2983
+ args: [astroCli, "dev", "--config", astroConfigPath(), ...command.args],
2984
+ cwd: dir,
3320
2985
  env: {
3321
2986
  PROJECT_DIR: dir,
3322
2987
  CATALOG_DIR: core,
@@ -3341,11 +3006,11 @@ program.command("build").description("Run build of EventCatalog").action(async (
3341
3006
  logger.info("Building EventCatalog...", "build");
3342
3007
  const isServer = await isOutputServer();
3343
3008
  logger.info(isServer ? "EventCatalog is running in Server Mode" : "EventCatalog is running in Static Mode", "config");
3344
- if (import_fs3.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3009
+ if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3345
3010
  import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3346
3011
  }
3347
3012
  await verifyRequiredFieldsAreInCatalogConfigFile(dir);
3348
- copyCore();
3013
+ prepareCore();
3349
3014
  const isBackstagePluginEnabled = await (0, import_license2.isFeatureEnabled)(
3350
3015
  "@eventcatalog/backstage-plugin-eventcatalog",
3351
3016
  process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
@@ -3361,7 +3026,6 @@ program.command("build").description("Run build of EventCatalog").action(async (
3361
3026
  });
3362
3027
  await resolve_catalog_dependencies_default(dir, core);
3363
3028
  await runMigrations(dir);
3364
- await catalogToAstro(dir, core);
3365
3029
  if (isServer) {
3366
3030
  try {
3367
3031
  logger.info("Building fields index...", "fields");
@@ -3376,10 +3040,10 @@ program.command("build").description("Run build of EventCatalog").action(async (
3376
3040
  }
3377
3041
  }
3378
3042
  checkForUpdate();
3379
- const args = command.args.join(" ").trim();
3380
3043
  await runCommandWithFilteredOutput({
3381
- command: `npx astro build ${args}`,
3382
- cwd: core,
3044
+ command: process.execPath,
3045
+ args: [astroCli, "build", "--config", astroConfigPath(), ...command.args],
3046
+ cwd: dir,
3383
3047
  env: {
3384
3048
  PROJECT_DIR: dir,
3385
3049
  CATALOG_DIR: core,
@@ -3411,8 +3075,9 @@ var previewCatalog = async ({
3411
3075
  isEventCatalogScale = false
3412
3076
  }) => {
3413
3077
  await runCommandWithFilteredOutput({
3414
- command: `npx astro preview ${command.args.join(" ").trim()}`,
3415
- cwd: core,
3078
+ command: process.execPath,
3079
+ args: [astroCli, "preview", "--config", astroConfigPath(), ...command.args],
3080
+ cwd: dir,
3416
3081
  env: {
3417
3082
  PROJECT_DIR: dir,
3418
3083
  CATALOG_DIR: core,
@@ -3430,8 +3095,9 @@ var startServerCatalog = async ({
3430
3095
  }) => {
3431
3096
  const serverEntryPath = import_node_path20.default.join(dir, "dist", "server", "entry.mjs");
3432
3097
  await runCommandWithFilteredOutput({
3433
- command: `node "${serverEntryPath}"`,
3434
- cwd: core,
3098
+ command: process.execPath,
3099
+ args: [serverEntryPath],
3100
+ cwd: dir,
3435
3101
  env: {
3436
3102
  PROJECT_DIR: dir,
3437
3103
  CATALOG_DIR: core,
@@ -3445,7 +3111,7 @@ var startServerCatalog = async ({
3445
3111
  program.command("preview").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
3446
3112
  logger.welcome();
3447
3113
  logger.info("Starting preview of your build...", "preview");
3448
- if (import_fs3.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3114
+ if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3449
3115
  import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3450
3116
  }
3451
3117
  const canEmbedPages = await (0, import_license2.isFeatureEnabled)(
@@ -3464,7 +3130,7 @@ program.command("preview").description("Serves the contents of your eventcatalog
3464
3130
  program.command("start").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
3465
3131
  logger.welcome();
3466
3132
  logger.info("Starting preview of your build...", "preview");
3467
- if (import_fs3.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3133
+ if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3468
3134
  import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3469
3135
  }
3470
3136
  const canEmbedPages = await (0, import_license2.isFeatureEnabled)(
@@ -3492,7 +3158,7 @@ program.command("start").description("Serves the contents of your eventcatalog b
3492
3158
  program.command("export").description("Export your EventCatalog using the SDK dumpCatalog function").option("--include-markdown", "Include markdown content in the export", false).action(async (options) => {
3493
3159
  logger.welcome();
3494
3160
  logger.info("Exporting EventCatalog...", "export");
3495
- if (import_fs3.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3161
+ if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3496
3162
  import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3497
3163
  }
3498
3164
  const { default: initSDK } = await import("@eventcatalog/sdk");
@@ -3502,11 +3168,11 @@ program.command("export").description("Export your EventCatalog using the SDK du
3502
3168
  ensureDir(exportsDir);
3503
3169
  const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
3504
3170
  const exportFile = import_node_path20.default.join(exportsDir, `catalog-${date}.json`);
3505
- import_fs3.default.writeFileSync(exportFile, JSON.stringify(catalog, null, 2), "utf-8");
3171
+ import_fs.default.writeFileSync(exportFile, JSON.stringify(catalog, null, 2), "utf-8");
3506
3172
  logger.info(`Catalog exported to ${exportFile}`, "export");
3507
3173
  });
3508
3174
  program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
3509
- if (import_fs3.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3175
+ if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3510
3176
  import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3511
3177
  }
3512
3178
  await generate(dir);
@@ -3608,7 +3274,7 @@ var reportFederationProgress = (event, verbose = false) => {
3608
3274
  };
3609
3275
  program.command("federate").description("Fetch, resolve, and hydrate the catalogs configured in federation.sources.").option("--no-cache", "Download all federation content and refresh the cache.").option("-v, --verbose", "Show detailed federation diagnostics.").action(async (commandOptions) => {
3610
3276
  logger.welcome();
3611
- if (import_fs3.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3277
+ if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3612
3278
  import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3613
3279
  }
3614
3280
  logger.info("Starting federation...", "federation");