@eventcatalog/core 2.47.1 → 2.48.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 (28) 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/catalog-to-astro-content-directory.cjs +16 -1
  6. package/dist/catalog-to-astro-content-directory.js +2 -2
  7. package/dist/{chunk-SFA7F3CQ.js → chunk-IZMM7ZGY.js} +8 -1
  8. package/dist/{chunk-EXAALOQA.js → chunk-LDBRNJIL.js} +9 -1
  9. package/dist/{chunk-QWDFTW7H.js → chunk-M35UFAGG.js} +1 -1
  10. package/dist/{chunk-WWYOMQLW.js → chunk-WAVFA46U.js} +1 -1
  11. package/dist/{chunk-DCLTVJDP.js → chunk-XE6PFSH5.js} +2 -2
  12. package/dist/{chunk-YJYT2E6S.js → chunk-ZI5ZP7I2.js} +1 -1
  13. package/dist/constants.cjs +1 -1
  14. package/dist/constants.js +1 -1
  15. package/dist/eventcatalog.cjs +54 -40
  16. package/dist/eventcatalog.js +6 -6
  17. package/dist/map-catalog-to-astro.cjs +9 -1
  18. package/dist/map-catalog-to-astro.js +1 -1
  19. package/dist/watcher.cjs +14 -17
  20. package/dist/watcher.js +2 -3
  21. package/eventcatalog/src/components/SideNav/ListViewSideBar/components/MessageList.tsx +1 -0
  22. package/eventcatalog/src/components/SideNav/ListViewSideBar/components/SpecificationList.tsx +2 -0
  23. package/eventcatalog/src/components/SideNav/ListViewSideBar/index.tsx +310 -106
  24. package/eventcatalog/src/enterprise/custom-documentation/components/CustomDocsNav/index.tsx +86 -7
  25. package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +10 -0
  26. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +0 -2
  27. package/eventcatalog/tsconfig.json +1 -0
  28. package/package.json +1 -1
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "2.47.1";
40
+ var version = "2.48.1";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-QWDFTW7H.js";
4
- import "../chunk-WWYOMQLW.js";
3
+ } from "../chunk-M35UFAGG.js";
4
+ import "../chunk-WAVFA46U.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -106,7 +106,7 @@ var import_axios = __toESM(require("axios"), 1);
106
106
  var import_os = __toESM(require("os"), 1);
107
107
 
108
108
  // package.json
109
- var version = "2.47.1";
109
+ var version = "2.48.1";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-YJYT2E6S.js";
4
- import "../chunk-QWDFTW7H.js";
5
- import "../chunk-WWYOMQLW.js";
3
+ } from "../chunk-ZI5ZP7I2.js";
4
+ import "../chunk-M35UFAGG.js";
5
+ import "../chunk-WAVFA46U.js";
6
6
  import "../chunk-E7TXTI7G.js";
