@mx-space/cli 0.6.3 → 0.6.5
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/bin/mxs.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as defaultMessageFor, c as tagToCode, i as codeForTag, l as toErrorEnvelope, n as defaultGlobalFlags, o as exitCodeForError, r as parseGlobalFlags, s as exitCodeForTag, t as run } from "./mxs-
|
|
1
|
+
import { a as defaultMessageFor, c as tagToCode, i as codeForTag, l as toErrorEnvelope, n as defaultGlobalFlags, o as exitCodeForError, r as parseGlobalFlags, s as exitCodeForTag, t as run } from "./mxs-lcMA5vod.mjs";
|
|
2
2
|
export { codeForTag, defaultGlobalFlags, defaultMessageFor, exitCodeForError, exitCodeForTag, parseGlobalFlags, run, tagToCode, toErrorEnvelope };
|
|
@@ -24,7 +24,7 @@ import * as ChildProcess from "node:child_process";
|
|
|
24
24
|
import childProcess, { execFile, spawn } from "node:child_process";
|
|
25
25
|
import * as readline from "node:readline";
|
|
26
26
|
import E from "node:readline";
|
|
27
|
-
import
|
|
27
|
+
import process$1, { stdin, stdout } from "node:process";
|
|
28
28
|
import "node:tty";
|
|
29
29
|
//#region ../../node_modules/.pnpm/@effect+platform@0.96.1_effect@3.21.2/node_modules/@effect/platform/dist/esm/Error.js
|
|
30
30
|
/**
|
|
@@ -9042,7 +9042,7 @@ function isInsideContainer() {
|
|
|
9042
9042
|
//#endregion
|
|
9043
9043
|
//#region ../../node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js
|
|
9044
9044
|
const isWsl = () => {
|
|
9045
|
-
if (
|
|
9045
|
+
if (process$1.platform !== "linux") return false;
|
|
9046
9046
|
if (os.release().toLowerCase().includes("microsoft")) {
|
|
9047
9047
|
if (isInsideContainer()) return false;
|
|
9048
9048
|
return true;
|
|
@@ -9053,11 +9053,11 @@ const isWsl = () => {
|
|
|
9053
9053
|
if (fs.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs.existsSync("/run/WSL")) return !isInsideContainer();
|
|
9054
9054
|
return false;
|
|
9055
9055
|
};
|
|
9056
|
-
var is_wsl_default =
|
|
9056
|
+
var is_wsl_default = process$1.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
9057
9057
|
//#endregion
|
|
9058
9058
|
//#region ../../node_modules/.pnpm/powershell-utils@0.1.0/node_modules/powershell-utils/index.js
|
|
9059
9059
|
const execFile$2 = promisify(childProcess.execFile);
|
|
9060
|
-
const powerShellPath$1 = () => `${
|
|
9060
|
+
const powerShellPath$1 = () => `${process$1.env.SYSTEMROOT || process$1.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
9061
9061
|
const executePowerShell = async (command, options = {}) => {
|
|
9062
9062
|
const { powerShellPath: psPath, ...execFileOptions } = options;
|
|
9063
9063
|
const encodedCommand = executePowerShell.encodeCommand(command);
|
|
@@ -9164,7 +9164,7 @@ function defineLazyProperty(object, propertyName, valueGetter) {
|
|
|
9164
9164
|
//#region ../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
|
|
9165
9165
|
const execFileAsync$3 = promisify(execFile);
|
|
9166
9166
|
async function defaultBrowserId() {
|
|
9167
|
-
if (
|
|
9167
|
+
if (process$1.platform !== "darwin") throw new Error("macOS only");
|
|
9168
9168
|
const { stdout } = await execFileAsync$3("defaults", [
|
|
9169
9169
|
"read",
|
|
9170
9170
|
"com.apple.LaunchServices/com.apple.launchservices.secure",
|
|
@@ -9178,7 +9178,7 @@ async function defaultBrowserId() {
|
|
|
9178
9178
|
//#region ../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js
|
|
9179
9179
|
const execFileAsync$2 = promisify(execFile);
|
|
9180
9180
|
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
9181
|
-
if (
|
|
9181
|
+
if (process$1.platform !== "darwin") throw new Error("macOS only");
|
|
9182
9182
|
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
9183
9183
|
const execOptions = {};
|
|
9184
9184
|
if (signal) execOptions.signal = signal;
|
|
@@ -9289,14 +9289,14 @@ async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
|
|
|
9289
9289
|
const execFileAsync = promisify(execFile);
|
|
9290
9290
|
const titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
|
|
9291
9291
|
async function defaultBrowser() {
|
|
9292
|
-
if (
|
|
9292
|
+
if (process$1.platform === "darwin") {
|
|
9293
9293
|
const id = await defaultBrowserId();
|
|
9294
9294
|
return {
|
|
9295
9295
|
name: await bundleName(id),
|
|
9296
9296
|
id
|
|
9297
9297
|
};
|
|
9298
9298
|
}
|
|
9299
|
-
if (
|
|
9299
|
+
if (process$1.platform === "linux") {
|
|
9300
9300
|
const { stdout } = await execFileAsync("xdg-mime", [
|
|
9301
9301
|
"query",
|
|
9302
9302
|
"default",
|
|
@@ -9308,18 +9308,18 @@ async function defaultBrowser() {
|
|
|
9308
9308
|
id
|
|
9309
9309
|
};
|
|
9310
9310
|
}
|
|
9311
|
-
if (
|
|
9311
|
+
if (process$1.platform === "win32") return defaultBrowser$1();
|
|
9312
9312
|
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
9313
9313
|
}
|
|
9314
9314
|
//#endregion
|
|
9315
9315
|
//#region ../../node_modules/.pnpm/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js
|
|
9316
|
-
const isInSsh = Boolean(
|
|
9316
|
+
const isInSsh = Boolean(process$1.env.SSH_CONNECTION || process$1.env.SSH_CLIENT || process$1.env.SSH_TTY);
|
|
9317
9317
|
//#endregion
|
|
9318
9318
|
//#region ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
|
|
9319
9319
|
const fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
9320
9320
|
const __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
|
|
9321
9321
|
const localXdgOpenPath = path.join(__dirname, "xdg-open");
|
|
9322
|
-
const { platform: platform$1, arch: arch$1 } =
|
|
9322
|
+
const { platform: platform$1, arch: arch$1 } = process$1;
|
|
9323
9323
|
const tryEachApp = async (apps, opener) => {
|
|
9324
9324
|
if (apps.length === 0) return;
|
|
9325
9325
|
const errors = [];
|
|
@@ -9432,7 +9432,7 @@ const baseOpen = async (options) => {
|
|
|
9432
9432
|
await fs$1.access(localXdgOpenPath, constants.X_OK);
|
|
9433
9433
|
exeLocalXdgOpen = true;
|
|
9434
9434
|
} catch {}
|
|
9435
|
-
command =
|
|
9435
|
+
command = process$1.versions.electron ?? (platform$1 === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
|
|
9436
9436
|
}
|
|
9437
9437
|
if (appArguments.length > 0) cliArguments.push(...appArguments);
|
|
9438
9438
|
if (!options.wait) {
|
|
@@ -10889,7 +10889,7 @@ var ht$1 = class extends m {
|
|
|
10889
10889
|
//#endregion
|
|
10890
10890
|
//#region ../../node_modules/.pnpm/@clack+prompts@1.4.0/node_modules/@clack/prompts/dist/index.mjs
|
|
10891
10891
|
function ee() {
|
|
10892
|
-
return
|
|
10892
|
+
return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
10893
10893
|
}
|
|
10894
10894
|
const tt = ee(), w = (t, i) => tt ? t : i, Tt = w("◆", "*"), at = w("■", "x"), ut = w("▲", "x"), H = w("◇", "o");
|
|
10895
10895
|
const $ = w("│", "|"), x = w("└", "—");
|
|
@@ -12483,7 +12483,7 @@ function customAlphabet(alphabet, size = 21) {
|
|
|
12483
12483
|
return customRandom(alphabet, size, random);
|
|
12484
12484
|
}
|
|
12485
12485
|
//#endregion
|
|
12486
|
-
//#region ../../node_modules/.pnpm/@haklex+rich-litexml@0.15.
|
|
12486
|
+
//#region ../../node_modules/.pnpm/@haklex+rich-litexml@0.15.3/node_modules/@haklex/rich-litexml/dist/src-Chu1pfGY.js
|
|
12487
12487
|
var impl = null;
|
|
12488
12488
|
function registerParseHTML(fn) {
|
|
12489
12489
|
impl = fn;
|
|
@@ -13510,6 +13510,7 @@ function deserializeFromXml(xml, registry) {
|
|
|
13510
13510
|
}
|
|
13511
13511
|
/** Structural containers whose whitespace-only text nodes are layout artifacts, not content */
|
|
13512
13512
|
var BLOCK_TAGS = new Set([
|
|
13513
|
+
"body",
|
|
13513
13514
|
"doc",
|
|
13514
13515
|
"fragment",
|
|
13515
13516
|
"root",
|
|
@@ -24750,7 +24751,7 @@ function Document() {
|
|
|
24750
24751
|
}
|
|
24751
24752
|
setPrototypeOf(Document, Document$1).prototype = Document$1.prototype;
|
|
24752
24753
|
//#endregion
|
|
24753
|
-
//#region ../../node_modules/.pnpm/@haklex+rich-litexml@0.15.
|
|
24754
|
+
//#region ../../node_modules/.pnpm/@haklex+rich-litexml@0.15.3/node_modules/@haklex/rich-litexml/dist/node.mjs
|
|
24754
24755
|
registerParseHTML((html) => parseHTML(html).document);
|
|
24755
24756
|
//#endregion
|
|
24756
24757
|
//#region src/services/Renderer/content.ts
|
|
@@ -31768,6 +31769,10 @@ registerCommandHelp({
|
|
|
31768
31769
|
{
|
|
31769
31770
|
flag: "--print",
|
|
31770
31771
|
description: "emit HTML to stdout instead of opening a browser"
|
|
31772
|
+
},
|
|
31773
|
+
{
|
|
31774
|
+
flag: "--open",
|
|
31775
|
+
description: "explicitly open the rendered HTML in a browser (default behavior)"
|
|
31771
31776
|
}
|
|
31772
31777
|
]
|
|
31773
31778
|
});
|
|
@@ -31780,6 +31785,7 @@ const variantOpt = choice("variant", [
|
|
|
31780
31785
|
]).pipe(optional$2);
|
|
31781
31786
|
const saveOpt = text$1("save").pipe(optional$2);
|
|
31782
31787
|
const printOpt = boolean("print").pipe(optional$2);
|
|
31788
|
+
const openOpt = boolean("open").pipe(optional$2);
|
|
31783
31789
|
const requireFrom$3 = createRequire(import.meta.url);
|
|
31784
31790
|
const resolveLitexmlBin = () => {
|
|
31785
31791
|
try {
|
|
@@ -31857,11 +31863,17 @@ const previewCmd = make$13("preview", {
|
|
|
31857
31863
|
theme: themeOpt,
|
|
31858
31864
|
variant: variantOpt,
|
|
31859
31865
|
save: saveOpt,
|
|
31860
|
-
print: printOpt
|
|
31861
|
-
|
|
31866
|
+
print: printOpt,
|
|
31867
|
+
open: openOpt
|
|
31868
|
+
}, ({ file, theme, variant, save, print, open: openFlag }) => gen(function* () {
|
|
31862
31869
|
const editor = yield* Editor;
|
|
31863
31870
|
const renderer = yield* Renderer;
|
|
31864
31871
|
const filePath = getOrUndefined(file);
|
|
31872
|
+
const stdinIsTty = Boolean(process.stdin.isTTY);
|
|
31873
|
+
if ((filePath === void 0 || filePath === "-" || filePath === "") && stdinIsTty) return yield* fail$2(new ValidationXml({
|
|
31874
|
+
message: "mxs preview requires a file path or piped LiteXML on stdin",
|
|
31875
|
+
hint: "pass `mxs preview <file>` or pipe content: `cat post.xml | mxs preview -`"
|
|
31876
|
+
}));
|
|
31865
31877
|
const raw = yield* editor.readFileOrStdin(filePath);
|
|
31866
31878
|
let body;
|
|
31867
31879
|
let detectedVariant = "article";
|
|
@@ -31872,10 +31884,14 @@ const previewCmd = make$13("preview", {
|
|
|
31872
31884
|
} catch (err) {
|
|
31873
31885
|
return yield* fail$2(err instanceof ValidationXml ? err : new ValidationXml({ message: err instanceof Error ? err.message : String(err) }));
|
|
31874
31886
|
}
|
|
31887
|
+
if (!body.includes("<doc")) body = `<doc>${body}</doc>`;
|
|
31875
31888
|
const resolvedVariant = getOrElse(variant, () => detectedVariant);
|
|
31876
31889
|
const resolvedTheme = getOrUndefined(theme);
|
|
31877
31890
|
const savePath = getOrUndefined(save);
|
|
31878
31891
|
const printMode = getOrElse(print, () => false);
|
|
31892
|
+
const explicitOpen = getOrElse(openFlag, () => false);
|
|
31893
|
+
if (printMode && savePath) return yield* fail$2(new ValidationXml({ message: "--print and --save are mutually exclusive" }));
|
|
31894
|
+
if (explicitOpen && (printMode || savePath)) return yield* fail$2(new ValidationXml({ message: "--open conflicts with --print / --save" }));
|
|
31879
31895
|
const args = [
|
|
31880
31896
|
"--format",
|
|
31881
31897
|
"html",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mx-space/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Command line interface for mx-space (mx-core) — auth, content, configuration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mx-space",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@effect/platform": "0.96.1",
|
|
54
54
|
"@effect/platform-node": "0.106.0",
|
|
55
55
|
"@haklex/rich-headless": "0.13.0",
|
|
56
|
-
"@haklex/rich-litexml": "0.15.
|
|
56
|
+
"@haklex/rich-litexml": "0.15.3",
|
|
57
57
|
"@haklex/rich-litexml-cli": "0.15.3",
|
|
58
58
|
"@lexical/headless": "^0.44.0",
|
|
59
59
|
"better-auth": "^1.6.9",
|
|
@@ -12,9 +12,12 @@ order: 39
|
|
|
12
12
|
| Command | Behavior |
|
|
13
13
|
| ---------------------------------------- | --------------------------------------------------------------------------- |
|
|
14
14
|
| `mxs preview <file>` | Render the file and open the preview in a browser. |
|
|
15
|
+
| `mxs preview <file> --open` | Same as above, but explicit. Useful in scripts. |
|
|
15
16
|
| `mxs preview -` | Read LiteXML or envelope from stdin and open the preview. |
|
|
16
|
-
| `mxs preview <file
|
|
17
|
-
| `mxs preview
|
|
17
|
+
| `mxs preview --print <file>` | Emit HTML to stdout instead of opening a browser. |
|
|
18
|
+
| `mxs preview --save <out.html> <file>` | Write HTML to `<out.html>` instead of opening a browser. |
|
|
19
|
+
|
|
20
|
+
Flags must precede the positional `<file>` argument. `mxs preview <file> --print` is rejected by `@effect/cli` ("unknown argument") — write `mxs preview --print <file>` or `cat file | mxs preview --print -`.
|
|
18
21
|
|
|
19
22
|
## Flags
|
|
20
23
|
|
|
@@ -22,8 +25,9 @@ order: 39
|
|
|
22
25
|
| ------------------------------------------ | ------------------------------------------------------------------------------------------------ |
|
|
23
26
|
| `--theme <light\|dark>` | HTML theme. Default `light`. |
|
|
24
27
|
| `--variant <article\|note\|comment>` | HTML variant. Auto-detected from the envelope root (`<mxpost>` → `article`, `<mxnote>` → `note`). |
|
|
25
|
-
| `--save <path>` | Write HTML to a file instead of opening the browser. Mutually exclusive with `--print`.
|
|
26
|
-
| `--print` | Emit HTML to stdout. Mutually exclusive with `--save`.
|
|
28
|
+
| `--save <path>` | Write HTML to a file instead of opening the browser. Mutually exclusive with `--print` / `--open`. |
|
|
29
|
+
| `--print` | Emit HTML to stdout. Mutually exclusive with `--save` / `--open`. |
|
|
30
|
+
| `--open` | Explicitly open the rendered HTML in a browser (default behavior; mutually exclusive with `--print` / `--save`). |
|
|
27
31
|
|
|
28
32
|
## Behavior notes
|
|
29
33
|
|