@eventcatalog/core 5.0.1 → 5.1.0

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 (37) 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 +1 -1
  4. package/dist/analytics/log-build.js +3 -3
  5. package/dist/architecture-export.cjs +69 -0
  6. package/dist/architecture-export.d.cts +48 -0
  7. package/dist/architecture-export.d.ts +48 -0
  8. package/dist/architecture-export.js +12 -0
  9. package/dist/chunk-E6WTCJUL.js +32 -0
  10. package/dist/{chunk-KTXSCPEK.js → chunk-FHZXZWCY.js} +1 -1
  11. package/dist/{chunk-YPWK5ITM.js → chunk-G3CHTDAE.js} +1 -1
  12. package/dist/{chunk-UWAXRTAJ.js → chunk-OT57IOWN.js} +1 -1
  13. package/dist/{chunk-HFR5OPHV.js → chunk-TBXLUIJD.js} +1 -1
  14. package/dist/{chunk-DVHJTQWQ.js → chunk-WBUSFEBH.js} +1 -1
  15. package/dist/constants.cjs +1 -1
  16. package/dist/constants.js +1 -1
  17. package/dist/eventcatalog.cjs +182 -133
  18. package/dist/eventcatalog.config.d.cts +12 -0
  19. package/dist/eventcatalog.config.d.ts +12 -0
  20. package/dist/eventcatalog.js +42 -14
  21. package/dist/federation/federate.js +2 -2
  22. package/dist/generate.cjs +1 -1
  23. package/dist/generate.js +3 -3
  24. package/dist/runtime-dependencies/@eventcatalog__exporters.mjs +3 -0
  25. package/dist/runtime-dependencies/manifest.json +1 -0
  26. package/dist/utils/cli-logger.cjs +1 -1
  27. package/dist/utils/cli-logger.js +2 -2
  28. package/eventcatalog/src/components/NewVersionBanner.astro +31 -0
  29. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +10 -13
  30. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +10 -13
  31. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +13 -18
  32. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +16 -19
  33. package/eventcatalog/src/utils/collections/resource-type-badge.ts +9 -0
  34. package/eventcatalog/src/utils/collections/util.ts +10 -0
  35. package/eventcatalog/src/utils/version-banner.ts +10 -0
  36. package/package.json +4 -3
  37. package/dist/{chunk-46TBJZC3.js → chunk-QJ7KKN2D.js} +4 -4
@@ -29,10 +29,10 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
29
29
  // src/eventcatalog.ts
30
30
  var import_commander = require("commander");
31
31
  var import_node_child_process2 = require("child_process");
32
- var import_node_path21 = require("path");
32
+ var import_node_path22 = require("path");
33
33
  var import_node_http = __toESM(require("http"), 1);
34
34
  var import_fs = __toESM(require("fs"), 1);
35
- var import_node_path22 = __toESM(require("path"), 1);
35
+ var import_node_path23 = __toESM(require("path"), 1);
36
36
  var import_node_url2 = require("url");
37
37
  var import_node_module3 = require("module");
38
38
 
@@ -174,7 +174,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
174
174
  var import_picocolors = __toESM(require("picocolors"), 1);
175
175
 
176
176
  // package.json
177
- var version = "5.0.1";
177
+ var version = "5.1.0";
178
178
 
179
179
  // src/constants.ts
180
180
  var VERSION = version;
