Lines 8-48javascript
8var __hasOwnProp = Object.prototype.hasOwnProperty;
9var __copyProps = (to, from, except, desc) => {
10 if (from && typeof from === "object" || typeof from === "function") {
11 for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13 if (!__hasOwnProp.call(to, key) && key !== except) {
15 get: ((k) => from[k]).bind(null, key),
16 enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod ||
29let node_fs_promises = require("node:fs/promises");
30let _eventcatalog_sdk = require("@eventcatalog/sdk");
MediumDynamic Require
Package source references dynamic require/import behavior.
dist/generate-C1vYn-_M.cjsView on unpkg · L28 31_eventcatalog_sdk = __toESM(_eventcatalog_sdk, 1);
33//#region src/snapshot.ts
34const EXPECTED_SPEC_PREFIX = "autotel-architecture/";
36* Loads and validates an autotel architecture snapshot from disk.
38* Throws a descriptive error when the file is missing, contains invalid
39* JSON, or is not recognisable as an autotel snapshot, so the CLI surfaces
40* an actionable message rather than a raw `ENOENT` or `SyntaxError`.
42async function loadSnapshot(path) {
45 raw = await (0, node_fs_promises.readFile)(path, "utf8");
47 if (isNodeFsError(err) && err.code === "ENOENT") throw new Error(`Snapshot not found: ${path}`);
48 if (isNodeFsError(err) && err.code === "EISDIR") throw new Error(`Snapshot path is a directory, not a file: ${path}`);