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.
Files changed (110) hide show
  1. package/lib/api/deprecate.js +2 -2
  2. package/lib/api/encodeConfig.js +1 -1
  3. package/lib/api/encodeNavigation.js +3 -3
  4. package/lib/api/encodePage.js +2 -2
  5. package/lib/api/encodeProgress.js +1 -1
  6. package/lib/api/encodeSummary.js +1 -1
  7. package/lib/api/index.js +1 -1
  8. package/lib/browser.js +1 -1
  9. package/lib/cli/build.js +2 -2
  10. package/lib/cli/buildEbook.js +2 -2
  11. package/lib/cli/init.js +1 -1
  12. package/lib/cli/options.js +5 -5
  13. package/lib/cli/parse.js +1 -1
  14. package/lib/cli/serve.d.ts.map +1 -1
  15. package/lib/cli/serve.js +28 -19
  16. package/lib/cli/server.js +1 -1
  17. package/lib/cli/watch.js +1 -1
  18. package/lib/constants/configSchema.js +50 -50
  19. package/lib/constants/defaultFilters.js +1 -1
  20. package/lib/fs/mock.js +5 -5
  21. package/lib/fs/node.js +1 -1
  22. package/lib/honkit.js +1 -1
  23. package/lib/index.js +1 -1
  24. package/lib/json/encodeBook.js +4 -4
  25. package/lib/json/encodeFile.js +1 -1
  26. package/lib/json/encodeGlossary.js +1 -1
  27. package/lib/json/encodeGlossaryEntry.js +1 -1
  28. package/lib/json/encodeLanguages.js +2 -2
  29. package/lib/json/encodeOutput.js +1 -1
  30. package/lib/json/encodeReadme.js +1 -1
  31. package/lib/json/encodeSummary.js +1 -1
  32. package/lib/json/encodeSummaryArticle.js +1 -1
  33. package/lib/json/encodeSummaryArticleWithCache.js +1 -1
  34. package/lib/json/encodeSummaryPart.js +1 -1
  35. package/lib/json/index.js +1 -1
  36. package/lib/models/book.js +4 -4
  37. package/lib/models/config.js +3 -3
  38. package/lib/models/fs.js +2 -2
  39. package/lib/models/glossaryEntry.js +1 -1
  40. package/lib/models/hash.js +1 -1
  41. package/lib/models/ignore.js +1 -1
  42. package/lib/models/language.js +1 -1
  43. package/lib/models/languages.js +3 -3
  44. package/lib/models/output.js +2 -2
  45. package/lib/models/page.js +4 -4
  46. package/lib/models/plugin.js +3 -3
  47. package/lib/models/pluginDependency.js +6 -6
  48. package/lib/models/readme.js +2 -2
  49. package/lib/models/summary.js +4 -4
  50. package/lib/models/summaryArticle.js +2 -2
  51. package/lib/models/summaryPart.js +2 -2
  52. package/lib/models/templateBlock.js +4 -4
  53. package/lib/models/templateEngine.js +4 -4
  54. package/lib/models/templateOutput.js +2 -2
  55. package/lib/modifiers/config/index.js +1 -1
  56. package/lib/modifiers/index.js +1 -1
  57. package/lib/modifiers/summary/editArticleRef.js +1 -1
  58. package/lib/modifiers/summary/editArticleTitle.js +1 -1
  59. package/lib/modifiers/summary/index.js +1 -1
  60. package/lib/modifiers/summary/indexArticleLevels.js +1 -1
  61. package/lib/modifiers/summary/indexPartLevels.js +1 -1
  62. package/lib/output/createTemplateEngine.js +1 -1
  63. package/lib/output/ebook/getConvertOptions.js +2 -2
  64. package/lib/output/ebook/getPDFTemplate.js +3 -3
  65. package/lib/output/ebook/index.js +1 -1
  66. package/lib/output/ebook/onFinish.js +2 -2
  67. package/lib/output/ebook/options.js +1 -1
  68. package/lib/output/generateBook.js +2 -2
  69. package/lib/output/getModifiers.js +3 -3
  70. package/lib/output/index.js +1 -1
  71. package/lib/output/json/index.js +1 -1
  72. package/lib/output/json/options.js +1 -1
  73. package/lib/output/modifiers/index.js +1 -1
  74. package/lib/output/preparePlugins.js +1 -1
  75. package/lib/output/testing/createMock.js +1 -1
  76. package/lib/output/testing/generateMock.js +2 -2
  77. package/lib/output/website/copyPluginAssets.js +2 -2
  78. package/lib/output/website/createTemplateEngine.js +4 -4
  79. package/lib/output/website/index.js +1 -1
  80. package/lib/output/website/onPage.js +4 -4
  81. package/lib/output/website/options.js +1 -1
  82. package/lib/output/website/prepareResources.js +2 -2
  83. package/lib/output/website/state.js +1 -1
  84. package/lib/parse/index.js +1 -1
  85. package/lib/parse/parseConfig.js +1 -1
  86. package/lib/parse/parseIgnore.js +1 -1
  87. package/lib/parse/parsePageFromString.js +1 -1
  88. package/lib/parse/parseSummary.js +1 -1
  89. package/lib/parse/validateConfig.js +1 -1
  90. package/lib/plugins/PluginResolver.js +1 -1
  91. package/lib/plugins/index.js +1 -1
  92. package/lib/plugins/listResources.js +2 -2
  93. package/lib/plugins/loadForBook.js +1 -1
  94. package/lib/plugins/loadPlugin.js +2 -2
  95. package/lib/plugins/validateConfig.js +1 -1
  96. package/lib/templating/index.js +1 -1
  97. package/lib/templating/render.js +1 -1
  98. package/lib/templating/renderFile.js +1 -1
  99. package/lib/templating/themesLoader.js +2 -2
  100. package/lib/utils/command.js +1 -1
  101. package/lib/utils/error.js +11 -11
  102. package/lib/utils/fs.d.ts.map +1 -1
  103. package/lib/utils/fs.js +1 -0
  104. package/lib/utils/git.js +1 -1
  105. package/lib/utils/images.js +1 -1
  106. package/lib/utils/location.js +1 -1
  107. package/lib/utils/logger.js +2 -2
  108. package/lib/utils/path.js +2 -2
  109. package/lib/utils/timing.js +2 -2
  110. package/package.json +7 -7
