markmap-cli 0.15.9-alpha.12 → 0.15.9-alpha.16
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/index.js +12 -11
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { readFile, stat, mkdir, writeFile } from "fs/promises";
|
|
2
|
-
import {
|
|
2
|
+
import { join, resolve, dirname } from "path";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import open from "open";
|
|
6
6
|
import updateNotifier from "update-notifier";
|
|
7
7
|
import { readPackageUp } from "read-package-up";
|
|
8
8
|
import { buildCSSItem, buildJSItem, defer } from "markmap-common";
|
|
9
|
-
import { Transformer
|
|
9
|
+
import { Transformer } from "markmap-lib";
|
|
10
10
|
export * from "markmap-lib";
|
|
11
|
+
import { fillTemplate, baseJsPaths } from "markmap-render";
|
|
11
12
|
import { serve } from "@hono/node-server";
|
|
12
13
|
import chokidar from "chokidar";
|
|
13
14
|
import { EventEmitter } from "events";
|
|
@@ -15,7 +16,8 @@ import { createReadStream, createWriteStream } from "fs";
|
|
|
15
16
|
import { Hono } from "hono";
|
|
16
17
|
import { Readable } from "stream";
|
|
17
18
|
import { finished } from "stream/promises";
|
|
18
|
-
const
|
|
19
|
+
const __vite_glob_0_0 = "data:application/octet-stream;base64,L2Fzc2V0cwo=";
|
|
20
|
+
const TOOLBAR_VERSION = "0.15.9-alpha.16";
|
|
19
21
|
const TOOLBAR_CSS = `markmap-toolbar@${TOOLBAR_VERSION}/dist/style.css`;
|
|
20
22
|
const TOOLBAR_JS = `markmap-toolbar@${TOOLBAR_VERSION}/dist/index.js`;
|
|
21
23
|
const ASSETS_PREFIX = "/assets/";
|
|
@@ -67,9 +69,8 @@ function createStreamBody(stream) {
|
|
|
67
69
|
});
|
|
68
70
|
return body;
|
|
69
71
|
}
|
|
70
|
-
const rootDir = new URL(import.meta.url).pathname;
|
|
71
72
|
const config = {
|
|
72
|
-
assetsDir:
|
|
73
|
+
assetsDir: new URL((/* @__PURE__ */ Object.assign({ "../.gitignore": __vite_glob_0_0 }))[`../.${ASSETS_PREFIX}`], import.meta.url).pathname
|
|
73
74
|
};
|
|
74
75
|
var getMimeType = (filename) => {
|
|
75
76
|
const regexp = /\.([a-zA-Z0-9]+?)$/;
|
|
@@ -290,10 +291,9 @@ async function setUpServer(transformer, provider, options) {
|
|
|
290
291
|
let assets = transformer.getAssets();
|
|
291
292
|
if (options.toolbar)
|
|
292
293
|
assets = addToolbar(transformer.urlBuilder, assets);
|
|
293
|
-
const html = `${
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
)}<script>(${startServer.toString()})(${options.toolbar ? 60 : 0})<\/script>`;
|
|
294
|
+
const html = `${fillTemplate(null, assets, {
|
|
295
|
+
urlBuilder: transformer.urlBuilder
|
|
296
|
+
})}<script>(${startServer.toString()})(${options.toolbar ? 60 : 0})<\/script>`;
|
|
297
297
|
const app = new Hono();
|
|
298
298
|
app.get("/", (c) => c.html(html));
|
|
299
299
|
app.get("/~data", async (c) => {
|
|
@@ -472,9 +472,10 @@ async function createMarkmap(options) {
|
|
|
472
472
|
if (options.offline) {
|
|
473
473
|
assets = await inlineAssets(assets);
|
|
474
474
|
}
|
|
475
|
-
const html =
|
|
475
|
+
const html = fillTemplate(root, assets, {
|
|
476
476
|
baseJs: [],
|
|
477
|
-
jsonOptions: frontmatter == null ? void 0 : frontmatter.markmap
|
|
477
|
+
jsonOptions: frontmatter == null ? void 0 : frontmatter.markmap,
|
|
478
|
+
urlBuilder: transformer.urlBuilder
|
|
478
479
|
});
|
|
479
480
|
const output = options.output || "markmap.html";
|
|
480
481
|
await writeFile(output, html, "utf8");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markmap-cli",
|
|
3
|
-
"version": "0.15.9-alpha.
|
|
3
|
+
"version": "0.15.9-alpha.16+01ebaff",
|
|
4
4
|
"description": "Create markmaps from CLI",
|
|
5
5
|
"author": "Gerald <gera2ld@live.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,13 +48,14 @@
|
|
|
48
48
|
"chokidar": "^3.5.3",
|
|
49
49
|
"commander": "^11.1.0",
|
|
50
50
|
"hono": "^3.11.8",
|
|
51
|
-
"markmap-common": "0.15.9-alpha.
|
|
52
|
-
"markmap-lib": "0.15.9-alpha.
|
|
53
|
-
"markmap-
|
|
51
|
+
"markmap-common": "0.15.9-alpha.16+01ebaff",
|
|
52
|
+
"markmap-lib": "0.15.9-alpha.16+01ebaff",
|
|
53
|
+
"markmap-render": "0.15.9-alpha.16+01ebaff",
|
|
54
|
+
"markmap-toolbar": "0.15.9-alpha.16+01ebaff",
|
|
54
55
|
"open": "^10.0.0",
|
|
55
56
|
"pkg-dir": "^8.0.0",
|
|
56
57
|
"read-package-up": "^11.0.0",
|
|
57
58
|
"update-notifier": "^7.0.0"
|
|
58
59
|
},
|
|
59
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "01ebaffc9c373b822b5c78808fff8f009843bd4d"
|
|
60
61
|
}
|