@@ -1412,22 +1412,22 @@ function getAvroTypeName(type) {
1412
1412
  function walkAvroRecord(schema, prefix, fields) {
1413
1413
  if (!schema.fields || !Array.isArray(schema.fields)) return;
1414
1414
  for (const field of schema.fields) {
1415
- const path21 = prefix ? `${prefix}.${field.name}` : field.name;
1415
+ const path22 = prefix ? `${prefix}.${field.name}` : field.name;
1416
1416
  const isOptional = Array.isArray(field.type) && field.type.includes("null");
1417
1417
  const typeName = getAvroTypeName(field.type);
1418
1418
  fields.push({
1419
- path: path21,
1419
+ path: path22,
1420
1420
  type: typeName,
1421
1421
  description: field.doc || "",
1422
1422
  required: !isOptional
1423
1423
  });
1424
1424
  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;
1425
1425
  if (innerType) {
1426
- walkAvroRecord(innerType, path21, fields);
1426
+ walkAvroRecord(innerType, path22, fields);
1427
1427
  }
1428
1428
  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;
1429
1429
  if (arrayType && typeof arrayType.items === "object" && arrayType.items.type === "record") {
1430
- walkAvroRecord(arrayType.items, `${path21}[]`, fields);
1430
+ walkAvroRecord(arrayType.items, `${path22}[]`, fields);
1431
1431
  }
1432
1432
  }
1433
1433
  }
@@ -1458,32 +1458,32 @@ function walkJsonSchema(node, prefix, requiredList, rootSchema, fields) {
1458
1458
  }
1459
1459
  if (!node.properties) return;
1460
1460
  for (const [name, prop] of Object.entries(node.properties)) {
1461
- const path21 = prefix ? `${prefix}.${name}` : name;
1461
+ const path22 = prefix ? `${prefix}.${name}` : name;
1462
1462
  const isRequired = requiredList.includes(name);
1463
1463
  if (prop.$ref) {
1464
1464
  const resolved = resolveLocalRef(prop.$ref, rootSchema);
1465
1465
  if (resolved) {
1466
1466
  const rawRefType = resolved.type || "object";
1467
1467
  const type2 = Array.isArray(rawRefType) ? [...rawRefType].sort().join(" | ") : rawRefType;
1468
- fields.push({ path: path21, type: type2, description: resolved.description || "", required: isRequired });
1468
+ fields.push({ path: path22, type: type2, description: resolved.description || "", required: isRequired });
1469
1469
  if (resolved.properties) {
1470
- walkJsonSchema(resolved, path21, resolved.required || [], rootSchema, fields);
1470
+ walkJsonSchema(resolved, path22, resolved.required || [], rootSchema, fields);
1471
1471
  }
1472
1472
  } else {
1473
- fields.push({ path: path21, type: "$ref", description: "", required: isRequired });
1473
+ fields.push({ path: path22, type: "$ref", description: "", required: isRequired });
1474
1474
  }
1475
1475
  continue;
1476
1476
  }
1477
1477
  const rawType = prop.type || (prop.enum ? "enum" : prop.$ref ? "$ref" : "object");
1478
1478
  const typeList = Array.isArray(rawType) ? rawType : [rawType];
1479
1479
  const type = Array.isArray(rawType) ? [...rawType].sort().join(" | ") : rawType;
1480
- fields.push({ path: path21, type, description: prop.description || "", required: isRequired });
1480
+ fields.push({ path: path22, type, description: prop.description || "", required: isRequired });
1481
1481
  if (typeList.includes("object") && prop.properties) {
1482
- walkJsonSchema(prop, path21, prop.required || [], rootSchema, fields);
1482
+ walkJsonSchema(prop, path22, prop.required || [], rootSchema, fields);
1483
1483
  }
1484
1484
  if (typeList.includes("array") && prop.items) {
1485
1485
  if (prop.items.type === "object" && prop.items.properties) {
1486
- walkJsonSchema(prop.items, `${path21}[]`, prop.items.required || [], rootSchema, fields);
1486
+ walkJsonSchema(prop.items, `${path22}[]`, prop.items.required || [], rootSchema, fields);
1487
1487
  }
1488
1488
  }
1489
1489
  }
@@ -1938,75 +1938,101 @@ ${errors.join("\n")}`);
1938
1938
  };
1939
1939
  };
1940
1940
 
1941
- // src/catalog-runtime.ts
1941
+ // src/architecture-export.ts
1942
1942
  var import_node_fs9 = __toESM(require("fs"), 1);
1943
1943
  var import_node_path13 = __toESM(require("path"), 1);
1944
+ var import_exporters = require("@eventcatalog/exporters");
1945
+ var isCatalogAuthEnabled = ({
1946
+ config,
1947
+ projectDir,
1948
+ isServer
1949
+ }) => Boolean(config?.auth?.enabled) && isServer && import_node_fs9.default.existsSync(import_node_path13.default.join(projectDir, "eventcatalog.auth.js"));
1950
+ var resolveArchitectureExport = (config, { authEnabled }) => {
1951
+ const enabled = config?.exports?.html?.enabled;
1952
+ if (enabled === false) return { enabled: false, reason: "disabled" };
1953
+ if (authEnabled && enabled !== true) return { enabled: false, reason: "auth" };
1954
+ return { enabled: true };
1955
+ };
1956
+ var getArchitectureExportPath = ({ outDir, isServer }) => import_node_path13.default.join(outDir, isServer ? "client" : "", "architecture.html");
1957
+ var writeArchitectureExport = ({
1958
+ projectDir,
1959
+ outDir,
1960
+ isServer
1961
+ }) => (0, import_exporters.writeHtml)({
1962
+ dir: projectDir,
1963
+ outputPath: getArchitectureExportPath({ outDir, isServer }),
1964
+ regenerateCommand: "npx eventcatalog build"
1965
+ });
1966
+
1967
+ // src/catalog-runtime.ts
1968
+ var import_node_fs10 = __toESM(require("fs"), 1);
1969
+ var import_node_path14 = __toESM(require("path"), 1);
1944
1970
  var import_node_module2 = require("module");
1945
1971
  var require2 = (0, import_node_module2.createRequire)(importMetaUrl);
1946
1972
  var writeIfChanged = (file, content) => {
1947
- if (import_node_fs9.default.existsSync(file) && import_node_fs9.default.readFileSync(file, "utf8") === content) return;
1948
- import_node_fs9.default.mkdirSync(import_node_path13.default.dirname(file), { recursive: true });
1949
- import_node_fs9.default.writeFileSync(file, content);
1973
+ if (import_node_fs10.default.existsSync(file) && import_node_fs10.default.readFileSync(file, "utf8") === content) return;
1974
+ import_node_fs10.default.mkdirSync(import_node_path14.default.dirname(file), { recursive: true });
1975
+ import_node_fs10.default.writeFileSync(file, content);
1950
1976
  };
1951
1977
  var importPath = (file) => file.replace(/\\/g, "/");
1952
- var hasLegacyCatalogRuntime = (projectDirectory) => import_node_fs9.default.existsSync(import_node_path13.default.join(projectDirectory, ".eventcatalog-core"));
1978
+ var hasLegacyCatalogRuntime = (projectDirectory) => import_node_fs10.default.existsSync(import_node_path14.default.join(projectDirectory, ".eventcatalog-core"));
1953
1979
  var clearCatalogCache = (projectDirectory) => {
1954
1980
  const { cacheDirectory } = getRuntimePaths(projectDirectory);
1955
- import_node_fs9.default.rmSync(cacheDirectory, { recursive: true, force: true });
1981
+ import_node_fs10.default.rmSync(cacheDirectory, { recursive: true, force: true });
1956
1982
  };
1957
1983
  var prepareCatalogRuntime = ({ projectDirectory, catalogDirectory, packageDirectory }) => {
1958
- const runtime = import_node_path13.default.resolve(catalogDirectory);
1959
- const source = import_node_path13.default.resolve(packageDirectory);
1960
- const project = import_node_path13.default.resolve(projectDirectory);
1984
+ const runtime = import_node_path14.default.resolve(catalogDirectory);
1985
+ const source = import_node_path14.default.resolve(packageDirectory);
1986
+ const project = import_node_path14.default.resolve(projectDirectory);
1961
1987
  if (runtime === source || runtime === project) {
1962
1988
  throw new Error("The catalog runtime must be separate from the project and installed application directories.");
1963
1989
  }
1964
- import_node_fs9.default.mkdirSync(runtime, { recursive: true });
1990
+ import_node_fs10.default.mkdirSync(runtime, { recursive: true });
1965
1991
  writeIfChanged(
1966
- import_node_path13.default.join(runtime, "content.config.ts"),
1967
- `export { collections } from ${JSON.stringify(importPath(import_node_path13.default.join(source, "src/content.config.ts")))};
1992
+ import_node_path14.default.join(runtime, "content.config.ts"),
1993
+ `export { collections } from ${JSON.stringify(importPath(import_node_path14.default.join(source, "src/content.config.ts")))};
1968
1994
  `
1969
1995
  );
1970
- const packageTsconfig = JSON.parse(import_node_fs9.default.readFileSync(import_node_path13.default.join(source, "tsconfig.json"), "utf8"));
1996
+ const packageTsconfig = JSON.parse(import_node_fs10.default.readFileSync(import_node_path14.default.join(source, "tsconfig.json"), "utf8"));
1971
1997
  const paths = Object.fromEntries(
1972
1998
  Object.entries(packageTsconfig.compilerOptions.paths).map(([alias, targets]) => [
1973
1999
  alias,
1974
- targets.map((target) => importPath(import_node_path13.default.resolve(source, target)))
2000
+ targets.map((target) => importPath(import_node_path14.default.resolve(source, target)))
1975
2001
  ])
1976
2002
  );
1977
- paths["@config"] = [importPath(import_node_path13.default.join(project, "eventcatalog.config.js"))];
1978
- paths["@catalog/styles"] = [importPath(import_node_path13.default.join(project, "eventcatalog.styles.css"))];
2003
+ paths["@config"] = [importPath(import_node_path14.default.join(project, "eventcatalog.config.js"))];
2004
+ paths["@catalog/styles"] = [importPath(import_node_path14.default.join(project, "eventcatalog.styles.css"))];
1979
2005
  paths["@catalog/components/*"] = [
1980
- importPath(import_node_path13.default.join(project, "components/*")),
1981
- importPath(import_node_path13.default.join(project, "federated/components/*"))
2006
+ importPath(import_node_path14.default.join(project, "components/*")),
2007
+ importPath(import_node_path14.default.join(project, "federated/components/*"))
1982
2008
  ];
