@markdown-viewer/documd 5.2.1 → 5.2.2
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/documd.js +14 -2
- package/package.json +4 -1
package/documd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
4
4
|
import crypto from 'node:crypto';
|
|
5
5
|
import fs from 'node:fs/promises';
|
|
6
6
|
import http from 'node:http';
|
|
@@ -1046,5 +1046,17 @@ async function main() {
|
|
|
1046
1046
|
}
|
|
1047
1047
|
}
|
|
1048
1048
|
|
|
1049
|
+
// Only run as a CLI entry point when this file is the invoked script.
|
|
1050
|
+
// Compare REAL paths: process.argv[1] keeps symlinks (e.g. macOS /tmp ->
|
|
1051
|
+
// /private/tmp, pnpm/yarn stores, npm link), while import.meta.url is the
|
|
1052
|
+
// resolved module path. A plain path.resolve() comparison silently skipped
|
|
1053
|
+
// main() in those layouts and the CLI exited 0 without doing anything.
|
|
1049
1054
|
const invokedPath = process.argv[1] ? path.resolve(process.argv[1]) : '';
|
|
1050
|
-
|
|
1055
|
+
let isEntry = false;
|
|
1056
|
+
try {
|
|
1057
|
+
isEntry = realpathSync(invokedPath) === realpathSync(fileURLToPath(import.meta.url));
|
|
1058
|
+
} catch {
|
|
1059
|
+
// Fall back to the plain comparison if realpath fails (e.g. missing file).
|
|
1060
|
+
isEntry = invokedPath === fileURLToPath(import.meta.url);
|
|
1061
|
+
}
|
|
1062
|
+
if (isEntry) await main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markdown-viewer/documd",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.2",
|
|
4
4
|
"description": "documd — render Markdown, diagrams and books (html / epub / docx / pdf / svg / png / drawio)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"playwright-core": "^1.62.1"
|
|
31
|
+
},
|
|
29
32
|
"files": [
|
|
30
33
|
"documd.js",
|
|
31
34
|
"browser-renderer.js",
|