@eventcatalog/core 2.14.2 → 2.15.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.
- package/README.md +4 -3
- package/bin/eventcatalog.js +2 -0
- package/dist/analytics/analytics.cjs +71 -0
- package/dist/analytics/analytics.d.cts +3 -0
- package/dist/analytics/analytics.d.ts +3 -0
- package/dist/analytics/analytics.js +7 -0
- package/dist/analytics/log-build.cjs +155 -0
- package/dist/analytics/log-build.d.cts +7 -0
- package/dist/analytics/log-build.d.ts +7 -0
- package/dist/analytics/log-build.js +9 -0
- package/dist/catalog-to-astro-content-directory.cjs +277 -0
- package/dist/catalog-to-astro-content-directory.d.cts +3 -0
- package/dist/catalog-to-astro-content-directory.d.ts +3 -0
- package/dist/catalog-to-astro-content-directory.js +8 -0
- package/dist/chunk-65VQIGAP.js +33 -0
- package/{scripts/watcher.js → dist/chunk-7HYM3M5I.js} +29 -52
- package/dist/chunk-E7TXTI7G.js +78 -0
- package/dist/chunk-KI4KAUWW.js +30 -0
- package/dist/chunk-O6BGVVOW.js +86 -0
- package/dist/chunk-PK2EQVPD.js +89 -0
- package/dist/chunk-TGOUSS6C.js +9 -0
- package/dist/chunk-YEQVKHST.js +56 -0
- package/dist/constants.cjs +35 -0
- package/dist/constants.d.cts +3 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +6 -0
- package/dist/eventcatalog-config-file-utils.cjs +116 -0
- package/dist/eventcatalog-config-file-utils.d.cts +7 -0
- package/dist/eventcatalog-config-file-utils.d.ts +7 -0
- package/dist/eventcatalog-config-file-utils.js +14 -0
- package/{bin/dist → dist}/eventcatalog.cjs +23 -33
- package/{bin/dist → dist}/eventcatalog.config.cjs +1 -1
- package/dist/eventcatalog.config.js +0 -0
- package/dist/eventcatalog.d.cts +2 -0
- package/dist/eventcatalog.d.ts +2 -0
- package/dist/eventcatalog.js +116 -0
- package/dist/generate.cjs +121 -0
- package/dist/generate.d.cts +3 -0
- package/dist/generate.d.ts +3 -0
- package/dist/generate.js +7 -0
- package/dist/map-catalog-to-astro.cjs +123 -0
- package/dist/map-catalog-to-astro.d.cts +28 -0
- package/dist/map-catalog-to-astro.d.ts +28 -0
- package/dist/map-catalog-to-astro.js +6 -0
- package/dist/watcher.cjs +223 -0
- package/dist/watcher.d.cts +21 -0
- package/dist/watcher.d.ts +21 -0
- package/dist/watcher.js +8 -0
- package/eventcatalog/public/icons/ms-teams.svg +2 -0
- package/{src → eventcatalog/src}/components/MDX/NodeGraph/NodeGraph.tsx +27 -38
- package/{src → eventcatalog/src}/content/config.ts +2 -0
- package/eventcatalog/src/hooks/eventcatalog-visualizer.ts +89 -0
- package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/asyncapi/index.astro +2 -1
- package/{src → eventcatalog/src}/pages/docs/teams/[id]/index.astro +10 -0
- package/{src → eventcatalog/src}/pages/docs/users/[id]/index.astro +10 -0
- package/{src → eventcatalog/src}/utils/node-graphs/message-node-graph.ts +2 -27
- package/{src → eventcatalog/src}/utils/node-graphs/utils/utils.ts +60 -3
- package/package.json +11 -3
- package/.all-contributorsrc +0 -436
- package/.changeset/config.json +0 -11
- package/.github/CODEOWNERS +0 -3
- package/.github/ISSUE_TEMPLATE/bug.yml +0 -84
- package/.github/ISSUE_TEMPLATE/config.yml +0 -5
- package/.github/ISSUE_TEMPLATE/feature.yml +0 -48
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -14
- package/.github/funding.yml +0 -1
- package/.github/workflows/lint.yml +0 -22
- package/.github/workflows/release.yml +0 -34
- package/.github/workflows/test-bin.yml +0 -29
- package/.github/workflows/test-e2e.yml +0 -27
- package/.github/workflows/verify-build.yml +0 -28
- package/.prettierignore +0 -7
- package/.prettierrc +0 -18
- package/CHANGELOG.md +0 -1289
- package/bin/dist/eventcatalog.d.cts +0 -1
- package/bin/dist/eventcatalog.d.ts +0 -1
- package/bin/dist/eventcatalog.js +0 -531
- package/bin/eventcatalog.config.ts +0 -34
- package/images/example.png +0 -0
- package/images/sponsors/gravitee-logo-black.svg +0 -54
- package/images/sponsors/hookdeck.svg +0 -11
- package/images/sponsors/oso-logo-green.png +0 -0
- package/scripts/analytics/analytics.js +0 -31
- package/scripts/analytics/log-build.js +0 -26
- package/scripts/build-ci.js +0 -27
- package/scripts/catalog-to-astro-content-directory.js +0 -115
- package/scripts/ci/test.js +0 -24
- package/scripts/constants.ts +0 -3
- package/scripts/eventcatalog-config-file-utils.js +0 -89
- package/scripts/generate.js +0 -65
- package/scripts/map-catalog-to-astro.js +0 -174
- package/scripts/start-catalog-locally.js +0 -26
- /package/{bin/dist → dist}/eventcatalog.config.d.cts +0 -0
- /package/{bin/dist → dist}/eventcatalog.config.d.ts +0 -0
- /package/{astro.config.mjs → eventcatalog/astro.config.mjs} +0 -0
- /package/{global.d.ts → eventcatalog/global.d.ts} +0 -0
- /package/{public → eventcatalog/public}/favicon.ico +0 -0
- /package/{public → eventcatalog/public}/icons/asyncapi.svg +0 -0
- /package/{public → eventcatalog/public}/icons/discord.svg +0 -0
- /package/{public → eventcatalog/public}/icons/github-purple.svg +0 -0
- /package/{public → eventcatalog/public}/icons/github.svg +0 -0
- /package/{public → eventcatalog/public}/icons/openapi.svg +0 -0
- /package/{public → eventcatalog/public}/icons/protocols/kafka.svg +0 -0
- /package/{public → eventcatalog/public}/icons/x-twitter.svg +0 -0
- /package/{public → eventcatalog/public}/icons/youtube.svg +0 -0
- /package/{public → eventcatalog/public}/logo.png +0 -0
- /package/{public → eventcatalog/public}/openapi.yml +0 -0
- /package/{public → eventcatalog/public}/opengraph.png +0 -0
- /package/{public → eventcatalog/public}/slack-icon.svg +0 -0
- /package/{src → eventcatalog/src}/components/DiscoverInsight.astro +0 -0
- /package/{src → eventcatalog/src}/components/DocsNavigation.astro +0 -0
- /package/{src → eventcatalog/src}/components/Header.astro +0 -0
- /package/{src → eventcatalog/src}/components/Lists/OwnersList.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Lists/PillList.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Lists/PillListFlat.styles.css +0 -0
- /package/{src → eventcatalog/src}/components/Lists/PillListFlat.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Lists/ProtocolList.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Lists/RepositoryList.astro +0 -0
- /package/{src → eventcatalog/src}/components/Lists/SpecificationsList.astro +0 -0
- /package/{src → eventcatalog/src}/components/Lists/VersionList.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Accordion/Accordion.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Accordion/Accordion.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Accordion/AccordionGroup.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Admonition.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/AsyncAPI/AsyncAPI.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/ChannelInformation/ChannelInformation.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/File.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Flow/Flow.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/DownloadButton.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Edges/AnimatedMessageEdge.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/NodeGraph.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/NodeGraphPortal.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Channel.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Command.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Event.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/ExternalSystem.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Query.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Service.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Step.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/User.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/OpenAPI/OpenAPI.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Schema.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/SchemaViewer/SchemaViewer.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/SchemaViewer/SchemaViewer.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/SchemaViewer/SchemaViewerPortal.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Steps/Step.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Steps/Steps.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Tiles/Tile.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Tiles/Tiles.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/components.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/page-components.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Search.astro +0 -0
- /package/{src → eventcatalog/src}/components/Seo.astro +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/CatalogResourcesSideBar/index.tsx +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/CatalogResourcesSideBar/styles.css +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/ChannelSideBar.astro +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/DomainSideBar.astro +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/MessageSideBar.astro +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/ServiceSideBar.astro +0 -0
- /package/{src → eventcatalog/src}/components/Tables/DebouncedInput.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/Table.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/DomainTableColumns.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/FlowTableColumns.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/MessageTableColumns.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/ServiceTableColumns.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/index.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/filters/custom-filters.ts +0 -0
- /package/{src → eventcatalog/src}/env.d.ts +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/WebSocket.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/amqp.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/eventbridge.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/googlepubsub.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/http.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/index.ts +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/jms.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/kafka.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/mercure.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/mqtt.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/nats.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/pulsar.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/redis.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/sns.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/solace.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/sqs.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/ws.svg +0 -0
- /package/{src → eventcatalog/src}/layouts/CustomDocsPageLayout.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/DiscoverLayout.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/Footer.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/PlainPage.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/VerticalSideBarLayout.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/VisualiserLayout.astro +0 -0
- /package/{src → eventcatalog/src}/pages/discover/[type]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/changelog/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/spec/_styles.css +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/spec/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/visualiser/[type]/[id]/[version]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/visualiser/[type]/[id]/index.astro +0 -0
- /package/{src → eventcatalog/src}/remark-plugins/mermaid.ts +0 -0
- /package/{src → eventcatalog/src}/types/index.ts +0 -0
- /package/{src → eventcatalog/src}/utils/channels.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/changelogs.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/domains.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/file-diffs.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/flows.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/icons.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/services.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/util.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/versions.ts +0 -0
- /package/{src → eventcatalog/src}/utils/colors.ts +0 -0
- /package/{src → eventcatalog/src}/utils/commands.ts +0 -0
- /package/{src → eventcatalog/src}/utils/eventcatalog-config/catalog.ts +0 -0
- /package/{src → eventcatalog/src}/utils/events.ts +0 -0
- /package/{src → eventcatalog/src}/utils/example-remark-plugin.mjs +0 -0
- /package/{src → eventcatalog/src}/utils/messages.ts +0 -0
- /package/{src → eventcatalog/src}/utils/node-graphs/domains-node-graph.ts +0 -0
- /package/{src → eventcatalog/src}/utils/node-graphs/flows-node-graph.ts +0 -0
- /package/{src → eventcatalog/src}/utils/node-graphs/services-node-graph.ts +0 -0
- /package/{src → eventcatalog/src}/utils/page-loaders/page-data-loader.ts +0 -0
- /package/{src → eventcatalog/src}/utils/pages.ts +0 -0
- /package/{src → eventcatalog/src}/utils/queries.ts +0 -0
- /package/{src → eventcatalog/src}/utils/teams.ts +0 -0
- /package/{src → eventcatalog/src}/utils/url-builder.ts +0 -0
- /package/{src → eventcatalog/src}/utils/users.ts +0 -0
- /package/{tailwind.config.mjs → eventcatalog/tailwind.config.mjs} +0 -0
- /package/{tsconfig.json → eventcatalog/tsconfig.json} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addPropertyToFrontMatter,
|
|
3
|
+
cleanup,
|
|
4
|
+
getEventCatalogConfigFile,
|
|
5
|
+
verifyRequiredFieldsAreInCatalogConfigFile,
|
|
6
|
+
writeEventCatalogConfigFile
|
|
7
|
+
} from "./chunk-E7TXTI7G.js";
|
|
8
|
+
export {
|
|
9
|
+
addPropertyToFrontMatter,
|
|
10
|
+
cleanup,
|
|
11
|
+
getEventCatalogConfigFile,
|
|
12
|
+
verifyRequiredFieldsAreInCatalogConfigFile,
|
|
13
|
+
writeEventCatalogConfigFile
|
|
14
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
"use strict";
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
@@ -27,7 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
26
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
28
27
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
29
28
|
|
|
30
|
-
//
|
|
29
|
+
// src/eventcatalog.ts
|
|
31
30
|
var import_commander = require("commander");
|
|
32
31
|
var import_node_child_process = require("child_process");
|
|
33
32
|
var import_node_path4 = require("path");
|
|
@@ -36,10 +35,10 @@ var import_node_path5 = __toESM(require("path"), 1);
|
|
|
36
35
|
var import_node_url = require("url");
|
|
37
36
|
var import_concurrently = __toESM(require("concurrently"), 1);
|
|
38
37
|
|
|
39
|
-
//
|
|
38
|
+
// src/generate.js
|
|
40
39
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
41
40
|
|
|
42
|
-
//
|
|
41
|
+
// src/eventcatalog-config-file-utils.js
|
|
43
42
|
var import_promises = require("fs/promises");
|
|
44
43
|
var import_node_fs = require("fs");
|
|
45
44
|
var import_promises2 = require("fs/promises");
|
|
@@ -110,7 +109,7 @@ function addPropertyToFrontMatter(input, newProperty, newValue) {
|
|
|
110
109
|
return import_gray_matter.default.stringify(file.content, { ...file.data, [newProperty]: newValue });
|
|
111
110
|
}
|
|
112
111
|
|
|
113
|
-
//
|
|
112
|
+
// src/generate.js
|
|
114
113
|
function getDefaultExport(importedModule) {
|
|
115
114
|
if (importedModule === null || typeof importedModule !== "object") {
|
|
116
115
|
throw new Error("Invalid module");
|
|
@@ -157,17 +156,17 @@ var generate = async (PROJECT_DIRECTORY) => {
|
|
|
157
156
|
}
|
|
158
157
|
};
|
|
159
158
|
|
|
160
|
-
//
|
|
159
|
+
// src/analytics/analytics.js
|
|
161
160
|
var import_axios = __toESM(require("axios"), 1);
|
|
162
161
|
var import_os = __toESM(require("os"), 1);
|
|
163
162
|
|
|
164
163
|
// package.json
|
|
165
|
-
var version = "2.
|
|
164
|
+
var version = "2.15.0";
|
|
166
165
|
|
|
167
|
-
//
|
|
166
|
+
// src/constants.ts
|
|
168
167
|
var VERSION = version;
|
|
169
168
|
|
|
170
|
-
//
|
|
169
|
+
// src/analytics/analytics.js
|
|
171
170
|
async function raiseEvent(eventData) {
|
|
172
171
|
const url = "https://queue.simpleanalyticscdn.com/events";
|
|
173
172
|
const userAgent = `@eventcatalog/eventcatalog@${VERSION} (${import_os.default.platform()}; ${import_os.default.arch()}; Node/${process.version})`;
|
|
@@ -191,7 +190,7 @@ async function raiseEvent(eventData) {
|
|
|
191
190
|
}
|
|
192
191
|
}
|
|
193
192
|
|
|
194
|
-
//
|
|
193
|
+
// src/analytics/log-build.js
|
|
195
194
|
var main = async (projectDir) => {
|
|
196
195
|
if (process.env.NODE_ENV === "CI") return;
|
|
197
196
|
try {
|
|
@@ -210,11 +209,11 @@ var main = async (projectDir) => {
|
|
|
210
209
|
};
|
|
211
210
|
var log_build_default = main;
|
|
212
211
|
|
|
213
|
-
//
|
|
212
|
+
// src/watcher.js
|
|
214
213
|
var import_watcher = __toESM(require("@parcel/watcher"), 1);
|
|
215
214
|
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
216
215
|
|
|
217
|
-
//
|
|
216
|
+
// src/map-catalog-to-astro.js
|
|
218
217
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
219
218
|
var COLLECTION_KEYS = [
|
|
220
219
|
"events",
|
|
@@ -300,7 +299,7 @@ function getRelativeTargetPath(filePath) {
|
|
|
300
299
|
return import_node_path3.default.join(...relativePath);
|
|
301
300
|
}
|
|
302
301
|
|
|
303
|
-
//
|
|
302
|
+
// src/watcher.js
|
|
304
303
|
var import_rimraf = require("rimraf");
|
|
305
304
|
async function watch(projectDirectory, catalogDirectory, callback = void 0) {
|
|
306
305
|
const subscription = await import_watcher.default.subscribe(
|
|
@@ -382,25 +381,14 @@ function retryEPERM(fn) {
|
|
|
382
381
|
};
|
|
383
382
|
}
|
|
384
383
|
|
|
385
|
-
//
|
|
384
|
+
// src/catalog-to-astro-content-directory.js
|
|
386
385
|
var import_glob = require("glob");
|
|
387
386
|
var path4 = __toESM(require("path"), 1);
|
|
388
387
|
var import_fs = __toESM(require("fs"), 1);
|
|
389
388
|
var import_url2 = require("url");
|
|
390
389
|
var import_node_os = __toESM(require("os"), 1);
|
|
391
390
|
var __filename2 = (0, import_url2.fileURLToPath)(importMetaUrl);
|
|
392
|
-
var rootPkg = path4.resolve(
|
|
393
|
-
path4.dirname(__filename2),
|
|
394
|
-
/**
|
|
395
|
-
* TODO: fix me =0
|
|
396
|
-
*
|
|
397
|
-
* The following is a workaround until organize the structure to have the correct path
|
|
398
|
-
* for any value of NODE_ENV
|
|
399
|
-
*
|
|
400
|
-
* @author carlosallexandre
|
|
401
|
-
*/
|
|
402
|
-
process.env.NODE_ENV === "test" ? "../" : "../../"
|
|
403
|
-
);
|
|
391
|
+
var rootPkg = path4.resolve(path4.dirname(__filename2), "../");
|
|
404
392
|
var copyFiles = async (source, target) => {
|
|
405
393
|
const files = await (0, import_glob.glob)(path4.join(source, "**"), {
|
|
406
394
|
nodir: true,
|
|
@@ -468,12 +456,12 @@ var catalogToAstro = async (source, astroDir) => {
|
|
|
468
456
|
await ensureAstroCollectionNotEmpty(astroDir);
|
|
469
457
|
};
|
|
470
458
|
|
|
471
|
-
//
|
|
459
|
+
// src/eventcatalog.ts
|
|
472
460
|
var currentDir = import_node_path5.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
473
461
|
var program = new import_commander.Command().version(VERSION);
|
|
474
462
|
var dir = import_node_path5.default.resolve(process.env.PROJECT_DIR || process.cwd());
|
|
475
463
|
var core = import_node_path5.default.resolve(process.env.CATALOG_DIR || (0, import_node_path4.join)(dir, ".eventcatalog-core"));
|
|
476
|
-
var eventCatalogDir = import_node_path5.default.resolve((0, import_node_path4.join)(currentDir, "
|
|
464
|
+
var eventCatalogDir = import_node_path5.default.resolve((0, import_node_path4.join)(currentDir, "../eventcatalog/"));
|
|
477
465
|
program.name("eventcatalog").description("Documentation tool for event-driven architectures");
|
|
478
466
|
var ensureDir = (dir2) => {
|
|
479
467
|
if (!import_fs2.default.existsSync(dir2)) {
|
|
@@ -512,7 +500,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
512
500
|
const { result } = (0, import_concurrently.default)([
|
|
513
501
|
{
|
|
514
502
|
name: "astro",
|
|
515
|
-
command: "
|
|
503
|
+
command: "npx astro dev",
|
|
516
504
|
cwd: core,
|
|
517
505
|
env: {
|
|
518
506
|
PROJECT_DIR: dir,
|
|
@@ -532,14 +520,13 @@ program.command("build").description("Run build of EventCatalog").action(async (
|
|
|
532
520
|
copyCore();
|
|
533
521
|
await log_build_default(dir);
|
|
534
522
|
await catalogToAstro(dir, core);
|
|
535
|
-
(0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}'
|
|
523
|
+
(0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npx astro build`, {
|
|
536
524
|
cwd: core,
|
|
537
525
|
stdio: "inherit"
|
|
538
526
|
});
|
|
539
527
|
});
|
|
540
528
|
var previewCatalog = () => {
|
|
541
|
-
|
|
542
|
-
(0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npm run preview -- --root ${dir} --port 3000`, {
|
|
529
|
+
(0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npx astro preview --root ${dir} --port 3000`, {
|
|
543
530
|
cwd: core,
|
|
544
531
|
stdio: "inherit"
|
|
545
532
|
});
|
|
@@ -555,4 +542,7 @@ program.command("start").description("Serves the contents of your eventcatalog b
|
|
|
555
542
|
program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
|
|
556
543
|
await generate(dir);
|
|
557
544
|
});
|
|
558
|
-
program.parseAsync()
|
|
545
|
+
program.parseAsync().then(() => process.exit(0)).catch((err) => {
|
|
546
|
+
console.error(err);
|
|
547
|
+
process.exit(1);
|
|
548
|
+
});
|
|
@@ -13,6 +13,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
13
|
};
|
|
14
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
15
|
|
|
16
|
-
//
|
|
16
|
+
// src/eventcatalog.config.ts
|
|
17
17
|
var eventcatalog_config_exports = {};
|
|
18
18
|
module.exports = __toCommonJS(eventcatalog_config_exports);
|
|
File without changes
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {
|
|
2
|
+
log_build_default
|
|
3
|
+
} from "./chunk-KI4KAUWW.js";
|
|
4
|
+
import "./chunk-65VQIGAP.js";
|
|
5
|
+
import {
|
|
6
|
+
catalogToAstro
|
|
7
|
+
} from "./chunk-O6BGVVOW.js";
|
|
8
|
+
import {
|
|
9
|
+
VERSION
|
|
10
|
+
} from "./chunk-TGOUSS6C.js";
|
|
11
|
+
import {
|
|
12
|
+
generate
|
|
13
|
+
} from "./chunk-YEQVKHST.js";
|
|
14
|
+
import {
|
|
15
|
+
watch
|
|
16
|
+
} from "./chunk-7HYM3M5I.js";
|
|
17
|
+
import "./chunk-E7TXTI7G.js";
|
|
18
|
+
import "./chunk-PK2EQVPD.js";
|
|
19
|
+
|
|
20
|
+
// src/eventcatalog.ts
|
|
21
|
+
import { Command } from "commander";
|
|
22
|
+
import { execSync } from "node:child_process";
|
|
23
|
+
import { join } from "node:path";
|
|
24
|
+
import fs from "fs";
|
|
25
|
+
import path from "node:path";
|
|
26
|
+
import { fileURLToPath } from "node:url";
|
|
27
|
+
import concurrently from "concurrently";
|
|
28
|
+
var currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
29
|
+
var program = new Command().version(VERSION);
|
|
30
|
+
var dir = path.resolve(process.env.PROJECT_DIR || process.cwd());
|
|
31
|
+
var core = path.resolve(process.env.CATALOG_DIR || join(dir, ".eventcatalog-core"));
|
|
32
|
+
var eventCatalogDir = path.resolve(join(currentDir, "../eventcatalog/"));
|
|
33
|
+
program.name("eventcatalog").description("Documentation tool for event-driven architectures");
|
|
34
|
+
var ensureDir = (dir2) => {
|
|
35
|
+
if (!fs.existsSync(dir2)) {
|
|
36
|
+
fs.mkdirSync(dir2);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var copyCore = () => {
|
|
40
|
+
ensureDir(core);
|
|
41
|
+
if (eventCatalogDir === core) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
fs.cpSync(eventCatalogDir, core, {
|
|
45
|
+
recursive: true,
|
|
46
|
+
filter: (src) => {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
var clearCore = () => {
|
|
52
|
+
if (fs.existsSync(core)) fs.rmSync(core, { recursive: true });
|
|
53
|
+
};
|
|
54
|
+
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) => {
|
|
55
|
+
console.log("Setting up EventCatalog....");
|
|
56
|
+
if (options.debug) {
|
|
57
|
+
console.log("Debug mode enabled");
|
|
58
|
+
console.log("PROJECT_DIR", dir);
|
|
59
|
+
console.log("CATALOG_DIR", core);
|
|
60
|
+
}
|
|
61
|
+
if (options.forceRecreate) clearCore();
|
|
62
|
+
copyCore();
|
|
63
|
+
console.log("EventCatalog is starting at http://localhost:3000/docs");
|
|
64
|
+
await catalogToAstro(dir, core);
|
|
65
|
+
let watchUnsub;
|
|
66
|
+
try {
|
|
67
|
+
watchUnsub = await watch(dir, core);
|
|
68
|
+
const { result } = concurrently([
|
|
69
|
+
{
|
|
70
|
+
name: "astro",
|
|
71
|
+
command: "npx astro dev",
|
|
72
|
+
cwd: core,
|
|
73
|
+
env: {
|
|
74
|
+
PROJECT_DIR: dir,
|
|
75
|
+
CATALOG_DIR: core
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]);
|
|
79
|
+
await result;
|
|
80
|
+
} catch (err) {
|
|
81
|
+
console.error(err);
|
|
82
|
+
} finally {
|
|
83
|
+
await watchUnsub?.();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
program.command("build").description("Run build of EventCatalog").action(async (options) => {
|
|
87
|
+
console.log("Building EventCatalog...");
|
|
88
|
+
copyCore();
|
|
89
|
+
await log_build_default(dir);
|
|
90
|
+
await catalogToAstro(dir, core);
|
|
91
|
+
execSync(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npx astro build`, {
|
|
92
|
+
cwd: core,
|
|
93
|
+
stdio: "inherit"
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
var previewCatalog = () => {
|
|
97
|
+
execSync(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npx astro preview --root ${dir} --port 3000`, {
|
|
98
|
+
cwd: core,
|
|
99
|
+
stdio: "inherit"
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
program.command("preview").description("Serves the contents of your eventcatalog build directory").action((options) => {
|
|
103
|
+
console.log("Starting preview of your build...");
|
|
104
|
+
previewCatalog();
|
|
105
|
+
});
|
|
106
|
+
program.command("start").description("Serves the contents of your eventcatalog build directory").action((options) => {
|
|
107
|
+
console.log("Starting preview of your build...");
|
|
108
|
+
previewCatalog();
|
|
109
|
+
});
|
|
110
|
+
program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
|
|
111
|
+
await generate(dir);
|
|
112
|
+
});
|
|
113
|
+
program.parseAsync().then(() => process.exit(0)).catch((err) => {
|
|
114
|
+
console.error(err);
|
|
115
|
+
process.exit(1);
|
|
116
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/generate.js
|
|
31
|
+
var generate_exports = {};
|
|
32
|
+
__export(generate_exports, {
|
|
33
|
+
generate: () => generate
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(generate_exports);
|
|
36
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
37
|
+
|
|
38
|
+
// src/eventcatalog-config-file-utils.js
|
|
39
|
+
var import_promises = require("fs/promises");
|
|
40
|
+
var import_node_fs = require("fs");
|
|
41
|
+
var import_promises2 = require("fs/promises");
|
|
42
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
43
|
+
var import_uuid = require("uuid");
|
|
44
|
+
var import_url = require("url");
|
|
45
|
+
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
46
|
+
async function cleanup(projectDirectory) {
|
|
47
|
+
const filePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
48
|
+
if ((0, import_node_fs.existsSync)(filePath)) {
|
|
49
|
+
await (0, import_promises.rm)(filePath);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
53
|
+
try {
|
|
54
|
+
let configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.js");
|
|
55
|
+
const filePath = import_node_path.default.join(projectDirectory, "package.json");
|
|
56
|
+
const packageJson = JSON.parse(await (0, import_promises.readFile)(filePath, "utf-8"));
|
|
57
|
+
if (packageJson?.type !== "module") {
|
|
58
|
+
await (0, import_promises2.copyFile)(configFilePath, import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs"));
|
|
59
|
+
configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
60
|
+
}
|
|
61
|
+
const configFileURL = (0, import_url.pathToFileURL)(configFilePath).href;
|
|
62
|
+
const config = await import(
|
|
63
|
+
/* @vite-ignore */
|
|
64
|
+
configFileURL
|
|
65
|
+
);
|
|
66
|
+
return config.default;
|
|
67
|
+
} finally {
|
|
68
|
+
await cleanup(projectDirectory);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/generate.js
|
|
73
|
+
function getDefaultExport(importedModule) {
|
|
74
|
+
if (importedModule === null || typeof importedModule !== "object") {
|
|
75
|
+
throw new Error("Invalid module");
|
|
76
|
+
}
|
|
77
|
+
if (typeof importedModule.default === "object" && importedModule.default !== null) {
|
|
78
|
+
return importedModule.default.default || importedModule.default;
|
|
79
|
+
}
|
|
80
|
+
if (typeof importedModule.default !== "undefined") {
|
|
81
|
+
return importedModule.default;
|
|
82
|
+
}
|
|
83
|
+
return importedModule;
|
|
84
|
+
}
|
|
85
|
+
var generate = async (PROJECT_DIRECTORY) => {
|
|
86
|
+
try {
|
|
87
|
+
const config = await getEventCatalogConfigFile(PROJECT_DIRECTORY);
|
|
88
|
+
const { generators = [] } = config;
|
|
89
|
+
if (!generators.length) {
|
|
90
|
+
console.log("No configured generators found, skipping generation");
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
for (const generator of generators) {
|
|
94
|
+
let plugin = generator[0];
|
|
95
|
+
const pluginConfig = generator[1];
|
|
96
|
+
if (plugin.startsWith("./")) {
|
|
97
|
+
plugin = import_node_path2.default.join(PROJECT_DIRECTORY, plugin);
|
|
98
|
+
}
|
|
99
|
+
if (plugin.includes("<rootDir>")) {
|
|
100
|
+
plugin = plugin.replace("<rootDir>", PROJECT_DIRECTORY);
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
const importedGenerator = await import(plugin);
|
|
104
|
+
const generator2 = getDefaultExport(importedGenerator);
|
|
105
|
+
await generator2({ eventCatalogConfig: {} }, pluginConfig);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error("Error loading plugin:", error);
|
|
108
|
+
await cleanup(PROJECT_DIRECTORY);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
await cleanup(PROJECT_DIRECTORY);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
console.error(error);
|
|
115
|
+
await cleanup(PROJECT_DIRECTORY);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
119
|
+
0 && (module.exports = {
|
|
120
|
+
generate
|
|
121
|
+
});
|
package/dist/generate.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/map-catalog-to-astro.js
|
|
31
|
+
var map_catalog_to_astro_exports = {};
|
|
32
|
+
__export(map_catalog_to_astro_exports, {
|
|
33
|
+
mapCatalogToAstro: () => mapCatalogToAstro
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(map_catalog_to_astro_exports);
|
|
36
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
37
|
+
var COLLECTION_KEYS = [
|
|
38
|
+
"events",
|
|
39
|
+
"commands",
|
|
40
|
+
"services",
|
|
41
|
+
"users",
|
|
42
|
+
"teams",
|
|
43
|
+
"domains",
|
|
44
|
+
"flows",
|
|
45
|
+
"pages",
|
|
46
|
+
"changelogs",
|
|
47
|
+
"queries",
|
|
48
|
+
"channels"
|
|
49
|
+
];
|
|
50
|
+
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
51
|
+
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
52
|
+
if (!isCatalogRelated(relativeFilePath)) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
|
|
56
|
+
const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
|
|
57
|
+
return baseTargetPaths.map(
|
|
58
|
+
(base) => import_node_path.default.join(astroDir, base, relativeTargetPath.replace("index.md", "index.mdx").replace("changelog.md", "changelog.mdx"))
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
function removeBasePath(fullPath, basePath) {
|
|
62
|
+
const relativePath = import_node_path.default.relative(basePath, fullPath);
|
|
63
|
+
return relativePath.startsWith("..") ? fullPath : relativePath;
|
|
64
|
+
}
|
|
65
|
+
function isCollectionKey(key) {
|
|
66
|
+
return COLLECTION_KEYS.includes(key);
|
|
67
|
+
}
|
|
68
|
+
function isCatalogRelated(filePath) {
|
|
69
|
+
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
70
|
+
if ([
|
|
71
|
+
"eventcatalog.config.js",
|
|
72
|
+
// config file at root
|
|
73
|
+
"eventcatalog.styles.css",
|
|
74
|
+
// custom styles file at root
|
|
75
|
+
"components",
|
|
76
|
+
// custom components
|
|
77
|
+
"public",
|
|
78
|
+
// public assets
|
|
79
|
+
...COLLECTION_KEYS
|
|
80
|
+
].includes(filePathArr[0])) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
function getBaseTargetPaths(filePath) {
|
|
86
|
+
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
87
|
+
if (isCollectionKey(filePathArr[0])) {
|
|
88
|
+
if (filePathArr[filePathArr.length - 1] == "changelog.md") {
|
|
89
|
+
return [import_node_path.default.join("src", "content", "changelogs")];
|
|
90
|
+
}
|
|
91
|
+
if (filePathArr[filePathArr.length - 1].match(/\.md$/)) {
|
|
92
|
+
return [import_node_path.default.join("src", "content")];
|
|
93
|
+
}
|
|
94
|
+
const hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
|
|
95
|
+
if (hasExtension(filePath)) {
|
|
96
|
+
return [import_node_path.default.join("public", "generated"), import_node_path.default.join("src", "catalog-files")];
|
|
97
|
+
}
|
|
98
|
+
return [import_node_path.default.join("public", "generated"), import_node_path.default.join("src", "catalog-files"), import_node_path.default.join("src", "content")];
|
|
99
|
+
}
|
|
100
|
+
if (filePathArr[0] == "components") {
|
|
101
|
+
return [import_node_path.default.join("src", "custom-defined-components")];
|
|
102
|
+
}
|
|
103
|
+
if (filePathArr[0] == "public") {
|
|
104
|
+
return [import_node_path.default.join("public")];
|
|
105
|
+
}
|
|
106
|
+
return [import_node_path.default.join("/")];
|
|
107
|
+
}
|
|
108
|
+
function getRelativeTargetPath(filePath) {
|
|
109
|
+
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
110
|
+
if (filePathArr[0] == "public" || filePathArr[0] == "components") {
|
|
111
|
+
filePathArr.shift();
|
|
112
|
+
}
|
|
113
|
+
const relativePath = [];
|
|
114
|
+
for (let i = filePathArr.length - 1; i >= 0; i--) {
|
|
115
|
+
relativePath.unshift(filePathArr[i]);
|
|
116
|
+
if (isCollectionKey(filePathArr[i])) break;
|
|
117
|
+
}
|
|
118
|
+
return import_node_path.default.join(...relativePath);
|
|
119
|
+
}
|
|
120
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
121
|
+
0 && (module.exports = {
|
|
122
|
+
mapCatalogToAstro
|
|
123
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} MapCatalogToAstroParams
|
|
3
|
+
* @prop {string} filePath The catalog file path
|
|
4
|
+
* @prop {string} astroDir The astro directory
|
|
5
|
+
* @prop {string} projectDir The user's project directory
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {MapCatalogToAstroParams} params
|
|
10
|
+
* @returns {string[]} The astro file paths
|
|
11
|
+
*/
|
|
12
|
+
declare function mapCatalogToAstro({ filePath, astroDir, projectDir }: MapCatalogToAstroParams): string[];
|
|
13
|
+
type MapCatalogToAstroParams = {
|
|
14
|
+
/**
|
|
15
|
+
* The catalog file path
|
|
16
|
+
*/
|
|
17
|
+
filePath: string;
|
|
18
|
+
/**
|
|
19
|
+
* The astro directory
|
|
20
|
+
*/
|
|
21
|
+
astroDir: string;
|
|
22
|
+
/**
|
|
23
|
+
* The user's project directory
|
|
24
|
+
*/
|
|
25
|
+
projectDir: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { type MapCatalogToAstroParams, mapCatalogToAstro };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} MapCatalogToAstroParams
|
|
3
|
+
* @prop {string} filePath The catalog file path
|
|
4
|
+
* @prop {string} astroDir The astro directory
|
|
5
|
+
* @prop {string} projectDir The user's project directory
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {MapCatalogToAstroParams} params
|
|
10
|
+
* @returns {string[]} The astro file paths
|
|
11
|
+
*/
|
|
12
|
+
declare function mapCatalogToAstro({ filePath, astroDir, projectDir }: MapCatalogToAstroParams): string[];
|
|
13
|
+
type MapCatalogToAstroParams = {
|
|
14
|
+
/**
|
|
15
|
+
* The catalog file path
|
|
16
|
+
*/
|
|
17
|
+
filePath: string;
|
|
18
|
+
/**
|
|
19
|
+
* The astro directory
|
|
20
|
+
*/
|
|
21
|
+
astroDir: string;
|
|
22
|
+
/**
|
|
23
|
+
* The user's project directory
|
|
24
|
+
*/
|
|
25
|
+
projectDir: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { type MapCatalogToAstroParams, mapCatalogToAstro };
|