@eventcatalog/core 5.0.0-beta.25 → 5.0.0-beta.27
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.
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +35 -42
- package/dist/analytics/log-build.js +4 -4
- package/dist/{chunk-RFIXKATC.js → chunk-4G7FSRPN.js} +35 -42
- package/dist/{chunk-JHFZ7DQA.js → chunk-EFBDR7JJ.js} +1 -1
- package/dist/{chunk-T2MHDVFI.js → chunk-I6CBMGUM.js} +4 -2
- package/dist/{chunk-VH3RYFT7.js → chunk-ILPH363P.js} +1 -1
- package/dist/{chunk-MDWB5HLO.js → chunk-NKNOXQ62.js} +1 -1
- package/dist/{chunk-LH4Y23DH.js → chunk-P5IFIKG6.js} +2 -2
- package/dist/{chunk-36RYTYT5.js → chunk-PD7KTSYN.js} +1 -1
- package/dist/{chunk-KHACCTW2.js → chunk-QJ7KKN2D.js} +1 -1
- package/dist/{chunk-NJT4DIOO.js → chunk-YGUOLT7F.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog-config-file-utils.cjs +34 -41
- package/dist/eventcatalog-config-file-utils.d.cts +56 -58
- package/dist/eventcatalog-config-file-utils.d.ts +56 -58
- package/dist/eventcatalog-config-file-utils.js +1 -1
- package/dist/eventcatalog.cjs +52 -54
- package/dist/eventcatalog.js +13 -10
- package/dist/features.cjs +34 -41
- package/dist/features.js +2 -2
- package/dist/federation/federate.cjs +37 -44
- package/dist/federation/federate.js +2 -2
- package/dist/generate.cjs +37 -42
- package/dist/generate.js +4 -4
- package/dist/resolve-catalog-dependencies.cjs +34 -41
- package/dist/resolve-catalog-dependencies.js +2 -2
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/integrations/config-loader.mjs +56 -58
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { rm, readFile
|
|
1
|
+
import { rm, readFile } from 'node:fs/promises';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import {
|
|
5
|
+
import { register } from 'node:module';
|
|
6
6
|
|
|
7
7
|
async function cleanup(projectDirectory) {
|
|
8
8
|
const filePath = path.join(projectDirectory, 'eventcatalog.config.mjs');
|
|
@@ -11,76 +11,74 @@ async function cleanup(projectDirectory) {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
let hidesConfigModuleTypeWarning = false;
|
|
15
|
+
let loads = 0;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Node loads an eventcatalog.config.js that uses import/export as an ES module even when the catalog's
|
|
19
|
+
* package.json has no "type": "module" (a new catalog's doesn't), and warns that it had to detect it.
|
|
20
|
+
* That warning, for the config file only, is hidden: the catalog doesn't need to change anything.
|
|
21
|
+
*/
|
|
22
|
+
const hideConfigModuleTypeWarning = () => {
|
|
23
|
+
if (hidesConfigModuleTypeWarning) return;
|
|
24
|
+
hidesConfigModuleTypeWarning = true;
|
|
25
|
+
|
|
26
|
+
const emitWarning = process.emitWarning;
|
|
27
|
+
process.emitWarning = function (warning, ...args) {
|
|
28
|
+
const code = typeof args[0] === 'object' ? args[0]?.code : args[1];
|
|
29
|
+
const message = typeof warning === 'string' ? warning : warning?.message;
|
|
30
|
+
if (code === 'MODULE_TYPELESS_PACKAGE_JSON' && message?.includes('eventcatalog.config.js')) return;
|
|
31
|
+
return emitWarning.call(this, warning, ...args);
|
|
32
|
+
};
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
// Marks a config URL Node should load as an ES module, whatever the catalog's package.json says
|
|
36
|
+
const AS_MODULE_QUERY = 'eventcatalog-config-as-module';
|
|
37
|
+
let loadsMarkedConfigsAsModules = false;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Node won't load a config written with import/export in a catalog whose package.json has
|
|
41
|
+
* "type": "commonjs". A loader hook loads that config file (and only it) as an ES module.
|
|
42
|
+
*/
|
|
43
|
+
const loadMarkedConfigsAsModules = () => {
|
|
44
|
+
if (loadsMarkedConfigsAsModules) return;
|
|
45
|
+
loadsMarkedConfigsAsModules = true;
|
|
46
|
+
const hook = `export async function load(url, context, nextLoad) {
|
|
47
|
+
return nextLoad(url, url.includes('${AS_MODULE_QUERY}=') ? { ...context, format: 'module' } : context);
|
|
48
|
+
}`;
|
|
49
|
+
register(`data:text/javascript,${encodeURIComponent(hook)}`);
|
|
42
50
|
};
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Loads the catalog's eventcatalog.config.js from where it is, so paths it builds from its own location
|
|
54
|
+
* (`import.meta.url`, `import.meta.dirname`) and its relative imports point into the catalog. It was
|
|
55
|
+
* loaded from a copy in a temporary folder before, which broke them (e.g. the paths to a generator's specs).
|
|
56
|
+
*/
|
|
57
|
+
const isCommonJSPackage = async (projectDirectory) => {
|
|
58
|
+
try {
|
|
59
|
+
const packageJson = JSON.parse(await readFile(path.join(projectDirectory, 'package.json'), 'utf-8'));
|
|
60
|
+
return packageJson?.type === 'commonjs';
|
|
61
|
+
} catch {
|
|
62
|
+
return false;
|
|
49
63
|
}
|
|
50
|
-
|
|
51
|
-
const tempDir = await mkdtemp(path.join(tmpdir(), 'eventcatalog-config-'));
|
|
52
|
-
await linkNodeModulesIntoTempDirectory({ projectDirectory, tempDir });
|
|
53
|
-
return tempDir;
|
|
54
64
|
};
|
|
55
65
|
|
|
56
66
|
const getEventCatalogConfigFile = async (projectDirectory) => {
|
|
57
|
-
let tempDir;
|
|
58
|
-
|
|
59
67
|
try {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
68
|
+
hideConfigModuleTypeWarning();
|
|
69
|
+
// A catalog's config is an ES module, as it always was (with "type": "commonjs" it was loaded from an .mjs copy)
|
|
70
|
+
const asModule = await isCommonJSPackage(projectDirectory);
|
|
71
|
+
if (asModule) loadMarkedConfigsAsModules();
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
tempDir = await createTemporaryConfigDirectory(projectDirectory);
|
|
70
|
-
configFilePath = path.join(tempDir, 'eventcatalog.config.mjs');
|
|
71
|
-
await copyFile(path.join(projectDirectory, 'eventcatalog.config.js'), configFilePath);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const configFileURL = `${pathToFileURL(configFilePath).href}?t=${Date.now()}`;
|
|
75
|
-
const config = await import(/* @vite-ignore */ configFileURL);
|
|
73
|
+
const configFileURL = pathToFileURL(path.join(projectDirectory, 'eventcatalog.config.js')).href;
|
|
74
|
+
// A new URL each time, so a changed config is loaded again (not `?t=`: Vite drops it as its own timestamp)
|
|
75
|
+
const query = `${asModule ? AS_MODULE_QUERY : 'loaded'}=${Date.now()}-${loads++}`;
|
|
76
|
+
const config = await import(/* @vite-ignore */ `${configFileURL}?${query}`);
|
|
76
77
|
|
|
77
78
|
return config.default;
|
|
78
79
|
} finally {
|
|
80
|
+
// Earlier versions loaded a copy from eventcatalog.config.mjs in the catalog: remove one left behind
|
|
79
81
|
await cleanup(projectDirectory);
|
|
80
|
-
|
|
81
|
-
if (tempDir) {
|
|
82
|
-
await rm(tempDir, { recursive: true, force: true });
|
|
83
|
-
}
|
|
84
82
|
}
|
|
85
83
|
};
|
|
86
84
|
|
package/dist/eventcatalog.cjs
CHANGED
|
@@ -34,7 +34,7 @@ var import_node_http = __toESM(require("http"), 1);
|
|
|
34
34
|
var import_fs = __toESM(require("fs"), 1);
|
|
35
35
|
var import_node_path21 = __toESM(require("path"), 1);
|
|
36
36
|
var import_node_url2 = require("url");
|
|
37
|
-
var
|
|
37
|
+
var import_node_module3 = require("module");
|
|
38
38
|
|
|
39
39
|
// src/generate.js
|
|
40
40
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
@@ -50,65 +50,58 @@ var import_promises = require("fs/promises");
|
|
|
50
50
|
var import_node_fs = require("fs");
|
|
51
51
|
var import_node_path = __toESM(require("path"), 1);
|
|
52
52
|
var import_node_url = require("url");
|
|
53
|
-
var
|
|
53
|
+
var import_node_module = require("module");
|
|
54
54
|
async function cleanup(projectDirectory) {
|
|
55
55
|
const filePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
56
56
|
if ((0, import_node_fs.existsSync)(filePath)) {
|
|
57
57
|
await (0, import_promises.rm)(filePath);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var linkNodeModulesIntoTempDirectory = async ({ projectDirectory, tempDir }) => {
|
|
75
|
-
const nodeModulesDirectory = findNodeModulesDirectory(projectDirectory);
|
|
76
|
-
if (!nodeModulesDirectory) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
await (0, import_promises.symlink)(nodeModulesDirectory, import_node_path.default.join(tempDir, "node_modules"), "dir");
|
|
60
|
+
var hidesConfigModuleTypeWarning = false;
|
|
61
|
+
var loads = 0;
|
|
62
|
+
var hideConfigModuleTypeWarning = () => {
|
|
63
|
+
if (hidesConfigModuleTypeWarning) return;
|
|
64
|
+
hidesConfigModuleTypeWarning = true;
|
|
65
|
+
const emitWarning = process.emitWarning;
|
|
66
|
+
process.emitWarning = function(warning, ...args) {
|
|
67
|
+
const code = typeof args[0] === "object" ? args[0]?.code : args[1];
|
|
68
|
+
const message2 = typeof warning === "string" ? warning : warning?.message;
|
|
69
|
+
if (code === "MODULE_TYPELESS_PACKAGE_JSON" && message2?.includes("eventcatalog.config.js")) return;
|
|
70
|
+
return emitWarning.call(this, warning, ...args);
|
|
71
|
+
};
|
|
80
72
|
};
|
|
81
|
-
var
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
73
|
+
var AS_MODULE_QUERY = "eventcatalog-config-as-module";
|
|
74
|
+
var loadsMarkedConfigsAsModules = false;
|
|
75
|
+
var loadMarkedConfigsAsModules = () => {
|
|
76
|
+
if (loadsMarkedConfigsAsModules) return;
|
|
77
|
+
loadsMarkedConfigsAsModules = true;
|
|
78
|
+
const hook = `export async function load(url, context, nextLoad) {
|
|
79
|
+
return nextLoad(url, url.includes('${AS_MODULE_QUERY}=') ? { ...context, format: 'module' } : context);
|
|
80
|
+
}`;
|
|
81
|
+
(0, import_node_module.register)(`data:text/javascript,${encodeURIComponent(hook)}`);
|
|
82
|
+
};
|
|
83
|
+
var isCommonJSPackage = async (projectDirectory) => {
|
|
84
|
+
try {
|
|
85
|
+
const packageJson = JSON.parse(await (0, import_promises.readFile)(import_node_path.default.join(projectDirectory, "package.json"), "utf-8"));
|
|
86
|
+
return packageJson?.type === "commonjs";
|
|
87
|
+
} catch {
|
|
88
|
+
return false;
|
|
85
89
|
}
|
|
86
|
-
const tempDir = await (0, import_promises.mkdtemp)(import_node_path.default.join((0, import_node_os.tmpdir)(), "eventcatalog-config-"));
|
|
87
|
-
await linkNodeModulesIntoTempDirectory({ projectDirectory, tempDir });
|
|
88
|
-
return tempDir;
|
|
89
90
|
};
|
|
90
91
|
var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
91
|
-
let tempDir;
|
|
92
92
|
try {
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
configFilePath = import_node_path.default.join(tempDir, "eventcatalog.config.mjs");
|
|
99
|
-
await (0, import_promises.copyFile)(import_node_path.default.join(projectDirectory, "eventcatalog.config.js"), configFilePath);
|
|
100
|
-
}
|
|
101
|
-
const configFileURL = `${(0, import_node_url.pathToFileURL)(configFilePath).href}?t=${Date.now()}`;
|
|
93
|
+
hideConfigModuleTypeWarning();
|
|
94
|
+
const asModule = await isCommonJSPackage(projectDirectory);
|
|
95
|
+
if (asModule) loadMarkedConfigsAsModules();
|
|
96
|
+
const configFileURL = (0, import_node_url.pathToFileURL)(import_node_path.default.join(projectDirectory, "eventcatalog.config.js")).href;
|
|
97
|
+
const query = `${asModule ? AS_MODULE_QUERY : "loaded"}=${Date.now()}-${loads++}`;
|
|
102
98
|
const config = await import(
|
|
103
99
|
/* @vite-ignore */
|
|
104
|
-
configFileURL
|
|
100
|
+
`${configFileURL}?${query}`
|
|
105
101
|
);
|
|
106
102
|
return config.default;
|
|
107
103
|
} finally {
|
|
108
104
|
await cleanup(projectDirectory);
|
|
109
|
-
if (tempDir) {
|
|
110
|
-
await (0, import_promises.rm)(tempDir, { recursive: true, force: true });
|
|
111
|
-
}
|
|
112
105
|
}
|
|
113
106
|
};
|
|
114
107
|
|
|
@@ -181,7 +174,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
181
174
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
182
175
|
|
|
183
176
|
// package.json
|
|
184
|
-
var version = "5.0.0-beta.
|
|
177
|
+
var version = "5.0.0-beta.27";
|
|
185
178
|
|
|
186
179
|
// src/constants.ts
|
|
187
180
|
var VERSION = version;
|
|
@@ -295,10 +288,12 @@ var generate = async (PROJECT_DIRECTORY) => {
|
|
|
295
288
|
for (const { plugin } of errors) {
|
|
296
289
|
logger.error(` - ${plugin}`, "generator");
|
|
297
290
|
}
|
|
291
|
+
process.exitCode = 1;
|
|
298
292
|
}
|
|
299
293
|
} catch (error) {
|
|
300
294
|
console.error(error);
|
|
301
295
|
await cleanup(PROJECT_DIRECTORY);
|
|
296
|
+
process.exitCode = 1;
|
|
302
297
|
}
|
|
303
298
|
};
|
|
304
299
|
|
|
@@ -848,7 +843,7 @@ var import_dotenv = __toESM(require("dotenv"), 1);
|
|
|
848
843
|
// src/migrations/message-channels-to-service-channels.ts
|
|
849
844
|
var import_node_fs5 = __toESM(require("fs"), 1);
|
|
850
845
|
var import_glob2 = require("glob");
|
|
851
|
-
var
|
|
846
|
+
var import_node_os = __toESM(require("os"), 1);
|
|
852
847
|
var import_gray_matter3 = __toESM(require("gray-matter"), 1);
|
|
853
848
|
var import_node_path8 = __toESM(require("path"), 1);
|
|
854
849
|
var DISABLE_CHANNEL_MIGRATION_ENV = "EVENTCATALOG_DISABLE_CHANNEL_MIGRATION";
|
|
@@ -882,7 +877,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
|
|
|
882
877
|
cwd: PROJECT_DIR,
|
|
883
878
|
absolute: true,
|
|
884
879
|
nodir: true,
|
|
885
|
-
windowsPathsNoEscape:
|
|
880
|
+
windowsPathsNoEscape: import_node_os.default.platform() == "win32",
|
|
886
881
|
ignore: ["node_modules/**", "**/dist/**", "**/teams", "**/users", "**/package.json", "**/Dockerfile"]
|
|
887
882
|
}
|
|
888
883
|
);
|
|
@@ -966,7 +961,7 @@ var runMigrations = async (dir2) => {
|
|
|
966
961
|
};
|
|
967
962
|
|
|
968
963
|
// src/utils/child-process-signals.ts
|
|
969
|
-
var
|
|
964
|
+
var import_node_os2 = require("os");
|
|
970
965
|
var FORWARDED_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
971
966
|
var isRunning = (child) => child.exitCode === null && child.signalCode === null;
|
|
972
967
|
var stopChildWithParent = (child, parent = process) => {
|
|
@@ -985,7 +980,7 @@ var stopChildWithParent = (child, parent = process) => {
|
|
|
985
980
|
for (const signal of FORWARDED_SIGNALS) parent.off(signal, onSignal);
|
|
986
981
|
parent.off("exit", onExit);
|
|
987
982
|
if (!received) return false;
|
|
988
|
-
parent.exit(128 +
|
|
983
|
+
parent.exit(128 + import_node_os2.constants.signals[received]);
|
|
989
984
|
return true;
|
|
990
985
|
}
|
|
991
986
|
};
|
|
@@ -1887,8 +1882,8 @@ ${errors.join("\n")}`);
|
|
|
1887
1882
|
// src/catalog-runtime.ts
|
|
1888
1883
|
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
1889
1884
|
var import_node_path12 = __toESM(require("path"), 1);
|
|
1890
|
-
var
|
|
1891
|
-
var require2 = (0,
|
|
1885
|
+
var import_node_module2 = require("module");
|
|
1886
|
+
var require2 = (0, import_node_module2.createRequire)(importMetaUrl);
|
|
1892
1887
|
var writeIfChanged = (file, content) => {
|
|
1893
1888
|
if (import_node_fs8.default.existsSync(file) && import_node_fs8.default.readFileSync(file, "utf8") === content) return;
|
|
1894
1889
|
import_node_fs8.default.mkdirSync(import_node_path12.default.dirname(file), { recursive: true });
|
|
@@ -2579,7 +2574,7 @@ var createFileSystemSourceProvider = (projectDirectory) => ({
|
|
|
2579
2574
|
// src/federation/github-source-provider.ts
|
|
2580
2575
|
var import_node_child_process = require("child_process");
|
|
2581
2576
|
var import_promises9 = __toESM(require("fs/promises"), 1);
|
|
2582
|
-
var
|
|
2577
|
+
var import_node_os3 = __toESM(require("os"), 1);
|
|
2583
2578
|
var import_node_path18 = __toESM(require("path"), 1);
|
|
2584
2579
|
var import_node_util = require("util");
|
|
2585
2580
|
var import_sdk2 = __toESM(require("@eventcatalog/sdk"), 1);
|
|
@@ -2636,7 +2631,7 @@ var getGitEnvironment = (token) => {
|
|
|
2636
2631
|
var createCheckout = (executeFile, token) => async (source, ref, callback) => {
|
|
2637
2632
|
const { owner, repository } = parseGitHubSource(source);
|
|
2638
2633
|
const catalogPath = import_node_path18.default.posix.normalize(source.path ?? ".");
|
|
2639
|
-
const directory = await import_promises9.default.mkdtemp(import_node_path18.default.join(
|
|
2634
|
+
const directory = await import_promises9.default.mkdtemp(import_node_path18.default.join(import_node_os3.default.tmpdir(), "eventcatalog-federation-"));
|
|
2640
2635
|
const env = getGitEnvironment(token);
|
|
2641
2636
|
try {
|
|
2642
2637
|
const git = (args) => executeFile("git", args, { cwd: directory, env, encoding: "utf8" });
|
|
@@ -2974,7 +2969,7 @@ Run npm i @eventcatalog/core to update`;
|
|
|
2974
2969
|
|
|
2975
2970
|
// src/eventcatalog.ts
|
|
2976
2971
|
var currentDir = import_node_path21.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
|
|
2977
|
-
var astroCli = import_node_path21.default.join(import_node_path21.default.dirname((0,
|
|
2972
|
+
var astroCli = import_node_path21.default.join(import_node_path21.default.dirname((0, import_node_module3.createRequire)(importMetaUrl).resolve("astro/package.json")), "bin/astro.mjs");
|
|
2978
2973
|
var ASTRO_IN_FOREGROUND = { ASTRO_DEV_BACKGROUND: "1", ASTRO_PREVIEW_BACKGROUND: "1" };
|
|
2979
2974
|
var program = new import_commander.Command().version(VERSION);
|
|
2980
2975
|
var dir = import_node_path21.default.resolve(process.env.PROJECT_DIR || process.cwd());
|
|
@@ -3120,6 +3115,9 @@ var runCommandWithFilteredOutput = async ({
|
|
|
3120
3115
|
cwd,
|
|
3121
3116
|
env: {
|
|
3122
3117
|
...process.env,
|
|
3118
|
+
// Astro sends usage data (commands, config, machine details) to Astro by default: turn it off
|
|
3119
|
+
// for everyone using EventCatalog
|
|
3120
|
+
ASTRO_TELEMETRY_DISABLED: "1",
|
|
3123
3121
|
...env
|
|
3124
3122
|
},
|
|
3125
3123
|
stdio: ["inherit", "pipe", "pipe"]
|
|
@@ -3571,7 +3569,7 @@ program.addHelpText(
|
|
|
3571
3569
|
Example: npx eventcatalog dev --debug -- --env=production --port=3000
|
|
3572
3570
|
`
|
|
3573
3571
|
);
|
|
3574
|
-
program.parseAsync().then(() => process.exit(
|
|
3572
|
+
program.parseAsync().then(() => process.exit()).catch((err) => {
|
|
3575
3573
|
if (!(err instanceof FederationConflictError) && !(err instanceof FederationDiagnosticError)) console.error(err);
|
|
3576
3574
|
process.exit(1);
|
|
3577
3575
|
});
|
package/dist/eventcatalog.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-S5GWAUG5.js";
|
|
8
8
|
import {
|
|
9
9
|
log_build_default
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-P5IFIKG6.js";
|
|
11
11
|
import {
|
|
12
12
|
getLicenseStatus,
|
|
13
13
|
printLicenseStatus
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
FederationConflictError,
|
|
18
18
|
FederationDiagnosticError,
|
|
19
19
|
federateCatalog
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-QJ7KKN2D.js";
|
|
21
21
|
import "./chunk-WRNH5C3U.js";
|
|
22
22
|
import "./chunk-5EPNFDT5.js";
|
|
23
23
|
import "./chunk-A2RZR3U4.js";
|
|
@@ -33,16 +33,16 @@ import {
|
|
|
33
33
|
isAuthEnabled,
|
|
34
34
|
isIndexedSearchEnabled,
|
|
35
35
|
isOutputServer
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-NKNOXQ62.js";
|
|
37
37
|
import {
|
|
38
38
|
generate
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-I6CBMGUM.js";
|
|
40
40
|
import {
|
|
41
41
|
logger
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-ILPH363P.js";
|
|
43
43
|
import {
|
|
44
44
|
resolve_catalog_dependencies_default
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-PD7KTSYN.js";
|
|
46
46
|
import {
|
|
47
47
|
buildSearchIndex
|
|
48
48
|
} from "./chunk-DJCOJ77J.js";
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
import {
|
|
54
54
|
watch
|
|
55
55
|
} from "./chunk-U63GDPPY.js";
|
|
56
|
-
import "./chunk-
|
|
56
|
+
import "./chunk-EFBDR7JJ.js";
|
|
57
57
|
import "./chunk-CPW6G62V.js";
|
|
58
58
|
import {
|
|
59
59
|
getAstroConfigPath
|
|
@@ -70,11 +70,11 @@ import {
|
|
|
70
70
|
} from "./chunk-LFQJXLHG.js";
|
|
71
71
|
import {
|
|
72
72
|
VERSION
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-YGUOLT7F.js";
|
|
74
74
|
import {
|
|
75
75
|
getEventCatalogConfigFile,
|
|
76
76
|
verifyRequiredFieldsAreInCatalogConfigFile
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-4G7FSRPN.js";
|
|
78
78
|
|
|
79
79
|
// src/eventcatalog.ts
|
|
80
80
|
import { Command } from "commander";
|
|
@@ -786,6 +786,9 @@ var runCommandWithFilteredOutput = async ({
|
|
|
786
786
|
cwd,
|
|
787
787
|
env: {
|
|
788
788
|
...process.env,
|
|
789
|
+
// Astro sends usage data (commands, config, machine details) to Astro by default: turn it off
|
|
790
|
+
// for everyone using EventCatalog
|
|
791
|
+
ASTRO_TELEMETRY_DISABLED: "1",
|
|
789
792
|
...env
|
|
790
793
|
},
|
|
791
794
|
stdio: ["inherit", "pipe", "pipe"]
|
|
@@ -1237,7 +1240,7 @@ program.addHelpText(
|
|
|
1237
1240
|
Example: npx eventcatalog dev --debug -- --env=production --port=3000
|
|
1238
1241
|
`
|
|
1239
1242
|
);
|
|
1240
|
-
program.parseAsync().then(() => process.exit(
|
|
1243
|
+
program.parseAsync().then(() => process.exit()).catch((err) => {
|
|
1241
1244
|
if (!(err instanceof FederationConflictError) && !(err instanceof FederationDiagnosticError)) console.error(err);
|
|
1242
1245
|
process.exit(1);
|
|
1243
1246
|
});
|
package/dist/features.cjs
CHANGED
|
@@ -48,65 +48,58 @@ var import_promises = require("fs/promises");
|
|
|
48
48
|
var import_node_fs = require("fs");
|
|
49
49
|
var import_node_path = __toESM(require("path"), 1);
|
|
50
50
|
var import_node_url = require("url");
|
|
51
|
-
var
|
|
51
|
+
var import_node_module = require("module");
|
|
52
52
|
async function cleanup(projectDirectory) {
|
|
53
53
|
const filePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
54
54
|
if ((0, import_node_fs.existsSync)(filePath)) {
|
|
55
55
|
await (0, import_promises.rm)(filePath);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
58
|
+
var hidesConfigModuleTypeWarning = false;
|
|
59
|
+
var loads = 0;
|
|
60
|
+
var hideConfigModuleTypeWarning = () => {
|
|
61
|
+
if (hidesConfigModuleTypeWarning) return;
|
|
62
|
+
hidesConfigModuleTypeWarning = true;
|
|
63
|
+
const emitWarning = process.emitWarning;
|
|
64
|
+
process.emitWarning = function(warning, ...args) {
|
|
65
|
+
const code = typeof args[0] === "object" ? args[0]?.code : args[1];
|
|
66
|
+
const message = typeof warning === "string" ? warning : warning?.message;
|
|
67
|
+
if (code === "MODULE_TYPELESS_PACKAGE_JSON" && message?.includes("eventcatalog.config.js")) return;
|
|
68
|
+
return emitWarning.call(this, warning, ...args);
|
|
69
|
+
};
|
|
71
70
|
};
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
var AS_MODULE_QUERY = "eventcatalog-config-as-module";
|
|
72
|
+
var loadsMarkedConfigsAsModules = false;
|
|
73
|
+
var loadMarkedConfigsAsModules = () => {
|
|
74
|
+
if (loadsMarkedConfigsAsModules) return;
|
|
75
|
+
loadsMarkedConfigsAsModules = true;
|
|
76
|
+
const hook = `export async function load(url, context, nextLoad) {
|
|
77
|
+
return nextLoad(url, url.includes('${AS_MODULE_QUERY}=') ? { ...context, format: 'module' } : context);
|
|
78
|
+
}`;
|
|
79
|
+
(0, import_node_module.register)(`data:text/javascript,${encodeURIComponent(hook)}`);
|
|
78
80
|
};
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return
|
|
81
|
+
var isCommonJSPackage = async (projectDirectory) => {
|
|
82
|
+
try {
|
|
83
|
+
const packageJson = JSON.parse(await (0, import_promises.readFile)(import_node_path.default.join(projectDirectory, "package.json"), "utf-8"));
|
|
84
|
+
return packageJson?.type === "commonjs";
|
|
85
|
+
} catch {
|
|
86
|
+
return false;
|
|
83
87
|
}
|
|
84
|
-
const tempDir = await (0, import_promises.mkdtemp)(import_node_path.default.join((0, import_node_os.tmpdir)(), "eventcatalog-config-"));
|
|
85
|
-
await linkNodeModulesIntoTempDirectory({ projectDirectory, tempDir });
|
|
86
|
-
return tempDir;
|
|
87
88
|
};
|
|
88
89
|
var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
89
|
-
let tempDir;
|
|
90
90
|
try {
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
configFilePath = import_node_path.default.join(tempDir, "eventcatalog.config.mjs");
|
|
97
|
-
await (0, import_promises.copyFile)(import_node_path.default.join(projectDirectory, "eventcatalog.config.js"), configFilePath);
|
|
98
|
-
}
|
|
99
|
-
const configFileURL = `${(0, import_node_url.pathToFileURL)(configFilePath).href}?t=${Date.now()}`;
|
|
91
|
+
hideConfigModuleTypeWarning();
|
|
92
|
+
const asModule = await isCommonJSPackage(projectDirectory);
|
|
93
|
+
if (asModule) loadMarkedConfigsAsModules();
|
|
94
|
+
const configFileURL = (0, import_node_url.pathToFileURL)(import_node_path.default.join(projectDirectory, "eventcatalog.config.js")).href;
|
|
95
|
+
const query = `${asModule ? AS_MODULE_QUERY : "loaded"}=${Date.now()}-${loads++}`;
|
|
100
96
|
const config = await import(
|
|
101
97
|
/* @vite-ignore */
|
|
102
|
-
configFileURL
|
|
98
|
+
`${configFileURL}?${query}`
|
|
103
99
|
);
|
|
104
100
|
return config.default;
|
|
105
101
|
} finally {
|
|
106
102
|
await cleanup(projectDirectory);
|
|
107
|
-
if (tempDir) {
|
|
108
|
-
await (0, import_promises.rm)(tempDir, { recursive: true, force: true });
|
|
109
|
-
}
|
|
110
103
|
}
|
|
111
104
|
};
|
|
112
105
|
|
package/dist/features.js
CHANGED