@masumdev/markforge 0.2.2 → 0.2.3
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/App-DKCNXX3Z.mjs +2437 -0
- package/dist/chunk-ASXSHC6H.mjs +120 -0
- package/dist/chunk-NGC2ZAWZ.mjs +69 -0
- package/dist/chunk-YZHGBG4N.mjs +19 -0
- package/dist/cli.mjs +46 -2551
- package/dist/index.js +64 -13
- package/dist/index.mjs +63 -13
- package/dist/loadConfig-T4ZV6YY2.mjs +18 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
try {
|
|
2
|
+
if (typeof globalThis !== "undefined" && (!globalThis.localStorage || typeof globalThis.localStorage.getItem !== "function")) {
|
|
3
|
+
Object.defineProperty(globalThis, "localStorage", {
|
|
4
|
+
value: { getItem: () => null, setItem: () => {}, removeItem: () => {}, clear: () => {}, key: () => null, length: 0 },
|
|
5
|
+
configurable: true, writable: true,
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
} catch {}
|
|
1
9
|
"use strict";
|
|
2
10
|
var __create = Object.create;
|
|
3
11
|
var __defProp = Object.defineProperty;
|
|
@@ -847,11 +855,13 @@ var import_node_child_process2 = require("child_process");
|
|
|
847
855
|
var fs4 = __toESM(require("fs"));
|
|
848
856
|
var os2 = __toESM(require("os"));
|
|
849
857
|
var path4 = __toESM(require("path"));
|
|
858
|
+
var import_node_url2 = require("url");
|
|
850
859
|
|
|
851
860
|
// src/core/pdf/pdfBuilder.ts
|
|
852
861
|
var fs3 = __toESM(require("fs"));
|
|
853
862
|
var path3 = __toESM(require("path"));
|
|
854
863
|
var os = __toESM(require("os"));
|
|
864
|
+
var import_node_url = require("url");
|
|
855
865
|
var import_node_child_process = require("child_process");
|
|
856
866
|
|
|
857
867
|
// src/core/html/htmlBuilder.ts
|
|
@@ -1303,11 +1313,13 @@ function findChromeExecutable() {
|
|
|
1303
1313
|
"/snap/bin/chromium",
|
|
1304
1314
|
"/usr/bin/microsoft-edge",
|
|
1305
1315
|
"/usr/bin/microsoft-edge-stable",
|
|
1316
|
+
"/usr/bin/brave-browser",
|
|
1306
1317
|
// macOS
|
|
1307
1318
|
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
|
1308
1319
|
"/Applications/Chromium.app/Contents/MacOS/Chromium",
|
|
1309
1320
|
"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
|
|
1310
|
-
|
|
1321
|
+
"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser",
|
|
1322
|
+
// Windows — Google Chrome
|
|
1311
1323
|
`${winProgramFiles}\\Google\\Chrome\\Application\\chrome.exe`,
|
|
1312
1324
|
`${winProgramFilesX86}\\Google\\Chrome\\Application\\chrome.exe`,
|
|
1313
1325
|
`${winLocalAppData}\\Google\\Chrome\\Application\\chrome.exe`,
|
|
@@ -1315,6 +1327,10 @@ function findChromeExecutable() {
|
|
|
1315
1327
|
`${winProgramFiles}\\Microsoft\\Edge\\Application\\msedge.exe`,
|
|
1316
1328
|
`${winProgramFilesX86}\\Microsoft\\Edge\\Application\\msedge.exe`,
|
|
1317
1329
|
`${winLocalAppData}\\Microsoft\\Edge\\Application\\msedge.exe`,
|
|
1330
|
+
// Windows — Brave Browser
|
|
1331
|
+
`${winProgramFiles}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe`,
|
|
1332
|
+
`${winProgramFilesX86}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe`,
|
|
1333
|
+
`${winLocalAppData}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe`,
|
|
1318
1334
|
// Windows — Chromium
|
|
1319
1335
|
`${winLocalAppData}\\Chromium\\Application\\chrome.exe`
|
|
1320
1336
|
].filter(Boolean);
|
|
@@ -1328,7 +1344,7 @@ function findChromeExecutable() {
|
|
|
1328
1344
|
}
|
|
1329
1345
|
try {
|
|
1330
1346
|
const cmd = isWin ? "where" : "which";
|
|
1331
|
-
const names = isWin ? ["chrome", "msedge", "google-chrome", "chromium", "chromium-browser"] : ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser", "microsoft-edge"];
|
|
1347
|
+
const names = isWin ? ["chrome", "msedge", "brave", "google-chrome", "chromium", "chromium-browser"] : ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser", "microsoft-edge", "brave-browser"];
|
|
1332
1348
|
for (const name of names) {
|
|
1333
1349
|
const res = (0, import_node_child_process.spawnSync)(cmd, [name], { encoding: "utf-8" });
|
|
1334
1350
|
if (res.status === 0 && res.stdout.trim()) {
|
|
@@ -1433,6 +1449,7 @@ async function buildPdfDocument(doc, config, baseDir = process.cwd()) {
|
|
|
1433
1449
|
const tmpPdf = path3.join(tmpDir, `markforge_${tmpId}.pdf`);
|
|
1434
1450
|
try {
|
|
1435
1451
|
fs3.writeFileSync(tmpHtml, pagedHtml, "utf-8");
|
|
1452
|
+
const fileUrl = (0, import_node_url.pathToFileURL)(tmpHtml).href;
|
|
1436
1453
|
let res = (0, import_node_child_process.spawnSync)(
|
|
1437
1454
|
chromePath,
|
|
1438
1455
|
[
|
|
@@ -1441,12 +1458,13 @@ async function buildPdfDocument(doc, config, baseDir = process.cwd()) {
|
|
|
1441
1458
|
"--no-sandbox",
|
|
1442
1459
|
"--disable-setuid-sandbox",
|
|
1443
1460
|
"--allow-file-access-from-files",
|
|
1461
|
+
"--disable-web-security",
|
|
1444
1462
|
"--force-color-profile=srgb",
|
|
1445
1463
|
"--run-all-compositor-stages-before-draw",
|
|
1446
1464
|
"--virtual-time-budget=8000",
|
|
1447
1465
|
"--no-pdf-header-footer",
|
|
1448
1466
|
`--print-to-pdf=${tmpPdf}`,
|
|
1449
|
-
|
|
1467
|
+
fileUrl
|
|
1450
1468
|
],
|
|
1451
1469
|
{ timeout: 3e4 }
|
|
1452
1470
|
);
|
|
@@ -1459,10 +1477,11 @@ async function buildPdfDocument(doc, config, baseDir = process.cwd()) {
|
|
|
1459
1477
|
"--no-sandbox",
|
|
1460
1478
|
"--disable-setuid-sandbox",
|
|
1461
1479
|
"--allow-file-access-from-files",
|
|
1480
|
+
"--disable-web-security",
|
|
1462
1481
|
"--force-color-profile=srgb",
|
|
1463
1482
|
"--no-pdf-header-footer",
|
|
1464
1483
|
`--print-to-pdf=${tmpPdf}`,
|
|
1465
|
-
|
|
1484
|
+
fileUrl
|
|
1466
1485
|
],
|
|
1467
1486
|
{ timeout: 3e4 }
|
|
1468
1487
|
);
|
|
@@ -1532,6 +1551,7 @@ ${mermaidCode}
|
|
|
1532
1551
|
</html>`;
|
|
1533
1552
|
try {
|
|
1534
1553
|
fs4.writeFileSync(tmpHtml, htmlContent, "utf-8");
|
|
1554
|
+
const fileUrl = (0, import_node_url2.pathToFileURL)(tmpHtml).href;
|
|
1535
1555
|
const res = (0, import_node_child_process2.spawnSync)(
|
|
1536
1556
|
chromePath,
|
|
1537
1557
|
[
|
|
@@ -1539,11 +1559,13 @@ ${mermaidCode}
|
|
|
1539
1559
|
"--disable-gpu",
|
|
1540
1560
|
"--no-sandbox",
|
|
1541
1561
|
"--disable-setuid-sandbox",
|
|
1562
|
+
"--allow-file-access-from-files",
|
|
1563
|
+
"--disable-web-security",
|
|
1542
1564
|
"--disable-software-rasterizer",
|
|
1543
1565
|
"--window-size=1200,800",
|
|
1544
1566
|
"--virtual-time-budget=5000",
|
|
1545
1567
|
`--screenshot=${tmpScreenshot}`,
|
|
1546
|
-
|
|
1568
|
+
fileUrl
|
|
1547
1569
|
],
|
|
1548
1570
|
{ timeout: 15e3 }
|
|
1549
1571
|
);
|
|
@@ -2237,7 +2259,7 @@ async function buildDocxDocument(doc, config, baseDir = process.cwd()) {
|
|
|
2237
2259
|
// src/config/loadConfig.ts
|
|
2238
2260
|
var fs5 = __toESM(require("fs"));
|
|
2239
2261
|
var path5 = __toESM(require("path"));
|
|
2240
|
-
var
|
|
2262
|
+
var import_node_url3 = require("url");
|
|
2241
2263
|
var YAML = __toESM(require("yaml"));
|
|
2242
2264
|
var DEFAULT_CONFIG_FILENAMES = [
|
|
2243
2265
|
"markforge.config.json",
|
|
@@ -2312,7 +2334,7 @@ async function loadConfig(customPath, cwd = process.cwd()) {
|
|
|
2312
2334
|
userConfig = YAML.parse(raw);
|
|
2313
2335
|
} else if (ext === ".ts" || ext === ".js" || ext === ".mjs" || ext === ".cjs") {
|
|
2314
2336
|
try {
|
|
2315
|
-
const fileUrl = (0,
|
|
2337
|
+
const fileUrl = (0, import_node_url3.pathToFileURL)(resolvedPath).href;
|
|
2316
2338
|
const mod = await import(fileUrl);
|
|
2317
2339
|
userConfig = mod.default || mod;
|
|
2318
2340
|
} catch {
|
|
@@ -2437,7 +2459,29 @@ function defineConfig(config) {
|
|
|
2437
2459
|
// src/version.ts
|
|
2438
2460
|
var fs7 = __toESM(require("fs"));
|
|
2439
2461
|
var path7 = __toESM(require("path"));
|
|
2440
|
-
var
|
|
2462
|
+
var import_node_url4 = require("url");
|
|
2463
|
+
var import_meta = {};
|
|
2464
|
+
try {
|
|
2465
|
+
if (typeof globalThis !== "undefined" && (!globalThis.localStorage || typeof globalThis.localStorage.getItem !== "function")) {
|
|
2466
|
+
Object.defineProperty(globalThis, "localStorage", {
|
|
2467
|
+
value: {
|
|
2468
|
+
getItem: () => null,
|
|
2469
|
+
setItem: () => {
|
|
2470
|
+
},
|
|
2471
|
+
removeItem: () => {
|
|
2472
|
+
},
|
|
2473
|
+
clear: () => {
|
|
2474
|
+
},
|
|
2475
|
+
key: () => null,
|
|
2476
|
+
length: 0
|
|
2477
|
+
},
|
|
2478
|
+
configurable: true,
|
|
2479
|
+
writable: true
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
} catch {
|
|
2483
|
+
}
|
|
2484
|
+
var FALLBACK_VERSION = "0.2.2";
|
|
2441
2485
|
function readVersionFromPackageJson(fromDir) {
|
|
2442
2486
|
let currentDir = fromDir;
|
|
2443
2487
|
for (let i = 0; i < 6; i++) {
|
|
@@ -2457,11 +2501,18 @@ function readVersionFromPackageJson(fromDir) {
|
|
|
2457
2501
|
}
|
|
2458
2502
|
return FALLBACK_VERSION;
|
|
2459
2503
|
}
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2504
|
+
function getPackageDir() {
|
|
2505
|
+
if (typeof __dirname !== "undefined") {
|
|
2506
|
+
return __dirname;
|
|
2507
|
+
}
|
|
2508
|
+
try {
|
|
2509
|
+
return path7.dirname((0, import_node_url4.fileURLToPath)(import_meta.url));
|
|
2510
|
+
} catch {
|
|
2511
|
+
return process.cwd();
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
var MARKFORGE_VERSION = readVersionFromPackageJson(getPackageDir());
|
|
2515
|
+
function getMarkforgeVersion(fromDir = getPackageDir()) {
|
|
2465
2516
|
return readVersionFromPackageJson(fromDir);
|
|
2466
2517
|
}
|
|
2467
2518
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
try {
|
|
2
|
+
if (typeof globalThis !== "undefined" && (!globalThis.localStorage || typeof globalThis.localStorage.getItem !== "function")) {
|
|
3
|
+
Object.defineProperty(globalThis, "localStorage", {
|
|
4
|
+
value: { getItem: () => null, setItem: () => {}, removeItem: () => {}, clear: () => {}, key: () => null, length: 0 },
|
|
5
|
+
configurable: true, writable: true,
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
} catch {}
|
|
1
9
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
10
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
11
|
}) : x)(function(x) {
|
|
@@ -812,11 +820,13 @@ import { spawnSync as spawnSync2 } from "child_process";
|
|
|
812
820
|
import * as fs4 from "fs";
|
|
813
821
|
import * as os2 from "os";
|
|
814
822
|
import * as path4 from "path";
|
|
823
|
+
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
815
824
|
|
|
816
825
|
// src/core/pdf/pdfBuilder.ts
|
|
817
826
|
import * as fs3 from "fs";
|
|
818
827
|
import * as path3 from "path";
|
|
819
828
|
import * as os from "os";
|
|
829
|
+
import { pathToFileURL } from "url";
|
|
820
830
|
import { spawnSync } from "child_process";
|
|
821
831
|
|
|
822
832
|
// src/core/html/htmlBuilder.ts
|
|
@@ -1268,11 +1278,13 @@ function findChromeExecutable() {
|
|
|
1268
1278
|
"/snap/bin/chromium",
|
|
1269
1279
|
"/usr/bin/microsoft-edge",
|
|
1270
1280
|
"/usr/bin/microsoft-edge-stable",
|
|
1281
|
+
"/usr/bin/brave-browser",
|
|
1271
1282
|
// macOS
|
|
1272
1283
|
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
|
1273
1284
|
"/Applications/Chromium.app/Contents/MacOS/Chromium",
|
|
1274
1285
|
"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
|
|
1275
|
-
|
|
1286
|
+
"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser",
|
|
1287
|
+
// Windows — Google Chrome
|
|
1276
1288
|
`${winProgramFiles}\\Google\\Chrome\\Application\\chrome.exe`,
|
|
1277
1289
|
`${winProgramFilesX86}\\Google\\Chrome\\Application\\chrome.exe`,
|
|
1278
1290
|
`${winLocalAppData}\\Google\\Chrome\\Application\\chrome.exe`,
|
|
@@ -1280,6 +1292,10 @@ function findChromeExecutable() {
|
|
|
1280
1292
|
`${winProgramFiles}\\Microsoft\\Edge\\Application\\msedge.exe`,
|
|
1281
1293
|
`${winProgramFilesX86}\\Microsoft\\Edge\\Application\\msedge.exe`,
|
|
1282
1294
|
`${winLocalAppData}\\Microsoft\\Edge\\Application\\msedge.exe`,
|
|
1295
|
+
// Windows — Brave Browser
|
|
1296
|
+
`${winProgramFiles}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe`,
|
|
1297
|
+
`${winProgramFilesX86}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe`,
|
|
1298
|
+
`${winLocalAppData}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe`,
|
|
1283
1299
|
// Windows — Chromium
|
|
1284
1300
|
`${winLocalAppData}\\Chromium\\Application\\chrome.exe`
|
|
1285
1301
|
].filter(Boolean);
|
|
@@ -1293,7 +1309,7 @@ function findChromeExecutable() {
|
|
|
1293
1309
|
}
|
|
1294
1310
|
try {
|
|
1295
1311
|
const cmd = isWin ? "where" : "which";
|
|
1296
|
-
const names = isWin ? ["chrome", "msedge", "google-chrome", "chromium", "chromium-browser"] : ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser", "microsoft-edge"];
|
|
1312
|
+
const names = isWin ? ["chrome", "msedge", "brave", "google-chrome", "chromium", "chromium-browser"] : ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser", "microsoft-edge", "brave-browser"];
|
|
1297
1313
|
for (const name of names) {
|
|
1298
1314
|
const res = spawnSync(cmd, [name], { encoding: "utf-8" });
|
|
1299
1315
|
if (res.status === 0 && res.stdout.trim()) {
|
|
@@ -1398,6 +1414,7 @@ async function buildPdfDocument(doc, config, baseDir = process.cwd()) {
|
|
|
1398
1414
|
const tmpPdf = path3.join(tmpDir, `markforge_${tmpId}.pdf`);
|
|
1399
1415
|
try {
|
|
1400
1416
|
fs3.writeFileSync(tmpHtml, pagedHtml, "utf-8");
|
|
1417
|
+
const fileUrl = pathToFileURL(tmpHtml).href;
|
|
1401
1418
|
let res = spawnSync(
|
|
1402
1419
|
chromePath,
|
|
1403
1420
|
[
|
|
@@ -1406,12 +1423,13 @@ async function buildPdfDocument(doc, config, baseDir = process.cwd()) {
|
|
|
1406
1423
|
"--no-sandbox",
|
|
1407
1424
|
"--disable-setuid-sandbox",
|
|
1408
1425
|
"--allow-file-access-from-files",
|
|
1426
|
+
"--disable-web-security",
|
|
1409
1427
|
"--force-color-profile=srgb",
|
|
1410
1428
|
"--run-all-compositor-stages-before-draw",
|
|
1411
1429
|
"--virtual-time-budget=8000",
|
|
1412
1430
|
"--no-pdf-header-footer",
|
|
1413
1431
|
`--print-to-pdf=${tmpPdf}`,
|
|
1414
|
-
|
|
1432
|
+
fileUrl
|
|
1415
1433
|
],
|
|
1416
1434
|
{ timeout: 3e4 }
|
|
1417
1435
|
);
|
|
@@ -1424,10 +1442,11 @@ async function buildPdfDocument(doc, config, baseDir = process.cwd()) {
|
|
|
1424
1442
|
"--no-sandbox",
|
|
1425
1443
|
"--disable-setuid-sandbox",
|
|
1426
1444
|
"--allow-file-access-from-files",
|
|
1445
|
+
"--disable-web-security",
|
|
1427
1446
|
"--force-color-profile=srgb",
|
|
1428
1447
|
"--no-pdf-header-footer",
|
|
1429
1448
|
`--print-to-pdf=${tmpPdf}`,
|
|
1430
|
-
|
|
1449
|
+
fileUrl
|
|
1431
1450
|
],
|
|
1432
1451
|
{ timeout: 3e4 }
|
|
1433
1452
|
);
|
|
@@ -1497,6 +1516,7 @@ ${mermaidCode}
|
|
|
1497
1516
|
</html>`;
|
|
1498
1517
|
try {
|
|
1499
1518
|
fs4.writeFileSync(tmpHtml, htmlContent, "utf-8");
|
|
1519
|
+
const fileUrl = pathToFileURL2(tmpHtml).href;
|
|
1500
1520
|
const res = spawnSync2(
|
|
1501
1521
|
chromePath,
|
|
1502
1522
|
[
|
|
@@ -1504,11 +1524,13 @@ ${mermaidCode}
|
|
|
1504
1524
|
"--disable-gpu",
|
|
1505
1525
|
"--no-sandbox",
|
|
1506
1526
|
"--disable-setuid-sandbox",
|
|
1527
|
+
"--allow-file-access-from-files",
|
|
1528
|
+
"--disable-web-security",
|
|
1507
1529
|
"--disable-software-rasterizer",
|
|
1508
1530
|
"--window-size=1200,800",
|
|
1509
1531
|
"--virtual-time-budget=5000",
|
|
1510
1532
|
`--screenshot=${tmpScreenshot}`,
|
|
1511
|
-
|
|
1533
|
+
fileUrl
|
|
1512
1534
|
],
|
|
1513
1535
|
{ timeout: 15e3 }
|
|
1514
1536
|
);
|
|
@@ -2202,7 +2224,7 @@ async function buildDocxDocument(doc, config, baseDir = process.cwd()) {
|
|
|
2202
2224
|
// src/config/loadConfig.ts
|
|
2203
2225
|
import * as fs5 from "fs";
|
|
2204
2226
|
import * as path5 from "path";
|
|
2205
|
-
import { pathToFileURL } from "url";
|
|
2227
|
+
import { pathToFileURL as pathToFileURL3 } from "url";
|
|
2206
2228
|
import * as YAML from "yaml";
|
|
2207
2229
|
var DEFAULT_CONFIG_FILENAMES = [
|
|
2208
2230
|
"markforge.config.json",
|
|
@@ -2277,7 +2299,7 @@ async function loadConfig(customPath, cwd = process.cwd()) {
|
|
|
2277
2299
|
userConfig = YAML.parse(raw);
|
|
2278
2300
|
} else if (ext === ".ts" || ext === ".js" || ext === ".mjs" || ext === ".cjs") {
|
|
2279
2301
|
try {
|
|
2280
|
-
const fileUrl =
|
|
2302
|
+
const fileUrl = pathToFileURL3(resolvedPath).href;
|
|
2281
2303
|
const mod = await import(fileUrl);
|
|
2282
2304
|
userConfig = mod.default || mod;
|
|
2283
2305
|
} catch {
|
|
@@ -2402,7 +2424,28 @@ function defineConfig(config) {
|
|
|
2402
2424
|
// src/version.ts
|
|
2403
2425
|
import * as fs7 from "fs";
|
|
2404
2426
|
import * as path7 from "path";
|
|
2405
|
-
|
|
2427
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
2428
|
+
try {
|
|
2429
|
+
if (typeof globalThis !== "undefined" && (!globalThis.localStorage || typeof globalThis.localStorage.getItem !== "function")) {
|
|
2430
|
+
Object.defineProperty(globalThis, "localStorage", {
|
|
2431
|
+
value: {
|
|
2432
|
+
getItem: () => null,
|
|
2433
|
+
setItem: () => {
|
|
2434
|
+
},
|
|
2435
|
+
removeItem: () => {
|
|
2436
|
+
},
|
|
2437
|
+
clear: () => {
|
|
2438
|
+
},
|
|
2439
|
+
key: () => null,
|
|
2440
|
+
length: 0
|
|
2441
|
+
},
|
|
2442
|
+
configurable: true,
|
|
2443
|
+
writable: true
|
|
2444
|
+
});
|
|
2445
|
+
}
|
|
2446
|
+
} catch {
|
|
2447
|
+
}
|
|
2448
|
+
var FALLBACK_VERSION = "0.2.2";
|
|
2406
2449
|
function readVersionFromPackageJson(fromDir) {
|
|
2407
2450
|
let currentDir = fromDir;
|
|
2408
2451
|
for (let i = 0; i < 6; i++) {
|
|
@@ -2422,11 +2465,18 @@ function readVersionFromPackageJson(fromDir) {
|
|
|
2422
2465
|
}
|
|
2423
2466
|
return FALLBACK_VERSION;
|
|
2424
2467
|
}
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2468
|
+
function getPackageDir() {
|
|
2469
|
+
if (typeof __dirname !== "undefined") {
|
|
2470
|
+
return __dirname;
|
|
2471
|
+
}
|
|
2472
|
+
try {
|
|
2473
|
+
return path7.dirname(fileURLToPath2(import.meta.url));
|
|
2474
|
+
} catch {
|
|
2475
|
+
return process.cwd();
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
var MARKFORGE_VERSION = readVersionFromPackageJson(getPackageDir());
|
|
2479
|
+
function getMarkforgeVersion(fromDir = getPackageDir()) {
|
|
2430
2480
|
return readVersionFromPackageJson(fromDir);
|
|
2431
2481
|
}
|
|
2432
2482
|
export {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
try {
|
|
3
|
+
if (typeof globalThis !== "undefined" && (!globalThis.localStorage || typeof globalThis.localStorage.getItem !== "function")) {
|
|
4
|
+
Object.defineProperty(globalThis, "localStorage", {
|
|
5
|
+
value: { getItem: () => null, setItem: () => {}, removeItem: () => {}, clear: () => {}, key: () => null, length: 0 },
|
|
6
|
+
configurable: true, writable: true,
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
} catch {}
|
|
10
|
+
import {
|
|
11
|
+
DEFAULT_CONFIG,
|
|
12
|
+
loadConfig
|
|
13
|
+
} from "./chunk-ASXSHC6H.mjs";
|
|
14
|
+
import "./chunk-YZHGBG4N.mjs";
|
|
15
|
+
export {
|
|
16
|
+
DEFAULT_CONFIG,
|
|
17
|
+
loadConfig
|
|
18
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@masumdev/markforge",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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",
|