@masumdev/markforge 0.2.5 → 0.4.0

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.
@@ -32,7 +32,7 @@ try {
32
32
  }
33
33
  } catch {
34
34
  }
35
- var FALLBACK_VERSION = "0.2.2";
35
+ var FALLBACK_VERSION = "0.4.0";
36
36
  function readVersionFromPackageJson(fromDir) {
37
37
  let currentDir = fromDir;
38
38
  for (let i = 0; i < 6; i++) {
package/dist/cli.mjs CHANGED
@@ -9,7 +9,7 @@ try {
9
9
  } catch {}
10
10
  import {
11
11
  MARKFORGE_VERSION
12
- } from "./chunk-NGC2ZAWZ.mjs";
12
+ } from "./chunk-TNWZ4MFS.mjs";
13
13
  import "./chunk-YZHGBG4N.mjs";
14
14
 
15
15
  // src/cli.tsx
@@ -45,7 +45,7 @@ process.on("warning", (w) => {
45
45
  });
46
46
  async function main() {
47
47
  const program = new Command();
48
- program.name("markforge").description("Modern Markdown & MDX multi-format publishing engine & CLI (DOCX, PDF, HTML, Images)").version(MARKFORGE_VERSION, "-V, --version", "Output current markforge version").argument("[input-file]", "Markdown or MDX source file to compile", "README.md").option("-t, --to <formats>", "Target formats to compile to (comma-separated: docx,pdf,html)").option("-o, --output <dir>", "Output directory for generated documents").option("--theme <theme>", "Built-in theme name (default, academic, github, corporate, minimal)").option("--css <path...>", "Custom CSS stylesheet(s) to inject").option("-c, --config <path>", "Path to custom markforge configuration file").option("--toc", "Force Table of Contents generation").option("-w, --watch", "Watch input file for changes and recompile", false).option("-s, --serve [port]", "Start local HTTP preview server", false).option("-O, --open", "Open compiled document in default browser", false);
48
+ program.name("markforge").description("Modern Markdown & MDX multi-format publishing engine & CLI (DOCX, PDF, HTML, Images)").version(MARKFORGE_VERSION, "-V, --version", "Output current markforge version").argument("[input-file]", "Markdown or MDX source file to compile", "README.md").option("-t, --to <formats>", "Target formats to compile to (comma-separated: docx,pdf,html)").option("-o, --output <dir>", "Output directory for generated documents").option("--theme <theme>", "Built-in theme name (default, academic, github, corporate, minimal)").option("--css <path...>", "Custom CSS stylesheet(s) to inject").option("-c, --config <path>", "Path to custom markforge configuration file").option("--toc", "Force Table of Contents generation").option("-w, --watch", "Watch input file for changes and recompile", false).option("-s, --serve [port]", "Start interactive live-reload preview server").option("-O, --open", "Open preview or compiled document in default browser", false);
49
49
  program.parse(process.argv);
50
50
  const options = program.opts();
51
51
  const inputArg = program.args[0] || "README.md";
@@ -55,11 +55,7 @@ async function main() {
55
55
  process.exit(1);
56
56
  }
57
57
  const cliFormats = options.to ? options.to.split(",").map((f) => f.trim().toLowerCase()).filter(Boolean) : void 0;
58
- const [{ render }, { App }, { loadConfig }] = await Promise.all([
59
- import("ink"),
60
- import("./App-GNRUPFM7.mjs"),
61
- import("./loadConfig-PD6ENMAM.mjs")
62
- ]);
58
+ const { loadConfig } = await import("./loadConfig-PGJKPE6G.mjs");
63
59
  const { config: fileConfig } = await loadConfig(
64
60
  options.config,
65
61
  path.dirname(resolvedInputPath)
@@ -72,6 +68,32 @@ async function main() {
72
68
  ...options.css ? { css: options.css } : {},
73
69
  ...options.toc ? { toc: true } : {}
74
70
  };
71
+ if (options.serve !== false && options.serve !== void 0) {
72
+ const rawPort = options.serve === true ? 3e3 : parseInt(String(options.serve), 10);
73
+ const port = isNaN(rawPort) ? 3e3 : rawPort;
74
+ const { startPreviewServer } = await import("./previewServer-XAUOBNBZ.mjs");
75
+ const instance = await startPreviewServer({
76
+ filePath: resolvedInputPath,
77
+ port,
78
+ open: Boolean(options.open),
79
+ config: mergedConfig
80
+ });
81
+ console.log(`
82
+ ======================================================`);
83
+ console.log(` MarkForge Live Reload Preview Server`);
84
+ console.log(` Target File : ${resolvedInputPath}`);
85
+ console.log(` Server URL : ${instance.url}`);
86
+ console.log(` Author : Ma'sum (https://github.com/masumrpg)`);
87
+ console.log(`======================================================
88
+ `);
89
+ console.log(`[READY] Watching for markdown and style changes. Press Ctrl+C to exit.
90
+ `);
91
+ return;
92
+ }
93
+ const [{ render }, { App }] = await Promise.all([
94
+ import("ink"),
95
+ import("./App-3QDKBKHG.mjs")
96
+ ]);
75
97
  render(
76
98
  /* @__PURE__ */ jsx(
77
99
  App,