7
7
  export {
8
8
  log_build_default as default
@@ -153,6 +153,8 @@ function isCatalogRelated(filePath) {
153
153
  // custom styles file at root
154
154
  "components",
155
155
  // custom components
156
+ "snippets",
157
+ // custom snippets
156
158
  "public",
157
159
  // public assets
158
160
  ".env",
@@ -175,6 +177,9 @@ function getBaseTargetPaths(filePath) {
175
177
  if (filePathArr[0] == "components") {
176
178
  return [import_node_path2.default.join("src", "custom-defined-components")];
177
179
  }
180
+ if (filePathArr[0] == "snippets") {
181
+ return [import_node_path2.default.join("src")];
182
+ }
178
183
  if (filePathArr[0] == "public") {
179
184
  return [import_node_path2.default.join("public")];
180
185
  }
@@ -185,10 +190,13 @@ function getRelativeTargetPath(filePath) {
185
190
  if (filePathArr[0] == "public" || filePathArr[0] == "components") {
186
191
  filePathArr.shift();
187
192
  }
193
+ if (filePathArr[0] == "snippets") {
194
+ return import_node_path2.default.join("snippets", ...filePathArr.slice(1));
195
+ }
188
196
  const relativePath = [];
189
197
  for (let i = filePathArr.length - 1; i >= 0; i--) {
190
198
  relativePath.unshift(filePathArr[i]);
191
- if (isCollectionKey(filePathArr[i])) break;
199
+ if (isCollectionKey(filePathArr[i]) && filePathArr[i] != "snippets") break;
192
200
  }
193
201
  return import_node_path2.default.join(...relativePath);
194
202
  }
@@ -202,6 +210,13 @@ var copyFiles = async (source, target) => {
202
210
  windowsPathsNoEscape: import_node_os.default.platform() == "win32",
203
211
  ignore: ["node_modules/**", "**/dist/**", "**/teams", "**/users", "**/*.mdx", "**/*.md", "**/package.json", "**/Dockerfile"]
204
212
  });
213
+ const snippets = await (0, import_glob.glob)(path3.join(source, "snippets/**/*.mdx"), {
214
+ nodir: true,
215
+ windowsPathsNoEscape: import_node_os.default.platform() == "win32"
216
+ });
217
+ if (snippets.length > 0) {
218
+ files.push(...snippets);
219
+ }
205
220
  if (import_fs.default.existsSync(path3.join(source, ".env"))) {
206
221
  files.push(path3.join(source, ".env"));
207
222
  }
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  catalogToAstro,
3
3
  checkAndConvertMdToMdx
4
- } from "./chunk-SFA7F3CQ.js";
5
- import "./chunk-EXAALOQA.js";
4
+ } from "./chunk-IZMM7ZGY.js";
5
+ import "./chunk-LDBRNJIL.js";
6
6
  import "./chunk-E7TXTI7G.js";
7
7
  export {
8
8
  catalogToAstro,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mapCatalogToAstro
3
- } from "./chunk-EXAALOQA.js";
3
+ } from "./chunk-LDBRNJIL.js";
4
4
  import {
5
5
  verifyRequiredFieldsAreInCatalogConfigFile
6
6
  } from "./chunk-E7TXTI7G.js";
@@ -19,6 +19,13 @@ var copyFiles = async (source, target) => {
19
19
  windowsPathsNoEscape: os.platform() == "win32",
20
20
  ignore: ["node_modules/**", "**/dist/**", "**/teams", "**/users", "**/*.mdx", "**/*.md", "**/package.json", "**/Dockerfile"]
21
21
  });
22
+ const snippets = await glob(path.join(source, "snippets/**/*.mdx"), {
23
+ nodir: true,
24
+ windowsPathsNoEscape: os.platform() == "win32"
25
+ });
26
+ if (snippets.length > 0) {
27
+ files.push(...snippets);
28
+ }
22
29
  if (fs.existsSync(path.join(source, ".env"))) {
23
30
  files.push(path.join(source, ".env"));
24
31
  }
@@ -38,6 +38,8 @@ function isCatalogRelated(filePath) {
38
38
  // custom styles file at root
39
39
  "components",
40
40
  // custom components
41
+ "snippets",
42
+ // custom snippets
41
43
  "public",
42
44
  // public assets
43
45
  ".env",
@@ -60,6 +62,9 @@ function getBaseTargetPaths(filePath) {
60
62
  if (filePathArr[0] == "components") {
61
63
  return [path.join("src", "custom-defined-components")];
62
64
  }
65
+ if (filePathArr[0] == "snippets") {
66
+ return [path.join("src")];
67
+ }
63
68
  if (filePathArr[0] == "public") {
64
69
  return [path.join("public")];
65
70
  }
@@ -70,10 +75,13 @@ function getRelativeTargetPath(filePath) {
70
75
  if (filePathArr[0] == "public" || filePathArr[0] == "components") {
71
76
  filePathArr.shift();
72
77
  }
78
+ if (filePathArr[0] == "snippets") {
79
+ return path.join("snippets", ...filePathArr.slice(1));
80
+ }
73
81
  const relativePath = [];
74
82
  for (let i = filePathArr.length - 1; i >= 0; i--) {
75
83
  relativePath.unshift(filePathArr[i]);
76
- if (isCollectionKey(filePathArr[i])) break;
84
+ if (isCollectionKey(filePathArr[i]) && filePathArr[i] != "snippets") break;
77
85
  }
78
86
  return path.join(...relativePath);
79
87
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-WWYOMQLW.js";
3
+ } from "./chunk-WAVFA46U.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.47.1";
2
+ var version = "2.48.1";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mapCatalogToAstro
3
- } from "./chunk-EXAALOQA.js";
3
+ } from "./chunk-LDBRNJIL.js";
4
4
 
