@eventcatalog/core 4.1.1 → 4.1.3

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.1.1";
39
+ var version = "4.1.3";
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-OXX3DBZ3.js";
4
- import "../chunk-5VJKDWMT.js";
3
+ } from "../chunk-PDQER3NQ.js";
4
+ import "../chunk-G3D7IZ67.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -44,14 +44,20 @@ var RESOURCE_PATTERNS = {
44
44
  diagrams: ["**/diagrams/**/index.@(md|mdx)"],
45
45
  ubiquitousLanguages: ["domains/*/ubiquitous-language.@(md|mdx)", "domains/*/subdomains/*/ubiquitous-language.@(md|mdx)"]
46
46
  };
47
+ var CUSTOM_ROUTE_PATTERNS = {
48
+ customPages: ["pages/**/*.astro"],
49
+ customApis: ["pages/**/*.@(ts|js|mjs)"]
50
+ };
51
+ var DEFAULT_IGNORES = ["**/versioned/**", "**/dist/**", "**/node_modules/**"];
52
+ var CUSTOM_ROUTE_IGNORES = [...DEFAULT_IGNORES, "pages/**/_*/**", "pages/**/_*"];
47
53
  async function countResources(projectDir) {
48
54
  const counts = {};
49
- for (const [type, patterns] of Object.entries(RESOURCE_PATTERNS)) {
55
+ for (const [type, patterns] of Object.entries({ ...RESOURCE_PATTERNS, ...CUSTOM_ROUTE_PATTERNS })) {
50
56
  let total = 0;
51
57
  for (const pattern of patterns) {
52
58
  const files = await (0, import_glob.glob)(pattern, {
53
59
  cwd: projectDir,
54
- ignore: ["**/versioned/**", "**/dist/**", "**/node_modules/**"]
60
+ ignore: type in CUSTOM_ROUTE_PATTERNS ? CUSTOM_ROUTE_IGNORES : DEFAULT_IGNORES
55
61
  });
56
62
  total += files.length;
57
63
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  countResources,
3
3
  serializeCounts
4
- } from "../chunk-DAOXTQVS.js";
4
+ } from "../chunk-K2XIENVT.js";
5
5
  export {
6
6
  countResources,
7
7
  serializeCounts
@@ -140,7 +140,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
140
140
  var import_os = __toESM(require("os"), 1);
141
141
 
142
142
  // package.json
143
- var version = "4.1.1";
143
+ var version = "4.1.3";
144
144
 
145
145
  // src/constants.ts
146
146
  var VERSION = version;
@@ -197,14 +197,20 @@ var RESOURCE_PATTERNS = {
197
197
  diagrams: ["**/diagrams/**/index.@(md|mdx)"],
198
198
  ubiquitousLanguages: ["domains/*/ubiquitous-language.@(md|mdx)", "domains/*/subdomains/*/ubiquitous-language.@(md|mdx)"]
199
199
  };
200
+ var CUSTOM_ROUTE_PATTERNS = {
201
+ customPages: ["pages/**/*.astro"],
202
+ customApis: ["pages/**/*.@(ts|js|mjs)"]
203
+ };
204
+ var DEFAULT_IGNORES = ["**/versioned/**", "**/dist/**", "**/node_modules/**"];
205
+ var CUSTOM_ROUTE_IGNORES = [...DEFAULT_IGNORES, "pages/**/_*/**", "pages/**/_*"];
200
206
  async function countResources(projectDir) {
201
207
  const counts = {};
202
- for (const [type, patterns] of Object.entries(RESOURCE_PATTERNS)) {
208
+ for (const [type, patterns] of Object.entries({ ...RESOURCE_PATTERNS, ...CUSTOM_ROUTE_PATTERNS })) {
203
209
  let total = 0;
204
210
  for (const pattern of patterns) {
205
211
  const files = await (0, import_glob.glob)(pattern, {
206
212
  cwd: projectDir,
207
- ignore: ["**/versioned/**", "**/dist/**", "**/node_modules/**"]
213
+ ignore: type in CUSTOM_ROUTE_PATTERNS ? CUSTOM_ROUTE_IGNORES : DEFAULT_IGNORES
208
214
  });
209
215
  total += files.length;
210
216
  }
@@ -263,7 +269,9 @@ var toCloudResourceCounts = (counts) => ({
263
269
  users: counts.users || 0,
264
270
  designs: counts.designs || 0,
265
271
  diagrams: counts.diagrams || 0,
266
- ubiquitousLanguages: counts.ubiquitousLanguages || 0
272
+ ubiquitousLanguages: counts.ubiquitousLanguages || 0,
273
+ customPages: counts.customPages || 0,
274
+ customApis: counts.customApis || 0
267
275
  });
268
276
  var reportCloudResourceInventory = async (configFile, resourceCounts) => {
269
277
  const analytics = configFile.cloud?.analytics;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-SZTOJ5TU.js";
4
- import "../chunk-OXX3DBZ3.js";
5
- import "../chunk-DAOXTQVS.js";
6
- import "../chunk-5VJKDWMT.js";
3
+ } from "../chunk-DDGOJV25.js";
4
+ import "../chunk-PDQER3NQ.js";
5
+ import "../chunk-K2XIENVT.js";
6
+ import "../chunk-G3D7IZ67.js";
7
7
  import "../chunk-6QENHZZP.js";
8
8
  export {
9
9
  log_build_default as default
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-OXX3DBZ3.js";
3
+ } from "./chunk-PDQER3NQ.js";
4
4
  import {
5
5
  countResources,
6
6
  serializeCounts
7
- } from "./chunk-DAOXTQVS.js";
7
+ } from "./chunk-K2XIENVT.js";
8
8
  import {
9
9
  getEventCatalogConfigFile,
10
10
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -57,7 +57,9 @@ var toCloudResourceCounts = (counts) => ({
57
57
  users: counts.users || 0,
58
58
  designs: counts.designs || 0,
59
59
  diagrams: counts.diagrams || 0,
60
- ubiquitousLanguages: counts.ubiquitousLanguages || 0
60
+ ubiquitousLanguages: counts.ubiquitousLanguages || 0,
61
+ customPages: counts.customPages || 0,
62
+ customApis: counts.customApis || 0
61
63
  });
62
64
  var reportCloudResourceInventory = async (configFile, resourceCounts) => {
63
65
  const analytics = configFile.cloud?.analytics;
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "4.1.1";
2
+ var version = "4.1.3";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -19,14 +19,20 @@ var RESOURCE_PATTERNS = {
19
19
  diagrams: ["**/diagrams/**/index.@(md|mdx)"],
20
20
  ubiquitousLanguages: ["domains/*/ubiquitous-language.@(md|mdx)", "domains/*/subdomains/*/ubiquitous-language.@(md|mdx)"]
21
21
  };
22
+ var CUSTOM_ROUTE_PATTERNS = {
23
+ customPages: ["pages/**/*.astro"],
24
+ customApis: ["pages/**/*.@(ts|js|mjs)"]
25
+ };
26
+ var DEFAULT_IGNORES = ["**/versioned/**", "**/dist/**", "**/node_modules/**"];
27
+ var CUSTOM_ROUTE_IGNORES = [...DEFAULT_IGNORES, "pages/**/_*/**", "pages/**/_*"];
22
28
  async function countResources(projectDir) {
23
29
  const counts = {};
24
- for (const [type, patterns] of Object.entries(RESOURCE_PATTERNS)) {
30
+ for (const [type, patterns] of Object.entries({ ...RESOURCE_PATTERNS, ...CUSTOM_ROUTE_PATTERNS })) {
25
31
  let total = 0;
26
32
  for (const pattern of patterns) {
27
33
  const files = await glob(pattern, {
28
34
  cwd: projectDir,
29
- ignore: ["**/versioned/**", "**/dist/**", "**/node_modules/**"]
35
+ ignore: type in CUSTOM_ROUTE_PATTERNS ? CUSTOM_ROUTE_IGNORES : DEFAULT_IGNORES
30
36
  });
31
37
  total += files.length;
32
38
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-5VJKDWMT.js";
3
+ } from "./chunk-G3D7IZ67.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import os from "os";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-5VJKDWMT.js";
3
+ } from "./chunk-G3D7IZ67.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-C7BA7WQB.js";
3
+ } from "./chunk-TUKKXNQR.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "4.1.1";
28
+ var version = "4.1.3";
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-5VJKDWMT.js";
3
+ } from "./chunk-G3D7IZ67.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -144,7 +144,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
144
144
  var import_picocolors = __toESM(require("picocolors"), 1);
145
145
 
146
146
  // package.json
147
- var version = "4.1.1";
147
+ var version = "4.1.3";
148
148
 
149
149
  // src/constants.ts
150
150
  var VERSION = version;
@@ -295,14 +295,20 @@ var RESOURCE_PATTERNS = {
295
295
  diagrams: ["**/diagrams/**/index.@(md|mdx)"],
296
296
  ubiquitousLanguages: ["domains/*/ubiquitous-language.@(md|mdx)", "domains/*/subdomains/*/ubiquitous-language.@(md|mdx)"]
297
297
  };
298
+ var CUSTOM_ROUTE_PATTERNS = {
299
+ customPages: ["pages/**/*.astro"],
300
+ customApis: ["pages/**/*.@(ts|js|mjs)"]
301
+ };
302
+ var DEFAULT_IGNORES = ["**/versioned/**", "**/dist/**", "**/node_modules/**"];
303
+ var CUSTOM_ROUTE_IGNORES = [...DEFAULT_IGNORES, "pages/**/_*/**", "pages/**/_*"];
298
304
  async function countResources(projectDir) {
299
305
  const counts = {};
300
- for (const [type, patterns] of Object.entries(RESOURCE_PATTERNS)) {
306
+ for (const [type, patterns] of Object.entries({ ...RESOURCE_PATTERNS, ...CUSTOM_ROUTE_PATTERNS })) {
301
307
  let total = 0;
302
308
  for (const pattern of patterns) {
303
309
  const files = await (0, import_glob.glob)(pattern, {
304
310
  cwd: projectDir,
305
- ignore: ["**/versioned/**", "**/dist/**", "**/node_modules/**"]
311
+ ignore: type in CUSTOM_ROUTE_PATTERNS ? CUSTOM_ROUTE_IGNORES : DEFAULT_IGNORES
306
312
  });
307
313
  total += files.length;
308
314
  }
@@ -361,7 +367,9 @@ var toCloudResourceCounts = (counts) => ({
361
367
  users: counts.users || 0,
362
368
  designs: counts.designs || 0,
363
369
  diagrams: counts.diagrams || 0,
364
- ubiquitousLanguages: counts.ubiquitousLanguages || 0
370
+ ubiquitousLanguages: counts.ubiquitousLanguages || 0,
371
+ customPages: counts.customPages || 0,
372
+ customApis: counts.customApis || 0
365
373
  });
366
374
  var reportCloudResourceInventory = async (configFile, resourceCounts) => {
367
375
  const analytics = configFile.cloud?.analytics;
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  log_build_default
3
- } from "./chunk-SZTOJ5TU.js";
3
+ } from "./chunk-DDGOJV25.js";
4
4
  import {
5
5
  runMigrations
6
6
  } from "./chunk-XUAF2H54.js";
7
7
  import "./chunk-CA4U2JP7.js";
8
8
  import {
9
9
  generate
10
- } from "./chunk-P2FQLNHI.js";
10
+ } from "./chunk-WEDJTUSQ.js";
11
11
  import {
12
12
  logger
13
- } from "./chunk-C7BA7WQB.js";
13
+ } from "./chunk-TUKKXNQR.js";
14
14
  import {
15
15
  resolve_catalog_dependencies_default
16
16
  } from "./chunk-LHR4G2UO.js";
@@ -20,15 +20,15 @@ import {
20
20
  import {
21
21
  watch
22
22
  } from "./chunk-CAJUIMDJ.js";
23
- import "./chunk-OXX3DBZ3.js";
24
- import "./chunk-DAOXTQVS.js";
23
+ import "./chunk-PDQER3NQ.js";
24
+ import "./chunk-K2XIENVT.js";
25
25
  import {
26
26
  catalogToAstro
27
27
  } from "./chunk-W3SAPOZU.js";
28
28
  import "./chunk-W5JQON7Z.js";
29
29
  import {
30
30
  VERSION
31
- } from "./chunk-5VJKDWMT.js";
31
+ } from "./chunk-G3D7IZ67.js";
32
32
  import {
33
33
  linkCoreNodeModules,
34
34
  resolveInstalledCoreNodeModules
package/dist/generate.cjs CHANGED
@@ -108,7 +108,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
108
108
  var import_picocolors = __toESM(require("picocolors"), 1);
109
109
 
110
110
  // package.json
111
- var version = "4.1.1";
111
+ var version = "4.1.3";
112
112
 
113
113
  // src/constants.ts
114
114
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-P2FQLNHI.js";
4
- import "./chunk-C7BA7WQB.js";
5
- import "./chunk-5VJKDWMT.js";
3
+ } from "./chunk-WEDJTUSQ.js";
4
+ import "./chunk-TUKKXNQR.js";
5
+ import "./chunk-G3D7IZ67.js";
6
6
  import "./chunk-6QENHZZP.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.1.1";
39
+ var version = "4.1.3";
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-C7BA7WQB.js";
4
- import "../chunk-5VJKDWMT.js";
3
+ } from "../chunk-TUKKXNQR.js";
4
+ import "../chunk-G3D7IZ67.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -15,6 +15,7 @@ import remarkComment from 'remark-comment';
15
15
  import rehypeSlug from 'rehype-slug';
16
16
  import rehypeAutolinkHeadings from 'rehype-autolink-headings';
17
17
  import { eventCatalogLikeC4 } from './src/plugins/likec4';
18
+ import { astroTrailingSlashEndpointFix } from './src/plugins/astro-trailing-slash-endpoint-fix';
18
19
 
19
20
  import rehypeExpressiveCode from 'rehype-expressive-code';
20
21
 
@@ -116,7 +117,11 @@ export default defineConfig({
116
117
  eventCatalogIntegration(),
117
118
  ].filter(Boolean),
118
119
  vite: {
119
- plugins: [tailwindcss(), ...(await eventCatalogLikeC4(projectDirectory))],
120
+ plugins: [
121
+ tailwindcss(),
122
+ ...(await eventCatalogLikeC4(projectDirectory)),
123
+ ...(config.trailingSlash === true ? [astroTrailingSlashEndpointFix()] : []),
124
+ ],
120
125
  define: {
121
126
  /**
122
127
  * Trailing slash is exposed as global variable here principally for `@utils/url-builder`.
@@ -0,0 +1,52 @@
1
+ import type { Plugin } from 'vite';
2
+
3
+ // Works around a regression in Astro >= 7.0.4 (withastro/astro PR #17224).
4
+ //
5
+ // With `trailingSlash: 'always'`, Astro's prerender path generation
6
+ // (dist/runtime/prerender/static-paths.js) appends a trailing slash to every
7
+ // generated path, including dynamic file endpoints such as
8
+ // /docs/teams/[id].md -> /docs/teams/customer-platform.md/. Since 7.0.4 the
9
+ // route *pattern* for those endpoints no longer accepts a trailing slash, so
10
+ // at render time `getParams` fails to extract any params and static builds
11
+ // crash with `TypeError: Missing parameter: id`.
12
+ //
13
+ // The generation side runs in the Astro CLI process and cannot be patched
14
+ // here, but `getParams` (dist/core/render/params-and-props.js) is bundled
15
+ // through Vite into the prerender/server entries. This plugin rewrites it to
16
+ // retry with the trailing slash flipped when no route pattern matches - a
17
+ // no-op on unaffected Astro versions and once the regression is fixed
18
+ // upstream.
19
+ //
20
+ // The regex below matches Astro 7.0.3 (`const paramsMatch`) through 7.0.7
21
+ // (`let paramsMatch`). A unit test asserts it still applies to the installed
22
+ // Astro version so a future refactor is caught in CI rather than as a broken
23
+ // user build.
24
+ const GET_PARAMS_PATTERN =
25
+ /(?:const|let)( paramsMatch = allPatterns\.map\(\(pattern\) => pattern\.exec\(path\)\)\.find\(\(x\) => x\);)/;
26
+
27
+ export const applyGetParamsTrailingSlashFix = (code: string): string | undefined => {
28
+ if (!GET_PARAMS_PATTERN.test(code)) return undefined;
29
+ return code.replace(
30
+ GET_PARAMS_PATTERN,
31
+ `let$1
32
+ if (!paramsMatch) {
33
+ const flipped = path.endsWith('/') ? path.slice(0, -1) : path + '/';
34
+ paramsMatch = allPatterns.map((p) => p.exec(flipped)).find((x) => x);
35
+ }`
36
+ );
37
+ };
38
+
39
+ export const astroTrailingSlashEndpointFix = (): Plugin => ({
40
+ name: 'eventcatalog:astro-trailing-slash-endpoint-fix',
41
+ transform(code, id) {
42
+ if (!id.replace(/\\/g, '/').includes('astro/dist/core/render/params-and-props.js')) return;
43
+ const patched = applyGetParamsTrailingSlashFix(code);
44
+ if (!patched) {
45
+ console.warn(
46
+ '[eventcatalog] Could not apply the Astro trailing-slash endpoint fix; builds with trailingSlash: true may fail. Please raise an issue at https://github.com/event-catalog/eventcatalog/issues'
47
+ );
48
+ return;
49
+ }
50
+ return { code: patched, map: null };
51
+ },
52
+ });
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "license": "SEE LICENSE IN LICENSE",
9
9
  "type": "module",
10
- "version": "4.1.1",
10
+ "version": "4.1.3",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },