@eventcatalog/core 4.12.0-beta.3 → 4.12.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(analytics_exports);
36
36
  var import_os = __toESM(require("os"), 1);
37
37
 
38
38
  // package.json
39
- var version = "4.12.0-beta.3";
39
+ var version = "4.12.0-beta.4";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-GGPT4I3K.js";
4
- import "../chunk-AVRFMQJX.js";
3
+ } from "../chunk-AHPVNJ7S.js";
4
+ import "../chunk-ZZSCV5ZI.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -146,7 +146,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
146
146
  var import_os = __toESM(require("os"), 1);
147
147
 
148
148
  // package.json
149
- var version = "4.12.0-beta.3";
149
+ var version = "4.12.0-beta.4";
150
150
 
151
151
  // src/constants.ts
152
152
  var VERSION = version;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-5MBYZHYS.js";
3
+ } from "../chunk-NAGVDHNB.js";
4
4
  import "../chunk-ZAZHAVKB.js";
5
- import "../chunk-GGPT4I3K.js";
6
- import "../chunk-AVRFMQJX.js";
5
+ import "../chunk-AHPVNJ7S.js";
6
+ import "../chunk-ZZSCV5ZI.js";
7
7
  import "../chunk-JE6RX7SJ.js";
8
8
  export {
9
9
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-AVRFMQJX.js";
3
+ } from "./chunk-ZZSCV5ZI.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import os from "os";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-TAGBLT3L.js";
3
+ } from "./chunk-M4MMC5MN.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-AVRFMQJX.js";
3
+ } from "./chunk-ZZSCV5ZI.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-ZAZHAVKB.js";
6
6
  import {
7
7
  raiseEvent
8
- } from "./chunk-GGPT4I3K.js";
8
+ } from "./chunk-AHPVNJ7S.js";
9
9
  import {
10
10
  getEventCatalogConfigFile,
11
11
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "4.12.0-beta.3";
2
+ var version = "4.12.0-beta.4";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "4.12.0-beta.3";
28
+ var version = "4.12.0-beta.4";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-AVRFMQJX.js";
3
+ } from "./chunk-ZZSCV5ZI.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -151,7 +151,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
151
151
  var import_picocolors = __toESM(require("picocolors"), 1);
152
152
 
153
153
  // package.json
154
- var version = "4.12.0-beta.3";
154
+ var version = "4.12.0-beta.4";
155
155
 
156
156
  // src/constants.ts
157
157
  var VERSION = version;
@@ -4,7 +4,7 @@ import {
4
4
  import "./chunk-CA4U2JP7.js";
5
5
  import {
6
6
  log_build_default
7
- } from "./chunk-5MBYZHYS.js";
7
+ } from "./chunk-NAGVDHNB.js";
8
8
  import "./chunk-ZAZHAVKB.js";
9
9
  import {
10
10
  FederationConflictError,
@@ -30,10 +30,10 @@ import {
30
30
  } from "./chunk-3SJDIENM.js";
31
31
  import {
32
32
  generate
33
- } from "./chunk-56TJHDS2.js";
33
+ } from "./chunk-GTXK64UD.js";
34
34
  import {
35
35
  logger
36
- } from "./chunk-TAGBLT3L.js";
36
+ } from "./chunk-M4MMC5MN.js";
37
37
  import {
38
38
  resolve_catalog_dependencies_default
39
39
  } from "./chunk-EEZXGNF6.js";
@@ -47,7 +47,7 @@ import {
47
47
  import {
48
48
  watch
49
49
  } from "./chunk-U63GDPPY.js";
50
- import "./chunk-GGPT4I3K.js";
50
+ import "./chunk-AHPVNJ7S.js";
51
51
  import {
52
52
  getAstroConfigPath
53
53
  } from "./chunk-VIJJ7JKH.js";
@@ -62,7 +62,7 @@ import {
62
62
  } from "./chunk-SAN4U2WU.js";
63
63
  import {
64
64
  VERSION
65
- } from "./chunk-AVRFMQJX.js";
65
+ } from "./chunk-ZZSCV5ZI.js";
66
66
  import {
67
67
  getEventCatalogConfigFile,
68
68
  verifyRequiredFieldsAreInCatalogConfigFile
package/dist/generate.cjs CHANGED
@@ -112,7 +112,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
112
112
  var import_picocolors = __toESM(require("picocolors"), 1);
113
113
 
114
114
  // package.json
115
- var version = "4.12.0-beta.3";
115
+ var version = "4.12.0-beta.4";
116
116
 
117
117
  // src/constants.ts
118
118
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-56TJHDS2.js";
4
- import "./chunk-TAGBLT3L.js";
5
- import "./chunk-AVRFMQJX.js";
3
+ } from "./chunk-GTXK64UD.js";
4
+ import "./chunk-M4MMC5MN.js";
5
+ import "./chunk-ZZSCV5ZI.js";
6
6
  import "./chunk-JE6RX7SJ.js";
7
7
  export {
8
8
  generate
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(cli_logger_exports);
36
36
  var import_picocolors = __toESM(require("picocolors"), 1);
37
37
 
38
38
  // package.json
39
- var version = "4.12.0-beta.3";
39
+ var version = "4.12.0-beta.4";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  logger
3
- } from "../chunk-TAGBLT3L.js";
4
- import "../chunk-AVRFMQJX.js";
3
+ } from "../chunk-M4MMC5MN.js";
4
+ import "../chunk-ZZSCV5ZI.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -34,7 +34,7 @@ import preprocessExpressiveCodeConfig from './integrations/expressive-code-confi
34
34
  import catalogAssets from './integrations/catalog-assets.mjs';
35
35
  import runtimeDependencies from './integrations/runtime-dependencies.mjs';
36
36
  import { getRuntimePaths } from './integrations/runtime-paths.mjs';
37
- import { clientDependencies } from './integrations/client-dependencies.mjs';
37
+ import { collectClientDependencies } from './integrations/client-dependencies.mjs';
38
38
 
39
39
  const projectDirectory = process.env.PROJECT_DIR || process.cwd();
40
40
  const { runtimeDirectory } = getRuntimePaths(projectDirectory, process.env.CATALOG_DIR);
@@ -219,7 +219,7 @@ export default defineConfig({
219
219
  },
220
220
  optimizeDeps: {
221
221
  exclude: [],
222
- include: clientDependencies,
222
+ include: collectClientDependencies(),
223
223
  },
224
224
  },
225
225
  });
