@markdy/cli 0.7.18 → 0.7.19
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 +8 -10
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { PRESETS, PRESET_NAMES, parse } from "@markdy/core";
|
|
5
5
|
import { createRequire } from "module";
|
|
6
|
-
import { basename, dirname, extname, join, resolve } from "path";
|
|
6
|
+
import { basename, dirname, extname, join, resolve, sep } from "path";
|
|
7
7
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
8
8
|
import { createServer } from "http";
|
|
9
9
|
import { readdir, readFile, stat, writeFile } from "fs/promises";
|
|
@@ -157,7 +157,7 @@ var MARKDY_EXT = ".markdy";
|
|
|
157
157
|
var PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
158
158
|
async function runCli(argv, io = defaultIo(), runtime = defaultRuntime()) {
|
|
159
159
|
const parsed = parseArgv(argv);
|
|
160
|
-
if (
|
|
160
|
+
if (hasFlag(parsed, "help")) {
|
|
161
161
|
io.stdout(helpText());
|
|
162
162
|
return { exitCode: 0 };
|
|
163
163
|
}
|
|
@@ -165,10 +165,6 @@ async function runCli(argv, io = defaultIo(), runtime = defaultRuntime()) {
|
|
|
165
165
|
return launchPlayground(parsed, io, runtime);
|
|
166
166
|
}
|
|
167
167
|
const command = parsed.command;
|
|
168
|
-
if (command === "--help" || command === "-h") {
|
|
169
|
-
io.stdout(helpText());
|
|
170
|
-
return { exitCode: 0 };
|
|
171
|
-
}
|
|
172
168
|
switch (command) {
|
|
173
169
|
case "lint":
|
|
174
170
|
return lintCommand(parsed, io);
|
|
@@ -454,7 +450,7 @@ async function startPreviewServer(code, imports, sourcePath, preferredPort) {
|
|
|
454
450
|
async function servePackageFile(response, distDir, relativePath) {
|
|
455
451
|
const safePath = relativePath.replace(/^\/+/, "");
|
|
456
452
|
const fullPath = resolve(distDir, safePath);
|
|
457
|
-
if (!fullPath.startsWith(distDir)) {
|
|
453
|
+
if (fullPath !== distDir && !fullPath.startsWith(distDir + sep)) {
|
|
458
454
|
sendText(response, 403, "Forbidden", "text/plain; charset=utf-8");
|
|
459
455
|
return;
|
|
460
456
|
}
|
|
@@ -771,11 +767,13 @@ function parseArgv(argv) {
|
|
|
771
767
|
continue;
|
|
772
768
|
}
|
|
773
769
|
if (arg.startsWith("--")) {
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
|
|
770
|
+
const body = arg.slice(2);
|
|
771
|
+
const eqIndex = body.indexOf("=");
|
|
772
|
+
if (eqIndex !== -1) {
|
|
773
|
+
flags.set(body.slice(0, eqIndex), body.slice(eqIndex + 1));
|
|
777
774
|
continue;
|
|
778
775
|
}
|
|
776
|
+
const rawKey = body;
|
|
779
777
|
const next = argv[index + 1];
|
|
780
778
|
if (next && !next.startsWith("-") && expectsValue(rawKey)) {
|
|
781
779
|
flags.set(rawKey, next);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markdy/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.19",
|
|
4
4
|
"description": "First-party CLI for MarkdyScript: lint, format, explain, render, and local playground tooling.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@markdy/core": "0.7.
|
|
45
|
-
"@markdy/renderer-dom": "0.7.
|
|
44
|
+
"@markdy/core": "0.7.19",
|
|
45
|
+
"@markdy/renderer-dom": "0.7.19"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/node": "^25.9.5",
|