@markdy/cli 0.8.21 → 0.8.23
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/index.js +18 -13
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -8,13 +8,6 @@ import {
|
|
|
8
8
|
diffDiagramASTs,
|
|
9
9
|
compressMarkdyToUrlHash
|
|
10
10
|
} from "@markdy/core";
|
|
11
|
-
import {
|
|
12
|
-
transpileMermaidToMarkdy,
|
|
13
|
-
transpileDockerComposeToMarkdy,
|
|
14
|
-
transpileKubernetesManifestsToMarkdy,
|
|
15
|
-
transpileTerraformStateToMarkdy,
|
|
16
|
-
transpileDrawioToMarkdy
|
|
17
|
-
} from "@markdy/compat";
|
|
18
11
|
import { createRequire } from "module";
|
|
19
12
|
import { basename, dirname, extname, join, resolve, sep } from "path";
|
|
20
13
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
@@ -153,6 +146,13 @@ function formatValue(value) {
|
|
|
153
146
|
var DEFAULT_PORT = 4242;
|
|
154
147
|
var MARKDY_EXT = ".markdy";
|
|
155
148
|
var PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
149
|
+
var compatModulePromise = null;
|
|
150
|
+
function loadCompatModule() {
|
|
151
|
+
if (!compatModulePromise) {
|
|
152
|
+
compatModulePromise = import("@markdy/compat");
|
|
153
|
+
}
|
|
154
|
+
return compatModulePromise;
|
|
155
|
+
}
|
|
156
156
|
async function runCli(argv, io = defaultIo(), runtime = defaultRuntime()) {
|
|
157
157
|
const parsed = parseArgv(argv);
|
|
158
158
|
if (hasFlag(parsed, "help")) {
|
|
@@ -379,19 +379,24 @@ async function importCommand(parsed, io) {
|
|
|
379
379
|
const formatFlag = getStringFlag(parsed, "from")?.toLowerCase();
|
|
380
380
|
const ext = extname(inputFile).toLowerCase();
|
|
381
381
|
const title = basename(inputFile, extname(inputFile));
|
|
382
|
+
const compat = await loadCompatModule().catch((err) => {
|
|
383
|
+
io.stderr(`markdy import: failed to load @markdy/compat: ${describeError(err)}`);
|
|
384
|
+
return null;
|
|
385
|
+
});
|
|
386
|
+
if (!compat) return { exitCode: 1 };
|
|
382
387
|
let markdyCode;
|
|
383
388
|
if (formatFlag === "mermaid" || ext === ".mmd" || ext === ".mermaid") {
|
|
384
|
-
markdyCode = transpileMermaidToMarkdy(content, title).code;
|
|
389
|
+
markdyCode = compat.transpileMermaidToMarkdy(content, title).code;
|
|
385
390
|
} else if (formatFlag === "compose" || (ext === ".yml" || ext === ".yaml") && (inputFile.includes("compose") || content.includes("services:"))) {
|
|
386
|
-
markdyCode = transpileDockerComposeToMarkdy(content, title);
|
|
391
|
+
markdyCode = compat.transpileDockerComposeToMarkdy(content, title);
|
|
387
392
|
} else if (formatFlag === "k8s" || content.includes("apiVersion:") && content.includes("kind:")) {
|
|
388
|
-
markdyCode = transpileKubernetesManifestsToMarkdy(content, title);
|
|
393
|
+
markdyCode = compat.transpileKubernetesManifestsToMarkdy(content, title);
|
|
389
394
|
} else if (formatFlag === "terraform" || ext === ".tfstate" || (content.includes("terraform_version") || content.includes('"resources":'))) {
|
|
390
|
-
markdyCode = transpileTerraformStateToMarkdy(content, title);
|
|
395
|
+
markdyCode = compat.transpileTerraformStateToMarkdy(content, title);
|
|
391
396
|
} else if (formatFlag === "drawio" || ext === ".drawio" || ext === ".xml" && content.includes("<mxCell")) {
|
|
392
|
-
markdyCode = transpileDrawioToMarkdy(content, title).code;
|
|
397
|
+
markdyCode = compat.transpileDrawioToMarkdy(content, title).code;
|
|
393
398
|
} else {
|
|
394
|
-
markdyCode = transpileMermaidToMarkdy(content, title).code;
|
|
399
|
+
markdyCode = compat.transpileMermaidToMarkdy(content, title).code;
|
|
395
400
|
}
|
|
396
401
|
const outPath = getStringFlag(parsed, "out");
|
|
397
402
|
if (outPath) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markdy/cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.23",
|
|
4
4
|
"description": "First-party CLI for diagram-native MarkdyScript diagrams: lint, format, explain, render, and preview.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@markdy/
|
|
46
|
-
"@markdy/
|
|
47
|
-
"@markdy/renderer-dom": "0.8.
|
|
48
|
-
"@markdy/stdlib-systems": "0.8.
|
|
45
|
+
"@markdy/core": "0.8.23",
|
|
46
|
+
"@markdy/compat": "0.8.23",
|
|
47
|
+
"@markdy/renderer-dom": "0.8.23",
|
|
48
|
+
"@markdy/stdlib-systems": "0.8.23"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^25.9.5",
|