@eventcatalog/core 4.11.2 → 4.12.0-beta.2
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 +17 -11
- package/dist/analytics/log-build.js +4 -4
- package/dist/astro-config-path.cjs +51 -0
- package/dist/astro-config-path.d.cts +6 -0
- package/dist/astro-config-path.d.ts +6 -0
- package/dist/astro-config-path.js +6 -0
- package/dist/catalog-runtime.cjs +136 -0
- package/dist/catalog-runtime.d.cts +12 -0
- package/dist/catalog-runtime.d.ts +12 -0
- package/dist/catalog-runtime.js +8 -0
- package/dist/{chunk-B7HCX5HM.js → chunk-3SJDIENM.js} +1 -1
- package/dist/{chunk-Z6OKCHWL.js → chunk-C326DCDM.js} +2 -2
- package/dist/{chunk-6U72KINX.js → chunk-DJCOJ77J.js} +1 -0
- package/dist/{chunk-LHR4G2UO.js → chunk-EEZXGNF6.js} +1 -1
- package/dist/{chunk-XMRPNDXB.js → chunk-FZEJ62MJ.js} +1 -1
- package/dist/{chunk-6QENHZZP.js → chunk-JE6RX7SJ.js} +11 -5
- package/dist/{chunk-2YJRF4ZX.js → chunk-RYPZGCRN.js} +1 -1
- package/dist/chunk-SAN4U2WU.js +96 -0
- package/dist/{chunk-LAWEGSJH.js → chunk-SETCQKS3.js} +1 -1
- package/dist/{chunk-AFPH6ERZ.js → chunk-TI3Y63NZ.js} +1 -1
- package/dist/chunk-U63GDPPY.js +14 -0
- package/dist/chunk-VIJJ7JKH.js +17 -0
- package/dist/{chunk-EGH3ALRY.js → chunk-ZER6HESL.js} +4 -4
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog-config-file-utils.cjs +13 -7
- package/dist/eventcatalog-config-file-utils.d.cts +86 -2
- package/dist/eventcatalog-config-file-utils.d.ts +86 -2
- package/dist/eventcatalog-config-file-utils.js +1 -1
- package/dist/eventcatalog.cjs +227 -561
- package/dist/eventcatalog.js +62 -71
- package/dist/features.cjs +10 -6
- package/dist/features.js +2 -2
- package/dist/federation/federate.cjs +110 -106
- package/dist/federation/federate.js +4 -4
- package/dist/generate.cjs +11 -7
- package/dist/generate.js +4 -4
- package/dist/resolve-catalog-dependencies.cjs +12 -8
- package/dist/resolve-catalog-dependencies.js +2 -2
- package/dist/runtime-dependencies/@ai-sdk__react.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__markdown-remark.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__mdx.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__node.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__react.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__rss.mjs +3 -0
- package/dist/runtime-dependencies/@asyncapi__avro-schema-parser.mjs +3 -0
- package/dist/runtime-dependencies/@asyncapi__parser.mjs +3 -0
- package/dist/runtime-dependencies/@asyncapi__react-component.mjs +3 -0
- package/dist/runtime-dependencies/@asyncapi__react-component__styles__default.min.css.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__auth0.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__github.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__google.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__microsoft-entra-id.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__okta.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__types.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__license.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__linter.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__sdk.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__visualiser.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__visualiser__styles-core.css.mjs +3 -0
- package/dist/runtime-dependencies/@fontsource__inter.mjs +3 -0
- package/dist/runtime-dependencies/@fontsource__inter__400.css.mjs +3 -0
- package/dist/runtime-dependencies/@fontsource__inter__700.css.mjs +3 -0
- package/dist/runtime-dependencies/@headlessui__react.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__16__solid__EnvelopeIcon.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__20__solid.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__outline.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__outline__MagnifyingGlassIcon.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__outline__RectangleGroupIcon.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__outline__ServerIcon.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__solid.mjs +3 -0
- package/dist/runtime-dependencies/@iconify-json__logos.mjs +3 -0
- package/dist/runtime-dependencies/@mermaid-js__layout-elk.mjs +3 -0
- package/dist/runtime-dependencies/@mermaid-js__layout-elk__dist__mermaid-layout-elk.core.mjs.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__sdk.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__sdk__server__mcp.js.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__sdk__server__webStandardStreamableHttp.js.mjs +3 -0
- package/dist/runtime-dependencies/@nanostores__react.mjs +3 -0
- package/dist/runtime-dependencies/@parcel__watcher.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-context-menu.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-dialog.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-dropdown-menu.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-popover.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-tooltip.mjs +3 -0
- package/dist/runtime-dependencies/@scalar__api-reference-react.mjs +3 -0
- package/dist/runtime-dependencies/@scalar__api-reference-react__style.css.mjs +3 -0
- package/dist/runtime-dependencies/@tailwindcss__typography.mjs +3 -0
- package/dist/runtime-dependencies/@tailwindcss__vite.mjs +3 -0
- package/dist/runtime-dependencies/@tanstack__react-table.mjs +3 -0
- package/dist/runtime-dependencies/@xyflow__react.mjs +3 -0
- package/dist/runtime-dependencies/@xyflow__react__dist__style.css.mjs +3 -0
- package/dist/runtime-dependencies/ai.mjs +3 -0
- package/dist/runtime-dependencies/astro-expressive-code.mjs +3 -0
- package/dist/runtime-dependencies/astro-expressive-code__components.mjs +3 -0
- package/dist/runtime-dependencies/astro-seo.mjs +3 -0
- package/dist/runtime-dependencies/astro.mjs +3 -0
- package/dist/runtime-dependencies/astro__assets__services__sharp.mjs +3 -0
- package/dist/runtime-dependencies/astro__config.mjs +3 -0
- package/dist/runtime-dependencies/astro__jsx-runtime.mjs +3 -0
- package/dist/runtime-dependencies/astro__loaders.mjs +3 -0
- package/dist/runtime-dependencies/astro__logger__node.mjs +3 -0
- package/dist/runtime-dependencies/astro__types.mjs +3 -0
- package/dist/runtime-dependencies/astro__zod.mjs +3 -0
- package/dist/runtime-dependencies/auth-astro.mjs +3 -0
- package/dist/runtime-dependencies/auth-astro__client.mjs +3 -0
- package/dist/runtime-dependencies/auth-astro__server.mjs +3 -0
- package/dist/runtime-dependencies/boxen.mjs +3 -0
- package/dist/runtime-dependencies/commander.mjs +3 -0
- package/dist/runtime-dependencies/cross-env.mjs +3 -0
- package/dist/runtime-dependencies/d3-drag.mjs +3 -0
- package/dist/runtime-dependencies/d3-force.mjs +3 -0
- package/dist/runtime-dependencies/d3-selection.mjs +3 -0
- package/dist/runtime-dependencies/d3-zoom.mjs +3 -0
- package/dist/runtime-dependencies/dagre.mjs +3 -0
- package/dist/runtime-dependencies/diff.mjs +3 -0
- package/dist/runtime-dependencies/diff2html.mjs +3 -0
- package/dist/runtime-dependencies/diff2html__bundles__css__diff2html.min.css.mjs +3 -0
- package/dist/runtime-dependencies/dotenv.mjs +3 -0
- package/dist/runtime-dependencies/elkjs.mjs +3 -0
- package/dist/runtime-dependencies/elkjs__lib__elk.bundled.js.mjs +3 -0
- package/dist/runtime-dependencies/glob.mjs +3 -0
- package/dist/runtime-dependencies/gray-matter.mjs +3 -0
- package/dist/runtime-dependencies/hono.mjs +3 -0
- package/dist/runtime-dependencies/html-to-image.mjs +3 -0
- package/dist/runtime-dependencies/js-yaml.mjs +3 -0
- package/dist/runtime-dependencies/jsonpath-plus.mjs +3 -0
- package/dist/runtime-dependencies/jsonwebtoken.mjs +3 -0
- package/dist/runtime-dependencies/lodash.debounce.mjs +3 -0
- package/dist/runtime-dependencies/lodash.merge.mjs +3 -0
- package/dist/runtime-dependencies/lucide-react.mjs +3 -0
- package/dist/runtime-dependencies/manifest.json +136 -0
- package/dist/runtime-dependencies/marked.mjs +3 -0
- package/dist/runtime-dependencies/mdast-util-find-and-replace.mjs +3 -0
- package/dist/runtime-dependencies/mermaid.mjs +3 -0
- package/dist/runtime-dependencies/minisearch.mjs +3 -0
- package/dist/runtime-dependencies/nanostores.mjs +3 -0
- package/dist/runtime-dependencies/pagefind.mjs +3 -0
- package/dist/runtime-dependencies/pako.mjs +3 -0
- package/dist/runtime-dependencies/parse5.mjs +3 -0
- package/dist/runtime-dependencies/picocolors.mjs +3 -0
- package/dist/runtime-dependencies/picomatch.mjs +3 -0
- package/dist/runtime-dependencies/react-dom.mjs +3 -0
- package/dist/runtime-dependencies/react-dom__client.mjs +3 -0
- package/dist/runtime-dependencies/react-dom__server.mjs +3 -0
- package/dist/runtime-dependencies/react-markdown.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__cjs__styles__prism.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__cjs__styles__prism__index.js.mjs +3 -0
- package/dist/runtime-dependencies/react.mjs +3 -0
- package/dist/runtime-dependencies/react__jsx-dev-runtime.mjs +3 -0
- package/dist/runtime-dependencies/react__jsx-runtime.mjs +3 -0
- package/dist/runtime-dependencies/recast.mjs +3 -0
- package/dist/runtime-dependencies/recast__parsers__babel.js.mjs +3 -0
- package/dist/runtime-dependencies/rehype-autolink-headings.mjs +3 -0
- package/dist/runtime-dependencies/rehype-expressive-code.mjs +3 -0
- package/dist/runtime-dependencies/rehype-expressive-code__hast.mjs +3 -0
- package/dist/runtime-dependencies/rehype-slug.mjs +3 -0
- package/dist/runtime-dependencies/remark-comment.mjs +3 -0
- package/dist/runtime-dependencies/remark-directive.mjs +3 -0
- package/dist/runtime-dependencies/remark-gfm.mjs +3 -0
- package/dist/runtime-dependencies/rimraf.mjs +3 -0
- package/dist/runtime-dependencies/semver.mjs +3 -0
- package/dist/runtime-dependencies/shelljs.mjs +3 -0
- package/dist/runtime-dependencies/sonner.mjs +3 -0
- package/dist/runtime-dependencies/sql.js.mjs +3 -0
- package/dist/runtime-dependencies/tailwindcss.mjs +3 -0
- package/dist/runtime-dependencies/typescript.mjs +3 -0
- package/dist/runtime-dependencies/unist-util-visit.mjs +3 -0
- package/dist/runtime-dependencies/update-notifier.mjs +3 -0
- package/dist/runtime-dependencies/uuid.mjs +3 -0
- package/dist/runtime-dependencies/zod.mjs +3 -0
- package/dist/runtime-dependencies/zod__v4.mjs +3 -0
- package/dist/search-indexer.cjs +1 -0
- package/dist/search-indexer.js +1 -1
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/dist/watcher.cjs +5 -204
- package/dist/watcher.js +1 -2
- package/eventcatalog/astro.config.mjs +66 -31
- package/eventcatalog/integrations/catalog-assets.mjs +204 -0
- package/eventcatalog/integrations/config-loader.mjs +85 -0
- package/eventcatalog/integrations/ecstudio-watcher.mjs +11 -9
- package/eventcatalog/integrations/eventcatalog-runtime.mjs +255 -0
- package/eventcatalog/integrations/expressive-code-config.mjs +6 -0
- package/eventcatalog/integrations/runtime-dependencies.mjs +49 -0
- package/eventcatalog/integrations/runtime-dependency-manifest.mjs +15 -0
- package/eventcatalog/integrations/runtime-paths.mjs +16 -0
- package/eventcatalog/src/content.config.ts +33 -46
- package/eventcatalog/src/enterprise/custom-pages/routes.ts +3 -2
- package/eventcatalog/src/enterprise/feature.ts +2 -1
- package/eventcatalog/src/enterprise/fields/field-indexer.ts +5 -2
- package/eventcatalog/src/enterprise/fields/pages/api/fields.ts +4 -3
- package/eventcatalog/src/enterprise/integrations/eventcatalog-features.ts +32 -32
- package/eventcatalog/src/enterprise/mcp/mcp-auth.ts +1 -1
- package/eventcatalog/src/env.d.ts +7 -1
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +15 -3
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +1 -1
- package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/index.astro +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +1 -1
- package/eventcatalog/src/pages/docs/teams/[id]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/users/[id]/index.astro +2 -2
- package/eventcatalog/src/pages/index.astro +2 -3
- package/eventcatalog/src/styles/tailwind.css +3 -0
- package/eventcatalog/src/utils/eventcatalog-config/source.ts +9 -0
- package/eventcatalog/src/utils/feature.ts +2 -1
- package/eventcatalog/tsconfig.json +1 -4
- package/package.json +16 -3
- package/dist/catalog-to-astro-content-directory.cjs +0 -382
- package/dist/catalog-to-astro-content-directory.d.cts +0 -3
- package/dist/catalog-to-astro-content-directory.d.ts +0 -3
- package/dist/catalog-to-astro-content-directory.js +0 -9
- package/dist/chunk-BWN544LB.js +0 -73
- package/dist/chunk-DHH5U5PF.js +0 -53
- package/dist/chunk-KLOHNCNF.js +0 -101
- package/dist/chunk-T4RVWPIQ.js +0 -85
- package/dist/chunk-T5IUG523.js +0 -54
- package/dist/chunk-W5JQON7Z.js +0 -117
- package/dist/copy-core.cjs +0 -88
- package/dist/copy-core.d.cts +0 -4
- package/dist/copy-core.d.ts +0 -4
- package/dist/copy-core.js +0 -8
- package/dist/core-node-modules.cjs +0 -108
- package/dist/core-node-modules.d.cts +0 -7
- package/dist/core-node-modules.d.ts +0 -7
- package/dist/core-node-modules.js +0 -8
- package/dist/custom-components.cjs +0 -89
- package/dist/custom-components.d.cts +0 -4
- package/dist/custom-components.d.ts +0 -4
- package/dist/custom-components.js +0 -8
- package/dist/map-catalog-to-astro.cjs +0 -151
- package/dist/map-catalog-to-astro.d.cts +0 -28
- package/dist/map-catalog-to-astro.d.ts +0 -28
- package/dist/map-catalog-to-astro.js +0 -6
|
@@ -1,382 +0,0 @@
|
|
|
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/catalog-to-astro-content-directory.js
|
|
31
|
-
var catalog_to_astro_content_directory_exports = {};
|
|
32
|
-
__export(catalog_to_astro_content_directory_exports, {
|
|
33
|
-
catalogToAstro: () => catalogToAstro
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(catalog_to_astro_content_directory_exports);
|
|
36
|
-
|
|
37
|
-
// ../../node_modules/.pnpm/tsup@8.5.0_jiti@2.7.0_postcss@8.5.15_tsx@4.21.0_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js
|
|
38
|
-
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
39
|
-
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
40
|
-
|
|
41
|
-
// src/catalog-to-astro-content-directory.js
|
|
42
|
-
var import_glob = require("glob");
|
|
43
|
-
var path4 = __toESM(require("path"), 1);
|
|
44
|
-
var import_fs = __toESM(require("fs"), 1);
|
|
45
|
-
var import_url2 = require("url");
|
|
46
|
-
var import_node_os2 = __toESM(require("os"), 1);
|
|
47
|
-
|
|
48
|
-
// src/eventcatalog-config-file-utils.js
|
|
49
|
-
var import_promises = require("fs/promises");
|
|
50
|
-
var import_node_fs = require("fs");
|
|
51
|
-
var import_node_path = __toESM(require("path"), 1);
|
|
52
|
-
var import_uuid = require("uuid");
|
|
53
|
-
var import_url = require("url");
|
|
54
|
-
var import_node_os = require("os");
|
|
55
|
-
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
56
|
-
async function cleanup(projectDirectory) {
|
|
57
|
-
const filePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
58
|
-
if ((0, import_node_fs.existsSync)(filePath)) {
|
|
59
|
-
await (0, import_promises.rm)(filePath);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
var findNodeModulesDirectory = (directory) => {
|
|
63
|
-
let currentDirectory = directory;
|
|
64
|
-
while (true) {
|
|
65
|
-
const nodeModulesDirectory = import_node_path.default.join(currentDirectory, "node_modules");
|
|
66
|
-
if ((0, import_node_fs.existsSync)(nodeModulesDirectory)) {
|
|
67
|
-
return nodeModulesDirectory;
|
|
68
|
-
}
|
|
69
|
-
const parentDirectory = import_node_path.default.dirname(currentDirectory);
|
|
70
|
-
if (parentDirectory === currentDirectory) {
|
|
71
|
-
return void 0;
|
|
72
|
-
}
|
|
73
|
-
currentDirectory = parentDirectory;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
var linkNodeModulesIntoTempDirectory = async ({ projectDirectory, tempDir }) => {
|
|
77
|
-
const nodeModulesDirectory = findNodeModulesDirectory(projectDirectory);
|
|
78
|
-
if (!nodeModulesDirectory) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
await (0, import_promises.symlink)(nodeModulesDirectory, import_node_path.default.join(tempDir, "node_modules"), "dir");
|
|
82
|
-
};
|
|
83
|
-
var createTemporaryConfigDirectory = async (projectDirectory) => {
|
|
84
|
-
const nodeModulesDirectory = findNodeModulesDirectory(projectDirectory);
|
|
85
|
-
if (nodeModulesDirectory) {
|
|
86
|
-
return (0, import_promises.mkdtemp)(import_node_path.default.join(nodeModulesDirectory, ".eventcatalog-config-"));
|
|
87
|
-
}
|
|
88
|
-
const tempDir = await (0, import_promises.mkdtemp)(import_node_path.default.join((0, import_node_os.tmpdir)(), "eventcatalog-config-"));
|
|
89
|
-
await linkNodeModulesIntoTempDirectory({ projectDirectory, tempDir });
|
|
90
|
-
return tempDir;
|
|
91
|
-
};
|
|
92
|
-
var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
93
|
-
let tempDir;
|
|
94
|
-
try {
|
|
95
|
-
let configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.js");
|
|
96
|
-
const filePath = import_node_path.default.join(projectDirectory, "package.json");
|
|
97
|
-
const packageJson = JSON.parse(await (0, import_promises.readFile)(filePath, "utf-8"));
|
|
98
|
-
if (packageJson?.type !== "module") {
|
|
99
|
-
tempDir = await createTemporaryConfigDirectory(projectDirectory);
|
|
100
|
-
configFilePath = import_node_path.default.join(tempDir, "eventcatalog.config.mjs");
|
|
101
|
-
await (0, import_promises.copyFile)(import_node_path.default.join(projectDirectory, "eventcatalog.config.js"), configFilePath);
|
|
102
|
-
}
|
|
103
|
-
const configFileURL = `${(0, import_url.pathToFileURL)(configFilePath).href}?t=${Date.now()}`;
|
|
104
|
-
const config = await import(
|
|
105
|
-
/* @vite-ignore */
|
|
106
|
-
configFileURL
|
|
107
|
-
);
|
|
108
|
-
return config.default;
|
|
109
|
-
} finally {
|
|
110
|
-
await cleanup(projectDirectory);
|
|
111
|
-
if (tempDir) {
|
|
112
|
-
await (0, import_promises.rm)(tempDir, { recursive: true, force: true });
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
var writeEventCatalogConfigFile = async (projectDirectory, newConfig) => {
|
|
117
|
-
try {
|
|
118
|
-
const configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.js");
|
|
119
|
-
let content = await (0, import_promises.readFile)(configFilePath, "utf8");
|
|
120
|
-
const startIndex = content.indexOf("export default {");
|
|
121
|
-
if (startIndex === -1) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
Object.entries(newConfig).forEach(([key, value]) => {
|
|
125
|
-
const valueString = JSON.stringify(value, null, 2).replace(/"/g, "'").replace(/\n/g, "\n ");
|
|
126
|
-
const keyRegex = new RegExp(`(${key}\\s*:)([^,}]+)`, "g");
|
|
127
|
-
if (content.match(keyRegex)) {
|
|
128
|
-
content = content.replace(keyRegex, `$1 ${valueString}`);
|
|
129
|
-
} else {
|
|
130
|
-
const insertPosition = content.indexOf("{", startIndex) + 1;
|
|
131
|
-
content = content.slice(0, insertPosition) + `
|
|
132
|
-
${key}: ${valueString},` + content.slice(insertPosition);
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
await (0, import_promises.writeFile)(configFilePath, content);
|
|
136
|
-
} finally {
|
|
137
|
-
await cleanup(projectDirectory);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
141
|
-
try {
|
|
142
|
-
const config = await getEventCatalogConfigFile(projectDirectory);
|
|
143
|
-
if (!config.cId) {
|
|
144
|
-
await writeEventCatalogConfigFile(projectDirectory, { cId: (0, import_uuid.v4)() });
|
|
145
|
-
}
|
|
146
|
-
} catch (error) {
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// src/map-catalog-to-astro.js
|
|
151
|
-
var import_node_path2 = __toESM(require("path"), 1);
|
|
152
|
-
var CUSTOM_PAGE_EXTENSIONS = [".astro", ".ts", ".js", ".mjs"];
|
|
153
|
-
var COLLECTION_KEYS = [
|
|
154
|
-
"agents",
|
|
155
|
-
"events",
|
|
156
|
-
"commands",
|
|
157
|
-
"services",
|
|
158
|
-
"domains",
|
|
159
|
-
"flows",
|
|
160
|
-
"pages",
|
|
161
|
-
"changelogs",
|
|
162
|
-
"queries",
|
|
163
|
-
"channels",
|
|
164
|
-
"ubiquitousLanguages",
|
|
165
|
-
"dependencies"
|
|
166
|
-
];
|
|
167
|
-
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
168
|
-
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
169
|
-
if (isLikeC4Source(relativeFilePath)) {
|
|
170
|
-
return [];
|
|
171
|
-
}
|
|
172
|
-
if (!isCatalogRelated(relativeFilePath)) {
|
|
173
|
-
return [];
|
|
174
|
-
}
|
|
175
|
-
const customPageTargetPaths = getCustomPageTargetPaths(relativeFilePath, astroDir);
|
|
176
|
-
if (customPageTargetPaths) {
|
|
177
|
-
return customPageTargetPaths;
|
|
178
|
-
}
|
|
179
|
-
const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
|
|
180
|
-
const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
|
|
181
|
-
return baseTargetPaths.map((base) => import_node_path2.default.join(astroDir, base, relativeTargetPath));
|
|
182
|
-
}
|
|
183
|
-
function removeBasePath(fullPath, basePath) {
|
|
184
|
-
const relativePath = import_node_path2.default.relative(basePath, fullPath);
|
|
185
|
-
return relativePath.startsWith("..") ? fullPath : relativePath;
|
|
186
|
-
}
|
|
187
|
-
function isCollectionKey(key) {
|
|
188
|
-
return COLLECTION_KEYS.includes(key);
|
|
189
|
-
}
|
|
190
|
-
function isLikeC4Source(filePath) {
|
|
191
|
-
return filePath.endsWith(".c4") || filePath.endsWith(".likec4");
|
|
192
|
-
}
|
|
193
|
-
var hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
|
|
194
|
-
function getCustomPageTargetPaths(filePath, astroDir) {
|
|
195
|
-
const filePathArr = filePath.split(import_node_path2.default.sep).filter(Boolean);
|
|
196
|
-
if (filePathArr[0] !== "pages") {
|
|
197
|
-
return null;
|
|
198
|
-
}
|
|
199
|
-
const customPagePath = import_node_path2.default.join(astroDir, "src", "custom-pages", ...filePathArr.slice(1));
|
|
200
|
-
if (CUSTOM_PAGE_EXTENSIONS.includes(import_node_path2.default.extname(filePath).toLowerCase())) {
|
|
201
|
-
return [customPagePath];
|
|
202
|
-
}
|
|
203
|
-
if (!hasExtension(filePath)) {
|
|
204
|
-
return [customPagePath, import_node_path2.default.join(astroDir, "public", "generated", ...filePathArr)];
|
|
205
|
-
}
|
|
206
|
-
return [import_node_path2.default.join(astroDir, "public", "generated", ...filePathArr)];
|
|
207
|
-
}
|
|
208
|
-
function isCatalogRelated(filePath) {
|
|
209
|
-
const filePathArr = filePath.split(import_node_path2.default.sep).filter(Boolean);
|
|
210
|
-
if ([
|
|
211
|
-
"eventcatalog.config.js",
|
|
212
|
-
// config file at root
|
|
213
|
-
"eventcatalog.styles.css",
|
|
214
|
-
// custom styles file at root
|
|
215
|
-
"components",
|
|
216
|
-
// custom components
|
|
217
|
-
"snippets",
|
|
218
|
-
// custom snippets
|
|
219
|
-
"public",
|
|
220
|
-
// public assets
|
|
221
|
-
".env",
|
|
222
|
-
// env file
|
|
223
|
-
...COLLECTION_KEYS
|
|
224
|
-
].includes(filePathArr[0])) {
|
|
225
|
-
return true;
|
|
226
|
-
}
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
function getBaseTargetPaths(filePath) {
|
|
230
|
-
const filePathArr = filePath.split(import_node_path2.default.sep).filter(Boolean);
|
|
231
|
-
if (isCollectionKey(filePathArr[0])) {
|
|
232
|
-
if (hasExtension(filePath)) {
|
|
233
|
-
return [import_node_path2.default.join("public", "generated")];
|
|
234
|
-
}
|
|
235
|
-
return [import_node_path2.default.join("public", "generated")];
|
|
236
|
-
}
|
|
237
|
-
if (filePathArr[0] == "components") {
|
|
238
|
-
return [import_node_path2.default.join("src", "custom-defined-components")];
|
|
239
|
-
}
|
|
240
|
-
if (filePathArr[0] == "snippets") {
|
|
241
|
-
return [import_node_path2.default.join("src")];
|
|
242
|
-
}
|
|
243
|
-
if (filePathArr[0] == "public") {
|
|
244
|
-
return [import_node_path2.default.join("public")];
|
|
245
|
-
}
|
|
246
|
-
return [import_node_path2.default.join("/")];
|
|
247
|
-
}
|
|
248
|
-
function getRelativeTargetPath(filePath) {
|
|
249
|
-
const filePathArr = filePath.split(import_node_path2.default.sep).filter(Boolean);
|
|
250
|
-
if (filePathArr[0] == "public" || filePathArr[0] == "components") {
|
|
251
|
-
filePathArr.shift();
|
|
252
|
-
}
|
|
253
|
-
if (filePathArr[0] == "snippets") {
|
|
254
|
-
return import_node_path2.default.join("snippets", ...filePathArr.slice(1));
|
|
255
|
-
}
|
|
256
|
-
const relativePath = [];
|
|
257
|
-
for (let i = filePathArr.length - 1; i >= 0; i--) {
|
|
258
|
-
relativePath.unshift(filePathArr[i]);
|
|
259
|
-
if (isCollectionKey(filePathArr[i]) && filePathArr[i] != "snippets") break;
|
|
260
|
-
}
|
|
261
|
-
return import_node_path2.default.join(...relativePath);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// src/custom-components.js
|
|
265
|
-
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
266
|
-
var import_node_path3 = __toESM(require("path"), 1);
|
|
267
|
-
var isCustomComponentPath = (projectDirectory, filePath) => {
|
|
268
|
-
const [rootDirectory, childDirectory] = import_node_path3.default.relative(projectDirectory, filePath).split(import_node_path3.default.sep);
|
|
269
|
-
return rootDirectory === "components" || rootDirectory === "federated" && childDirectory === "components";
|
|
270
|
-
};
|
|
271
|
-
var readDirectory = async (directory) => {
|
|
272
|
-
try {
|
|
273
|
-
return await import_promises2.default.readdir(directory, { withFileTypes: true });
|
|
274
|
-
} catch (error) {
|
|
275
|
-
if (error.code === "ENOENT") return [];
|
|
276
|
-
throw error;
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
var mergeDirectory = async (sourceDirectory, destinationDirectory) => {
|
|
280
|
-
for (const entry of await readDirectory(sourceDirectory)) {
|
|
281
|
-
const sourcePath = import_node_path3.default.join(sourceDirectory, entry.name);
|
|
282
|
-
const destinationPath = import_node_path3.default.join(destinationDirectory, entry.name);
|
|
283
|
-
if (entry.isDirectory()) {
|
|
284
|
-
const destinationEntry = await import_promises2.default.stat(destinationPath).catch((error) => {
|
|
285
|
-
if (error.code === "ENOENT") return void 0;
|
|
286
|
-
throw error;
|
|
287
|
-
});
|
|
288
|
-
if (destinationEntry && !destinationEntry.isDirectory()) {
|
|
289
|
-
await import_promises2.default.rm(destinationPath, { recursive: true, force: true });
|
|
290
|
-
}
|
|
291
|
-
await import_promises2.default.mkdir(destinationPath, { recursive: true });
|
|
292
|
-
await mergeDirectory(sourcePath, destinationPath);
|
|
293
|
-
continue;
|
|
294
|
-
}
|
|
295
|
-
await import_promises2.default.rm(destinationPath, { recursive: true, force: true });
|
|
296
|
-
await import_promises2.default.copyFile(sourcePath, destinationPath);
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
var syncCustomComponents = async (projectDirectory, catalogDirectory) => {
|
|
300
|
-
const destinationDirectory = import_node_path3.default.join(catalogDirectory, "src", "custom-defined-components");
|
|
301
|
-
const destinationParent = import_node_path3.default.dirname(destinationDirectory);
|
|
302
|
-
await import_promises2.default.mkdir(destinationParent, { recursive: true });
|
|
303
|
-
const stagingDirectory = await import_promises2.default.mkdtemp(import_node_path3.default.join(destinationParent, ".custom-defined-components.staging-"));
|
|
304
|
-
try {
|
|
305
|
-
await mergeDirectory(import_node_path3.default.join(projectDirectory, "federated", "components"), stagingDirectory);
|
|
306
|
-
await mergeDirectory(import_node_path3.default.join(projectDirectory, "components"), stagingDirectory);
|
|
307
|
-
await import_promises2.default.rm(destinationDirectory, { recursive: true, force: true });
|
|
308
|
-
await import_promises2.default.rename(stagingDirectory, destinationDirectory);
|
|
309
|
-
} finally {
|
|
310
|
-
await import_promises2.default.rm(stagingDirectory, { recursive: true, force: true });
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
// src/catalog-to-astro-content-directory.js
|
|
315
|
-
var __filename2 = (0, import_url2.fileURLToPath)(importMetaUrl);
|
|
316
|
-
var rootPkg = path4.resolve(path4.dirname(__filename2), "../");
|
|
317
|
-
var copyFiles = async (source, target) => {
|
|
318
|
-
const files = await (0, import_glob.glob)(path4.join(source, "**"), {
|
|
319
|
-
nodir: true,
|
|
320
|
-
windowsPathsNoEscape: import_node_os2.default.platform() == "win32",
|
|
321
|
-
ignore: ["node_modules/**", "**/dist/**", "**/teams", "**/users", "**/*.mdx", "**/*.md", "**/package.json", "**/Dockerfile"]
|
|
322
|
-
});
|
|
323
|
-
const snippets = await (0, import_glob.glob)(path4.join(source, "snippets/**/*.mdx"), {
|
|
324
|
-
nodir: true,
|
|
325
|
-
windowsPathsNoEscape: import_node_os2.default.platform() == "win32"
|
|
326
|
-
});
|
|
327
|
-
if (snippets.length > 0) {
|
|
328
|
-
files.push(...snippets);
|
|
329
|
-
}
|
|
330
|
-
if (import_fs.default.existsSync(path4.join(source, ".env"))) {
|
|
331
|
-
files.push(path4.join(source, ".env"));
|
|
332
|
-
}
|
|
333
|
-
for (const file of files) {
|
|
334
|
-
if (isCustomComponentPath(source, file)) continue;
|
|
335
|
-
mapCatalogToAstro({
|
|
336
|
-
filePath: file,
|
|
337
|
-
astroDir: target,
|
|
338
|
-
projectDir: source
|
|
339
|
-
}).map((astroPath) => {
|
|
340
|
-
import_fs.default.cpSync(file, astroPath);
|
|
341
|
-
return { oldPath: file, newPath: astroPath };
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
var clearCustomPages = async (target) => {
|
|
346
|
-
const customPagesDir = path4.join(target, "src", "custom-pages");
|
|
347
|
-
if (import_fs.default.existsSync(customPagesDir)) import_fs.default.rmSync(customPagesDir, { recursive: true });
|
|
348
|
-
const staleCodeFiles = await (0, import_glob.glob)(path4.join(target, "public", "generated", "pages", "**/*.{astro,ts,js,mjs}"), {
|
|
349
|
-
nodir: true,
|
|
350
|
-
windowsPathsNoEscape: import_node_os2.default.platform() == "win32"
|
|
351
|
-
});
|
|
352
|
-
for (const file of staleCodeFiles) {
|
|
353
|
-
import_fs.default.rmSync(file);
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
var removeGeneratedLikeC4Sources = async (target) => {
|
|
357
|
-
const generatedDir = path4.join(target, "public", "generated");
|
|
358
|
-
const files = await (0, import_glob.glob)(path4.join(generatedDir, "**/*.{c4,likec4}"), {
|
|
359
|
-
nodir: true,
|
|
360
|
-
windowsPathsNoEscape: import_node_os2.default.platform() == "win32"
|
|
361
|
-
});
|
|
362
|
-
for (const file of files) {
|
|
363
|
-
import_fs.default.rmSync(file);
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
var catalogToAstro = async (source, astroDir) => {
|
|
367
|
-
const astroContentDir = path4.join(astroDir, "src/content/");
|
|
368
|
-
if (import_fs.default.existsSync(astroContentDir)) import_fs.default.rmSync(astroContentDir, { recursive: true });
|
|
369
|
-
import_fs.default.mkdirSync(astroContentDir);
|
|
370
|
-
await verifyRequiredFieldsAreInCatalogConfigFile(source);
|
|
371
|
-
if (!import_fs.default.existsSync(path4.join(source, "eventcatalog.styles.css"))) {
|
|
372
|
-
import_fs.default.writeFileSync(path4.join(source, "eventcatalog.styles.css"), "");
|
|
373
|
-
}
|
|
374
|
-
await clearCustomPages(astroDir);
|
|
375
|
-
await removeGeneratedLikeC4Sources(astroDir);
|
|
376
|
-
await syncCustomComponents(source, astroDir);
|
|
377
|
-
await copyFiles(source, astroDir);
|
|
378
|
-
};
|
|
379
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
380
|
-
0 && (module.exports = {
|
|
381
|
-
catalogToAstro
|
|
382
|
-
});
|
package/dist/chunk-BWN544LB.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// src/core-node-modules.ts
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import path from "path";
|
|
4
|
-
var isDirectory = (directory) => {
|
|
5
|
-
try {
|
|
6
|
-
return fs.statSync(directory).isDirectory();
|
|
7
|
-
} catch (error) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
var hasAstroDependency = (nodeModulesDirectory) => {
|
|
12
|
-
const astroBin = process.platform === "win32" ? "astro.cmd" : "astro";
|
|
13
|
-
return fs.existsSync(path.join(nodeModulesDirectory, "astro", "package.json")) || fs.existsSync(path.join(nodeModulesDirectory, ".bin", astroBin));
|
|
14
|
-
};
|
|
15
|
-
var isSymbolicLink = (targetPath) => {
|
|
16
|
-
try {
|
|
17
|
-
return fs.lstatSync(targetPath).isSymbolicLink();
|
|
18
|
-
} catch (error) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
var isSameDirectory = (a, b) => {
|
|
23
|
-
try {
|
|
24
|
-
return fs.realpathSync.native(a) === fs.realpathSync.native(b);
|
|
25
|
-
} catch (error) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var resolveInstalledCoreNodeModules = (currentDir) => {
|
|
30
|
-
const candidates = [];
|
|
31
|
-
const seen = /* @__PURE__ */ new Set();
|
|
32
|
-
const addCandidate = (candidate) => {
|
|
33
|
-
const resolvedCandidate = path.resolve(candidate);
|
|
34
|
-
if (!seen.has(resolvedCandidate)) {
|
|
35
|
-
candidates.push(resolvedCandidate);
|
|
36
|
-
seen.add(resolvedCandidate);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
addCandidate(path.resolve(currentDir, "..", "node_modules"));
|
|
40
|
-
let directory = path.resolve(currentDir);
|
|
41
|
-
while (true) {
|
|
42
|
-
if (path.basename(directory) === "node_modules") {
|
|
43
|
-
addCandidate(directory);
|
|
44
|
-
}
|
|
45
|
-
addCandidate(path.join(directory, "node_modules"));
|
|
46
|
-
const parentDirectory = path.dirname(directory);
|
|
47
|
-
if (parentDirectory === directory) {
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
directory = parentDirectory;
|
|
51
|
-
}
|
|
52
|
-
return candidates.find((candidate) => isDirectory(candidate) && hasAstroDependency(candidate)) ?? candidates.find(isDirectory);
|
|
53
|
-
};
|
|
54
|
-
var linkCoreNodeModules = ({
|
|
55
|
-
coreNodeModules,
|
|
56
|
-
installedCoreNodeModules
|
|
57
|
-
}) => {
|
|
58
|
-
if (!installedCoreNodeModules) return;
|
|
59
|
-
if (isSymbolicLink(coreNodeModules)) {
|
|
60
|
-
if (isSameDirectory(coreNodeModules, installedCoreNodeModules)) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
fs.unlinkSync(coreNodeModules);
|
|
64
|
-
} else if (fs.existsSync(coreNodeModules)) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
fs.symlinkSync(installedCoreNodeModules, coreNodeModules, process.platform === "win32" ? "junction" : "dir");
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export {
|
|
71
|
-
resolveInstalledCoreNodeModules,
|
|
72
|
-
linkCoreNodeModules
|
|
73
|
-
};
|
package/dist/chunk-DHH5U5PF.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// src/copy-core.ts
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import path from "path";
|
|
4
|
-
var IGNORED_CORE_DIRECTORIES = /* @__PURE__ */ new Set([".astro", "dist", "node_modules", "__tests__"]);
|
|
5
|
-
var COLOCATED_TEST_SUFFIXES = [
|
|
6
|
-
".spec.js",
|
|
7
|
-
".spec.jsx",
|
|
8
|
-
".spec.cjs",
|
|
9
|
-
".spec.mjs",
|
|
10
|
-
".spec.ts",
|
|
11
|
-
".spec.tsx",
|
|
12
|
-
".spec.cts",
|
|
13
|
-
".spec.mts",
|
|
14
|
-
".test.js",
|
|
15
|
-
".test.jsx",
|
|
16
|
-
".test.cjs",
|
|
17
|
-
".test.mjs",
|
|
18
|
-
".test.ts",
|
|
19
|
-
".test.tsx",
|
|
20
|
-
".test.cts",
|
|
21
|
-
".test.mts"
|
|
22
|
-
];
|
|
23
|
-
var isColocatedTestFile = (fileName) => COLOCATED_TEST_SUFFIXES.some((suffix) => fileName.endsWith(suffix));
|
|
24
|
-
var shouldCopyCoreEntry = (sourceRoot, sourcePath) => {
|
|
25
|
-
const relativePath = path.relative(sourceRoot, sourcePath);
|
|
26
|
-
if (relativePath === "") return true;
|
|
27
|
-
const pathParts = relativePath.split(path.sep);
|
|
28
|
-
if (pathParts.some((part) => IGNORED_CORE_DIRECTORIES.has(part))) return false;
|
|
29
|
-
const fileName = pathParts[pathParts.length - 1] ?? "";
|
|
30
|
-
return !isColocatedTestFile(fileName);
|
|
31
|
-
};
|
|
32
|
-
var PRUNE_SKIPPED_DIRECTORIES = /* @__PURE__ */ new Set([".astro", "dist", "node_modules"]);
|
|
33
|
-
var pruneExcludedCoreEntries = (coreDir) => {
|
|
34
|
-
if (!fs.existsSync(coreDir)) return;
|
|
35
|
-
const visit = (directory) => {
|
|
36
|
-
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
37
|
-
const entryPath = path.join(directory, entry.name);
|
|
38
|
-
if (entry.name === "__tests__" || isColocatedTestFile(entry.name)) {
|
|
39
|
-
fs.rmSync(entryPath, { recursive: true, force: true });
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (entry.isDirectory() && !PRUNE_SKIPPED_DIRECTORIES.has(entry.name)) {
|
|
43
|
-
visit(entryPath);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
visit(coreDir);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
shouldCopyCoreEntry,
|
|
52
|
-
pruneExcludedCoreEntries
|
|
53
|
-
};
|
package/dist/chunk-KLOHNCNF.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
mapCatalogToAstro
|
|
3
|
-
} from "./chunk-W5JQON7Z.js";
|
|
4
|
-
|
|
5
|
-
// src/watcher.js
|
|
6
|
-
import watcher from "@parcel/watcher";
|
|
7
|
-
import fs from "fs";
|
|
8
|
-
import { rimrafSync } from "rimraf";
|
|
9
|
-
var toPosixPath = (p) => p.replace(/\\/g, "/");
|
|
10
|
-
async function watch(projectDirectory, catalogDirectory, callback = void 0) {
|
|
11
|
-
const subscription = await watcher.subscribe(
|
|
12
|
-
projectDirectory,
|
|
13
|
-
compose(
|
|
14
|
-
/**
|
|
15
|
-
* @param {Error|null} err
|
|
16
|
-
* @param {Event[]} events
|
|
17
|
-
* @returns {unknown}
|
|
18
|
-
*/
|
|
19
|
-
(err, events) => {
|
|
20
|
-
if (err) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
for (let event of events) {
|
|
24
|
-
const { path: filePath, type } = event;
|
|
25
|
-
if (filePath.endsWith(".lock")) {
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
if ((filePath.endsWith(".mdx") || filePath.endsWith(".md")) && !filePath.includes("snippets")) {
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
const astroPaths = mapCatalogToAstro({
|
|
32
|
-
filePath,
|
|
33
|
-
astroDir: catalogDirectory,
|
|
34
|
-
projectDir: projectDirectory
|
|
35
|
-
});
|
|
36
|
-
for (const astroPath of astroPaths) {
|
|
37
|
-
switch (type) {
|
|
38
|
-
case "create":
|
|
39
|
-
case "update": {
|
|
40
|
-
let stat;
|
|
41
|
-
try {
|
|
42
|
-
stat = fs.statSync(filePath);
|
|
43
|
-
} catch (err2) {
|
|
44
|
-
if (err2.code === "ENOENT") break;
|
|
45
|
-
throw err2;
|
|
46
|
-
}
|
|
47
|
-
if (stat.isDirectory()) {
|
|
48
|
-
fs.mkdirSync(astroPath, { recursive: true });
|
|
49
|
-
} else {
|
|
50
|
-
retryEPERM(fs.cpSync)(filePath, astroPath);
|
|
51
|
-
}
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
case "delete":
|
|
55
|
-
retryEPERM(rimrafSync)(astroPath);
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
callback
|
|
62
|
-
),
|
|
63
|
-
{
|
|
64
|
-
ignore: [`**/${toPosixPath(catalogDirectory)}/!(${toPosixPath(projectDirectory)})**`]
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
return () => subscription.unsubscribe();
|
|
68
|
-
}
|
|
69
|
-
function compose(...fns) {
|
|
70
|
-
return function(err, events) {
|
|
71
|
-
fns.filter(Boolean).forEach((fn, i) => {
|
|
72
|
-
try {
|
|
73
|
-
fn(err, events);
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.error({ error });
|
|
76
|
-
throw error;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
var MAX_RETRIES = 5;
|
|
82
|
-
var DELAY_MS = 100;
|
|
83
|
-
function retryEPERM(fn) {
|
|
84
|
-
return (...args) => {
|
|
85
|
-
let retries = 0;
|
|
86
|
-
while (retries < MAX_RETRIES) {
|
|
87
|
-
try {
|
|
88
|
-
return fn(...args);
|
|
89
|
-
} catch (err) {
|
|
90
|
-
if (err.code !== "EPERM") throw err;
|
|
91
|
-
setTimeout(() => {
|
|
92
|
-
}, DELAY_MS);
|
|
93
|
-
retries += 1;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export {
|
|
100
|
-
watch
|
|
101
|
-
};
|