@masumdev/markforge 0.1.0 → 0.2.1

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/cli.mjs CHANGED
@@ -22,7 +22,30 @@ import { Box, Text } from "ink";
22
22
  // src/version.ts
23
23
  import * as fs from "fs";
24
24
  import * as path from "path";
25
- var MARKFORGE_VERSION = "0.1.0";
25
+ var FALLBACK_VERSION = "0.2.1";
26
+ function readVersionFromPackageJson(fromDir) {
27
+ let currentDir = fromDir;
28
+ for (let i = 0; i < 6; i++) {
29
+ try {
30
+ const pkgJsonPath = path.join(currentDir, "package.json");
31
+ if (fs.existsSync(pkgJsonPath)) {
32
+ const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
33
+ if (pkg.name === "@masumdev/markforge" && pkg.version) {
34
+ return pkg.version;
35
+ }
36
+ }
37
+ } catch {
38
+ }
39
+ const parentDir = path.dirname(currentDir);
40
+ if (parentDir === currentDir) break;
41
+ currentDir = parentDir;
42
+ }
43
+ return FALLBACK_VERSION;
44
+ }
45
+ var MARKFORGE_VERSION = readVersionFromPackageJson(
46
+ // __dirname points to dist/ after build; walk up to find the package root
47
+ typeof __dirname !== "undefined" ? __dirname : process.cwd()
48
+ );
26
49
 
27
50
  // src/ui/Header.tsx
