honkit 6.0.2 → 6.0.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.
|
@@ -21,6 +21,6 @@ export declare class PluginResolver {
|
|
|
21
21
|
* @param {string} packageName
|
|
22
22
|
* @returns {string} return path to module
|
|
23
23
|
*/
|
|
24
|
-
resolvePluginPackageName(packageName: any):
|
|
24
|
+
resolvePluginPackageName(packageName: any): string;
|
|
25
25
|
}
|
|
26
26
|
//# sourceMappingURL=PluginResolver.d.ts.map
|
|
@@ -30,7 +30,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
exports.PluginResolver = void 0;
|
|
31
31
|
const path_1 = __importDefault(require("path"));
|
|
32
32
|
const util = __importStar(require("./package-name-util"));
|
|
33
|
-
const
|
|
33
|
+
const path_2 = __importDefault(require("../utils/path"));
|
|
34
34
|
const SPECIAL_PACKAGE_NAME = [
|
|
35
35
|
"fontsettings", // → @honkit/honkit-plugin-fontsettings
|
|
36
36
|
"highlight", // → @honkit/honkit-plugin-highlight
|
|
@@ -71,11 +71,11 @@ class PluginResolver {
|
|
|
71
71
|
// e.g.) load theme-default as @honkit/honkit-plugins-theme-default
|
|
72
72
|
const honkitScopePackageName = `@honkit/${honkitFullPackageName}`;
|
|
73
73
|
// In sometimes, HonKit package has not main field - so search package.json
|
|
74
|
-
const pkgPath =
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
const pkgPath = path_2.default.tryResolve(path_1.default.join(baseDir, honkitFullPackageName, "/package.json")) ||
|
|
75
|
+
path_2.default.tryResolve(path_1.default.join(baseDir, gitbookFullPackageName, "/package.json")) ||
|
|
76
|
+
path_2.default.tryResolve(path_1.default.join(baseDir, packageName, "/package.json")) ||
|
|
77
77
|
(SPECIAL_PACKAGE_NAME.includes(packageName) &&
|
|
78
|
-
|
|
78
|
+
path_2.default.tryResolve(path_1.default.join(baseDir, honkitScopePackageName, "/package.json")));
|
|
79
79
|
if (!pkgPath) {
|
|
80
80
|
throw new ReferenceError(`Failed to load HonKit's plugin module: "${packageName}" is not found.
|
|
81
81
|
|
package/lib/utils/path.d.ts
CHANGED
|
@@ -3,12 +3,19 @@ declare function isInRoot(root: any, filename: any): boolean;
|
|
|
3
3
|
declare function resolveInRoot(root: any): string;
|
|
4
4
|
declare function setExtension(filename: any, ext: any): string;
|
|
5
5
|
declare function isPureRelative(filename: any): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Try to resolve package name
|
|
8
|
+
* if `packageName` is found, return resolved absolute path.
|
|
9
|
+
* if `packageName` is not found, return `undefined`
|
|
10
|
+
**/
|
|
11
|
+
declare function tryResolve(packageName: string): string | undefined;
|
|
6
12
|
declare const _default: {
|
|
7
13
|
isInRoot: typeof isInRoot;
|
|
8
14
|
resolveInRoot: typeof resolveInRoot;
|
|
9
15
|
normalize: typeof normalizePath;
|
|
10
16
|
setExtension: typeof setExtension;
|
|
11
17
|
isPureRelative: typeof isPureRelative;
|
|
18
|
+
tryResolve: typeof tryResolve;
|
|
12
19
|
};
|
|
13
20
|
export default _default;
|
|
14
21
|
//# sourceMappingURL=path.d.ts.map
|
package/lib/utils/path.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/utils/path.ts"],"names":[],"mappings":"AAIA,iBAAS,aAAa,CAAC,QAAQ,KAAA,UAE9B;AAGD,iBAAS,QAAQ,CAAC,IAAI,KAAA,EAAE,QAAQ,KAAA,WAY/B;AAID,iBAAS,aAAa,CAAC,IAAI,KAAA,UAkB1B;AAGD,iBAAS,YAAY,CAAC,QAAQ,KAAA,EAAE,GAAG,KAAA,UAElC;AAQD,iBAAS,cAAc,CAAC,QAAQ,KAAA,WAE/B
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/utils/path.ts"],"names":[],"mappings":"AAIA,iBAAS,aAAa,CAAC,QAAQ,KAAA,UAE9B;AAGD,iBAAS,QAAQ,CAAC,IAAI,KAAA,EAAE,QAAQ,KAAA,WAY/B;AAID,iBAAS,aAAa,CAAC,IAAI,KAAA,UAkB1B;AAGD,iBAAS,YAAY,CAAC,QAAQ,KAAA,EAAE,GAAG,KAAA,UAElC;AAQD,iBAAS,cAAc,CAAC,QAAQ,KAAA,WAE/B;AAED;;;;IAII;AACJ,iBAAS,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM3D;;;;;;;;;AAED,wBAOE"}
|
package/lib/utils/path.js
CHANGED
|
@@ -40,7 +40,7 @@ function resolveInRoot(root) {
|
|
|
40
40
|
}
|
|
41
41
|
return result;
|
|
42
42
|
}
|
|
43
|
-
//
|
|
43
|
+
// Change extension of a file
|
|
44
44
|
function setExtension(filename, ext) {
|
|
45
45
|
return path_1.default.join(path_1.default.dirname(filename), path_1.default.basename(filename, path_1.default.extname(filename)) + ext);
|
|
46
46
|
}
|
|
@@ -53,10 +53,24 @@ function setExtension(filename, ext) {
|
|
|
53
53
|
function isPureRelative(filename) {
|
|
54
54
|
return filename.indexOf("./") === 0 || filename.indexOf("../") === 0;
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Try to resolve package name
|
|
58
|
+
* if `packageName` is found, return resolved absolute path.
|
|
59
|
+
* if `packageName` is not found, return `undefined`
|
|
60
|
+
**/
|
|
61
|
+
function tryResolve(packageName) {
|
|
62
|
+
try {
|
|
63
|
+
return require.resolve(packageName);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
56
69
|
exports.default = {
|
|
57
70
|
isInRoot: isInRoot,
|
|
58
71
|
resolveInRoot: resolveInRoot,
|
|
59
72
|
normalize: normalizePath,
|
|
60
73
|
setExtension: setExtension,
|
|
61
|
-
isPureRelative: isPureRelative
|
|
74
|
+
isPureRelative: isPureRelative,
|
|
75
|
+
tryResolve: tryResolve
|
|
62
76
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "honkit",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
4
4
|
"description": "HonKit is building beautiful books using Markdown.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"git",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"updateSnapshot": "jest src -u"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@honkit/asciidoc": "6.0.
|
|
41
|
-
"@honkit/honkit-plugin-fontsettings": "6.0.
|
|
42
|
-
"@honkit/honkit-plugin-highlight": "6.0.
|
|
43
|
-
"@honkit/honkit-plugin-theme-default": "6.0.
|
|
44
|
-
"@honkit/html": "6.0.
|
|
45
|
-
"@honkit/markdown-legacy": "6.0.
|
|
40
|
+
"@honkit/asciidoc": "6.0.3",
|
|
41
|
+
"@honkit/honkit-plugin-fontsettings": "6.0.3",
|
|
42
|
+
"@honkit/honkit-plugin-highlight": "6.0.3",
|
|
43
|
+
"@honkit/honkit-plugin-theme-default": "6.0.3",
|
|
44
|
+
"@honkit/html": "6.0.3",
|
|
45
|
+
"@honkit/markdown-legacy": "6.0.3",
|
|
46
46
|
"bash-color": "^0.0.4",
|
|
47
47
|
"cheerio": "^1.0.0",
|
|
48
48
|
"chokidar": "^3.6.0",
|
|
@@ -86,11 +86,10 @@
|
|
|
86
86
|
"send": "^0.17.2",
|
|
87
87
|
"tiny-lr": "^1.1.1",
|
|
88
88
|
"tmp": "0.0.28",
|
|
89
|
-
"try-resolve": "^1.0.1",
|
|
90
89
|
"urijs": "^1.19.11"
|
|
91
90
|
},
|
|
92
91
|
"devDependencies": {
|
|
93
|
-
"@honkit/internal-test-utils": "6.0.
|
|
92
|
+
"@honkit/internal-test-utils": "6.0.3",
|
|
94
93
|
"@relmify/jest-serializer-strip-ansi": "^1.0.2",
|
|
95
94
|
"@types/jest": "^29.5.13",
|
|
96
95
|
"@types/node": "^22.7.4",
|
|
@@ -101,5 +100,5 @@
|
|
|
101
100
|
"rimraf": "^3.0.2",
|
|
102
101
|
"typescript": "^5.6.2"
|
|
103
102
|
},
|
|
104
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "608191107875c3d613840d702b76a9888992d7bc"
|
|
105
104
|
}
|