1983
- paths["@catalog/snippets/*"] = [importPath(import_node_path13.default.join(project, "snippets/*"))];
2009
+ paths["@catalog/snippets/*"] = [importPath(import_node_path14.default.join(project, "snippets/*"))];
1984
2010
  for (const specifier of ["astro", "astro/zod", "astro/loaders", "astro/runtime/server/index.js"]) {
1985
2011
  paths[specifier] = [importPath(require2.resolve(specifier).replace(/\.js$/, ".d.ts"))];
1986
2012
  }
1987
2013
  writeIfChanged(
1988
- import_node_path13.default.join(runtime, "tsconfig.json"),
2014
+ import_node_path14.default.join(runtime, "tsconfig.json"),
1989
2015
  JSON.stringify(
1990
2016
  {
1991
- extends: importPath(import_node_path13.default.join(source, "tsconfig.json")),
2017
+ extends: importPath(import_node_path14.default.join(source, "tsconfig.json")),
1992
2018
  compilerOptions: {
1993
2019
  baseUrl: ".",
1994
2020
  paths,
1995
2021
  typeRoots: [
1996
- importPath(import_node_path13.default.join(project, "node_modules/@types")),
1997
- importPath(import_node_path13.default.join(source, "../node_modules/@types")),
1998
- importPath(import_node_path13.default.join(source, "../node_modules")),
1999
- importPath(import_node_path13.default.join(project, "node_modules"))
2022
+ importPath(import_node_path14.default.join(project, "node_modules/@types")),
2023
+ importPath(import_node_path14.default.join(source, "../node_modules/@types")),
2024
+ importPath(import_node_path14.default.join(source, "../node_modules")),
2025
+ importPath(import_node_path14.default.join(project, "node_modules"))
2000
2026
  ]
2001
2027
  },
2002
2028
  include: [
2003
- importPath(import_node_path13.default.join(project, ".astro/types.d.ts")),
2029
+ importPath(import_node_path14.default.join(project, ".astro/types.d.ts")),
2004
2030
  "content.config.ts",
2005
- importPath(import_node_path13.default.join(project, "components/**/*")),
2006
- importPath(import_node_path13.default.join(source, "src/**/*"))
2031
+ importPath(import_node_path14.default.join(project, "components/**/*")),
2032
+ importPath(import_node_path14.default.join(source, "src/**/*"))
2007
2033
  ],
2008
2034
  // Keep legacy generated files out of checks on an existing checkout.
2009
- exclude: (packageTsconfig.exclude ?? []).map((entry) => importPath(import_node_path13.default.resolve(source, entry)))
2035
+ exclude: (packageTsconfig.exclude ?? []).map((entry) => importPath(import_node_path14.default.resolve(source, entry)))
2010
2036
  },
2011
2037
  null,
2012
2038
  2
@@ -2086,8 +2112,8 @@ var createAstroDevLineFilter = () => {
2086
2112
  };
2087
2113
 
2088
2114
  // src/astro-config-path.ts
2089
- var import_node_path14 = __toESM(require("path"), 1);
2090
- var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path14.default) => {
2115
+ var import_node_path15 = __toESM(require("path"), 1);
2116
+ var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path15.default) => {
2091
2117
  const relative = paths.relative(projectDirectory, configFile);
2092
2118
  const projectRoot = paths.parse(paths.resolve(projectDirectory)).root.toLowerCase();
2093
2119
  const configRoot = paths.parse(paths.resolve(configFile)).root.toLowerCase();
@@ -2102,18 +2128,18 @@ var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path
2102
2128
  // src/federation/federate.ts
2103
2129
  var import_node_crypto5 = require("crypto");
2104
2130
  var import_promises10 = __toESM(require("fs/promises"), 1);
2105
- var import_node_path20 = __toESM(require("path"), 1);
2131
+ var import_node_path21 = __toESM(require("path"), 1);
2106
2132
  var import_sdk3 = __toESM(require("@eventcatalog/sdk"), 1);
2107
2133
 
2108
2134
  // src/federation/content-cache.ts
2109
2135
  var import_node_crypto2 = require("crypto");
2110
2136
  var import_promises5 = __toESM(require("fs/promises"), 1);
2111
- var import_node_path15 = __toESM(require("path"), 1);
2137
+ var import_node_path16 = __toESM(require("path"), 1);
2112
2138
  var getContentHash = (content) => `sha256:${(0, import_node_crypto2.createHash)("sha256").update(content).digest("hex")}`;
2113
2139
  var isContentHash = (key) => /^sha256:[a-f0-9]{64}$/i.test(key);
2114
2140
  var createFederationContentCache = (projectDirectory, options = {}) => {
2115
- const cacheDirectory = import_node_path15.default.join(projectDirectory, ".eventcatalog-cache", "federation", "content");
2116
- const getCachePath = (key) => import_node_path15.default.join(cacheDirectory, encodeURIComponent(key));
2141
+ const cacheDirectory = import_node_path16.default.join(projectDirectory, ".eventcatalog-cache", "federation", "content");
2142
+ const getCachePath = (key) => import_node_path16.default.join(cacheDirectory, encodeURIComponent(key));
2117
2143
  return {
2118
2144
  async get(key) {
2119
2145
  if (options.read === false || !isContentHash(key)) return void 0;
@@ -2300,20 +2326,20 @@ var getVisibleFederationDiagnostics = (diagnostics, verbose) => diagnostics.filt
2300
2326
 
2301
2327
  // src/federation/output-transaction.ts
2302
2328
  var import_promises6 = __toESM(require("fs/promises"), 1);
2303
- var import_node_path16 = __toESM(require("path"), 1);
2329
+ var import_node_path17 = __toESM(require("path"), 1);
2304
2330
  var getSafePublicPath = (publicDirectory, relativePath) => {
2305
- const normalizedPath = import_node_path16.default.posix.normalize(relativePath);
2306
- const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path16.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
2331
+ const normalizedPath = import_node_path17.default.posix.normalize(relativePath);
2332
+ const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path17.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
2307
2333
  if (unsafe) return void 0;
2308
- const destinationPath = import_node_path16.default.resolve(publicDirectory, relativePath);
2309
- const relativeDestinationPath = import_node_path16.default.relative(publicDirectory, destinationPath);
2310
- return relativeDestinationPath !== "" && relativeDestinationPath !== ".." && !relativeDestinationPath.startsWith(`..${import_node_path16.default.sep}`) && !import_node_path16.default.isAbsolute(relativeDestinationPath) ? destinationPath : void 0;
2334
+ const destinationPath = import_node_path17.default.resolve(publicDirectory, relativePath);
2335
+ const relativeDestinationPath = import_node_path17.default.relative(publicDirectory, destinationPath);
2336
+ return relativeDestinationPath !== "" && relativeDestinationPath !== ".." && !relativeDestinationPath.startsWith(`..${import_node_path17.default.sep}`) && !import_node_path17.default.isAbsolute(relativeDestinationPath) ? destinationPath : void 0;
2311
2337
  };
2312
2338
  var beginFederationOutputTransaction = async (projectDirectory, outDir, relativePublicPaths) => {
2313
- const transactionDirectory = await import_promises6.default.mkdtemp(import_node_path16.default.join(projectDirectory, ".eventcatalog-federation-transaction-"));
2314
- const previousOutDir = import_node_path16.default.join(transactionDirectory, "federated");
2315
- const publicBackupDirectory = import_node_path16.default.join(transactionDirectory, "public");
2316
- const publicDirectory = import_node_path16.default.resolve(projectDirectory, "public");
2339
+ const transactionDirectory = await import_promises6.default.mkdtemp(import_node_path17.default.join(projectDirectory, ".eventcatalog-federation-transaction-"));
2340
+ const previousOutDir = import_node_path17.default.join(transactionDirectory, "federated");
2341
+ const publicBackupDirectory = import_node_path17.default.join(transactionDirectory, "public");
2342
+ const publicDirectory = import_node_path17.default.resolve(projectDirectory, "public");
2317
2343
  const publicSnapshots = [];
2318
2344
  const missingPublicDirectories = /* @__PURE__ */ new Set();
2319
2345
  let hadPreviousOutDir = false;
@@ -2324,8 +2350,8 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
2324
2350
  try {
2325
2351
  const stat = await import_promises6.default.lstat(destinationPath);
2326
2352
  if (!stat.isFile()) continue;
2327
- const backupPath = import_node_path16.default.join(publicBackupDirectory, `${publicSnapshots.length}`);
2328
- await import_promises6.default.mkdir(import_node_path16.default.dirname(backupPath), { recursive: true });
2353
+ const backupPath = import_node_path17.default.join(publicBackupDirectory, `${publicSnapshots.length}`);
2354
+ await import_promises6.default.mkdir(import_node_path17.default.dirname(backupPath), { recursive: true });
2329
2355
  await import_promises6.default.copyFile(destinationPath, backupPath);
2330
2356
  publicSnapshots.push({ backupPath, destinationPath, state: "file" });
2331
2357
  } catch (error) {
@@ -2333,7 +2359,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
2333
2359
  if (code === "ENOTDIR") continue;
2334
2360
  if (code !== "ENOENT") throw error;
2335
2361
  publicSnapshots.push({ destinationPath, state: "missing" });
2336
- let directory = import_node_path16.default.dirname(destinationPath);
2362
+ let directory = import_node_path17.default.dirname(destinationPath);
2337
2363
  while (directory !== publicDirectory) {
2338
2364
  try {
2339
2365
  await import_promises6.default.lstat(directory);
@@ -2343,7 +2369,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
2343
2369
  if (directoryCode === "ENOTDIR") break;
2344
2370
  if (directoryCode !== "ENOENT") throw directoryError;
2345
2371
  missingPublicDirectories.add(directory);
2346
- directory = import_node_path16.default.dirname(directory);
2372
+ directory = import_node_path17.default.dirname(directory);
2347
2373
  }
2348
2374
  }
2349
2375
  }
@@ -2379,7 +2405,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
2379
2405
  continue;
2380
2406
  }
2381
2407
  await attempt(async () => {
2382
- await import_promises6.default.mkdir(import_node_path16.default.dirname(snapshot.destinationPath), { recursive: true });
2408
+ await import_promises6.default.mkdir(import_node_path17.default.dirname(snapshot.destinationPath), { recursive: true });
2383
2409
  await import_promises6.default.copyFile(snapshot.backupPath, snapshot.destinationPath);
2384
2410
  });
2385
2411
  }
@@ -2416,7 +2442,7 @@ var withFederationOutputTransaction = async (projectDirectory, outDir, relativeP
2416
2442
  // src/federation/public-assets.ts
2417
2443
  var import_node_crypto3 = require("crypto");
2418
2444
  var import_promises7 = __toESM(require("fs/promises"), 1);
2419
- var import_node_path17 = __toESM(require("path"), 1);
2445
+ var import_node_path18 = __toESM(require("path"), 1);
2420
2446
  var getContentHash2 = (content) => `sha256:${(0, import_node_crypto3.createHash)("sha256").update(content).digest("hex")}`;
2421
2447
  var getFileHash = async (filePath) => {
2422
2448
  try {
@@ -2428,13 +2454,13 @@ var getFileHash = async (filePath) => {
2428
2454
  }
2429
2455
  };
2430
2456
  var getSafePath = (directory, relativePath) => {
2431
- const normalizedPath = import_node_path17.default.posix.normalize(relativePath);
2432
- const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path17.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
2457
+ const normalizedPath = import_node_path18.default.posix.normalize(relativePath);
2458
+ const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path18.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
2433
2459
  if (unsafe) return void 0;
2434
- const resolvedDirectory = import_node_path17.default.resolve(directory);
2435
- const resolvedPath = import_node_path17.default.resolve(resolvedDirectory, relativePath);
2436
- const relativeResolvedPath = import_node_path17.default.relative(resolvedDirectory, resolvedPath);
2437
- if (relativeResolvedPath === "" || relativeResolvedPath === ".." || relativeResolvedPath.startsWith(`..${import_node_path17.default.sep}`) || import_node_path17.default.isAbsolute(relativeResolvedPath)) {
2460
+ const resolvedDirectory = import_node_path18.default.resolve(directory);
2461
+ const resolvedPath = import_node_path18.default.resolve(resolvedDirectory, relativePath);
2462
+ const relativeResolvedPath = import_node_path18.default.relative(resolvedDirectory, resolvedPath);
2463
+ if (relativeResolvedPath === "" || relativeResolvedPath === ".." || relativeResolvedPath.startsWith(`..${import_node_path18.default.sep}`) || import_node_path18.default.isAbsolute(relativeResolvedPath)) {
2438
2464
  return void 0;
2439
2465
  }
2440
2466
  return resolvedPath;
@@ -2442,16 +2468,16 @@ var getSafePath = (directory, relativePath) => {
2442
2468
  var listFiles = async (directory, relativeDirectory = "") => {
2443
2469
  let entries;
2444
2470
  try {
2445
- entries = await import_promises7.default.readdir(import_node_path17.default.join(directory, relativeDirectory), { withFileTypes: true });
2471
+ entries = await import_promises7.default.readdir(import_node_path18.default.join(directory, relativeDirectory), { withFileTypes: true });
2446
2472
  } catch (error) {
2447
2473
  if (error.code === "ENOENT") return [];
2448
2474
  throw error;
2449
2475
  }
2450
2476
  const files = await Promise.all(
2451
2477
  entries.map(async (entry) => {
2452
- const relativePath = import_node_path17.default.join(relativeDirectory, entry.name);
2478
+ const relativePath = import_node_path18.default.join(relativeDirectory, entry.name);
2453
2479
  if (entry.isDirectory()) return listFiles(directory, relativePath);
2454
- return entry.isFile() ? [relativePath.split(import_node_path17.default.sep).join("/")] : [];
2480
+ return entry.isFile() ? [relativePath.split(import_node_path18.default.sep).join("/")] : [];
2455
2481
  })
2456
2482
  );
2457
2483
  return files.flat().sort();
@@ -2466,19 +2492,19 @@ var pathExists = async (filePath) => {
2466
2492
  }
2467
2493
  };
2468
2494
  var hasBlockingParent = async (publicDirectory, destinationPath) => {
2469
- let currentPath = import_node_path17.default.dirname(destinationPath);
2495
+ let currentPath = import_node_path18.default.dirname(destinationPath);
2470
2496
  while (currentPath !== publicDirectory) {
2471
2497
  try {
2472
2498
  if (!(await import_promises7.default.lstat(currentPath)).isDirectory()) return true;
2473
2499
  } catch (error) {
2474
2500
  if (error.code !== "ENOENT") throw error;
2475
2501
  }
2476
- currentPath = import_node_path17.default.dirname(currentPath);
2502
+ currentPath = import_node_path18.default.dirname(currentPath);
2477
2503
  }
2478
2504
  return false;
2479
2505
  };
2480
2506
  var pruneEmptyDirectories = async (publicDirectory, filePath) => {
2481
- let currentPath = import_node_path17.default.dirname(filePath);
2507
+ let currentPath = import_node_path18.default.dirname(filePath);
2482
2508
  while (currentPath !== publicDirectory) {
2483
2509
  try {
2484
2510
  await import_promises7.default.rmdir(currentPath);
@@ -2486,7 +2512,7 @@ var pruneEmptyDirectories = async (publicDirectory, filePath) => {
2486
2512
  if (!["ENOENT", "ENOTEMPTY"].includes(error.code ?? "")) throw error;
2487
2513
  if (error.code === "ENOTEMPTY") return;
2488
2514
  }
2489
- currentPath = import_node_path17.default.dirname(currentPath);
2515
+ currentPath = import_node_path18.default.dirname(currentPath);
2490
2516
  }
2491
2517
  };
2492
2518
  var composePublicAssets = async ({
@@ -2496,8 +2522,8 @@ var composePublicAssets = async ({
2496
2522
  previousFiles = {},
2497
2523
  collisionPaths = /* @__PURE__ */ new Set()
2498
2524
  }) => {
2499
- const publicDirectory = import_node_path17.default.resolve(projectDirectory, "public");
2500
- const federatedPublicDirectory = import_node_path17.default.resolve(federatedDirectory, "public");
2525
+ const publicDirectory = import_node_path18.default.resolve(projectDirectory, "public");
2526
+ const federatedPublicDirectory = import_node_path18.default.resolve(federatedDirectory, "public");
2501
2527
  const sourceFiles = await listFiles(federatedPublicDirectory);
2502
2528
  const sourceFileSet = new Set(sourceFiles);
2503
2529
  const managedFiles = /* @__PURE__ */ new Set();
@@ -2533,7 +2559,7 @@ var composePublicAssets = async ({
2533
2559
  const asset = publicAssetsByPath.get(relativePath);
2534
2560
  if (!asset) throw new Error(`Cannot identify the source of federated public asset "${relativePath}"`);
2535
2561
  const content = await import_promises7.default.readFile(sourcePath);
2536
- await import_promises7.default.mkdir(import_node_path17.default.dirname(destinationPath), { recursive: true });
2562
+ await import_promises7.default.mkdir(import_node_path18.default.dirname(destinationPath), { recursive: true });
2537
2563
  await import_promises7.default.writeFile(destinationPath, content);
2538
2564
  files[relativePath] = { source: asset.resolvedFrom.source, hash: getContentHash2(content) };
2539
2565
  copied += 1;
@@ -2546,17 +2572,17 @@ var composePublicAssets = async ({
2546
2572
  // src/federation/filesystem-source-provider.ts
2547
2573
  var import_node_crypto4 = require("crypto");
2548
2574
  var import_promises8 = __toESM(require("fs/promises"), 1);
2549
- var import_node_path18 = __toESM(require("path"), 1);
2575
+ var import_node_path19 = __toESM(require("path"), 1);
2550
2576
  var import_sdk = __toESM(require("@eventcatalog/sdk"), 1);
2551
2577
  var FILESYSTEM_SOURCE_PREFIX = "file:";
2552
2578
  var isWithinDirectory = (directory, target) => {
2553
- const relativePath = import_node_path18.default.relative(directory, target);
2554
- return relativePath === "" || !relativePath.startsWith(`..${import_node_path18.default.sep}`) && relativePath !== ".." && !import_node_path18.default.isAbsolute(relativePath);
2579
+ const relativePath = import_node_path19.default.relative(directory, target);
2580
+ return relativePath === "" || !relativePath.startsWith(`..${import_node_path19.default.sep}`) && relativePath !== ".." && !import_node_path19.default.isAbsolute(relativePath);
2555
2581
  };
2556
2582
  var assertPortableRelativePath = (filePath, label, allowRoot = true) => {
2557
2583
  const portablePath = filePath.replaceAll("\\", "/");
2558
- const normalizedPath = import_node_path18.default.posix.normalize(portablePath);
2559
- const isUnsafe = filePath.includes("\\") || filePath.includes("\0") || import_node_path18.default.posix.isAbsolute(normalizedPath) || /^[a-zA-Z]:\//.test(normalizedPath) || normalizedPath === ".." || normalizedPath.startsWith("../") || !allowRoot && (normalizedPath === "." || normalizedPath === "");
2584
+ const normalizedPath = import_node_path19.default.posix.normalize(portablePath);
2585
+ const isUnsafe = filePath.includes("\\") || filePath.includes("\0") || import_node_path19.default.posix.isAbsolute(normalizedPath) || /^[a-zA-Z]:\//.test(normalizedPath) || normalizedPath === ".." || normalizedPath.startsWith("../") || !allowRoot && (normalizedPath === "." || normalizedPath === "");
2560
2586
  if (isUnsafe) throw new Error(`${label} "${filePath}" escapes its filesystem source`);
2561
2587
  return normalizedPath;
2562
2588
  };
@@ -2566,13 +2592,13 @@ var getSourceRoot = (projectDirectory, source) => {
2566
2592
  }
2567
2593
  const locator = source.source.slice(FILESYSTEM_SOURCE_PREFIX.length);
2568
2594
  if (!locator.trim()) throw new Error(`Filesystem federation source "${source.id}" requires a path after "file:".`);
2569
- return import_node_path18.default.resolve(projectDirectory, locator);
2595
+ return import_node_path19.default.resolve(projectDirectory, locator);
2570
2596
  };
2571
2597
  var getCatalogDirectory = async (projectDirectory, source) => {
2572
2598
  if (source.ref) throw new Error(`Filesystem federation source "${source.id}" does not support "ref".`);
2573
2599
  const sourceRoot = getSourceRoot(projectDirectory, source);
2574
2600
  const catalogPath = assertPortableRelativePath(source.path ?? ".", "Catalog path");
2575
- const catalogDirectory = import_node_path18.default.resolve(sourceRoot, ...catalogPath.split("/"));
2601
+ const catalogDirectory = import_node_path19.default.resolve(sourceRoot, ...catalogPath.split("/"));
2576
2602
  if (!isWithinDirectory(sourceRoot, catalogDirectory)) {
2577
2603
  throw new Error(`Catalog path "${source.path}" escapes source "${source.id}"`);
2578
2604
  }
@@ -2594,7 +2620,7 @@ var getCatalogDirectory = async (projectDirectory, source) => {
2594
2620
  };
2595
2621
  var getArtifactPath = async (catalogDirectory, source, artifactPath) => {
2596
2622
  const normalizedPath = assertPortableRelativePath(artifactPath, "Federated artifact path", false);
2597
- const filePath = import_node_path18.default.resolve(catalogDirectory, ...normalizedPath.split("/"));
2623
+ const filePath = import_node_path19.default.resolve(catalogDirectory, ...normalizedPath.split("/"));
2598
2624
  if (!isWithinDirectory(catalogDirectory, filePath)) {
2599
2625
  throw new Error(`Federated artifact path "${artifactPath}" escapes source "${source.id}"`);
2600
2626
  }
@@ -2634,7 +2660,7 @@ var createFileSystemSourceProvider = (projectDirectory) => ({
2634
2660
  var import_node_child_process = require("child_process");
2635
2661
  var import_promises9 = __toESM(require("fs/promises"), 1);
2636
2662
  var import_node_os3 = __toESM(require("os"), 1);
2637
- var import_node_path19 = __toESM(require("path"), 1);
2663
+ var import_node_path20 = __toESM(require("path"), 1);
2638
2664
  var import_node_util = require("util");
2639
2665
  var import_sdk2 = __toESM(require("@eventcatalog/sdk"), 1);
2640
2666
  var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
@@ -2645,8 +2671,8 @@ var parseGitHubSource = (source) => {
2645
2671
  };
2646
2672
  var assertSafeCatalogPath = (source) => {
2647
2673
  const catalogPath = source.path ?? ".";
2648
- const normalized = import_node_path19.default.posix.normalize(catalogPath.replaceAll("\\", "/"));
2649
- if (catalogPath.includes("\\") || import_node_path19.default.posix.isAbsolute(normalized) || normalized === ".." || normalized.startsWith("../")) {
2674
+ const normalized = import_node_path20.default.posix.normalize(catalogPath.replaceAll("\\", "/"));
2675
+ if (catalogPath.includes("\\") || import_node_path20.default.posix.isAbsolute(normalized) || normalized === ".." || normalized.startsWith("../")) {
2650
2676
  throw new Error(`Catalog path "${catalogPath}" escapes source "${source.id}"`);
2651
2677
  }
2652
2678
  };
@@ -2689,8 +2715,8 @@ var getGitEnvironment = (token) => {
2689
2715
  };
2690
2716
  var createCheckout = (executeFile, token) => async (source, ref, callback) => {
2691
2717
  const { owner, repository } = parseGitHubSource(source);
2692
- const catalogPath = import_node_path19.default.posix.normalize(source.path ?? ".");
2693
- const directory = await import_promises9.default.mkdtemp(import_node_path19.default.join(import_node_os3.default.tmpdir(), "eventcatalog-federation-"));
2718
+ const catalogPath = import_node_path20.default.posix.normalize(source.path ?? ".");
2719
+ const directory = await import_promises9.default.mkdtemp(import_node_path20.default.join(import_node_os3.default.tmpdir(), "eventcatalog-federation-"));
2694
2720
  const env = getGitEnvironment(token);
2695
2721
  try {
2696
2722
  const git = (args) => executeFile("git", args, { cwd: directory, env, encoding: "utf8" });
@@ -2710,16 +2736,16 @@ var createCheckout = (executeFile, token) => async (source, ref, callback) => {
2710
2736
  var generateIndex = async (source, ref, checkout, executeFile) => checkout(source, ref, async (directory) => {
2711
2737
  const { stdout } = await executeFile("git", ["rev-parse", "HEAD"], { cwd: directory, encoding: "utf8" });
2712
2738
  const commit = stdout.trim();
2713
- const catalogDirectory = import_node_path19.default.resolve(directory, source.path ?? ".");
2714
- const relativeCatalogDirectory = import_node_path19.default.relative(directory, catalogDirectory);
2715
- if (relativeCatalogDirectory.startsWith("..") || import_node_path19.default.isAbsolute(relativeCatalogDirectory)) {
2739
+ const catalogDirectory = import_node_path20.default.resolve(directory, source.path ?? ".");
2740
+ const relativeCatalogDirectory = import_node_path20.default.relative(directory, catalogDirectory);
2741
+ if (relativeCatalogDirectory.startsWith("..") || import_node_path20.default.isAbsolute(relativeCatalogDirectory)) {
2716
2742
  throw new Error(`Catalog path "${source.path}" escapes source "${source.id}"`);
2717
2743
  }
2718
2744
  const index = await (0, import_sdk2.default)(catalogDirectory).buildIndex({ source: source.id, commit });
2719
2745
  return { bytes: Buffer.from(JSON.stringify(index)), index, commit, generated: true };
2720
2746
  });
2721
2747
  var fetchPublishedIndex = async (source, ref, fetcher, token) => {
2722
- const indexPath = import_node_path19.default.posix.join(source.path ?? ".", "catalog.index.json");
2748
+ const indexPath = import_node_path20.default.posix.join(source.path ?? ".", "catalog.index.json");
2723
2749
  const bytes = await fetchBytes(source, ref, indexPath, fetcher, token);
2724
2750
  if (!bytes) return void 0;
2725
2751
  const index = (0, import_sdk2.parseIndex)(JSON.parse(bytes.toString("utf8")));
@@ -2742,7 +2768,7 @@ var createGitHubSourceProvider = (options = {}) => {
2742
2768
  },
2743
2769
  async fetchContent({ source, commit, path: artifactPath }) {
2744
2770
  assertSafeCatalogPath(source);
2745
- const catalogPath = import_node_path19.default.posix.join(source.path ?? ".", artifactPath);
2771
+ const catalogPath = import_node_path20.default.posix.join(source.path ?? ".", artifactPath);
2746
2772
  const content = await fetchBytes(source, commit, catalogPath, fetcher, token);
2747
2773
  if (!content) throw new Error(`Federated artifact not found for "${source.id}": ${artifactPath}`);
2748
2774
  return content;
@@ -2853,8 +2879,8 @@ var pathExists2 = async (filePath) => {
2853
2879
  }
2854
2880
  };
2855
2881
  var cleanupPreviousFederation = async (projectDirectory, onProgress) => {
2856
- const outDir = import_node_path20.default.join(projectDirectory, "federated");
2857
- const lockPath = import_node_path20.default.join(projectDirectory, "eventcatalog.lock");
2882
+ const outDir = import_node_path21.default.join(projectDirectory, "federated");
2883
+ const lockPath = import_node_path21.default.join(projectDirectory, "eventcatalog.lock");
2858
2884
  const previousLock = await readLock(lockPath);
2859
2885
  const hadFederatedOutput = await pathExists2(outDir);
2860
2886
  const hadLock = previousLock !== void 0;
@@ -2914,8 +2940,8 @@ var federateCatalog = async (projectDirectory, options = {}) => {
2914
2940
  throw new Error(`Failed to federate source "${source.id}": ${message2}`, { cause: error });
2915
2941
  }
2916
2942
  }
2917
- const outDir = import_node_path20.default.join(projectDirectory, "federated");
2918
- const lockPath = import_node_path20.default.join(projectDirectory, "eventcatalog.lock");
2943
+ const outDir = import_node_path21.default.join(projectDirectory, "federated");
2944
+ const lockPath = import_node_path21.default.join(projectDirectory, "eventcatalog.lock");
2919
2945
  const previousLock = await readLock(lockPath);
2920
2946
  const resources = resolvedSources.reduce((total, source) => total + source.resolved.index.resources.length, 0);
2921
2947
  const remoteIndexes = resolvedSources.map(({ resolved }) => resolved.index);
@@ -3027,17 +3053,17 @@ Run npm i @eventcatalog/core to update`;
3027
3053
  };
3028
3054
 
3029
3055
  // src/eventcatalog.ts
3030
- var currentDir = import_node_path22.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
3031
- var astroCli = import_node_path22.default.join(import_node_path22.default.dirname((0, import_node_module3.createRequire)(importMetaUrl).resolve("astro/package.json")), "bin/astro.mjs");
3056
+ var currentDir = import_node_path23.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
3057
+ var astroCli = import_node_path23.default.join(import_node_path23.default.dirname((0, import_node_module3.createRequire)(importMetaUrl).resolve("astro/package.json")), "bin/astro.mjs");
3032
3058
  var ASTRO_IN_FOREGROUND = { ASTRO_DEV_BACKGROUND: "1", ASTRO_PREVIEW_BACKGROUND: "1" };
3033
3059
  var program = new import_commander.Command().version(VERSION);
3034
- var dir = import_node_path22.default.resolve(process.env.PROJECT_DIR || process.cwd());
3035
- var eventCatalogDir = import_node_path22.default.resolve((0, import_node_path21.join)(currentDir, "../eventcatalog/"));
3036
- var astroConfigPath = () => getAstroConfigPath(dir, (0, import_node_path21.join)(eventCatalogDir, "astro.config.mjs"));
3060
+ var dir = import_node_path23.default.resolve(process.env.PROJECT_DIR || process.cwd());
3061
+ var eventCatalogDir = import_node_path23.default.resolve((0, import_node_path22.join)(currentDir, "../eventcatalog/"));
3062
+ var astroConfigPath = () => getAstroConfigPath(dir, (0, import_node_path22.join)(eventCatalogDir, "astro.config.mjs"));
3037
3063
  var { runtimeDirectory: core } = getRuntimePaths(dir);
3038
3064
  var getInstalledEventCatalogVersion = () => {
3039
3065
  try {
3040
- const pkg = import_fs.default.readFileSync((0, import_node_path21.join)(dir, "package.json"), "utf8");
3066
+ const pkg = import_fs.default.readFileSync((0, import_node_path22.join)(dir, "package.json"), "utf8");
3041
3067
  const json = JSON.parse(pkg);
3042
3068
  return json.dependencies["@eventcatalog/core"];
3043
3069
  } catch (error) {
@@ -3106,12 +3132,12 @@ var startDevPrewarm = ({
3106
3132
  var buildDevSearchIndex = async ({ config }) => {
3107
3133
  const result = await buildSearchIndex({
3108
3134
  projectDir: dir,
3109
- outDir: import_node_path22.default.join(core, "public"),
3110
- searchOutputPath: import_node_path22.default.join(core, "public", "pagefind"),
3135
+ outDir: import_node_path23.default.join(core, "public"),
3136
+ searchOutputPath: import_node_path23.default.join(core, "public", "pagefind"),
3111
3137
  config,
3112
3138
  isServer: false
3113
3139
  });
3114
- logger.info(`Indexed ${result.records} page(s) into ${import_node_path22.default.relative(core, result.outputPath)}`, "search");
3140
+ logger.info(`Indexed ${result.records} page(s) into ${import_node_path23.default.relative(core, result.outputPath)}`, "search");
3115
3141
  };
3116
3142
  var warnIfIndexedSearchUsesAuth = async () => {
3117
3143
  if (!await isAuthEnabled()) {
@@ -3293,8 +3319,8 @@ program.command("dev").description("Run development server of EventCatalog").opt
3293
3319
  logger.info("Setting up EventCatalog...", "eventcatalog");
3294
3320
  const isServer = await isOutputServer();
3295
3321
  logger.info(isServer ? "EventCatalog is running in Server Mode" : "EventCatalog is running in Static Mode", "config");
3296
- if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3297
- import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3322
+ if (import_fs.default.existsSync(import_node_path23.default.join(dir, ".env"))) {
3323
+ import_dotenv.default.config({ path: import_node_path23.default.join(dir, ".env") });
3298
3324
  }
3299
3325
  if (options.debug) {
3300
3326
  logger.info("Debug mode enabled", "debug");
@@ -3372,8 +3398,8 @@ program.command("build").description("Run build of EventCatalog").action(async (
3372
3398
  logger.info("Building EventCatalog...", "build");
3373
3399
  const isServer = await isOutputServer();
3374
3400
  logger.info(isServer ? "EventCatalog is running in Server Mode" : "EventCatalog is running in Static Mode", "config");
3375
- if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3376
- import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3401
+ if (import_fs.default.existsSync(import_node_path23.default.join(dir, ".env"))) {
3402
+ import_dotenv.default.config({ path: import_node_path23.default.join(dir, ".env") });
3377
3403
  }
3378
3404
  await verifyRequiredFieldsAreInCatalogConfigFile(dir);
3379
3405
  const config = await getEventCatalogConfigFile(dir);
@@ -3410,7 +3436,7 @@ program.command("build").description("Run build of EventCatalog").action(async (
3410
3436
  });
3411
3437
  if (await isIndexedSearchEnabled()) {
3412
3438
  await warnIfIndexedSearchUsesAuth();
3413
- const outDir = import_node_path22.default.resolve(dir, await getProjectOutDir());
3439
+ const outDir = import_node_path23.default.resolve(dir, await getProjectOutDir());
3414
3440
  logger.info("Building indexed search...", "search");
3415
3441
  const result = await buildSearchIndex({
3416
3442
  projectDir: dir,
@@ -3418,7 +3444,30 @@ program.command("build").description("Run build of EventCatalog").action(async (
3418
3444
  config,
3419
3445
  isServer
3420
3446
  });
3421
- logger.info(`Indexed ${result.records} page(s) into ${import_node_path22.default.relative(dir, result.outputPath)}`, "search");
3447
+ logger.info(`Indexed ${result.records} page(s) into ${import_node_path23.default.relative(dir, result.outputPath)}`, "search");
3448
+ }
3449
+ const architectureExport = resolveArchitectureExport(config, {
3450
+ authEnabled: isCatalogAuthEnabled({ config, projectDir: dir, isServer })
3451
+ });
3452
+ if (architectureExport.enabled) {
3453
+ try {
3454
+ const result = await writeArchitectureExport({
3455
+ projectDir: dir,
3456
+ outDir: import_node_path23.default.resolve(dir, await getProjectOutDir()),
3457
+ isServer
3458
+ });
3459
+ logger.info(
3460
+ `Wrote the architecture reference to ${import_node_path23.default.relative(dir, result.path)} (${Math.round(result.bytes / 1024)} KB in ${result.durationMs} ms)`,
3461
+ "export"
3462
+ );
3463
+ } catch (err) {
3464
+ logger.info(`Skipped the architecture reference: ${err.message}`, "export");
3465
+ }
3466
+ } else if (architectureExport.reason === "auth") {
3467
+ logger.info(
3468
+ "Skipped the architecture reference because auth is enabled and build output is served without it. Set exports.html.enabled to true to publish it anyway.",
3469
+ "export"
3470
+ );
3422
3471
  }
3423
3472
  });
3424
3473
  var previewCatalog = async ({ command }) => {
@@ -3449,7 +3498,7 @@ if (start) {
3449
3498
  }
3450
3499
  `;
3451
3500
  var startServerCatalog = async () => {
3452
- const serverEntryPath = import_node_path22.default.join(dir, "dist", "server", "entry.mjs");
3501
+ const serverEntryPath = import_node_path23.default.join(dir, "dist", "server", "entry.mjs");
3453
3502
  const config = await getEventCatalogConfigFile(dir);
3454
3503
  const base = (config?.base || "/").replace(/\/$/, "");
3455
3504
  await runCommandWithFilteredOutput({
@@ -3468,16 +3517,16 @@ var startServerCatalog = async () => {
3468
3517
  program.command("preview").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
3469
3518
  logger.welcome();
3470
3519
  logger.info("Starting preview of your build...", "preview");
3471
- if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3472
- import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3520
+ if (import_fs.default.existsSync(import_node_path23.default.join(dir, ".env"))) {
3521
+ import_dotenv.default.config({ path: import_node_path23.default.join(dir, ".env") });
3473
3522
  }
3474
3523
  await previewCatalog({ command });
3475
3524
  });
3476
3525
  program.command("start").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
3477
3526
  logger.welcome();
3478
3527
  logger.info("Starting preview of your build...", "preview");
3479
- if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3480
- import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3528
+ if (import_fs.default.existsSync(import_node_path23.default.join(dir, ".env"))) {
3529
+ import_dotenv.default.config({ path: import_node_path23.default.join(dir, ".env") });
3481
3530
  }
3482
3531
  const isServerOutput = await isOutputServer();
3483
3532
  if (isServerOutput) {
@@ -3491,22 +3540,22 @@ program.command("start").description("Serves the contents of your eventcatalog b
3491
3540
  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) => {
3492
3541
  logger.welcome();
3493
3542
  logger.info("Exporting EventCatalog...", "export");
3494
- if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3495
- import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3543
+ if (import_fs.default.existsSync(import_node_path23.default.join(dir, ".env"))) {
3544
+ import_dotenv.default.config({ path: import_node_path23.default.join(dir, ".env") });
3496
3545
  }
3497
3546
  const { default: initSDK } = await import("@eventcatalog/sdk");
3498
3547
  const sdk = initSDK(dir);
3499
3548
  const catalog = await sdk.dumpCatalog({ includeMarkdown: options.includeMarkdown });
3500
- const exportsDir = import_node_path22.default.join(dir, "exports");
3549
+ const exportsDir = import_node_path23.default.join(dir, "exports");
3501
3550
  ensureDir(exportsDir);
3502
3551
  const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
3503
- const exportFile = import_node_path22.default.join(exportsDir, `catalog-${date}.json`);
3552
+ const exportFile = import_node_path23.default.join(exportsDir, `catalog-${date}.json`);
3504
3553
  import_fs.default.writeFileSync(exportFile, JSON.stringify(catalog, null, 2), "utf-8");
3505
3554
  logger.info(`Catalog exported to ${exportFile}`, "export");
3506
3555
  });
3507
3556
  program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
3508
- if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3509
- import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3557
+ if (import_fs.default.existsSync(import_node_path23.default.join(dir, ".env"))) {
3558
+ import_dotenv.default.config({ path: import_node_path23.default.join(dir, ".env") });
3510
3559
  }
3511
3560
  await generate(dir);
3512
3561
  });
@@ -3579,7 +3628,7 @@ var reportFederationProgress = (event, verbose = false) => {
3579
3628
  }
3580
3629
  return;
3581
3630
  case "hydrating":
3582
- logger.info(`Hydrating federated content into ${import_node_path22.default.relative(dir, event.outDir)}/...`, "federation");
3631
+ logger.info(`Hydrating federated content into ${import_node_path23.default.relative(dir, event.outDir)}/...`, "federation");
3583
3632
  return;
3584
3633
  case "hydrate:cache":
3585
3634
  if (event.files === 1 || event.files % 25 === 0) {
@@ -3602,13 +3651,13 @@ var reportFederationProgress = (event, verbose = false) => {
3602
3651
  `Federation complete: ${event.result.sources} sources, ${event.result.resources} remote resources, ${event.result.hydrate.written} files written (${event.result.hydrate.fetched} downloaded, ${event.result.hydrate.written - event.result.hydrate.fetched} cached)`,
3603
3652
  "federation"
3604
3653
  );
3605
- logger.info(`Recorded resolved source state in ${import_node_path22.default.relative(dir, event.result.lockPath)}`, "federation");
3654
+ logger.info(`Recorded resolved source state in ${import_node_path23.default.relative(dir, event.result.lockPath)}`, "federation");
3606
3655
  }
3607
3656
  };
3608
3657
  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) => {
3609
3658
  logger.welcome();
3610
- if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3611
- import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3659
+ if (import_fs.default.existsSync(import_node_path23.default.join(dir, ".env"))) {
3660
+ import_dotenv.default.config({ path: import_node_path23.default.join(dir, ".env") });
3612
3661
  }
3613
3662
  logger.info("Starting federation...", "federation");
3614
3663
  let cleanedPreviousOutput = false;