28
51
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1366,6 +1389,10 @@ function findChromeExecutable() {
1366
1389
  if (process.env.PUPPETEER_EXECUTABLE_PATH && fs4.existsSync(process.env.PUPPETEER_EXECUTABLE_PATH)) {
1367
1390
  return process.env.PUPPETEER_EXECUTABLE_PATH;
1368
1391
  }
1392
+ const isWin = process.platform === "win32";
1393
+ const winLocalAppData = process.env.LOCALAPPDATA ?? "";
1394
+ const winProgramFiles = process.env.PROGRAMFILES ?? "C:\\Program Files";
1395
+ const winProgramFilesX86 = process.env["PROGRAMFILES(X86)"] ?? "C:\\Program Files (x86)";
1369
1396
  const candidates = [
1370
1397
  // Linux
1371
1398
  "/usr/bin/google-chrome",
@@ -1373,13 +1400,23 @@ function findChromeExecutable() {
1373
1400
  "/usr/bin/chromium",
1374
1401
  "/usr/bin/chromium-browser",
1375
1402
  "/snap/bin/chromium",
1403
+ "/usr/bin/microsoft-edge",
1404
+ "/usr/bin/microsoft-edge-stable",
1376
1405
  // macOS
1377
1406
  "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
1378
1407
  "/Applications/Chromium.app/Contents/MacOS/Chromium",
1379
- // Windows
1380
- "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
1381
- "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
1382
- ];
1408
+ "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
1409
+ // Windows — Program Files (env-var resolved)
1410
+ `${winProgramFiles}\\Google\\Chrome\\Application\\chrome.exe`,
1411
+ `${winProgramFilesX86}\\Google\\Chrome\\Application\\chrome.exe`,
1412
+ `${winLocalAppData}\\Google\\Chrome\\Application\\chrome.exe`,
1413
+ // Windows — Microsoft Edge (ships with Windows 10/11)
1414
+ `${winProgramFiles}\\Microsoft\\Edge\\Application\\msedge.exe`,
1415
+ `${winProgramFilesX86}\\Microsoft\\Edge\\Application\\msedge.exe`,
1416
+ `${winLocalAppData}\\Microsoft\\Edge\\Application\\msedge.exe`,
1417
+ // Windows — Chromium
1418
+ `${winLocalAppData}\\Chromium\\Application\\chrome.exe`
1419
+ ].filter(Boolean);
1383
1420
  for (const candidate of candidates) {
1384
1421
  try {
1385
1422
  if (fs4.existsSync(candidate)) {
@@ -1389,9 +1426,9 @@ function findChromeExecutable() {
1389
1426
  }
1390
1427
  }
1391
1428
  try {
1392
- const isWin = process.platform === "win32";
1393
1429
  const cmd = isWin ? "where" : "which";
1394
- for (const name of ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]) {
1430
+ const names = isWin ? ["chrome", "msedge", "google-chrome", "chromium", "chromium-browser"] : ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser", "microsoft-edge"];
1431
+ for (const name of names) {
1395
1432
  const res = spawnSync(cmd, [name], { encoding: "utf-8" });
1396
1433
  if (res.status === 0 && res.stdout.trim()) {
1397
1434
  const binPath = res.stdout.split(/\r?\n/)[0].trim();
@@ -1601,7 +1638,9 @@ ${mermaidCode}
1601
1638
  "--disable-gpu",
1602
1639
  "--no-sandbox",
1603
1640
  "--disable-setuid-sandbox",
1641
+ "--disable-software-rasterizer",
1604
1642
  "--window-size=1200,800",
1643
+ "--virtual-time-budget=5000",
1605
1644
  `--screenshot=${tmpScreenshot}`,
1606
1645
  tmpHtml
1607
1646
  ],
@@ -2512,6 +2551,12 @@ var App = ({ inputFile, config, onComplete }) => {
2512
2551
 
2513
2552
  // src/cli.tsx
2514
2553
  import { jsx as jsx5 } from "react/jsx-runtime";
2554
+ process.on("warning", (w) => {
2555
+ if (w.message.includes("localstorage-file") || w.message.includes("localStorage")) return;
2556
+ process.stderr.write(`(node:${process.pid}) ${w.name}: ${w.message}
2557
+ `);
2558
+ });
2559
+ process.removeAllListeners("warning");
2515
2560
  async function main() {
2516
2561
  const program = new Command();
2517
2562
  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)", "docx,pdf").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);
@@ -2523,32 +2568,28 @@ async function main() {
2523
2568
  console.error(`[ERROR] File not found: ${resolvedInputPath}`);
2524
2569
  process.exit(1);
2525
2570
  }
2526
- const { config } = await loadConfig(options.config, path8.dirname(resolvedInputPath));
2527
- if (options.to) {
2528
- config.to = options.to.split(",").map((s) => s.trim());
2529
- }
2530
- if (options.output) config.outputDir = options.output;
2531
- if (options.theme) config.theme = options.theme;
2532
- if (options.css) config.css = options.css;
2533
- if (options.toc) config.toc = true;
2534
- if (options.watch) config.watch = true;
2535
- const app = render(
2571
+ const rawFormats = (options.to || "docx,pdf").split(",").map((f) => f.trim().toLowerCase()).filter(Boolean);
2572
+ const fileConfig = await loadConfig(options.config, path8.dirname(resolvedInputPath));
2573
+ const mergedConfig = {
2574
+ ...fileConfig,
2575
+ to: rawFormats.length > 0 ? rawFormats : fileConfig.to ?? ["docx", "pdf"],
2576
+ ...options.output ? { outputDir: options.output } : {},
2577
+ ...options.theme ? { theme: options.theme } : {},
2578
+ ...options.css ? { css: options.css } : {},
2579
+ ...options.toc ? { toc: true } : {}
2580
+ };
2581
+ render(
2536
2582
  /* @__PURE__ */ jsx5(
2537
2583
  App,
2538
2584
  {
2539
- inputFile: resolvedInputPath,
2540
- config,
2541
- onComplete: (res) => {
2542
- if (res.errors.length > 0) {
2543
- process.exitCode = 1;
2544
- }
2545
- }
2585
+ inputPath: resolvedInputPath,
2586
+ config: mergedConfig,
2587
+ watch: options.watch
2546
2588
  }
2547
2589
  )
2548
2590
  );
2549
- await app.waitUntilExit();
2550
2591
  }
2551
2592
  main().catch((err) => {
2552
- console.error("[FATAL ERROR]", err);
2593
+ console.error("[FATAL]", err instanceof Error ? err.message : err);
2553
2594
  process.exit(1);
2554
2595
  });
package/dist/index.d.mts CHANGED
@@ -338,7 +338,12 @@ declare function loadConfig(customPath?: string, cwd?: string): Promise<{
338
338
  configPath: string | null;
339
339
  }>;
340
340
 
341
- declare const MARKFORGE_VERSION = "0.1.0";
341
+ /**
342
+ * Dynamically resolved version — reads from the nearest package.json at runtime.
343
+ * Falls back to the hardcoded FALLBACK_VERSION constant if not found.
344
+ */
345
+ declare const MARKFORGE_VERSION: string;
346
+ /** @deprecated Use MARKFORGE_VERSION directly. */
342
347
  declare function getMarkforgeVersion(fromDir?: string): string;
343
348
 
344
349
  export { type CompilationResult, DEFAULT_CONFIG, type DocumentOrientation, type FrontmatterMetadata, type GeneratedOutputFile, type HeaderFooterItem, MARKFORGE_VERSION, type MarkdownASTNode, type MarkdownInlineSpan, type MarkdownNodeType, type MarkforgeConfig, type MarkforgeFormat, type MarkforgeTheme, type PageMargins, type PaperSize, type ParsedMarkdownDocument, type ResolvedImage, SYNTAX_COLORS, type SyntaxToken, THEMES, THEME_ACADEMIC, THEME_DEFAULT, type WatermarkOptions, buildDocxDocument, buildHtmlDocument, buildPdfDocument, compileMarkdown, defineConfig, escapeHtml, findChromeExecutable, formatServerTimestamp, getMarkforgeVersion, getMimeType, highlightCodeToHtml, injectPagedMediaStyles, inlineHtmlImages, loadConfig, compileMarkdown as markforge, parseInlineSpans, parseMarginToTwip, parseMarkdownDocument, renderInlinesToHtml, renderMermaidToPng, resolveImage, slugify, tokenizeCodeLine };
package/dist/index.d.ts CHANGED
@@ -338,7 +338,12 @@ declare function loadConfig(customPath?: string, cwd?: string): Promise<{
338
338
  configPath: string | null;
339
339
  }>;
340
340
 
341
- declare const MARKFORGE_VERSION = "0.1.0";
341
+ /**
342
+ * Dynamically resolved version — reads from the nearest package.json at runtime.
343
+ * Falls back to the hardcoded FALLBACK_VERSION constant if not found.
344
+ */
345
+ declare const MARKFORGE_VERSION: string;
346
+ /** @deprecated Use MARKFORGE_VERSION directly. */
342
347
  declare function getMarkforgeVersion(fromDir?: string): string;
343
348
 
344
349
  export { type CompilationResult, DEFAULT_CONFIG, type DocumentOrientation, type FrontmatterMetadata, type GeneratedOutputFile, type HeaderFooterItem, MARKFORGE_VERSION, type MarkdownASTNode, type MarkdownInlineSpan, type MarkdownNodeType, type MarkforgeConfig, type MarkforgeFormat, type MarkforgeTheme, type PageMargins, type PaperSize, type ParsedMarkdownDocument, type ResolvedImage, SYNTAX_COLORS, type SyntaxToken, THEMES, THEME_ACADEMIC, THEME_DEFAULT, type WatermarkOptions, buildDocxDocument, buildHtmlDocument, buildPdfDocument, compileMarkdown, defineConfig, escapeHtml, findChromeExecutable, formatServerTimestamp, getMarkforgeVersion, getMimeType, highlightCodeToHtml, injectPagedMediaStyles, inlineHtmlImages, loadConfig, compileMarkdown as markforge, parseInlineSpans, parseMarginToTwip, parseMarkdownDocument, renderInlinesToHtml, renderMermaidToPng, resolveImage, slugify, tokenizeCodeLine };
package/dist/index.js CHANGED
@@ -1290,6 +1290,10 @@ function findChromeExecutable() {
1290
1290
  if (process.env.PUPPETEER_EXECUTABLE_PATH && fs3.existsSync(process.env.PUPPETEER_EXECUTABLE_PATH)) {
1291
1291
  return process.env.PUPPETEER_EXECUTABLE_PATH;
1292
1292
  }
1293
+ const isWin = process.platform === "win32";
1294
+ const winLocalAppData = process.env.LOCALAPPDATA ?? "";
1295
+ const winProgramFiles = process.env.PROGRAMFILES ?? "C:\\Program Files";
1296
+ const winProgramFilesX86 = process.env["PROGRAMFILES(X86)"] ?? "C:\\Program Files (x86)";
1293
1297
  const candidates = [
1294
1298
  // Linux
1295
1299
  "/usr/bin/google-chrome",
@@ -1297,13 +1301,23 @@ function findChromeExecutable() {
1297
1301
  "/usr/bin/chromium",
1298
1302
  "/usr/bin/chromium-browser",
1299
1303
  "/snap/bin/chromium",
1304
+ "/usr/bin/microsoft-edge",
1305
+ "/usr/bin/microsoft-edge-stable",
1300
1306
  // macOS
1301
1307
  "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
1302
1308
  "/Applications/Chromium.app/Contents/MacOS/Chromium",
1303
- // Windows
1304
- "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
1305
- "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
1306
- ];
1309
+ "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
1310
+ // Windows — Program Files (env-var resolved)
1311
+ `${winProgramFiles}\\Google\\Chrome\\Application\\chrome.exe`,
1312
+ `${winProgramFilesX86}\\Google\\Chrome\\Application\\chrome.exe`,
1313
+ `${winLocalAppData}\\Google\\Chrome\\Application\\chrome.exe`,
1314
+ // Windows — Microsoft Edge (ships with Windows 10/11)
1315
+ `${winProgramFiles}\\Microsoft\\Edge\\Application\\msedge.exe`,
1316
+ `${winProgramFilesX86}\\Microsoft\\Edge\\Application\\msedge.exe`,
1317
+ `${winLocalAppData}\\Microsoft\\Edge\\Application\\msedge.exe`,
1318
+ // Windows — Chromium
1319
+ `${winLocalAppData}\\Chromium\\Application\\chrome.exe`
1320
+ ].filter(Boolean);
1307
1321
  for (const candidate of candidates) {
1308
1322
  try {
1309
1323
  if (fs3.existsSync(candidate)) {
@@ -1313,9 +1327,9 @@ function findChromeExecutable() {
1313
1327
  }
1314
1328
  }
1315
1329
  try {
1316
- const isWin = process.platform === "win32";
1317
1330
  const cmd = isWin ? "where" : "which";
1318
- for (const name of ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]) {
1331
+ const names = isWin ? ["chrome", "msedge", "google-chrome", "chromium", "chromium-browser"] : ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser", "microsoft-edge"];
1332
+ for (const name of names) {
1319
1333
  const res = (0, import_node_child_process.spawnSync)(cmd, [name], { encoding: "utf-8" });
1320
1334
  if (res.status === 0 && res.stdout.trim()) {
1321
1335
  const binPath = res.stdout.split(/\r?\n/)[0].trim();
@@ -1525,7 +1539,9 @@ ${mermaidCode}
1525
1539
  "--disable-gpu",
1526
1540
  "--no-sandbox",
1527
1541
  "--disable-setuid-sandbox",
1542
+ "--disable-software-rasterizer",
1528
1543
  "--window-size=1200,800",
1544
+ "--virtual-time-budget=5000",
1529
1545
  `--screenshot=${tmpScreenshot}`,
1530
1546
  tmpHtml
1531
1547
  ],
@@ -2421,11 +2437,11 @@ function defineConfig(config) {
2421
2437
  // src/version.ts
2422
2438
  var fs7 = __toESM(require("fs"));
2423
2439
  var path7 = __toESM(require("path"));
2424
- var MARKFORGE_VERSION = "0.1.0";
2425
- function getMarkforgeVersion(fromDir = __dirname) {
2426
- try {
2427
- let currentDir = fromDir;
2428
- for (let i = 0; i < 5; i++) {
2440
+ var FALLBACK_VERSION = "0.2.1";
2441
+ function readVersionFromPackageJson(fromDir) {
2442
+ let currentDir = fromDir;
2443
+ for (let i = 0; i < 6; i++) {
2444
+ try {
2429
2445
  const pkgJsonPath = path7.join(currentDir, "package.json");
2430
2446
  if (fs7.existsSync(pkgJsonPath)) {
2431
2447
  const pkg = JSON.parse(fs7.readFileSync(pkgJsonPath, "utf-8"));
@@ -2433,13 +2449,20 @@ function getMarkforgeVersion(fromDir = __dirname) {
2433
2449
  return pkg.version;
2434
2450
  }
2435
2451
  }
2436
- const parentDir = path7.dirname(currentDir);
2437
- if (parentDir === currentDir) break;
2438
- currentDir = parentDir;
2452
+ } catch {
2439
2453
  }
2440
- } catch {
2454
+ const parentDir = path7.dirname(currentDir);
2455
+ if (parentDir === currentDir) break;
2456
+ currentDir = parentDir;
2441
2457
  }
2442
- return MARKFORGE_VERSION;
2458
+ return FALLBACK_VERSION;
2459
+ }
2460
+ var MARKFORGE_VERSION = readVersionFromPackageJson(
2461
+ // __dirname points to dist/ after build; walk up to find the package root
2462
+ typeof __dirname !== "undefined" ? __dirname : process.cwd()
2463
+ );
2464
+ function getMarkforgeVersion(fromDir = process.cwd()) {
2465
+ return readVersionFromPackageJson(fromDir);
2443
2466
  }
2444
2467
  // Annotate the CommonJS export names for ESM import in node:
2445
2468
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -1255,6 +1255,10 @@ function findChromeExecutable() {
1255
1255
  if (process.env.PUPPETEER_EXECUTABLE_PATH && fs3.existsSync(process.env.PUPPETEER_EXECUTABLE_PATH)) {
1256
1256
  return process.env.PUPPETEER_EXECUTABLE_PATH;
1257
1257
  }
1258
+ const isWin = process.platform === "win32";
1259
+ const winLocalAppData = process.env.LOCALAPPDATA ?? "";
1260
+ const winProgramFiles = process.env.PROGRAMFILES ?? "C:\\Program Files";
1261
+ const winProgramFilesX86 = process.env["PROGRAMFILES(X86)"] ?? "C:\\Program Files (x86)";
1258
1262
  const candidates = [
1259
1263
  // Linux
1260
1264
  "/usr/bin/google-chrome",
@@ -1262,13 +1266,23 @@ function findChromeExecutable() {
1262
1266
  "/usr/bin/chromium",
1263
1267
  "/usr/bin/chromium-browser",
1264
1268
  "/snap/bin/chromium",
1269
+ "/usr/bin/microsoft-edge",
1270
+ "/usr/bin/microsoft-edge-stable",
1265
1271
  // macOS
1266
1272
  "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
1267
1273
  "/Applications/Chromium.app/Contents/MacOS/Chromium",
1268
- // Windows
1269
- "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
1270
- "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
1271
- ];
1274
+ "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
1275
+ // Windows — Program Files (env-var resolved)
1276
+ `${winProgramFiles}\\Google\\Chrome\\Application\\chrome.exe`,
1277
+ `${winProgramFilesX86}\\Google\\Chrome\\Application\\chrome.exe`,
1278
+ `${winLocalAppData}\\Google\\Chrome\\Application\\chrome.exe`,
1279
+ // Windows — Microsoft Edge (ships with Windows 10/11)
1280
+ `${winProgramFiles}\\Microsoft\\Edge\\Application\\msedge.exe`,
1281
+ `${winProgramFilesX86}\\Microsoft\\Edge\\Application\\msedge.exe`,
1282
+ `${winLocalAppData}\\Microsoft\\Edge\\Application\\msedge.exe`,
1283
+ // Windows — Chromium
1284
+ `${winLocalAppData}\\Chromium\\Application\\chrome.exe`
1285
+ ].filter(Boolean);
1272
1286
  for (const candidate of candidates) {
1273
1287
  try {
1274
1288
  if (fs3.existsSync(candidate)) {
@@ -1278,9 +1292,9 @@ function findChromeExecutable() {
1278
1292
  }
1279
1293
  }
1280
1294
  try {
1281
- const isWin = process.platform === "win32";
1282
1295
  const cmd = isWin ? "where" : "which";
1283
- for (const name of ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]) {
1296
+ const names = isWin ? ["chrome", "msedge", "google-chrome", "chromium", "chromium-browser"] : ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser", "microsoft-edge"];
1297
+ for (const name of names) {
1284
1298
  const res = spawnSync(cmd, [name], { encoding: "utf-8" });
1285
1299
  if (res.status === 0 && res.stdout.trim()) {
1286
1300
  const binPath = res.stdout.split(/\r?\n/)[0].trim();
@@ -1490,7 +1504,9 @@ ${mermaidCode}
1490
1504
  "--disable-gpu",
1491
1505
  "--no-sandbox",
1492
1506
  "--disable-setuid-sandbox",
1507
+ "--disable-software-rasterizer",
1493
1508
  "--window-size=1200,800",
1509
+ "--virtual-time-budget=5000",
1494
1510
  `--screenshot=${tmpScreenshot}`,
1495
1511
  tmpHtml
1496
1512
  ],
@@ -2386,11 +2402,11 @@ function defineConfig(config) {
2386
2402
  // src/version.ts
2387
2403
  import * as fs7 from "fs";
2388
2404
  import * as path7 from "path";
2389
- var MARKFORGE_VERSION = "0.1.0";
2390
- function getMarkforgeVersion(fromDir = __dirname) {
2391
- try {
2392
- let currentDir = fromDir;
2393
- for (let i = 0; i < 5; i++) {
2405
+ var FALLBACK_VERSION = "0.2.1";
2406
+ function readVersionFromPackageJson(fromDir) {
2407
+ let currentDir = fromDir;
2408
+ for (let i = 0; i < 6; i++) {
2409
+ try {
2394
2410
  const pkgJsonPath = path7.join(currentDir, "package.json");
2395
2411
  if (fs7.existsSync(pkgJsonPath)) {
2396
2412
  const pkg = JSON.parse(fs7.readFileSync(pkgJsonPath, "utf-8"));
@@ -2398,13 +2414,20 @@ function getMarkforgeVersion(fromDir = __dirname) {
2398
2414
  return pkg.version;
2399
2415
  }
2400
2416
  }
2401
- const parentDir = path7.dirname(currentDir);
2402
- if (parentDir === currentDir) break;
2403
- currentDir = parentDir;
2417
+ } catch {
2404
2418
  }
2405
- } catch {
2419
+ const parentDir = path7.dirname(currentDir);
2420
+ if (parentDir === currentDir) break;
2421
+ currentDir = parentDir;
2406
2422
  }
2407
- return MARKFORGE_VERSION;
2423
+ return FALLBACK_VERSION;
2424
+ }
2425
+ var MARKFORGE_VERSION = readVersionFromPackageJson(
2426
+ // __dirname points to dist/ after build; walk up to find the package root
2427
+ typeof __dirname !== "undefined" ? __dirname : process.cwd()
2428
+ );
2429
+ function getMarkforgeVersion(fromDir = process.cwd()) {
2430
+ return readVersionFromPackageJson(fromDir);
2408
2431
  }
2409
2432
  export {
2410
2433
  DEFAULT_CONFIG,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masumdev/markforge",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Modern, high-performance Markdown & MDX multi-format document publishing engine and CLI (DOCX, PDF, HTML, and Images) with embedded HTML/CSS, image inliner, and Ink terminal UI.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -76,4 +76,4 @@
76
76
  "publishConfig": {
77
77
  "access": "public"
78
78
  }
79
- }
79
+ }