@mryhryki/markdown-preview 0.8.13 → 0.8.15
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/package.json +11 -16
- package/src/lib/params.test.js +10 -9
- package/src/lib/socket_manager.test.js +15 -14
- package/static/convert-markdown.js +13998 -11396
- package/static/highlightjs-github-dark-dimmed.css +117 -0
- package/template/default.html +4 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mryhryki/markdown-preview",
|
|
3
3
|
"description": "Markdown realtime preview on browser with your favorite editor",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.15",
|
|
5
5
|
"author": "mryhryki",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"url": "https://github.com/mryhryki/markdown-preview/issues"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=
|
|
23
|
+
"node": ">=20.0.0",
|
|
24
24
|
"npm": ">=9.0.0"
|
|
25
25
|
},
|
|
26
26
|
"main": "index.js",
|
|
@@ -30,14 +30,15 @@
|
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "npm run build:server && npm run build:css && npm run build:js",
|
|
32
32
|
"build:server": "tsc",
|
|
33
|
-
"build:css": "cp ./node_modules/github-markdown-css/github-markdown.css ./static/github-markdown.css && cp ./node_modules/highlight.js/styles/github.css ./static/highlightjs-github.css",
|
|
33
|
+
"build:css": "cp ./node_modules/github-markdown-css/github-markdown.css ./static/github-markdown.css && cp ./node_modules/highlight.js/styles/github.css ./static/highlightjs-github.css && cp ./node_modules/highlight.js/styles/github-dark-dimmed.css ./static/highlightjs-github-dark-dimmed.css",
|
|
34
34
|
"build:js": "esbuild --bundle --platform=browser --format=esm --outfile=./static/convert-markdown.js ./script/convert-markdown.ts",
|
|
35
|
+
"clean": "find ./src/ ./script/ -name \"*.js\" | xargs rm",
|
|
35
36
|
"fmt": "biome check --write ./src/**/*.ts ./**/*.html",
|
|
36
37
|
"lint": "biome check ./src/**/*.ts ./**/*.html",
|
|
37
38
|
"release": "npm run build && npm publish",
|
|
38
39
|
"start": "npm run build && node ./index.js",
|
|
39
|
-
"test": "
|
|
40
|
-
"test:watch": "
|
|
40
|
+
"test": "vitest",
|
|
41
|
+
"test:watch": "vitest watch",
|
|
41
42
|
"type": "tsc --noEmit",
|
|
42
43
|
"type:watch": "tsc --noEmit --watch"
|
|
43
44
|
},
|
|
@@ -50,33 +51,27 @@
|
|
|
50
51
|
"ws": "^8.18.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"@biomejs/biome": "1.
|
|
54
|
+
"@biomejs/biome": "2.1.1",
|
|
54
55
|
"@types/express": "^5.0.0",
|
|
55
56
|
"@types/express-ws": "^3.0.5",
|
|
56
|
-
"@types/jest": "^29.5.14",
|
|
57
57
|
"@types/opener": "^1.4.3",
|
|
58
58
|
"@types/serve-index": "^1.9.4",
|
|
59
59
|
"emojilib": "^4.0.1",
|
|
60
60
|
"esbuild": "^0.25.0",
|
|
61
61
|
"github-markdown-css": "^5.8.1",
|
|
62
62
|
"highlight.js": "^11.11.1",
|
|
63
|
-
"
|
|
64
|
-
"marked": "^15.0.6",
|
|
63
|
+
"marked": "^16.0.0",
|
|
65
64
|
"marked-emoji": "^2.0.0",
|
|
66
65
|
"marked-highlight": "^2.2.1",
|
|
67
66
|
"mermaid": "^11.4.1",
|
|
68
67
|
"nodemon": "^3.1.9",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
68
|
+
"typescript": "^5.7.3",
|
|
69
|
+
"vitest": "^3.2.3"
|
|
71
70
|
},
|
|
72
71
|
"files": [
|
|
73
72
|
"index.js",
|
|
74
73
|
"src/**/*.js",
|
|
75
74
|
"static/**/*",
|
|
76
75
|
"template/**/*"
|
|
77
|
-
]
|
|
78
|
-
"jest": {
|
|
79
|
-
"preset": "ts-jest",
|
|
80
|
-
"testEnvironment": "node"
|
|
81
|
-
}
|
|
76
|
+
]
|
|
82
77
|
}
|
package/src/lib/params.test.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const node_path_1 = __importDefault(require("node:path"));
|
|
7
|
+
const vitest_1 = require("vitest");
|
|
7
8
|
const directory_1 = require("./directory");
|
|
8
9
|
const params_1 = require("./params");
|
|
9
10
|
const DEFAULT_VALUES = {
|
|
@@ -16,12 +17,12 @@ const DEFAULT_VALUES = {
|
|
|
16
17
|
version: false,
|
|
17
18
|
help: false,
|
|
18
19
|
};
|
|
19
|
-
describe("Params", () => {
|
|
20
|
-
it("not specify", () => {
|
|
20
|
+
(0, vitest_1.describe)("Params", () => {
|
|
21
|
+
(0, vitest_1.it)("not specify", () => {
|
|
21
22
|
const params = new params_1.Params({}, []);
|
|
22
|
-
expect(params._params).toEqual(DEFAULT_VALUES);
|
|
23
|
+
(0, vitest_1.expect)(params._params).toEqual(DEFAULT_VALUES);
|
|
23
24
|
});
|
|
24
|
-
it("specify all short argument", () => {
|
|
25
|
+
(0, vitest_1.it)("specify all short argument", () => {
|
|
25
26
|
const argv = [
|
|
26
27
|
"-f",
|
|
27
28
|
"test/markdown/markdown1.md",
|
|
@@ -45,9 +46,9 @@ describe("Params", () => {
|
|
|
45
46
|
help: true,
|
|
46
47
|
};
|
|
47
48
|
const params = new params_1.Params({}, argv);
|
|
48
|
-
expect(params._params).toEqual(expectParams);
|
|
49
|
+
(0, vitest_1.expect)(params._params).toEqual(expectParams);
|
|
49
50
|
});
|
|
50
|
-
it("specify all long argument", () => {
|
|
51
|
+
(0, vitest_1.it)("specify all long argument", () => {
|
|
51
52
|
const argv = [
|
|
52
53
|
"--file",
|
|
53
54
|
"test/markdown/markdown1.md",
|
|
@@ -74,9 +75,9 @@ describe("Params", () => {
|
|
|
74
75
|
help: true,
|
|
75
76
|
};
|
|
76
77
|
const params = new params_1.Params({}, argv);
|
|
77
|
-
expect(params._params).toEqual(expectParams);
|
|
78
|
+
(0, vitest_1.expect)(params._params).toEqual(expectParams);
|
|
78
79
|
});
|
|
79
|
-
it("specify all environment variable", () => {
|
|
80
|
+
(0, vitest_1.it)("specify all environment variable", () => {
|
|
80
81
|
const env = {
|
|
81
82
|
MARKDOWN_PREVIEW_FILE: "test/markdown/markdown1.md",
|
|
82
83
|
MARKDOWN_PREVIEW_EXTENSIONS: "ext1, ext2",
|
|
@@ -96,6 +97,6 @@ describe("Params", () => {
|
|
|
96
97
|
help: false,
|
|
97
98
|
};
|
|
98
99
|
const params = new params_1.Params(env, []);
|
|
99
|
-
expect(params._params).toEqual(expectParams);
|
|
100
|
+
(0, vitest_1.expect)(params._params).toEqual(expectParams);
|
|
100
101
|
});
|
|
101
102
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
3
4
|
const socket_manager_1 = require("./socket_manager");
|
|
4
5
|
// biome-ignore lint/suspicious/noExplicitAny: It is used for testing only.
|
|
5
6
|
const dummySocket1 = { name: "socket1" };
|
|
@@ -12,33 +13,33 @@ const dummyFilepath2 = "file2";
|
|
|
12
13
|
const dummyInfo1 = { socket: dummySocket1, filepath: dummyFilepath1 };
|
|
13
14
|
const dummyInfo2 = { socket: dummySocket2, filepath: dummyFilepath2 };
|
|
14
15
|
const dummyInfo3 = { socket: dummySocket3, filepath: dummyFilepath2 };
|
|
15
|
-
describe("SocketManager", () => {
|
|
16
|
-
it("works normally", () => {
|
|
16
|
+
(0, vitest_1.describe)("SocketManager", () => {
|
|
17
|
+
(0, vitest_1.it)("works normally", () => {
|
|
17
18
|
const socketManager = new socket_manager_1.SocketManager();
|
|
18
|
-
expect(socketManager._sockets).toEqual([]);
|
|
19
|
+
(0, vitest_1.expect)(socketManager._sockets).toEqual([]);
|
|
19
20
|
socketManager.addSocket(dummySocket1, dummyFilepath1);
|
|
20
|
-
expect(socketManager._sockets).toEqual([dummyInfo1]);
|
|
21
|
+
(0, vitest_1.expect)(socketManager._sockets).toEqual([dummyInfo1]);
|
|
21
22
|
socketManager.addSocket(dummySocket2, dummyFilepath2);
|
|
22
|
-
expect(socketManager._sockets).toEqual([dummyInfo1, dummyInfo2]);
|
|
23
|
+
(0, vitest_1.expect)(socketManager._sockets).toEqual([dummyInfo1, dummyInfo2]);
|
|
23
24
|
socketManager.addSocket(dummySocket3, dummyFilepath2);
|
|
24
|
-
expect(socketManager._sockets).toEqual([
|
|
25
|
+
(0, vitest_1.expect)(socketManager._sockets).toEqual([
|
|
25
26
|
dummyInfo1,
|
|
26
27
|
dummyInfo2,
|
|
27
28
|
dummyInfo3,
|
|
28
29
|
]);
|
|
29
|
-
expect(socketManager.getSockets(dummyFilepath1)).toEqual([dummySocket1]);
|
|
30
|
-
expect(socketManager.getSockets(dummyFilepath2)).toEqual([
|
|
30
|
+
(0, vitest_1.expect)(socketManager.getSockets(dummyFilepath1)).toEqual([dummySocket1]);
|
|
31
|
+
(0, vitest_1.expect)(socketManager.getSockets(dummyFilepath2)).toEqual([
|
|
31
32
|
dummySocket2,
|
|
32
33
|
dummySocket3,
|
|
33
34
|
]);
|
|
34
|
-
expect(socketManager.countSocket()).toEqual(3);
|
|
35
|
-
expect(socketManager.countSocket(dummyFilepath1)).toEqual(1);
|
|
36
|
-
expect(socketManager.countSocket(dummyFilepath2)).toEqual(2);
|
|
35
|
+
(0, vitest_1.expect)(socketManager.countSocket()).toEqual(3);
|
|
36
|
+
(0, vitest_1.expect)(socketManager.countSocket(dummyFilepath1)).toEqual(1);
|
|
37
|
+
(0, vitest_1.expect)(socketManager.countSocket(dummyFilepath2)).toEqual(2);
|
|
37
38
|
socketManager.removeSocket(dummySocket2);
|
|
38
|
-
expect(socketManager._sockets).toEqual([dummyInfo1, dummyInfo3]);
|
|
39
|
+
(0, vitest_1.expect)(socketManager._sockets).toEqual([dummyInfo1, dummyInfo3]);
|
|
39
40
|
socketManager.removeSocket(dummySocket1);
|
|
40
|
-
expect(socketManager._sockets).toEqual([dummyInfo3]);
|
|
41
|
+
(0, vitest_1.expect)(socketManager._sockets).toEqual([dummyInfo3]);
|
|
41
42
|
socketManager.removeSocket(dummySocket3);
|
|
42
|
-
expect(socketManager._sockets).toEqual([]);
|
|
43
|
+
(0, vitest_1.expect)(socketManager._sockets).toEqual([]);
|
|
43
44
|
});
|
|
44
45
|
});
|