@@ -15,7 +15,7 @@ function indexArticleLevels(article, baseLevel) {
15
15
  });
16
16
  return article.merge({
17
17
  level: baseLevel,
18
- articles: articles,
18
+ articles: articles
19
19
  });
20
20
  }
21
21
  exports.default = indexArticleLevels;
@@ -19,7 +19,7 @@ function indexPartLevels(part, index) {
19
19
  });
20
20
  return part.merge({
21
21
  level: baseLevel,
22
- articles: articles,
22
+ articles: articles
23
23
  });
24
24
  }
25
25
  exports.default = indexPartLevels;
@@ -36,7 +36,7 @@ function createTemplateEngine(output) {
36
36
  filters: filters,
37
37
  blocks: blocks,
38
38
  loader: loader,
39
- context: context,
39
+ context: context
40
40
  });
41
41
  }
42
42
  exports.default = createTemplateEngine;
@@ -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
@@ -12,5 +12,5 @@ exports.default = (0, extend_1.default)({}, website_1.default, {
12
12
  name: "ebook",
13
13
  Options: options_1.default,
14
14
  onPage: onPage_1.default,
15
- onFinish: onFinish_1.default,
15
+ onFinish: onFinish_1.default
16
16
  });
@@ -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;
@@ -21,5 +21,5 @@ function getGenerator(name) {
21
21
  exports.default = {
22
22
  generate: generateBook_1.generateBook,
23
23
  incrementalBuild: generateBook_1.incrementalBuild,
24
- getGenerator: getGenerator,
24
+ getGenerator: getGenerator
25
25
  };
@@ -10,5 +10,5 @@ exports.default = {
10
10
  name: "json",
11
11
  Options: options_1.default,
12
12
  onPage: onPage_1.onPage,
13
- onFinish: onFinish_1.onFinish,
13
+ onFinish: onFinish_1.onFinish
14
14
  };
@@ -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;
@@ -22,5 +22,5 @@ exports.default = {
22
22
  resolveLinks: resolveLinks_1.default,
23
23
  resolveImages: resolveImages_1.default,
24
24
  annotateText: annotateText_1.default,
25
- highlightCode: highlightCode_1.default,
25
+ highlightCode: highlightCode_1.default
26
26
  };
@@ -28,7 +28,7 @@ function preparePlugins(output) {
28
28
  return plugins_1.default.validateConfig(book, plugins).then((newBook) => {
29
29
  return output.merge({
30
30
  book: newBook,
31
- plugins: plugins,
31
+ plugins: plugins
32
32
  });
33
33
  });
34
34
  }));