5
5
  // src/watcher.js
6
6
  import watcher from "@parcel/watcher";
@@ -21,7 +21,7 @@ async function watch(projectDirectory, catalogDirectory, callback = void 0) {
21
21
  }
22
22
  for (let event of events) {
23
23
  const { path: filePath, type } = event;
24
- if (filePath.endsWith(".mdx") || filePath.endsWith(".md")) {
24
+ if ((filePath.endsWith(".mdx") || filePath.endsWith(".md")) && !filePath.includes("snippets")) {
25
25
  continue;
26
26
  }
27
27
  const astroPaths = mapCatalogToAstro({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-QWDFTW7H.js";
3
+ } from "./chunk-M35UFAGG.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.47.1";
28
+ var version = "2.48.1";
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-WWYOMQLW.js";
3
+ } from "./chunk-WAVFA46U.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -29,9 +29,9 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
29
29
  // src/eventcatalog.ts
30
30
  var import_commander = require("commander");
31
31
  var import_node_child_process = require("child_process");
32
- var import_node_path7 = require("path");
32
+ var import_node_path6 = require("path");
33
33
  var import_fs2 = __toESM(require("fs"), 1);
34
- var import_node_path8 = __toESM(require("path"), 1);
34
+ var import_node_path7 = __toESM(require("path"), 1);
35
35
  var import_node_url = require("url");
36
36
  var import_concurrently = __toESM(require("concurrently"), 1);
37
37
 
@@ -157,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
157
157
  var import_os = __toESM(require("os"), 1);
158
158
 
159
159
  // package.json
160
- var version = "2.47.1";
160
+ var version = "2.48.1";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -268,6 +268,8 @@ function isCatalogRelated(filePath) {
268
268
  // custom styles file at root
269
269
  "components",
270
270
  // custom components
271
+ "snippets",
272
+ // custom snippets
271
273
  "public",
272
274
  // public assets
273
275
  ".env",
@@ -290,6 +292,9 @@ function getBaseTargetPaths(filePath) {
290
292
  if (filePathArr[0] == "components") {
291
293
  return [import_node_path3.default.join("src", "custom-defined-components")];
292
294
  }
295
+ if (filePathArr[0] == "snippets") {
296
+ return [import_node_path3.default.join("src")];
297
+ }
293
298
  if (filePathArr[0] == "public") {
294
299
  return [import_node_path3.default.join("public")];
295
300
  }
@@ -300,17 +305,19 @@ function getRelativeTargetPath(filePath) {
300
305
  if (filePathArr[0] == "public" || filePathArr[0] == "components") {
301
306
  filePathArr.shift();
302
307
  }
308
+ if (filePathArr[0] == "snippets") {
309
+ return import_node_path3.default.join("snippets", ...filePathArr.slice(1));
310
+ }
303
311
  const relativePath = [];
304
312
  for (let i = filePathArr.length - 1; i >= 0; i--) {
305
313
  relativePath.unshift(filePathArr[i]);
306
- if (isCollectionKey(filePathArr[i])) break;
314
+ if (isCollectionKey(filePathArr[i]) && filePathArr[i] != "snippets") break;
307
315
  }
308
316
  return import_node_path3.default.join(...relativePath);
309
317
  }
310
318
 
311
319
  // src/watcher.js
312
320
  var import_rimraf = require("rimraf");
313
- var import_node_path4 = __toESM(require("path"), 1);
314
321
  async function watch(projectDirectory, catalogDirectory, callback = void 0) {
315
322
  const subscription = await import_watcher.default.subscribe(
316
323
  projectDirectory,
@@ -326,7 +333,7 @@ async function watch(projectDirectory, catalogDirectory, callback = void 0) {
326
333
  }
327
334
  for (let event of events) {
328
335
  const { path: filePath, type } = event;
329
- if (filePath.endsWith(".mdx") || filePath.endsWith(".md")) {
336
+ if ((filePath.endsWith(".mdx") || filePath.endsWith(".md")) && !filePath.includes("snippets")) {
330
337
  continue;
331
338
  }
332
339
  const astroPaths = mapCatalogToAstro({
@@ -391,20 +398,27 @@ function retryEPERM(fn) {
391
398
 
392
399
  // src/catalog-to-astro-content-directory.js
393
400
  var import_glob = require("glob");
394
- var path5 = __toESM(require("path"), 1);
401
+ var path4 = __toESM(require("path"), 1);
395
402
  var import_fs = __toESM(require("fs"), 1);
396
403
  var import_url2 = require("url");
397
404
  var import_node_os = __toESM(require("os"), 1);
398
405
  var __filename2 = (0, import_url2.fileURLToPath)(importMetaUrl);
399
- var rootPkg = path5.resolve(path5.dirname(__filename2), "../");
406
+ var rootPkg = path4.resolve(path4.dirname(__filename2), "../");
400
407
  var copyFiles = async (source, target) => {
401
- const files = await (0, import_glob.glob)(path5.join(source, "**"), {
408
+ const files = await (0, import_glob.glob)(path4.join(source, "**"), {
402
409
  nodir: true,
403
410
  windowsPathsNoEscape: import_node_os.default.platform() == "win32",
404
411
  ignore: ["node_modules/**", "**/dist/**", "**/teams", "**/users", "**/*.mdx", "**/*.md", "**/package.json", "**/Dockerfile"]
405
412
  });
406
- if (import_fs.default.existsSync(path5.join(source, ".env"))) {
407
- files.push(path5.join(source, ".env"));
413
+ const snippets = await (0, import_glob.glob)(path4.join(source, "snippets/**/*.mdx"), {
414
+ nodir: true,
415
+ windowsPathsNoEscape: import_node_os.default.platform() == "win32"
416
+ });
417
+ if (snippets.length > 0) {
418
+ files.push(...snippets);
419
+ }
420
+ if (import_fs.default.existsSync(path4.join(source, ".env"))) {
421
+ files.push(path4.join(source, ".env"));
408
422
  }
409
423
  for (const file of files) {
410
424
  mapCatalogToAstro({
@@ -418,17 +432,17 @@ var copyFiles = async (source, target) => {
418
432
  }
419
433
  };
420
434
  var catalogToAstro = async (source, astroDir) => {
421
- const astroContentDir = path5.join(astroDir, "src/content/");
435
+ const astroContentDir = path4.join(astroDir, "src/content/");
422
436
  if (import_fs.default.existsSync(astroContentDir)) import_fs.default.rmSync(astroContentDir, { recursive: true });
423
437
  import_fs.default.mkdirSync(astroContentDir);
424
438
  await verifyRequiredFieldsAreInCatalogConfigFile(source);
425
- if (!import_fs.default.existsSync(path5.join(source, "eventcatalog.styles.css"))) {
426
- import_fs.default.writeFileSync(path5.join(source, "eventcatalog.styles.css"), "");
439
+ if (!import_fs.default.existsSync(path4.join(source, "eventcatalog.styles.css"))) {
440
+ import_fs.default.writeFileSync(path4.join(source, "eventcatalog.styles.css"), "");
427
441
  }
428
442
  await copyFiles(source, astroDir);
429
443
  };
430
444
  var checkAndConvertMdToMdx = async (source, astroDir) => {
431
- const files = await (0, import_glob.glob)(path5.join(source, "**"), {
445
+ const files = await (0, import_glob.glob)(path4.join(source, "**"), {
432
446
  nodir: true,
433
447
  windowsPathsNoEscape: import_node_os.default.platform() == "win32",
434
448
  ignore: ["node_modules/**", "**/dist/**", "**/README.md"]
@@ -444,7 +458,7 @@ var checkAndConvertMdToMdx = async (source, astroDir) => {
444
458
  };
445
459
 
446
460
  // src/resolve-catalog-dependencies.js
447
- var import_node_path5 = __toESM(require("path"), 1);
461
+ var import_node_path4 = __toESM(require("path"), 1);
448
462
  var import_node_fs3 = __toESM(require("fs"), 1);
449
463
  var import_gray_matter2 = __toESM(require("gray-matter"), 1);
450
464
  var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
@@ -453,7 +467,7 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
453
467
  if (!dependencies) {
454
468
  return;
455
469
  }
456
- const dependenciesDir = import_node_path5.default.join(catalogDir, "dependencies");
470
+ const dependenciesDir = import_node_path4.default.join(catalogDir, "dependencies");
457
471
  if (import_node_fs3.default.existsSync(dependenciesDir)) {
458
472
  import_node_fs3.default.rmSync(dependenciesDir, { recursive: true, force: true });
459
473
  }
@@ -477,8 +491,8 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
477
491
  },
478
492
  frontmatter
479
493
  );
480
- const resourceFile = import_node_path5.default.join(dependenciesDir, resourceType, dependency.id, `index.md`);
481
- import_node_fs3.default.mkdirSync(import_node_path5.default.dirname(resourceFile), { recursive: true });
494
+ const resourceFile = import_node_path4.default.join(dependenciesDir, resourceType, dependency.id, `index.md`);
495
+ import_node_fs3.default.mkdirSync(import_node_path4.default.dirname(resourceFile), { recursive: true });
482
496
  import_node_fs3.default.writeFileSync(resourceFile, markdown);
483
497
  }
484
498
  }
@@ -490,7 +504,7 @@ var import_boxen2 = __toESM(require("boxen"), 1);
490
504
 
491
505
  // src/features.ts
492
506
  var import_boxen = __toESM(require("boxen"), 1);
493
- var import_node_path6 = require("path");
507
+ var import_node_path5 = require("path");
494
508
  var import_node_fs4 = __toESM(require("fs"), 1);
495
509
  var isOutputServer = async () => {
496
510
  const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
@@ -498,7 +512,7 @@ var isOutputServer = async () => {
498
512
  };
499
513
  var isAuthEnabled = async () => {
500
514
  const directory = process.env.PROJECT_DIR || process.cwd();
501
- const hasAuthConfig = import_node_fs4.default.existsSync((0, import_node_path6.join)(directory, "eventcatalog.auth.js"));
515
+ const hasAuthConfig = import_node_fs4.default.existsSync((0, import_node_path5.join)(directory, "eventcatalog.auth.js"));
502
516
  return hasAuthConfig;
503
517
  };
504
518
  var isBackstagePluginEnabled = async (licenseKey) => {
@@ -632,14 +646,14 @@ var isEventCatalogStarterEnabled = async (licenseKey) => {
632
646
  // src/eventcatalog.ts
633
647
  var import_update_notifier = __toESM(require("update-notifier"), 1);
634
648
  var import_dotenv = __toESM(require("dotenv"), 1);
635
- var currentDir = import_node_path8.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
649
+ var currentDir = import_node_path7.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
636
650
  var program = new import_commander.Command().version(VERSION);
637
- var dir = import_node_path8.default.resolve(process.env.PROJECT_DIR || process.cwd());
638
- var core = import_node_path8.default.resolve(process.env.CATALOG_DIR || (0, import_node_path7.join)(dir, ".eventcatalog-core"));
639
- var eventCatalogDir = import_node_path8.default.resolve((0, import_node_path7.join)(currentDir, "../eventcatalog/"));
651
+ var dir = import_node_path7.default.resolve(process.env.PROJECT_DIR || process.cwd());
652
+ var core = import_node_path7.default.resolve(process.env.CATALOG_DIR || (0, import_node_path6.join)(dir, ".eventcatalog-core"));
653
+ var eventCatalogDir = import_node_path7.default.resolve((0, import_node_path6.join)(currentDir, "../eventcatalog/"));
640
654
  var getInstalledEventCatalogVersion = () => {
641
655
  try {
642
- const pkg = import_fs2.default.readFileSync((0, import_node_path7.join)(dir, "package.json"), "utf8");
656
+ const pkg = import_fs2.default.readFileSync((0, import_node_path6.join)(dir, "package.json"), "utf8");
643
657
  const json = JSON.parse(pkg);
644
658
  return json.dependencies["@eventcatalog/core"];
645
659
  } catch (error) {
@@ -666,13 +680,13 @@ var copyCore = () => {
666
680
  };
667
681
  var copyServerFiles = async () => {
668
682
  const isServerOutput = await isOutputServer();
669
- if (import_fs2.default.existsSync((0, import_node_path7.join)(core, "src/pages/api/server"))) {
670
- import_fs2.default.rmSync((0, import_node_path7.join)(core, "src/pages/api/server"), { recursive: true });
683
+ if (import_fs2.default.existsSync((0, import_node_path6.join)(core, "src/pages/api/server"))) {
684
+ import_fs2.default.rmSync((0, import_node_path6.join)(core, "src/pages/api/server"), { recursive: true });
671
685
  }
672
686
  if (!isServerOutput) {
673
687
  return;
674
688
  }
675
- import_fs2.default.cpSync((0, import_node_path7.join)(eventCatalogDir, "src/enterprise/eventcatalog-chat/pages/api"), (0, import_node_path7.join)(core, "src/pages/api/server"), {
689
+ import_fs2.default.cpSync((0, import_node_path6.join)(eventCatalogDir, "src/enterprise/eventcatalog-chat/pages/api"), (0, import_node_path6.join)(core, "src/pages/api/server"), {
676
690
  recursive: true
677
691
  });
678
692
  };
@@ -683,7 +697,7 @@ var createAuthFileIfNotExists = async (hasRequiredLicense) => {
683
697
  if (authEnabled && hasRequiredLicense && isSRR) {
684
698
  console.log("Creating auth file");
685
699
  import_fs2.default.writeFileSync(
686
- (0, import_node_path7.join)(core, "src/pages/api/[...auth].ts"),
700
+ (0, import_node_path6.join)(core, "src/pages/api/[...auth].ts"),
687
701
  `import { AstroAuth } from 'auth-astro/server';
688
702
  export const prerender = false;
689
703
  export const { GET, POST } = AstroAuth();
@@ -726,8 +740,8 @@ Run npm i @eventcatalog/core to update`;
726
740
  };
727
741
  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).action(async (options, command) => {
728
742
  console.log("Setting up EventCatalog....");
729
- if (import_fs2.default.existsSync(import_node_path8.default.join(dir, ".env"))) {
730
- import_dotenv.default.config({ path: import_node_path8.default.join(dir, ".env") });
743
+ if (import_fs2.default.existsSync(import_node_path7.default.join(dir, ".env"))) {
744
+ import_dotenv.default.config({ path: import_node_path7.default.join(dir, ".env") });
731
745
  }
732
746
  if (options.debug) {
733
747
  console.log("Debug mode enabled");
@@ -777,8 +791,8 @@ program.command("dev").description("Run development server of EventCatalog").opt
777
791
  });
778
792
  program.command("build").description("Run build of EventCatalog").action(async (options, command) => {
779
793
  console.log("Building EventCatalog...");
780
- if (import_fs2.default.existsSync(import_node_path8.default.join(dir, ".env"))) {
781
- import_dotenv.default.config({ path: import_node_path8.default.join(dir, ".env") });
794
+ if (import_fs2.default.existsSync(import_node_path7.default.join(dir, ".env"))) {
795
+ import_dotenv.default.config({ path: import_node_path7.default.join(dir, ".env") });
782
796
  }
783
797
  copyCore();
784
798
  await copyServerFiles();
@@ -836,8 +850,8 @@ var startServerCatalog = ({
836
850
  };
837
851
  program.command("preview").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
838
852
  console.log("Starting preview of your build...");
839
- if (import_fs2.default.existsSync(import_node_path8.default.join(dir, ".env"))) {
840
- import_dotenv.default.config({ path: import_node_path8.default.join(dir, ".env") });
853
+ if (import_fs2.default.existsSync(import_node_path7.default.join(dir, ".env"))) {
854
+ import_dotenv.default.config({ path: import_node_path7.default.join(dir, ".env") });
841
855
  }
842
856
  const canEmbedPages = await isBackstagePluginEnabled();
843
857
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
@@ -848,8 +862,8 @@ program.command("preview").description("Serves the contents of your eventcatalog
848
862
  });
849
863
  program.command("start").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
850
864
  console.log("Starting preview of your build...");
851
- if (import_fs2.default.existsSync(import_node_path8.default.join(dir, ".env"))) {
852
- import_dotenv.default.config({ path: import_node_path8.default.join(dir, ".env") });
865
+ if (import_fs2.default.existsSync(import_node_path7.default.join(dir, ".env"))) {
866
+ import_dotenv.default.config({ path: import_node_path7.default.join(dir, ".env") });
853
867
  }
854
868
  const canEmbedPages = await isBackstagePluginEnabled();
855
869
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
@@ -862,8 +876,8 @@ program.command("start").description("Serves the contents of your eventcatalog b
862
876
  }
863
877
  });
864
878
  program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
865
- if (import_fs2.default.existsSync(import_node_path8.default.join(dir, ".env"))) {
866
- import_dotenv.default.config({ path: import_node_path8.default.join(dir, ".env") });
879
+ if (import_fs2.default.existsSync(import_node_path7.default.join(dir, ".env"))) {
880
+ import_dotenv.default.config({ path: import_node_path7.default.join(dir, ".env") });
867
881
  }
868
882
  await generate(dir);
869
883
  });
@@ -3,19 +3,19 @@ import {
3
3
  } from "./chunk-BLDONK5J.js";
4
4
  import {
5
5
  watch
6
- } from "./chunk-DCLTVJDP.js";
6
+ } from "./chunk-XE6PFSH5.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-YJYT2E6S.js";
10
- import "./chunk-QWDFTW7H.js";
9
+ } from "./chunk-ZI5ZP7I2.js";
10
+ import "./chunk-M35UFAGG.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
14
- } from "./chunk-SFA7F3CQ.js";
15
- import "./chunk-EXAALOQA.js";
14
+ } from "./chunk-IZMM7ZGY.js";
15
+ import "./chunk-LDBRNJIL.js";
16
16
  import {
17
17
  VERSION
18
- } from "./chunk-WWYOMQLW.js";
18
+ } from "./chunk-WAVFA46U.js";
19
19
  import {
20
20
  isAuthEnabled,
21
21
  isBackstagePluginEnabled,
@@ -72,6 +72,8 @@ function isCatalogRelated(filePath) {
72
72
  // custom styles file at root
73
73
  "components",
74
74
  // custom components
75
+ "snippets",
76
+ // custom snippets
75
77
  "public",
76
78
  // public assets
77
79
  ".env",
@@ -94,6 +96,9 @@ function getBaseTargetPaths(filePath) {
94
96
  if (filePathArr[0] == "components") {
95
97
  return [import_node_path.default.join("src", "custom-defined-components")];
96
98
  }
99
+ if (filePathArr[0] == "snippets") {
100
+ return [import_node_path.default.join("src")];
101
+ }
97
102
  if (filePathArr[0] == "public") {
98
103
  return [import_node_path.default.join("public")];
99
104
  }
@@ -104,10 +109,13 @@ function getRelativeTargetPath(filePath) {
104
109
  if (filePathArr[0] == "public" || filePathArr[0] == "components") {
105
110
  filePathArr.shift();
106
111
  }
112
+ if (filePathArr[0] == "snippets") {
113
+ return import_node_path.default.join("snippets", ...filePathArr.slice(1));
114
+ }
107
115
  const relativePath = [];
108
116
  for (let i = filePathArr.length - 1; i >= 0; i--) {
109
117
  relativePath.unshift(filePathArr[i]);
110
- if (isCollectionKey(filePathArr[i])) break;
118
+ if (isCollectionKey(filePathArr[i]) && filePathArr[i] != "snippets") break;
111
119
  }
112
120
  return import_node_path.default.join(...relativePath);
113
121
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mapCatalogToAstro
3
- } from "./chunk-EXAALOQA.js";
3
+ } from "./chunk-LDBRNJIL.js";
4
4
  export {
5
5
  mapCatalogToAstro
6
6
  };
package/dist/watcher.cjs CHANGED
@@ -34,7 +34,7 @@ __export(watcher_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(watcher_exports);
36
36
  var import_watcher = __toESM(require("@parcel/watcher"), 1);
37
- var import_node_fs2 = __toESM(require("fs"), 1);
37
+ var import_node_fs = __toESM(require("fs"), 1);
38
38
 
39
39
  // src/map-catalog-to-astro.js
40
40
  var import_node_path = __toESM(require("path"), 1);
@@ -76,6 +76,8 @@ function isCatalogRelated(filePath) {
76
76
  // custom styles file at root
77
77
  "components",
78
78
  // custom components
79
+ "snippets",
80
+ // custom snippets
79
81
  "public",
80
82
  // public assets
81
83
  ".env",
@@ -98,6 +100,9 @@ function getBaseTargetPaths(filePath) {
98
100
  if (filePathArr[0] == "components") {
99
101
  return [import_node_path.default.join("src", "custom-defined-components")];
100
102
  }
103
+ if (filePathArr[0] == "snippets") {
104
+ return [import_node_path.default.join("src")];
105
+ }
101
106
  if (filePathArr[0] == "public") {
102
107
  return [import_node_path.default.join("public")];
103
108
  }
@@ -108,27 +113,19 @@ function getRelativeTargetPath(filePath) {
108
113
  if (filePathArr[0] == "public" || filePathArr[0] == "components") {
109
114
  filePathArr.shift();
110
115
  }
116
+ if (filePathArr[0] == "snippets") {
117
+ return import_node_path.default.join("snippets", ...filePathArr.slice(1));
118
+ }
111
119
  const relativePath = [];
112
120
  for (let i = filePathArr.length - 1; i >= 0; i--) {
113
121
  relativePath.unshift(filePathArr[i]);
114
- if (isCollectionKey(filePathArr[i])) break;
122
+ if (isCollectionKey(filePathArr[i]) && filePathArr[i] != "snippets") break;
115
123
  }
116
124
  return import_node_path.default.join(...relativePath);
117
125
  }
118
126
 
119
127
  // src/watcher.js
120
128
  var import_rimraf = require("rimraf");
121
-
122
- // src/eventcatalog-config-file-utils.js
123
- var import_promises = require("fs/promises");
124
- var import_node_fs = require("fs");
125
- var import_promises2 = require("fs/promises");
126
- var import_node_path2 = __toESM(require("path"), 1);
127
- var import_uuid = require("uuid");
128
- var import_gray_matter = __toESM(require("gray-matter"), 1);
129
-
130
- // src/watcher.js
131
- var import_node_path3 = __toESM(require("path"), 1);
132
129
  async function watch(projectDirectory, catalogDirectory, callback = void 0) {
133
130
  const subscription = await import_watcher.default.subscribe(
134
131
  projectDirectory,
@@ -144,7 +141,7 @@ async function watch(projectDirectory, catalogDirectory, callback = void 0) {
144
141
  }
145
142
  for (let event of events) {
146
143
  const { path: filePath, type } = event;
147
- if (filePath.endsWith(".mdx") || filePath.endsWith(".md")) {
144
+ if ((filePath.endsWith(".mdx") || filePath.endsWith(".md")) && !filePath.includes("snippets")) {
148
145
  continue;
149
146
  }
150
147
  const astroPaths = mapCatalogToAstro({
@@ -156,10 +153,10 @@ async function watch(projectDirectory, catalogDirectory, callback = void 0) {
156
153
  switch (type) {
157
154
  case "create":
158
155
  case "update":
159
- if (import_node_fs2.default.statSync(filePath).isDirectory()) {
160
- import_node_fs2.default.mkdirSync(astroPath, { recursive: true });
156
+ if (import_node_fs.default.statSync(filePath).isDirectory()) {
157
+ import_node_fs.default.mkdirSync(astroPath, { recursive: true });
161
158
  } else {
162
- retryEPERM(import_node_fs2.default.cpSync)(filePath, astroPath);
159
+ retryEPERM(import_node_fs.default.cpSync)(filePath, astroPath);
163
160
  }
164
161
  break;
165
162
  case "delete":
package/dist/watcher.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  watch
3
- } from "./chunk-DCLTVJDP.js";
4
- import "./chunk-EXAALOQA.js";
5
- import "./chunk-E7TXTI7G.js";
3
+ } from "./chunk-XE6PFSH5.js";
4
+ import "./chunk-LDBRNJIL.js";
6
5
  export {
7
6
  watch
8
7
  };