@@ -1,27 +1,126 @@
1
- // Core's browser components live in node_modules in an installed catalog. Vite
2
- // skips discovering dependencies imported from there, so explicitly pre-bundle
3
- // the graph and chat entrypoints, including their nested CommonJS dependencies.
4
- export const clientDependencies = [
5
- '@eventcatalog/visualiser',
6
- '@xyflow/react',
7
- '@ai-sdk/react',
8
- 'ai',
9
- 'lucide-react',
10
- '@heroicons/react/24/outline',
11
- '@heroicons/react/24/solid',
12
- '@heroicons/react/20/solid',
13
- '@headlessui/react',
14
- '@nanostores/react',
15
- 'nanostores',
16
- 'react',
17
- 'react-dom',
18
- 'semver',
19
- 'diff',
20
- 'diff2html',
21
- // ArchitectureGraph embeds also need these ready before the first request.
22
- // Discovering them mid-session can invalidate already-loaded chunks.
23
- 'd3-force',
24
- 'd3-selection',
25
- 'd3-zoom',
26
- 'd3-drag',
27
- ];
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { getRuntimeAliases, packageDirectory } from './eventcatalog-runtime.mjs';
4
+
5
+ // In an installed catalog Core's browser components live in node_modules, and
6
+ // Vite never discovers dependencies imported from there. Anything it serves
7
+ // unoptimized reaches the browser raw, so a CommonJS package anywhere in the
8
+ // tree (e.g. react-markdown > hast-util-to-jsx-runtime > style-to-js) breaks
9
+ // hydration. Astro's own crawl (vitefu) only covers Core's direct CommonJS
10
+ // dependencies. Collect every dependency Core's browser code imports instead,
11
+ // so Vite pre-bundles each one together with its nested dependencies.
12
+ //
13
+ // Entrypoints are React components and processed <script> blocks in .astro
14
+ // files. Local and aliased JavaScript/TypeScript imports are followed. Like the
15
+ // server dependency scan this matches literal imports rather than parsing, so
16
+ // commented-out imports can over-include; computed specifiers are not found.
17
+
18
+ // Always needed by React islands, even before a component imports them directly.
19
+ const baseDependencies = ['react', 'react-dom', 'react-dom/client', 'react/jsx-runtime', 'react/jsx-dev-runtime'];
20
+
21
+ const scriptExtensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs'];
22
+ const typeOnlyImport = /\b(?:import|export)\s+type\s+[^'";]*?\bfrom\s*['"][^'"]+['"]/g;
23
+ const importSpecifier = /\b(?:from\s*|import\s*(?:\(\s*)?)['"]([^'"]+)['"]/g;
24
+ const astroScript = /<script\b([^>]*)>([\s\S]*?)<\/script>/g;
25
+
26
+ const packageName = (specifier) =>
27
+ specifier
28
+ .split('/')
29
+ .slice(0, specifier.startsWith('@') ? 2 : 1)
30
+ .join('/');
31
+
32
+ const isTestFile = (file) => /\.(?:test|spec)\.[cm]?[jt]sx?$/.test(file) || file.split(path.sep).includes('__tests__');
33
+
34
+ function resolveFile(file) {
35
+ const candidates = [
36
+ file,
37
+ ...scriptExtensions.map((extension) => file + extension),
38
+ ...scriptExtensions.map((extension) => path.join(file, `index${extension}`)),
39
+ ];
40
+ return candidates.find(
41
+ (candidate) =>
42
+ scriptExtensions.includes(path.extname(candidate)) && fs.existsSync(candidate) && fs.statSync(candidate).isFile()
43
+ );
44
+ }
45
+
46
+ function findPackageJson(name, fromDirectory) {
47
+ for (let directory = fromDirectory; ; directory = path.dirname(directory)) {
48
+ const file = path.join(directory, 'node_modules', name, 'package.json');
49
+ if (fs.existsSync(file)) return JSON.parse(fs.readFileSync(file, 'utf-8'));
50
+ if (path.dirname(directory) === directory) return;
51
+ }
52
+ }
53
+
54
+ // Astro excludes its framework packages (those built on astro) from
55
+ // pre-bundling because they ship raw .astro files. Match its detection.
56
+ function isAstroPackage(name, coreDirectory) {
57
+ const pkg = findPackageJson(name, coreDirectory);
58
+ return name === 'astro' || Boolean(pkg?.dependencies?.astro || pkg?.peerDependencies?.astro);
59
+ }
60
+
61
+ function listFiles(directory) {
62
+ return fs.readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
63
+ if (entry.name.startsWith('.') || entry.name === 'node_modules') return [];
64
+ const file = path.join(directory, entry.name);
65
+ return entry.isDirectory() ? listFiles(file) : [file];
66
+ });
67
+ }
68
+
69
+ export function collectClientDependencies(coreDirectory = packageDirectory) {
70
+ const { dependencies = {} } = JSON.parse(fs.readFileSync(path.join(coreDirectory, '../package.json'), 'utf-8'));
71
+ // Only Core's own source aliases matter here; catalog-owned aliases point at
72
+ // the user's project, which Vite already scans normally.
73
+ const aliases = getRuntimeAliases({ projectDirectory: coreDirectory, runtimeDirectory: coreDirectory, coreDirectory }).filter(
74
+ ({ replacement }) => replacement.startsWith(path.join(coreDirectory, 'src'))
75
+ );
76
+ const resolveAlias = (specifier) => {
77
+ for (const { find, replacement } of aliases) {
78
+ if (find instanceof RegExp) {
79
+ if (find.test(specifier)) return specifier.replace(find, replacement);
80
+ } else if (specifier === find || specifier.startsWith(`${find}/`)) {
81
+ return replacement + specifier.slice(find.length);
82
+ }
83
+ }
84
+ };
85
+
86
+ const found = new Set(baseDependencies);
87
+ const visited = new Set();
88
+ const queue = [];
89
+
90
+ const scan = (code, importer) => {
91
+ for (const [, specifier] of code.replace(typeOnlyImport, '').matchAll(importSpecifier)) {
92
+ // Vite owns query imports (for example ?raw assets) and stylesheets.
93
+ if (/[?#]/.test(specifier) || /\.(?:css|scss|sass|less)$/.test(specifier)) continue;
94
+ const local = specifier.startsWith('.') ? path.resolve(path.dirname(importer), specifier) : resolveAlias(specifier);
95
+ if (local !== undefined) {
96
+ const file = resolveFile(local);
97
+ if (file && !visited.has(file)) queue.push(file);
98
+ } else if (Object.hasOwn(dependencies, packageName(specifier))) {
99
+ found.add(specifier);
100
+ }
101
+ }
102
+ };
103
+
104
+ for (const file of listFiles(path.join(coreDirectory, 'src'))) {
105
+ if (isTestFile(file)) continue;
106
+ if (/\.[jt]sx$/.test(file)) {
107
+ queue.push(file);
108
+ } else if (file.endsWith('.astro')) {
109
+ for (const [, attributes, code] of fs.readFileSync(file, 'utf-8').matchAll(astroScript)) {
110
+ // Inline, external and data scripts are not processed by Vite.
111
+ if (/\bis:inline\b|\bsrc\s*=|\btype\s*=\s*['"]?(?!module)/.test(attributes)) continue;
112
+ scan(code, file);
113
+ }
114
+ }
115
+ }
116
+
117
+ while (queue.length > 0) {
118
+ const file = queue.pop();
119
+ if (visited.has(file) || isTestFile(file)) continue;
120
+ visited.add(file);
121
+ scan(fs.readFileSync(file, 'utf-8'), file);
122
+ }
123
+
124
+ const astroPackages = new Set([...found].map(packageName).filter((name) => isAstroPackage(name, coreDirectory)));
125
+ return [...found].filter((specifier) => !astroPackages.has(packageName(specifier))).sort();
126
+ }
@@ -847,8 +847,10 @@ const ChatPanel = ({ isOpen, onClose, configured = false }: ChatPanelProps) => {
847
847
 
848
848
  return (
849
849
  <>
850
- {/* Keyframes for fade-in animation - using constant to avoid re-injection */}
851
- <style>{CHAT_PANEL_STYLES}</style>
850
+ {/* Keyframes for fade-in animation - using constant to avoid re-injection.
851
+ Injected raw: React 18's server renderer escapes the `>` selectors in
852
+ text children, which the client doesn't, causing a hydration mismatch. */}
853
+ <style dangerouslySetInnerHTML={{ __html: CHAT_PANEL_STYLES }} />
852
854
 
853
855
  {/* Panel - hidden when fullscreen modal is open */}
854
856
  {!isFullscreen && (
@@ -1,4 +1,4 @@
1
- import { useState, useEffect, useRef, useMemo } from 'react';
1
+ import { useState, useEffect, useRef, useMemo, useId } from 'react';
2
2
 
3
3
  interface JSONSchemaViewerProps {
4
4
  schema: any;
@@ -293,7 +293,8 @@ const NestedVariantSelector = ({
293
293
  const SchemaProperty = ({ name, details, isRequired, level, isListItem = false, expand }: SchemaPropertyProps) => {
294
294
  const [isExpanded, setIsExpanded] = useState(expand);
295
295
  const [selectedVariantIndex, setSelectedVariantIndex] = useState(0);
296
- const contentId = useRef(`prop-${name}-${level}-${Math.random().toString(36).substring(2, 7)}`).current;
296
+ // useId keeps the server and client IDs identical during hydration.
297
+ const contentId = `prop-${name}-${level}-${useId()}`;
297
298
 
298
299
  useEffect(() => {
299
300
  setIsExpanded(expand);
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "license": "SEE LICENSE IN LICENSE",
9
9
  "type": "module",
10
- "version": "4.12.0-beta.3",
10
+ "version": "4.12.0-beta.4",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -134,8 +134,8 @@
134
134
  "uuid": "^11.1.1",
135
135
  "zod": "^4.3.6",
136
136
  "@eventcatalog/linter": "1.1.20",
137
- "@eventcatalog/visualiser": "^4.1.4",
138
- "@eventcatalog/sdk": "2.29.1"
137
+ "@eventcatalog/sdk": "2.29.1",
138
+ "@eventcatalog/visualiser": "^4.1.4"
139
139
  },
140
140
  "devDependencies": {
141
141
  "@astrojs/check": "^0.9.10",