@@ -31,7 +31,7 @@ function createMockOutput(generator, files, options) {
31
31
  book: resultBook,
32
32
  options: options,
33
33
  state: state,
34
- generator: generator.name,
34
+ generator: generator.name
35
35
  });
36
36
  })
37
37
  .then(preparePlugins_1.default);
@@ -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;
@@ -18,5 +18,5 @@ exports.default = {
18
18
  onFinish: onFinish_1.onFinish,
19
19
  onPage: onPage_1.onPage,
20
20
  onAsset: onAsset_1.default,
21
- createTemplateEngine: createTemplateEngine_1.default,
21
+ createTemplateEngine: createTemplateEngine_1.default
22
22
  };
@@ -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
@@ -10,6 +10,6 @@ const Options = immutable_1.default.Record({
10
10
  // Prefix for generation
11
11
  prefix: String("website"),
12
12
  // Use directory index url instead of "index.html"
13
- directoryIndex: Boolean(true),
13
+ directoryIndex: Boolean(true)
14
14
  });
15
15
  exports.default = Options;
@@ -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");
@@ -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
  };
@@ -27,7 +27,7 @@ function parseConfig(book) {
27
27
  return fs.statFile(filename).then((file) => {
28
28
  return {
29
29
  file: file,
30
- values: cfg,
30
+ values: cfg
31
31
  };
32
32
  });
33
33
  })
@@ -15,7 +15,7 @@ const DEFAULT_IGNORES = [
15
15
  // Skip book outputs
16
16
  "_book",
17
17
  // Ignore files in the templates folder
18
- "_layouts",
18
+ "_layouts"
19
19
  ];
20
20
  /**
21
21
  Parse ignore files
@@ -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;
@@ -33,7 +33,7 @@ function parseSummary(book) {
33
33
  if (readmeFile.exists() && !readmeArticle) {
34
34
  summary = SummaryModifier.unshiftArticle(summary, {
35
35
  title: "Introduction",
36
- ref: readmeFile.getPath(),
36
+ ref: readmeFile.getPath()
37
37
  });
38
38
  }
39
39
  // Set new summary
@@ -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", // → @honkit/honkit-plugin-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.
@@ -13,5 +13,5 @@ exports.default = {
13
13
  validateConfig: validateConfig_1.default,
14
14
  listResources: listResources_1.default,
15
15
  listBlocks: listBlocks_1.default,
16
- listFilters: listFilters_1.default,
16
+ listFilters: listFilters_1.default
17
17
  };
@@ -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) {
@@ -15,5 +15,5 @@ exports.default = {
15
15
  postRender: postRender_1.default,
16
16
  replaceShortcuts: replaceShortcuts_1.default,
17
17
  ConrefsLoader: conrefsLoader_1.default,
18
- ThemesLoader: themesLoader_1.default,
18
+ ThemesLoader: themesLoader_1.default
19
19
  };
@@ -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;
@@ -68,5 +68,5 @@ function optionsToShellArgs(options) {
68
68
  }
69
69
  exports.default = {
70
70
  exec: exec,
71
- optionsToShellArgs: optionsToShellArgs,
71
+ optionsToShellArgs: optionsToShellArgs
72
72
  };
@@ -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
  };
@@ -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;AAyBD,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"}
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
@@ -110,7 +110,7 @@ Git.parseUrl = function (giturl) {
110
110
  return {
111
111
  host: uri.toString(),
112
112
  ref: ref,
113
- filepath: filepath,
113
+ filepath: filepath
114
114
  };
115
115
  };
116
116
  exports.default = Git;
@@ -18,5 +18,5 @@ function convertInlinePNG(source, dest) {
18
18
  });
19
19
  }
20
20
  exports.default = {
21
- convertInlinePNG: convertInlinePNG,
21
+ convertInlinePNG: convertInlinePNG
22
22
  };
@@ -125,5 +125,5 @@ exports.default = {
125
125
  toAbsolute: toAbsolute,
126
126
  relative: relative,
127
127
  relativeForFile: relativeForFile,
128
- flatten: flatten,
128
+ flatten: flatten
129
129
  };