honkit 5.1.0 → 5.1.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/lib/api/deprecate.js +2 -2
- package/lib/api/encodeConfig.js +1 -1
- package/lib/api/encodeNavigation.js +3 -3
- package/lib/api/encodePage.js +2 -2
- package/lib/api/encodeProgress.js +1 -1
- package/lib/api/encodeSummary.js +1 -1
- package/lib/api/index.js +1 -1
- package/lib/browser.js +1 -1
- package/lib/cli/build.js +2 -2
- package/lib/cli/buildEbook.js +2 -2
- package/lib/cli/init.js +1 -1
- package/lib/cli/options.js +5 -5
- package/lib/cli/parse.js +1 -1
- package/lib/cli/serve.d.ts.map +1 -1
- package/lib/cli/serve.js +28 -19
- package/lib/cli/server.js +1 -1
- package/lib/cli/watch.js +1 -1
- package/lib/constants/configSchema.js +50 -50
- package/lib/constants/defaultFilters.js +1 -1
- package/lib/fs/mock.js +5 -5
- package/lib/fs/node.js +1 -1
- package/lib/honkit.js +1 -1
- package/lib/index.js +1 -1
- package/lib/json/encodeBook.js +4 -4
- package/lib/json/encodeFile.js +1 -1
- package/lib/json/encodeGlossary.js +1 -1
- package/lib/json/encodeGlossaryEntry.js +1 -1
- package/lib/json/encodeLanguages.js +2 -2
- package/lib/json/encodeOutput.js +1 -1
- package/lib/json/encodeReadme.js +1 -1
- package/lib/json/encodeSummary.js +1 -1
- package/lib/json/encodeSummaryArticle.js +1 -1
- package/lib/json/encodeSummaryArticleWithCache.js +1 -1
- package/lib/json/encodeSummaryPart.js +1 -1
- package/lib/json/index.js +1 -1
- package/lib/models/book.js +4 -4
- package/lib/models/config.js +3 -3
- package/lib/models/fs.js +2 -2
- package/lib/models/glossaryEntry.js +1 -1
- package/lib/models/hash.js +1 -1
- package/lib/models/ignore.js +1 -1
- package/lib/models/language.js +1 -1
- package/lib/models/languages.js +3 -3
- package/lib/models/output.js +2 -2
- package/lib/models/page.js +4 -4
- package/lib/models/plugin.js +3 -3
- package/lib/models/pluginDependency.js +6 -6
- package/lib/models/readme.js +2 -2
- package/lib/models/summary.js +4 -4
- package/lib/models/summaryArticle.js +2 -2
- package/lib/models/summaryPart.js +2 -2
- package/lib/models/templateBlock.js +4 -4
- package/lib/models/templateEngine.js +4 -4
- package/lib/models/templateOutput.js +2 -2
- package/lib/modifiers/config/index.js +1 -1
- package/lib/modifiers/index.js +1 -1
- package/lib/modifiers/summary/editArticleRef.js +1 -1
- package/lib/modifiers/summary/editArticleTitle.js +1 -1
- package/lib/modifiers/summary/index.js +1 -1
- package/lib/modifiers/summary/indexArticleLevels.js +1 -1
- package/lib/modifiers/summary/indexPartLevels.js +1 -1
- package/lib/output/createTemplateEngine.js +1 -1
- package/lib/output/ebook/getConvertOptions.js +2 -2
- package/lib/output/ebook/getPDFTemplate.js +3 -3
- package/lib/output/ebook/index.js +1 -1
- package/lib/output/ebook/onFinish.js +2 -2
- package/lib/output/ebook/options.js +1 -1
- package/lib/output/generateBook.js +2 -2
- package/lib/output/getModifiers.js +3 -3
- package/lib/output/index.js +1 -1
- package/lib/output/json/index.js +1 -1
- package/lib/output/json/options.js +1 -1
- package/lib/output/modifiers/index.js +1 -1
- package/lib/output/preparePlugins.js +1 -1
- package/lib/output/testing/createMock.js +1 -1
- package/lib/output/testing/generateMock.js +2 -2
- package/lib/output/website/copyPluginAssets.js +2 -2
- package/lib/output/website/createTemplateEngine.js +4 -4
- package/lib/output/website/index.js +1 -1
- package/lib/output/website/onPage.js +4 -4
- package/lib/output/website/options.js +1 -1
- package/lib/output/website/prepareResources.js +2 -2
- package/lib/output/website/state.js +1 -1
- package/lib/parse/index.js +1 -1
- package/lib/parse/parseConfig.js +1 -1
- package/lib/parse/parseIgnore.js +1 -1
- package/lib/parse/parsePageFromString.js +1 -1
- package/lib/parse/parseSummary.js +1 -1
- package/lib/parse/validateConfig.js +1 -1
- package/lib/plugins/PluginResolver.js +1 -1
- package/lib/plugins/index.js +1 -1
- package/lib/plugins/listResources.js +2 -2
- package/lib/plugins/loadForBook.js +1 -1
- package/lib/plugins/loadPlugin.js +2 -2
- package/lib/plugins/validateConfig.js +1 -1
- package/lib/templating/index.js +1 -1
- package/lib/templating/render.js +1 -1
- package/lib/templating/renderFile.js +1 -1
- package/lib/templating/themesLoader.js +2 -2
- package/lib/utils/command.js +1 -1
- package/lib/utils/error.js +11 -11
- package/lib/utils/fs.d.ts.map +1 -1
- package/lib/utils/fs.js +1 -0
- package/lib/utils/git.js +1 -1
- package/lib/utils/images.js +1 -1
- package/lib/utils/location.js +1 -1
- package/lib/utils/logger.js +2 -2
- package/lib/utils/path.js +2 -2
- package/lib/utils/timing.js +2 -2
- package/package.json +7 -7
|
@@ -40,7 +40,7 @@ function getConvertOptions(output) {
|
|
|
40
40
|
"--max-levels": "1",
|
|
41
41
|
"--no-chapters-in-toc": true,
|
|
42
42
|
"--breadth-first": true,
|
|
43
|
-
"--dont-split-on-page-breaks": format === "epub" ? true : undefined
|
|
43
|
+
"--dont-split-on-page-breaks": format === "epub" ? true : undefined
|
|
44
44
|
};
|
|
45
45
|
if (format !== "pdf") {
|
|
46
46
|
return options;
|
|
@@ -61,7 +61,7 @@ function getConvertOptions(output) {
|
|
|
61
61
|
"--pdf-sans-family": String(pdfOptions.fontFamily),
|
|
62
62
|
"--pdf-header-template": headerTpl,
|
|
63
63
|
"--pdf-footer-template": footerTpl,
|
|
64
|
-
"--embed-all-fonts": Boolean(pdfOptions.embedFonts)
|
|
64
|
+
"--embed-all-fonts": Boolean(pdfOptions.embedFonts)
|
|
65
65
|
}));
|
|
66
66
|
});
|
|
67
67
|
});
|
|
@@ -24,7 +24,7 @@ function getPDFTemplate(output, type) {
|
|
|
24
24
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'page' does not exist on type '{ summary:... Remove this comment to see the full error message
|
|
25
25
|
context.page = {
|
|
26
26
|
num: "_PAGENUM_",
|
|
27
|
-
title: "_SECTION_"
|
|
27
|
+
title: "_SECTION_"
|
|
28
28
|
};
|
|
29
29
|
// Render the theme
|
|
30
30
|
return (templating_1.default.renderFile(engine, `ebook/${filePath}`, context)
|
|
@@ -32,8 +32,8 @@ function getPDFTemplate(output, type) {
|
|
|
32
32
|
.then((tplOut) => {
|
|
33
33
|
return promise_1.default.nfcall(juice_1.default.juiceResources, tplOut.getContent(), {
|
|
34
34
|
webResources: {
|
|
35
|
-
relativeTo: outputRoot
|
|
36
|
-
}
|
|
35
|
+
relativeTo: outputRoot
|
|
36
|
+
}
|
|
37
37
|
});
|
|
38
38
|
})
|
|
39
39
|
.then((tplOut) => tplOut.replace(/\n/g, " ")) // PDF templates need to be on one line for inclusion in spawned command
|
|
@@ -52,7 +52,7 @@ function runEbookConvert(output) {
|
|
|
52
52
|
"ebook-convert",
|
|
53
53
|
path_1.default.resolve(outputFolder, SUMMARY_FILE),
|
|
54
54
|
path_1.default.resolve(outputFolder, `index.${format}`),
|
|
55
|
-
command_1.default.optionsToShellArgs(options)
|
|
55
|
+
command_1.default.optionsToShellArgs(options)
|
|
56
56
|
].join(" ");
|
|
57
57
|
return (command_1.default
|
|
58
58
|
// @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
|
|
@@ -64,7 +64,7 @@ function runEbookConvert(output) {
|
|
|
64
64
|
if (err.code == 127) {
|
|
65
65
|
throw error_1.default.RequireInstallError({
|
|
66
66
|
cmd: "ebook-convert",
|
|
67
|
-
install: "Install it from Calibre: https://calibre-ebook.com"
|
|
67
|
+
install: "Install it from Calibre: https://calibre-ebook.com"
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
throw error_1.default.EbookError(err);
|
|
@@ -12,6 +12,6 @@ const Options = immutable_1.default.Record({
|
|
|
12
12
|
// Format to generate using ebook-convert
|
|
13
13
|
format: String(),
|
|
14
14
|
// Force use of absolute urls ("index.html" instead of "/")
|
|
15
|
-
directoryIndex: Boolean(false)
|
|
15
|
+
directoryIndex: Boolean(false)
|
|
16
16
|
});
|
|
17
17
|
exports.default = Options;
|
|
@@ -51,7 +51,7 @@ const generateMultipleLanguages = (generator, output) => {
|
|
|
51
51
|
options: langOptions,
|
|
52
52
|
state: state,
|
|
53
53
|
generator: generator.name,
|
|
54
|
-
plugins: plugins
|
|
54
|
+
plugins: plugins
|
|
55
55
|
});
|
|
56
56
|
logger.info.ln("");
|
|
57
57
|
logger.info.ln(`generating language "${langBook.getLanguage()}"`);
|
|
@@ -132,7 +132,7 @@ function generateBook(generator, book, options = {}) {
|
|
|
132
132
|
book: book,
|
|
133
133
|
options: options,
|
|
134
134
|
state: state,
|
|
135
|
-
generator: generator.name
|
|
135
|
+
generator: generator.name
|
|
136
136
|
}))
|
|
137
137
|
// Cleanup output folder
|
|
138
138
|
.then((output) => {
|
|
@@ -47,8 +47,8 @@ function getModifiers(output, page) {
|
|
|
47
47
|
return (0, promise_1.default)(code.applyBlock({
|
|
48
48
|
body: source,
|
|
49
49
|
kwargs: {
|
|
50
|
-
language: lang
|
|
51
|
-
}
|
|
50
|
+
language: lang
|
|
51
|
+
}
|
|
52
52
|
}, context)).then((result) => {
|
|
53
53
|
if (result.html === false) {
|
|
54
54
|
return { text: result.body };
|
|
@@ -57,7 +57,7 @@ function getModifiers(output, page) {
|
|
|
57
57
|
return { html: result.body };
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
})
|
|
60
|
+
})
|
|
61
61
|
];
|
|
62
62
|
}
|
|
63
63
|
exports.default = getModifiers;
|
package/lib/output/index.js
CHANGED
package/lib/output/json/index.js
CHANGED
|
@@ -6,6 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const immutable_1 = __importDefault(require("immutable"));
|
|
7
7
|
const Options = immutable_1.default.Record({
|
|
8
8
|
// Root folder for the output
|
|
9
|
-
root: String()
|
|
9
|
+
root: String()
|
|
10
10
|
});
|
|
11
11
|
exports.default = Options;
|
|
@@ -27,14 +27,14 @@ function generateMockBook(Generator, files) {
|
|
|
27
27
|
return (0, parseBook_1.default)(book)
|
|
28
28
|
.then((resultBook) => {
|
|
29
29
|
return (0, generateBook_1.generateBook)(Generator, resultBook, {
|
|
30
|
-
root: dir.name
|
|
30
|
+
root: dir.name
|
|
31
31
|
});
|
|
32
32
|
})
|
|
33
33
|
.then((output) => {
|
|
34
34
|
return {
|
|
35
35
|
book,
|
|
36
36
|
output,
|
|
37
|
-
dir: dir.name
|
|
37
|
+
dir: dir.name
|
|
38
38
|
};
|
|
39
39
|
});
|
|
40
40
|
}
|
|
@@ -54,7 +54,7 @@ function copyAssets(output, plugin) {
|
|
|
54
54
|
return fs_1.default.copyDir(assetFolder, assetOutputFolder, {
|
|
55
55
|
deleteFirst: false,
|
|
56
56
|
overwrite: true,
|
|
57
|
-
confirm: false
|
|
57
|
+
confirm: false
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
@@ -84,7 +84,7 @@ function copyResources(output, plugin) {
|
|
|
84
84
|
return fs_1.default.copyDir(assetsFolder, assetOutputFolder, {
|
|
85
85
|
deleteFirst: false,
|
|
86
86
|
overwrite: true,
|
|
87
|
-
confirm: false
|
|
87
|
+
confirm: false
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
exports.default = copyPluginAssets;
|
|
@@ -92,7 +92,7 @@ function createTemplateEngine(output, currentFile) {
|
|
|
92
92
|
globals: {
|
|
93
93
|
getArticleByPath: (0, memoize_one_1.default)(getArticleByPath),
|
|
94
94
|
getPageByPath: (0, memoize_one_1.default)(getPageByPath),
|
|
95
|
-
fileExists: fileExists
|
|
95
|
+
fileExists: fileExists
|
|
96
96
|
},
|
|
97
97
|
filters: defaultFilters_1.default.merge({
|
|
98
98
|
/**
|
|
@@ -124,11 +124,11 @@ function createTemplateEngine(output, currentFile) {
|
|
|
124
124
|
getArticleByPath: deprecate_1.default.method(book, "getArticleByPath", fileExists, 'Filter "getArticleByPath" is deprecated, use "getArticleByPath(filename)" '),
|
|
125
125
|
contentURL: function (filePath) {
|
|
126
126
|
return (0, fileToURL_1.default)(output, filePath);
|
|
127
|
-
}
|
|
127
|
+
}
|
|
128
128
|
}),
|
|
129
129
|
extensions: {
|
|
130
|
-
DoExtension: new DoExtension()
|
|
131
|
-
}
|
|
130
|
+
DoExtension: new DoExtension()
|
|
131
|
+
}
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
exports.default = createTemplateEngine;
|
|
@@ -40,7 +40,7 @@ function onPage(output, page) {
|
|
|
40
40
|
const context = json_1.default.encodeOutputWithPage(output, resultPage);
|
|
41
41
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'plugins' does not exist on type '{ summa... Remove this comment to see the full error message
|
|
42
42
|
context.plugins = {
|
|
43
|
-
resources: plugins_1.default.listResources(plugins, resources).toJS()
|
|
43
|
+
resources: plugins_1.default.listResources(plugins, resources).toJS()
|
|
44
44
|
};
|
|
45
45
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'template' does not exist on type '{ summ... Remove this comment to see the full error message
|
|
46
46
|
context.template = {
|
|
@@ -54,10 +54,10 @@ function onPage(output, page) {
|
|
|
54
54
|
gitbook: context.gitbook,
|
|
55
55
|
basePath: basePath,
|
|
56
56
|
book: {
|
|
57
|
-
language: book.getLanguage()
|
|
58
|
-
}
|
|
57
|
+
language: book.getLanguage()
|
|
58
|
+
}
|
|
59
59
|
};
|
|
60
|
-
}
|
|
60
|
+
}
|
|
61
61
|
};
|
|
62
62
|
// We should probabbly move it to "template" or a "site" namespace
|
|
63
63
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'basePath' does not exist on type '{ summ... Remove this comment to see the full error message
|
|
@@ -38,10 +38,10 @@ function prepareResources(output) {
|
|
|
38
38
|
}).then(() => {
|
|
39
39
|
// Set output resources
|
|
40
40
|
state = state.merge({
|
|
41
|
-
resources: result
|
|
41
|
+
resources: result
|
|
42
42
|
});
|
|
43
43
|
output = output.merge({
|
|
44
|
-
state: state
|
|
44
|
+
state: state
|
|
45
45
|
});
|
|
46
46
|
return output;
|
|
47
47
|
});
|
|
@@ -8,7 +8,7 @@ const immutable_1 = __importDefault(require("immutable"));
|
|
|
8
8
|
class GeneratorState extends immutable_1.default.Record({
|
|
9
9
|
i18n: (0, i18n_t_1.default)(),
|
|
10
10
|
// List of plugins' resources
|
|
11
|
-
resources: immutable_1.default.Map()
|
|
11
|
+
resources: immutable_1.default.Map()
|
|
12
12
|
}) {
|
|
13
13
|
getI18n() {
|
|
14
14
|
return this.get("i18n");
|
package/lib/parse/index.js
CHANGED
|
@@ -27,5 +27,5 @@ exports.default = {
|
|
|
27
27
|
parseLanguages: parseLanguages_1.default,
|
|
28
28
|
parsePage: parsePage_1.default,
|
|
29
29
|
parsePageFromString: parsePageFromString_1.default,
|
|
30
|
-
lookupStructureFile: lookupStructureFile_1.default
|
|
30
|
+
lookupStructureFile: lookupStructureFile_1.default
|
|
31
31
|
};
|
package/lib/parse/parseConfig.js
CHANGED
package/lib/parse/parseIgnore.js
CHANGED
|
@@ -19,7 +19,7 @@ function parsePageFromString(page, content) {
|
|
|
19
19
|
return page.merge({
|
|
20
20
|
content: parsed.body,
|
|
21
21
|
attributes: immutable_1.default.fromJS(parsed.attributes),
|
|
22
|
-
dir: (0, direction_1.default)(parsed.body)
|
|
22
|
+
dir: (0, direction_1.default)(parsed.body)
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
exports.default = parsePageFromString;
|
|
@@ -18,7 +18,7 @@ const mergeDefaults_1 = __importDefault(require("../utils/mergeDefaults"));
|
|
|
18
18
|
function validateConfig(bookJson) {
|
|
19
19
|
const v = new jsonschema_1.default.Validator();
|
|
20
20
|
const result = v.validate(bookJson, configSchema_1.default, {
|
|
21
|
-
propertyName: "config"
|
|
21
|
+
propertyName: "config"
|
|
22
22
|
});
|
|
23
23
|
// Throw error
|
|
24
24
|
if (result.errors.length > 0) {
|
|
@@ -33,7 +33,7 @@ const util = __importStar(require("./package-name-util"));
|
|
|
33
33
|
const try_resolve_1 = __importDefault(require("try-resolve"));
|
|
34
34
|
const SPECIAL_PACKAGE_NAME = [
|
|
35
35
|
"highlight",
|
|
36
|
-
"theme-default"
|
|
36
|
+
"theme-default" // → @honkit/honkit-plugin-theme-default
|
|
37
37
|
];
|
|
38
38
|
/**
|
|
39
39
|
* This class aim to resolve honkit's package name and get the module path.
|
package/lib/plugins/index.js
CHANGED
|
@@ -23,12 +23,12 @@ function listResources(plugins, resources) {
|
|
|
23
23
|
assets = assets.map((assetFile) => {
|
|
24
24
|
if (location_1.default.isExternal(assetFile)) {
|
|
25
25
|
return {
|
|
26
|
-
url: assetFile
|
|
26
|
+
url: assetFile
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
30
|
return {
|
|
31
|
-
path: location_1.default.normalize(path_1.default.join(npmId, assetFile))
|
|
31
|
+
path: location_1.default.normalize(path_1.default.join(npmId, assetFile))
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
});
|
|
@@ -23,7 +23,7 @@ function loadForBook(book) {
|
|
|
23
23
|
const installedPlugins = requirements.map((dep) => {
|
|
24
24
|
const name = dep.getName();
|
|
25
25
|
return dep.merge({
|
|
26
|
-
path: pluginResolver.resolvePluginPackageName(name)
|
|
26
|
+
path: pluginResolver.resolvePluginPackageName(name)
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
// Log state
|
|
@@ -65,7 +65,7 @@ function loadPlugin(book, plugin) {
|
|
|
65
65
|
}
|
|
66
66
|
catch (err) {
|
|
67
67
|
throw new error_1.default.PluginError(err, {
|
|
68
|
-
plugin: name
|
|
68
|
+
plugin: name
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -75,7 +75,7 @@ function loadPlugin(book, plugin) {
|
|
|
75
75
|
version: packageContent.version || "*",
|
|
76
76
|
path: pkgPath,
|
|
77
77
|
package: immutable_1.default.fromJS(packageContent),
|
|
78
|
-
content: immutable_1.default.fromJS(content || {})
|
|
78
|
+
content: immutable_1.default.fromJS(content || {})
|
|
79
79
|
});
|
|
80
80
|
})
|
|
81
81
|
.then((plugin) => (0, validatePlugin_1.default)(plugin))
|
|
@@ -30,7 +30,7 @@ function validatePluginConfig(book, plugin) {
|
|
|
30
30
|
// Validate and throw if invalid
|
|
31
31
|
const v = new jsonschema_1.default.Validator();
|
|
32
32
|
const result = v.validate(pluginConfig, schema, {
|
|
33
|
-
propertyName: configKey
|
|
33
|
+
propertyName: configKey
|
|
34
34
|
});
|
|
35
35
|
// Throw error
|
|
36
36
|
if (result.errors.length > 0) {
|
package/lib/templating/index.js
CHANGED
package/lib/templating/render.js
CHANGED
|
@@ -25,7 +25,7 @@ function renderTemplate(engine, filePath, content, context) {
|
|
|
25
25
|
// Replace shortcuts from plugin's blocks
|
|
26
26
|
content = (0, replaceShortcuts_1.default)(engine.getBlocks(), filePath, content);
|
|
27
27
|
return timing_1.default.measure("template.render", promise_1.default.nfcall(env.renderString.bind(env), content, context, {
|
|
28
|
-
path: filePath
|
|
28
|
+
path: filePath
|
|
29
29
|
})
|
|
30
30
|
.then((content) => {
|
|
31
31
|
return templateOutput_1.default.create(content, blocks);
|
|
@@ -30,7 +30,7 @@ function renderTemplateFile(engine, filePath, context) {
|
|
|
30
30
|
.then((result) => {
|
|
31
31
|
if (!result) {
|
|
32
32
|
throw error_1.default.TemplateError(new Error("Not found"), {
|
|
33
|
-
filename: filePath
|
|
33
|
+
filename: filePath
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
return (0, render_1.default)(engine, result.path, result.src, context);
|
|
@@ -31,7 +31,7 @@ const ThemesLoader = nunjucks_1.default.Loader.extend({
|
|
|
31
31
|
return {
|
|
32
32
|
src: src,
|
|
33
33
|
path: fullpath,
|
|
34
|
-
noCache: true
|
|
34
|
+
noCache: true
|
|
35
35
|
};
|
|
36
36
|
},
|
|
37
37
|
/**
|
|
@@ -93,6 +93,6 @@ const ThemesLoader = nunjucks_1.default.Loader.extend({
|
|
|
93
93
|
if (!resultFolder)
|
|
94
94
|
return null;
|
|
95
95
|
return path_1.default.resolve(resultFolder, to);
|
|
96
|
-
}
|
|
96
|
+
}
|
|
97
97
|
});
|
|
98
98
|
exports.default = ThemesLoader;
|
package/lib/utils/command.js
CHANGED
package/lib/utils/error.js
CHANGED
|
@@ -16,23 +16,23 @@ function enforce(err) {
|
|
|
16
16
|
// Random error wrappers during parsing/generation
|
|
17
17
|
const ParsingError = (0, wrapped_1.default)({
|
|
18
18
|
message: "Parsing Error: {origMessage}",
|
|
19
|
-
type: "parse"
|
|
19
|
+
type: "parse"
|
|
20
20
|
});
|
|
21
21
|
const OutputError = (0, wrapped_1.default)({
|
|
22
22
|
message: "Output Error: {origMessage}",
|
|
23
|
-
type: "generate"
|
|
23
|
+
type: "generate"
|
|
24
24
|
});
|
|
25
25
|
// A file does not exists
|
|
26
26
|
const FileNotFoundError = (0, typed_1.default)({
|
|
27
27
|
type: "file.not-found",
|
|
28
28
|
message: 'No "{filename}" file (or is ignored)',
|
|
29
|
-
filename: null
|
|
29
|
+
filename: null
|
|
30
30
|
});
|
|
31
31
|
// A file cannot be parsed
|
|
32
32
|
const FileNotParsableError = (0, typed_1.default)({
|
|
33
33
|
type: "file.not-parsable",
|
|
34
34
|
message: '"{filename}" file cannot be parsed',
|
|
35
|
-
filename: null
|
|
35
|
+
filename: null
|
|
36
36
|
});
|
|
37
37
|
// A file is outside the scope
|
|
38
38
|
const FileOutOfScopeError = (0, typed_1.default)({
|
|
@@ -40,7 +40,7 @@ const FileOutOfScopeError = (0, typed_1.default)({
|
|
|
40
40
|
message: '"{filename}" not in "{root}"',
|
|
41
41
|
filename: null,
|
|
42
42
|
root: null,
|
|
43
|
-
code: "EACCESS"
|
|
43
|
+
code: "EACCESS"
|
|
44
44
|
});
|
|
45
45
|
// A file is outside the scope
|
|
46
46
|
const RequireInstallError = (0, typed_1.default)({
|
|
@@ -48,30 +48,30 @@ const RequireInstallError = (0, typed_1.default)({
|
|
|
48
48
|
message: '"{cmd}" is not installed.\n{install}',
|
|
49
49
|
cmd: null,
|
|
50
50
|
code: "ENOENT",
|
|
51
|
-
install: ""
|
|
51
|
+
install: ""
|
|
52
52
|
});
|
|
53
53
|
// Error for nunjucks templates
|
|
54
54
|
const TemplateError = (0, wrapped_1.default)({
|
|
55
55
|
message: 'Error compiling template "{filename}": {origMessage}',
|
|
56
56
|
type: "template",
|
|
57
|
-
filename: null
|
|
57
|
+
filename: null
|
|
58
58
|
});
|
|
59
59
|
// Error for nunjucks templates
|
|
60
60
|
const PluginError = (0, wrapped_1.default)({
|
|
61
61
|
message: 'Error with plugin "{plugin}": {origMessage}',
|
|
62
62
|
type: "plugin",
|
|
63
|
-
plugin: null
|
|
63
|
+
plugin: null
|
|
64
64
|
});
|
|
65
65
|
// Error with the book's configuration
|
|
66
66
|
const ConfigurationError = (0, wrapped_1.default)({
|
|
67
67
|
message: "Error with book's configuration: {origMessage}",
|
|
68
|
-
type: "configuration"
|
|
68
|
+
type: "configuration"
|
|
69
69
|
});
|
|
70
70
|
// Error during ebook generation
|
|
71
71
|
const EbookError = (0, wrapped_1.default)({
|
|
72
72
|
message: "Error during ebook generation: {origMessage}\n{stdout}",
|
|
73
73
|
type: "ebook",
|
|
74
|
-
stdout: ""
|
|
74
|
+
stdout: ""
|
|
75
75
|
});
|
|
76
76
|
exports.default = {
|
|
77
77
|
enforce: enforce,
|
|
@@ -84,5 +84,5 @@ exports.default = {
|
|
|
84
84
|
TemplateError: TemplateError,
|
|
85
85
|
PluginError: PluginError,
|
|
86
86
|
ConfigurationError: ConfigurationError,
|
|
87
|
-
EbookError: EbookError
|
|
87
|
+
EbookError: EbookError
|
|
88
88
|
};
|
package/lib/utils/fs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAYpB,iBAAS,WAAW,CAAC,QAAQ,KAAA,EAAE,EAAE,KAAA,OA0BhC;AAGD,iBAAS,UAAU,CAAC,QAAQ,KAAA,OAY3B;AAGD,iBAAS,UAAU,CAAC,IAAI,KAAA,OAEvB;AAGD,iBAAS,SAAS,CAAC,IAAI,KAAA,OAEtB;
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAYpB,iBAAS,WAAW,CAAC,QAAQ,KAAA,EAAE,EAAE,KAAA,OA0BhC;AAGD,iBAAS,UAAU,CAAC,QAAQ,KAAA,OAY3B;AAGD,iBAAS,UAAU,CAAC,IAAI,KAAA,OAEvB;AAGD,iBAAS,SAAS,CAAC,IAAI,KAAA,OAEtB;AA0BD,iBAAe,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gBAaxD;AAGD,iBAAS,cAAc,CAAC,IAAI,KAAA,EAAE,QAAQ,KAAA,OAcrC;AAGD,iBAAS,UAAU,CAAC,QAAQ,KAAA,OAI3B;AAGD,iBAAS,KAAK,CAAC,IAAI,KAAA,OAIlB;AAED;;;;;;GAMG;AACH,iBAAS,UAAU,CAAC,QAAQ,KAAA,EAAE,SAAS,KAAA,OAMtC;AAED;;;;;;GAMG;AACH,iBAAS,QAAQ,CAAC,UAAU,KAAA,EAAE,QAAQ,KAAA,UAOrC;AAED;;;;;GAKG;AACH,iBAAS,YAAY,CAAC,UAAU,KAAA,OAQ/B;;;;;;;;;;;;;;;;;;;;;;;;AAED,wBAqCE"}
|
package/lib/utils/fs.js
CHANGED
|
@@ -75,6 +75,7 @@ const downloadStream = (url, dest, cb) => {
|
|
|
75
75
|
fs_1.default.unlink(dest, () => cb(err)); // delete the (partial) file and then return the error
|
|
76
76
|
});
|
|
77
77
|
file.on("error", (err) => {
|
|
78
|
+
// Handle errors
|
|
78
79
|
fs_1.default.unlink(dest, () => cb(err)); // delete the (partial) file and then return the error
|
|
79
80
|
});
|
|
80
81
|
};
|
package/lib/utils/git.js
CHANGED
package/lib/utils/images.js
CHANGED
package/lib/utils/location.js
CHANGED