markmap-cli 0.5.3 → 0.5.4
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/README.md +2 -3
- package/bin/cli.js +0 -0
- package/dist/index.js +8 -11
- package/package.json +3 -4
- package/types/dev-server.d.ts +17 -17
- package/types/index.d.ts +7 -7
- package/types/util.d.ts +17 -17
package/README.md
CHANGED
|
@@ -29,10 +29,9 @@ Create a markmap from a Markdown input file
|
|
|
29
29
|
|
|
30
30
|
Options:
|
|
31
31
|
-V, --version output the version number
|
|
32
|
-
-o, --output <output> specify filename of the output HTML
|
|
33
|
-
--enable-mathjax enable MathJax support
|
|
34
|
-
--enable-prism enable PrismJS support
|
|
35
32
|
--no-open do not open the output file after generation
|
|
33
|
+
--no-toolbar do not show toolbar
|
|
34
|
+
-o, --output <output> specify filename of the output HTML
|
|
36
35
|
-w, --watch watch the input file and update output on the fly, note that this feature is for development only
|
|
37
36
|
-h, --help display help for command
|
|
38
37
|
```
|
package/bin/cli.js
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! markmap-cli v0.5.
|
|
1
|
+
/*! markmap-cli v0.5.4 | MIT License */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var fs = require('fs');
|
|
@@ -10,14 +10,14 @@ var http = require('http');
|
|
|
10
10
|
var Koa = require('koa');
|
|
11
11
|
var chokidar = require('chokidar');
|
|
12
12
|
|
|
13
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e[
|
|
13
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
14
14
|
|
|
15
15
|
var open__default = /*#__PURE__*/_interopDefaultLegacy(open);
|
|
16
16
|
var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
|
17
17
|
var Koa__default = /*#__PURE__*/_interopDefaultLegacy(Koa);
|
|
18
18
|
var chokidar__default = /*#__PURE__*/_interopDefaultLegacy(chokidar);
|
|
19
19
|
|
|
20
|
-
const TOOLBAR_VERSION = "0.
|
|
20
|
+
const TOOLBAR_VERSION = "0.2.0";
|
|
21
21
|
const TOOLBAR_CSS = `npm/markmap-toolbar@${TOOLBAR_VERSION}/dist/style.min.css`;
|
|
22
22
|
const TOOLBAR_JS = `npm/markmap-toolbar@${TOOLBAR_VERSION}/dist/index.umd.min.js`;
|
|
23
23
|
|
|
@@ -59,8 +59,6 @@ function addToolbar(assets) {
|
|
|
59
59
|
}
|
|
60
60
|
class Defer {
|
|
61
61
|
constructor() {
|
|
62
|
-
this.resolve = void 0;
|
|
63
|
-
this.reject = void 0;
|
|
64
62
|
this.promise = new Promise((resolve, reject) => {
|
|
65
63
|
this.resolve = resolve;
|
|
66
64
|
this.reject = reject;
|
|
@@ -69,6 +67,8 @@ class Defer {
|
|
|
69
67
|
|
|
70
68
|
}
|
|
71
69
|
|
|
70
|
+
/* eslint-disable max-classes-per-file */
|
|
71
|
+
|
|
72
72
|
function consecutive(fn) {
|
|
73
73
|
let promise;
|
|
74
74
|
return () => {
|
|
@@ -88,8 +88,6 @@ class BufferContentProvider {
|
|
|
88
88
|
this.deferredSet = new Set();
|
|
89
89
|
this.events = new events.EventEmitter();
|
|
90
90
|
this.ts = 0;
|
|
91
|
-
this.content = void 0;
|
|
92
|
-
this.line = void 0;
|
|
93
91
|
this.events.on('content', () => {
|
|
94
92
|
this.feed({
|
|
95
93
|
ts: this.ts,
|
|
@@ -152,7 +150,6 @@ class FileSystemProvider extends BufferContentProvider {
|
|
|
152
150
|
constructor(fileName) {
|
|
153
151
|
super();
|
|
154
152
|
this.fileName = fileName;
|
|
155
|
-
this.watcher = void 0;
|
|
156
153
|
this.watcher = chokidar__default.watch(fileName).on('all', consecutive(() => this.update()));
|
|
157
154
|
}
|
|
158
155
|
|
|
@@ -220,7 +217,7 @@ function startServer(paddingBottom) {
|
|
|
220
217
|
function setUpServer(transformer, provider, options) {
|
|
221
218
|
let assets = transformer.getAssets();
|
|
222
219
|
if (options.toolbar) assets = addToolbar(assets);
|
|
223
|
-
const html = markmapLib.fillTemplate(null, assets)
|
|
220
|
+
const html = `${markmapLib.fillTemplate(null, assets)}<script>(${startServer.toString()})(${options.toolbar ? 60 : 0})</script>`;
|
|
224
221
|
const app = new Koa__default();
|
|
225
222
|
app.use(async (ctx, next) => {
|
|
226
223
|
if (ctx.path === '/') {
|
|
@@ -308,6 +305,6 @@ function main(version) {
|
|
|
308
305
|
exports.createMarkmap = createMarkmap;
|
|
309
306
|
exports.develop = develop;
|
|
310
307
|
exports.main = main;
|
|
311
|
-
|
|
308
|
+
for (var k in markmapLib) {
|
|
312
309
|
if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = markmapLib[k];
|
|
313
|
-
}
|
|
310
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markmap-cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "Create markmaps from CLI",
|
|
5
5
|
"author": "Gerald <gera2ld@live.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"dev": "rollup -wc rollup.conf.js",
|
|
26
26
|
"clean": "del-cli dist types",
|
|
27
|
-
"lint": "eslint --ext .ts .",
|
|
28
27
|
"build:types": "tsc",
|
|
29
28
|
"build:js": "rollup -c rollup.conf.js"
|
|
30
29
|
},
|
|
@@ -43,12 +42,12 @@
|
|
|
43
42
|
"chokidar": "^3.5.1",
|
|
44
43
|
"commander": "^7.1.0",
|
|
45
44
|
"koa": "^2.13.1",
|
|
46
|
-
"markmap-lib": "^0.
|
|
45
|
+
"markmap-lib": "^0.12.0",
|
|
47
46
|
"open": "^8.0.3",
|
|
48
47
|
"update-notifier": "^5.1.0"
|
|
49
48
|
},
|
|
50
49
|
"engines": {
|
|
51
50
|
"node": ">=10"
|
|
52
51
|
},
|
|
53
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "fbec667e1706813f9f60bea6a971f3820858ca40"
|
|
54
53
|
}
|
package/types/dev-server.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { IDevelopOptions } from './util';
|
|
2
|
-
interface IFileUpdate {
|
|
3
|
-
ts?: number;
|
|
4
|
-
content?: string;
|
|
5
|
-
line?: number;
|
|
6
|
-
}
|
|
7
|
-
interface IContentProvider {
|
|
8
|
-
getUpdate: (ts: number, timeout?: number) => Promise<IFileUpdate>;
|
|
9
|
-
setContent: (content: string) => void;
|
|
10
|
-
setCursor: (line: number) => void;
|
|
11
|
-
dispose: () => void;
|
|
12
|
-
}
|
|
13
|
-
export declare function develop(fileName: string | undefined, options: IDevelopOptions): Promise<{
|
|
14
|
-
provider: IContentProvider;
|
|
15
|
-
close(): Promise<void>;
|
|
16
|
-
}>;
|
|
17
|
-
export {};
|
|
1
|
+
import { IDevelopOptions } from './util';
|
|
2
|
+
interface IFileUpdate {
|
|
3
|
+
ts?: number;
|
|
4
|
+
content?: string;
|
|
5
|
+
line?: number;
|
|
6
|
+
}
|
|
7
|
+
interface IContentProvider {
|
|
8
|
+
getUpdate: (ts: number, timeout?: number) => Promise<IFileUpdate>;
|
|
9
|
+
setContent: (content: string) => void;
|
|
10
|
+
setCursor: (line: number) => void;
|
|
11
|
+
dispose: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function develop(fileName: string | undefined, options: IDevelopOptions): Promise<{
|
|
14
|
+
provider: IContentProvider;
|
|
15
|
+
close(): Promise<void>;
|
|
16
|
+
}>;
|
|
17
|
+
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { IMarkmapCreateOptions } from 'markmap-lib';
|
|
2
|
-
import { IDevelopOptions } from './util';
|
|
3
|
-
import { develop } from './dev-server';
|
|
4
|
-
export * from 'markmap-lib';
|
|
5
|
-
export { develop };
|
|
6
|
-
export declare function createMarkmap(options: IMarkmapCreateOptions & IDevelopOptions): Promise<void>;
|
|
7
|
-
export declare function main(version: string): void;
|
|
1
|
+
import type { IMarkmapCreateOptions } from 'markmap-lib';
|
|
2
|
+
import { IDevelopOptions } from './util';
|
|
3
|
+
import { develop } from './dev-server';
|
|
4
|
+
export * from 'markmap-lib';
|
|
5
|
+
export { develop };
|
|
6
|
+
export declare function createMarkmap(options: IMarkmapCreateOptions & IDevelopOptions): Promise<void>;
|
|
7
|
+
export declare function main(version: string): void;
|
package/types/util.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { IAssets } from 'markmap-lib';
|
|
2
|
-
export interface IDevelopOptions {
|
|
3
|
-
/**
|
|
4
|
-
* whether to open the generated markmap in browser
|
|
5
|
-
*/
|
|
6
|
-
open: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* whether to show default toolbar
|
|
9
|
-
*/
|
|
10
|
-
toolbar: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function addToolbar(assets: IAssets): IAssets;
|
|
13
|
-
export declare class Defer<T> {
|
|
14
|
-
resolve: (value: T) => void;
|
|
15
|
-
reject: (err: Error) => void;
|
|
16
|
-
promise: Promise<unknown>;
|
|
17
|
-
}
|
|
1
|
+
import { IAssets } from 'markmap-lib';
|
|
2
|
+
export interface IDevelopOptions {
|
|
3
|
+
/**
|
|
4
|
+
* whether to open the generated markmap in browser
|
|
5
|
+
*/
|
|
6
|
+
open: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* whether to show default toolbar
|
|
9
|
+
*/
|
|
10
|
+
toolbar: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function addToolbar(assets: IAssets): IAssets;
|
|
13
|
+
export declare class Defer<T> {
|
|
14
|
+
resolve: (value: T) => void;
|
|
15
|
+
reject: (err: Error) => void;
|
|
16
|
+
promise: Promise<unknown>;
|
|
17
|
+
}
|