fix
This commit is contained in:
13
book/node_modules/honkit/lib/BuildGenerator.d.ts
generated
vendored
Normal file
13
book/node_modules/honkit/lib/BuildGenerator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import GeneratorState from "./output/website/state";
|
||||
import createTemplateEngine from "./output/website/createTemplateEngine";
|
||||
export interface BuildGenerator {
|
||||
name: string;
|
||||
State: GeneratorState;
|
||||
Options: any;
|
||||
onInit: Function;
|
||||
onFinish: Function;
|
||||
onPage: Function;
|
||||
onAsset: Function;
|
||||
createTemplateEngine: typeof createTemplateEngine;
|
||||
}
|
||||
//# sourceMappingURL=BuildGenerator.d.ts.map
|
||||
1
book/node_modules/honkit/lib/BuildGenerator.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/BuildGenerator.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BuildGenerator.d.ts","sourceRoot":"","sources":["../src/BuildGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,oBAAoB,MAAM,uCAAuC,CAAC;AAEzE,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,GAAG,CAAC;IACb,MAAM,EAAE,QAAQ,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,QAAQ,CAAC;IACjB,OAAO,EAAE,QAAQ,CAAC;IAClB,oBAAoB,EAAE,OAAO,oBAAoB,CAAC;CACrD"}
|
||||
2
book/node_modules/honkit/lib/BuildGenerator.js
generated
vendored
Normal file
2
book/node_modules/honkit/lib/BuildGenerator.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
10
book/node_modules/honkit/lib/api/decodeConfig.d.ts
generated
vendored
Normal file
10
book/node_modules/honkit/lib/api/decodeConfig.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
Decode changes from a JS API to a config object
|
||||
|
||||
@param {Config} config
|
||||
@param {Object} result: result from API
|
||||
@return {Config}
|
||||
*/
|
||||
declare function decodeConfig(config: any, result: any): any;
|
||||
export { decodeConfig };
|
||||
//# sourceMappingURL=decodeConfig.d.ts.map
|
||||
1
book/node_modules/honkit/lib/api/decodeConfig.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/api/decodeConfig.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"decodeConfig.d.ts","sourceRoot":"","sources":["../../src/api/decodeConfig.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,iBAAS,YAAY,CAAC,MAAM,KAAA,EAAE,MAAM,KAAA,OAOnC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
||||
16
book/node_modules/honkit/lib/api/decodeConfig.js
generated
vendored
Normal file
16
book/node_modules/honkit/lib/api/decodeConfig.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.decodeConfig = decodeConfig;
|
||||
/**
|
||||
Decode changes from a JS API to a config object
|
||||
|
||||
@param {Config} config
|
||||
@param {Object} result: result from API
|
||||
@return {Config}
|
||||
*/
|
||||
function decodeConfig(config, result) {
|
||||
const values = result.values;
|
||||
delete values.generator;
|
||||
delete values.output;
|
||||
return config.updateValues(values);
|
||||
}
|
||||
11
book/node_modules/honkit/lib/api/decodeGlobal.d.ts
generated
vendored
Normal file
11
book/node_modules/honkit/lib/api/decodeGlobal.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
Decode changes from a JS API to a output object.
|
||||
Only the configuration can be edited by plugin's hooks
|
||||
|
||||
@param {Output} output
|
||||
@param {Object} result: result from API
|
||||
@return {Output}
|
||||
*/
|
||||
declare function decodeGlobal(output: any, result: any): any;
|
||||
export { decodeGlobal };
|
||||
//# sourceMappingURL=decodeGlobal.d.ts.map
|
||||
1
book/node_modules/honkit/lib/api/decodeGlobal.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/api/decodeGlobal.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"decodeGlobal.d.ts","sourceRoot":"","sources":["../../src/api/decodeGlobal.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,iBAAS,YAAY,CAAC,MAAM,KAAA,EAAE,MAAM,KAAA,OASnC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
||||
20
book/node_modules/honkit/lib/api/decodeGlobal.js
generated
vendored
Normal file
20
book/node_modules/honkit/lib/api/decodeGlobal.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.decodeGlobal = decodeGlobal;
|
||||
const decodeConfig_1 = require("./decodeConfig");
|
||||
/**
|
||||
Decode changes from a JS API to a output object.
|
||||
Only the configuration can be edited by plugin's hooks
|
||||
|
||||
@param {Output} output
|
||||
@param {Object} result: result from API
|
||||
@return {Output}
|
||||
*/
|
||||
function decodeGlobal(output, result) {
|
||||
let book = output.getBook();
|
||||
let config = book.getConfig();
|
||||
// Update config
|
||||
config = (0, decodeConfig_1.decodeConfig)(config, result.config);
|
||||
book = book.set("config", config);
|
||||
return output.set("book", book);
|
||||
}
|
||||
12
book/node_modules/honkit/lib/api/decodePage.d.ts
generated
vendored
Normal file
12
book/node_modules/honkit/lib/api/decodePage.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
Decode changes from a JS API to a page object.
|
||||
Only the content can be edited by plugin's hooks.
|
||||
|
||||
@param {Output} output
|
||||
@param {Page} page: page instance to edit
|
||||
@param {Object} result: result from API
|
||||
@return {Page}
|
||||
*/
|
||||
declare function decodePage(output: any, page: any, result: any): any;
|
||||
export default decodePage;
|
||||
//# sourceMappingURL=decodePage.d.ts.map
|
||||
1
book/node_modules/honkit/lib/api/decodePage.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/api/decodePage.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"decodePage.d.ts","sourceRoot":"","sources":["../../src/api/decodePage.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,iBAAS,UAAU,CAAC,MAAM,KAAA,EAAE,IAAI,KAAA,EAAE,MAAM,KAAA,OAiCvC;AAED,eAAe,UAAU,CAAC"}
|
||||
41
book/node_modules/honkit/lib/api/decodePage.js
generated
vendored
Normal file
41
book/node_modules/honkit/lib/api/decodePage.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const deprecate_1 = __importDefault(require("./deprecate"));
|
||||
/**
|
||||
Decode changes from a JS API to a page object.
|
||||
Only the content can be edited by plugin's hooks.
|
||||
|
||||
@param {Output} output
|
||||
@param {Page} page: page instance to edit
|
||||
@param {Object} result: result from API
|
||||
@return {Page}
|
||||
*/
|
||||
function decodePage(output, page, result) {
|
||||
const originalContent = page.getContent();
|
||||
// No returned value
|
||||
// Existing content will be used
|
||||
if (!result) {
|
||||
return page;
|
||||
}
|
||||
deprecate_1.default.disable("page.sections");
|
||||
// GitBook/HonKit 3
|
||||
// Use returned page.content if different from original content
|
||||
if (result.content != originalContent) {
|
||||
page = page.set("content", result.content);
|
||||
}
|
||||
// GitBook 2 compatibility
|
||||
// Finally, use page.sections
|
||||
else if (result.sections) {
|
||||
page = page.set("content", result.sections
|
||||
.map((section) => {
|
||||
return section.content;
|
||||
})
|
||||
.join("\n"));
|
||||
}
|
||||
deprecate_1.default.enable("page.sections");
|
||||
return page;
|
||||
}
|
||||
exports.default = decodePage;
|
||||
52
book/node_modules/honkit/lib/api/deprecate.d.ts
generated
vendored
Normal file
52
book/node_modules/honkit/lib/api/deprecate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
Deprecate a function
|
||||
|
||||
@param {Book|Output} book
|
||||
@param {string} key: unique identitifer for the deprecated
|
||||
@param {Function} fn
|
||||
@param {string} msg: message to print when called
|
||||
@return {Function}
|
||||
*/
|
||||
declare function deprecateMethod(book: any, key: any, fn: any, msg: any): () => any;
|
||||
/**
|
||||
Deprecate a property of an object
|
||||
|
||||
@param {Book|Output} book
|
||||
@param {string} key: unique identitifer for the deprecated
|
||||
@param {Object} instance
|
||||
@param {String|Function} property
|
||||
@param {string} msg: message to print when called
|
||||
@return {Function}
|
||||
*/
|
||||
declare function deprecateField(book: any, key: any, instance: any, property: any, value: any, msg: any): void;
|
||||
/**
|
||||
Enable a deprecation
|
||||
|
||||
@param {string} key: unique identitifer
|
||||
*/
|
||||
declare function enableDeprecation(key: any): void;
|
||||
/**
|
||||
Disable a deprecation
|
||||
|
||||
@param {string} key: unique identitifer
|
||||
*/
|
||||
declare function disableDeprecation(key: any): void;
|
||||
/**
|
||||
Deprecate a method in favor of another one
|
||||
|
||||
@param {Book} book
|
||||
@param {string} key
|
||||
@param {Object} instance
|
||||
@param {string} oldName
|
||||
@param {string} newName
|
||||
*/
|
||||
declare function deprecateRenamedMethod(book: any, key: any, instance: any, oldName: any, newName: any, msg: any): void;
|
||||
declare const _default: {
|
||||
method: typeof deprecateMethod;
|
||||
renamedMethod: typeof deprecateRenamedMethod;
|
||||
field: typeof deprecateField;
|
||||
enable: typeof enableDeprecation;
|
||||
disable: typeof disableDeprecation;
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=deprecate.d.ts.map
|
||||
1
book/node_modules/honkit/lib/api/deprecate.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/api/deprecate.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"deprecate.d.ts","sourceRoot":"","sources":["../../src/api/deprecate.ts"],"names":[],"mappings":"AAsBA;;;;;;;;GAQG;AACH,iBAAS,eAAe,CAAC,IAAI,KAAA,EAAE,GAAG,KAAA,EAAE,EAAE,KAAA,EAAE,GAAG,KAAA,aAM1C;AAED;;;;;;;;;GASG;AACH,iBAAS,cAAc,CAAC,IAAI,KAAA,EAAE,GAAG,KAAA,EAAE,QAAQ,KAAA,EAAE,QAAQ,KAAA,EAAE,KAAK,KAAA,EAAE,GAAG,KAAA,QA8BhE;AAED;;;;GAIG;AACH,iBAAS,iBAAiB,CAAC,GAAG,KAAA,QAE7B;AAED;;;;GAIG;AACH,iBAAS,kBAAkB,CAAC,GAAG,KAAA,QAE9B;AAED;;;;;;;;GAQG;AACH,iBAAS,sBAAsB,CAAC,IAAI,KAAA,EAAE,GAAG,KAAA,EAAE,QAAQ,KAAA,EAAE,OAAO,KAAA,EAAE,OAAO,KAAA,EAAE,GAAG,KAAA,QAKzE;;;;;;;;AAED,wBAME"}
|
||||
113
book/node_modules/honkit/lib/api/deprecate.js
generated
vendored
Normal file
113
book/node_modules/honkit/lib/api/deprecate.js
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const is_1 = __importDefault(require("is"));
|
||||
const object_path_1 = __importDefault(require("object-path"));
|
||||
const logged = {};
|
||||
const disabled = {};
|
||||
/**
|
||||
Log a deprecated notice
|
||||
|
||||
@param {Book|Output} book
|
||||
@param {string} key
|
||||
@param {string} message
|
||||
*/
|
||||
function logNotice(book, key, message) {
|
||||
if (logged[key] || disabled[key])
|
||||
return;
|
||||
logged[key] = true;
|
||||
const logger = book.getLogger();
|
||||
logger.warn.ln(message);
|
||||
}
|
||||
/**
|
||||
Deprecate a function
|
||||
|
||||
@param {Book|Output} book
|
||||
@param {string} key: unique identitifer for the deprecated
|
||||
@param {Function} fn
|
||||
@param {string} msg: message to print when called
|
||||
@return {Function}
|
||||
*/
|
||||
function deprecateMethod(book, key, fn, msg) {
|
||||
return function () {
|
||||
logNotice(book, key, msg);
|
||||
return fn.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
/**
|
||||
Deprecate a property of an object
|
||||
|
||||
@param {Book|Output} book
|
||||
@param {string} key: unique identitifer for the deprecated
|
||||
@param {Object} instance
|
||||
@param {String|Function} property
|
||||
@param {string} msg: message to print when called
|
||||
@return {Function}
|
||||
*/
|
||||
function deprecateField(book, key, instance, property, value, msg) {
|
||||
let store = undefined;
|
||||
const prepare = function () {
|
||||
if (!is_1.default.undefined(store))
|
||||
return;
|
||||
if (is_1.default.fn(value))
|
||||
store = value();
|
||||
else
|
||||
store = value;
|
||||
};
|
||||
const getter = function () {
|
||||
prepare();
|
||||
logNotice(book, key, msg);
|
||||
return store;
|
||||
};
|
||||
const setter = function (v) {
|
||||
prepare();
|
||||
logNotice(book, key, msg);
|
||||
store = v;
|
||||
return store;
|
||||
};
|
||||
Object.defineProperty(instance, property, {
|
||||
get: getter,
|
||||
set: setter,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
Enable a deprecation
|
||||
|
||||
@param {string} key: unique identitifer
|
||||
*/
|
||||
function enableDeprecation(key) {
|
||||
disabled[key] = false;
|
||||
}
|
||||
/**
|
||||
Disable a deprecation
|
||||
|
||||
@param {string} key: unique identitifer
|
||||
*/
|
||||
function disableDeprecation(key) {
|
||||
disabled[key] = true;
|
||||
}
|
||||
/**
|
||||
Deprecate a method in favor of another one
|
||||
|
||||
@param {Book} book
|
||||
@param {string} key
|
||||
@param {Object} instance
|
||||
@param {string} oldName
|
||||
@param {string} newName
|
||||
*/
|
||||
function deprecateRenamedMethod(book, key, instance, oldName, newName, msg) {
|
||||
msg = msg || `"${oldName}" is deprecated, use "${newName}()" instead`;
|
||||
const fn = object_path_1.default.get(instance, newName);
|
||||
instance[oldName] = deprecateMethod(book, key, fn, msg);
|
||||
}
|
||||
exports.default = {
|
||||
method: deprecateMethod,
|
||||
renamedMethod: deprecateRenamedMethod,
|
||||
field: deprecateField,
|
||||
enable: enableDeprecation,
|
||||
disable: disableDeprecation
|
||||
};
|
||||
12
book/node_modules/honkit/lib/api/encodeConfig.d.ts
generated
vendored
Normal file
12
book/node_modules/honkit/lib/api/encodeConfig.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import Output from "../models/output";
|
||||
import Config from "../models/config";
|
||||
/**
|
||||
Encode a config object into a JS config api
|
||||
*/
|
||||
declare function encodeConfig(output: Output, config: Config): {
|
||||
values: any;
|
||||
get: (key: any, defaultValue: any) => any;
|
||||
set: (key: any, value: any) => any;
|
||||
};
|
||||
export default encodeConfig;
|
||||
//# sourceMappingURL=encodeConfig.d.ts.map
|
||||
1
book/node_modules/honkit/lib/api/encodeConfig.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/api/encodeConfig.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"encodeConfig.d.ts","sourceRoot":"","sources":["../../src/api/encodeConfig.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC;;GAEG;AAEH,iBAAS,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;EAyCnD;AAED,eAAe,YAAY,CAAC"}
|
||||
26
book/node_modules/honkit/lib/api/encodeConfig.js
generated
vendored
Normal file
26
book/node_modules/honkit/lib/api/encodeConfig.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const object_path_1 = __importDefault(require("object-path"));
|
||||
const deprecate_1 = __importDefault(require("./deprecate"));
|
||||
/**
|
||||
Encode a config object into a JS config api
|
||||
*/
|
||||
function encodeConfig(output, config) {
|
||||
const result = {
|
||||
values: config.getValues().toJS(),
|
||||
get: function (key, defaultValue) {
|
||||
return object_path_1.default.get(result.values, key, defaultValue);
|
||||
},
|
||||
set: function (key, value) {
|
||||
return object_path_1.default.set(result.values, key, value);
|
||||
}
|
||||
};
|
||||
deprecate_1.default.field(output, "config.options", result, "options", result.values, '"config.options" property is deprecated, use "config.get(key)" instead');
|
||||
deprecate_1.default.field(output, "config.options.generator", result.values, "generator", output.getGenerator(), '"options.generator" property is deprecated, use "output.name" instead');
|
||||
deprecate_1.default.field(output, "config.options.generator", result.values, "output", output.getRoot(), '"options.output" property is deprecated, use "output.root()" instead');
|
||||
return result;
|
||||
}
|
||||
exports.default = encodeConfig;
|
||||
165
book/node_modules/honkit/lib/api/encodeGlobal.d.ts
generated
vendored
Normal file
165
book/node_modules/honkit/lib/api/encodeGlobal.d.ts
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
import { ParserOptions } from "../models/parser";
|
||||
/**
|
||||
Encode a global context into a JS object
|
||||
It's the context for page's hook, etc
|
||||
|
||||
@param {Output} output
|
||||
@return {Object}
|
||||
*/
|
||||
declare function encodeGlobal(output: any): {
|
||||
log: any;
|
||||
config: {
|
||||
values: any;
|
||||
get: (key: any, defaultValue: any) => any;
|
||||
set: (key: any, value: any) => any;
|
||||
};
|
||||
summary: {
|
||||
walk: (iter: any) => void;
|
||||
getArticleByLevel: (level: any) => {
|
||||
title: string;
|
||||
level: string;
|
||||
depth: number;
|
||||
anchor: string;
|
||||
url: string;
|
||||
path: string;
|
||||
ref: string;
|
||||
articles: any;
|
||||
};
|
||||
getArticleByPath: (level: any) => {
|
||||
title: string;
|
||||
level: string;
|
||||
depth: number;
|
||||
anchor: string;
|
||||
url: string;
|
||||
path: string;
|
||||
ref: string;
|
||||
articles: any;
|
||||
};
|
||||
};
|
||||
/**
|
||||
Check if the book is a multilingual book
|
||||
|
||||
@return {boolean}
|
||||
*/
|
||||
isMultilingual: () => any;
|
||||
/**
|
||||
Check if the book is a language book for a multilingual book
|
||||
|
||||
@return {boolean}
|
||||
*/
|
||||
isLanguageBook: () => any;
|
||||
/**
|
||||
Read a file from the book
|
||||
|
||||
@param {string} fileName
|
||||
@return {Promise<Buffer>}
|
||||
*/
|
||||
readFile: (fileName: any) => any;
|
||||
/**
|
||||
Read a file from the book as a string
|
||||
|
||||
@param {string} fileName
|
||||
@return {Promise<String>}
|
||||
*/
|
||||
readFileAsString: (fileName: any) => any;
|
||||
/**
|
||||
Resolve a file from the book root
|
||||
|
||||
@param {string} fileName
|
||||
@return {string}
|
||||
*/
|
||||
resolve: (fileName: any) => string;
|
||||
/**
|
||||
Resolve a page by it path
|
||||
|
||||
@param {string} filePath
|
||||
@return {string}
|
||||
*/
|
||||
getPageByPath: (filePath: any) => import("./encodePage").EncodedPageWithAttributes;
|
||||
/**
|
||||
Render a block of text (markdown/asciidoc)
|
||||
|
||||
@param {string} type
|
||||
@param {string} text
|
||||
@param options
|
||||
@return {Promise<String>}
|
||||
*/
|
||||
renderBlock: (type: string, text: string, options: ParserOptions) => any;
|
||||
/**
|
||||
Render an inline text (markdown/asciidoc)
|
||||
|
||||
@param {string} type
|
||||
@param {string} text
|
||||
@param options
|
||||
@return {Promise<String>}
|
||||
*/
|
||||
renderInline: (type: string, text: string, options: ParserOptions) => any;
|
||||
template: {
|
||||
/**
|
||||
Apply a templating block and returns its result
|
||||
|
||||
@param {string} name
|
||||
@param {Object} blockData
|
||||
@return {Promise|Object}
|
||||
*/
|
||||
applyBlock: (name: any, blockData: any) => any;
|
||||
};
|
||||
output: {
|
||||
/**
|
||||
Name of the generator being used
|
||||
{string}
|
||||
*/
|
||||
name: any;
|
||||
/**
|
||||
Return absolute path to the root folder of output
|
||||
@return {string}
|
||||
*/
|
||||
root: () => any;
|
||||
/**
|
||||
Resolve a file from the output root
|
||||
|
||||
@param {string} fileName
|
||||
@return {string}
|
||||
*/
|
||||
resolve: (fileName: any) => string;
|
||||
/**
|
||||
Convert a filepath into an url
|
||||
@return {string}
|
||||
*/
|
||||
toURL: (filePath: any) => string;
|
||||
/**
|
||||
Check that a file exists.
|
||||
|
||||
@param {string} fileName
|
||||
@return {Promise}
|
||||
*/
|
||||
hasFile: (fileName: any, content: any) => any;
|
||||
/**
|
||||
Write a file to the output folder,
|
||||
It creates the required folder
|
||||
|
||||
@param {string} fileName
|
||||
@param {Buffer} content
|
||||
@return {Promise}
|
||||
*/
|
||||
writeFile: (fileName: any, content: any) => any;
|
||||
/**
|
||||
Copy a file to the output folder
|
||||
It creates the required folder.
|
||||
|
||||
@param {string} inputFile
|
||||
@param {string} outputFile
|
||||
@param {Buffer} content
|
||||
@return {Promise}
|
||||
*/
|
||||
copyFile: (inputFile: any, outputFile: any, content: any) => any;
|
||||
};
|
||||
gitbook: {
|
||||
version: any;
|
||||
};
|
||||
honkit: {
|
||||
version: any;
|
||||
};
|
||||
};
|
||||
export default encodeGlobal;
|
||||
//# sourceMappingURL=encodeGlobal.d.ts.map
|
||||
1
book/node_modules/honkit/lib/api/encodeGlobal.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/api/encodeGlobal.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"encodeGlobal.d.ts","sourceRoot":"","sources":["../../src/api/encodeGlobal.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;;;GAMG;AACH,iBAAS,YAAY,CAAC,MAAM,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAapB;;;;OAIG;;IAKH;;;;OAIG;;IAKH;;;;;OAKG;;IAKH;;;;;OAKG;;IAKH;;;;;OAKG;;IAKH;;;;;OAKG;;IAQH;;;;;;;OAOG;wBAC0B,MAAM,QAAQ,MAAM,WAAW,aAAa;IAMzE;;;;;;;OAOG;yBAC2B,MAAM,QAAQ,MAAM,WAAW,aAAa;;QAOtE;;;;;;WAMG;;;;QASH;;;WAGG;;QAGH;;;WAGG;;QAKH;;;;;WAKG;;QAKH;;;WAGG;;QAKH;;;;;WAKG;;QAUH;;;;;;;WAOG;;QAYH;;;;;;;;WAQG;;;;;;;;;EAoEd;AAED,eAAe,YAAY,CAAC"}
|
||||
228
book/node_modules/honkit/lib/api/encodeGlobal.js
generated
vendored
Normal file
228
book/node_modules/honkit/lib/api/encodeGlobal.js
generated
vendored
Normal file
@@ -0,0 +1,228 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const promise_1 = __importDefault(require("../utils/promise"));
|
||||
const path_2 = __importDefault(require("../utils/path"));
|
||||
const fs_1 = __importDefault(require("../utils/fs"));
|
||||
const plugins_1 = __importDefault(require("../plugins"));
|
||||
const deprecate_1 = __importDefault(require("./deprecate"));
|
||||
const fileToURL_1 = __importDefault(require("../output/helper/fileToURL"));
|
||||
const defaultBlocks_1 = __importDefault(require("../constants/defaultBlocks"));
|
||||
const honkit_1 = __importDefault(require("../honkit"));
|
||||
const parsers_1 = __importDefault(require("../parsers"));
|
||||
const encodeConfig_1 = __importDefault(require("./encodeConfig"));
|
||||
const encodeSummary_1 = __importDefault(require("./encodeSummary"));
|
||||
const encodeNavigation_1 = __importDefault(require("./encodeNavigation"));
|
||||
const encodePage_1 = __importDefault(require("./encodePage"));
|
||||
/**
|
||||
Encode a global context into a JS object
|
||||
It's the context for page's hook, etc
|
||||
|
||||
@param {Output} output
|
||||
@return {Object}
|
||||
*/
|
||||
function encodeGlobal(output) {
|
||||
const book = output.getBook();
|
||||
const bookFS = book.getContentFS();
|
||||
const logger = output.getLogger();
|
||||
const outputFolder = output.getRoot();
|
||||
const plugins = output.getPlugins();
|
||||
const blocks = plugins_1.default.listBlocks(plugins);
|
||||
const result = {
|
||||
log: logger,
|
||||
config: (0, encodeConfig_1.default)(output, book.getConfig()),
|
||||
summary: (0, encodeSummary_1.default)(output, book.getSummary()),
|
||||
/**
|
||||
Check if the book is a multilingual book
|
||||
|
||||
@return {boolean}
|
||||
*/
|
||||
isMultilingual: function () {
|
||||
return book.isMultilingual();
|
||||
},
|
||||
/**
|
||||
Check if the book is a language book for a multilingual book
|
||||
|
||||
@return {boolean}
|
||||
*/
|
||||
isLanguageBook: function () {
|
||||
return book.isLanguageBook();
|
||||
},
|
||||
/**
|
||||
Read a file from the book
|
||||
|
||||
@param {string} fileName
|
||||
@return {Promise<Buffer>}
|
||||
*/
|
||||
readFile: function (fileName) {
|
||||
return bookFS.read(fileName);
|
||||
},
|
||||
/**
|
||||
Read a file from the book as a string
|
||||
|
||||
@param {string} fileName
|
||||
@return {Promise<String>}
|
||||
*/
|
||||
readFileAsString: function (fileName) {
|
||||
return bookFS.readAsString(fileName);
|
||||
},
|
||||
/**
|
||||
Resolve a file from the book root
|
||||
|
||||
@param {string} fileName
|
||||
@return {string}
|
||||
*/
|
||||
resolve: function (fileName) {
|
||||
return path_1.default.resolve(book.getContentRoot(), fileName);
|
||||
},
|
||||
/**
|
||||
Resolve a page by it path
|
||||
|
||||
@param {string} filePath
|
||||
@return {string}
|
||||
*/
|
||||
getPageByPath: function (filePath) {
|
||||
const page = output.getPage(filePath);
|
||||
if (!page)
|
||||
return undefined;
|
||||
return (0, encodePage_1.default)(output, page);
|
||||
},
|
||||
/**
|
||||
Render a block of text (markdown/asciidoc)
|
||||
|
||||
@param {string} type
|
||||
@param {string} text
|
||||
@param options
|
||||
@return {Promise<String>}
|
||||
*/
|
||||
renderBlock: function (type, text, options) {
|
||||
const parser = parsers_1.default.get(type);
|
||||
return parser.parsePage(text, options).get("content");
|
||||
},
|
||||
/**
|
||||
Render an inline text (markdown/asciidoc)
|
||||
|
||||
@param {string} type
|
||||
@param {string} text
|
||||
@param options
|
||||
@return {Promise<String>}
|
||||
*/
|
||||
renderInline: function (type, text, options) {
|
||||
const parser = parsers_1.default.get(type);
|
||||
return parser.parseInline(text, options).get("content");
|
||||
},
|
||||
template: {
|
||||
/**
|
||||
Apply a templating block and returns its result
|
||||
|
||||
@param {string} name
|
||||
@param {Object} blockData
|
||||
@return {Promise|Object}
|
||||
*/
|
||||
applyBlock: function (name, blockData) {
|
||||
const block = blocks.get(name) || defaultBlocks_1.default.get(name);
|
||||
return (0, promise_1.default)(block.applyBlock(blockData, result));
|
||||
}
|
||||
},
|
||||
output: {
|
||||
/**
|
||||
Name of the generator being used
|
||||
{string}
|
||||
*/
|
||||
name: output.getGenerator(),
|
||||
/**
|
||||
Return absolute path to the root folder of output
|
||||
@return {string}
|
||||
*/
|
||||
root: function () {
|
||||
return outputFolder;
|
||||
},
|
||||
/**
|
||||
Resolve a file from the output root
|
||||
|
||||
@param {string} fileName
|
||||
@return {string}
|
||||
*/
|
||||
resolve: function (fileName) {
|
||||
return path_1.default.resolve(outputFolder, fileName);
|
||||
},
|
||||
/**
|
||||
Convert a filepath into an url
|
||||
@return {string}
|
||||
*/
|
||||
toURL: function (filePath) {
|
||||
return (0, fileToURL_1.default)(output, filePath);
|
||||
},
|
||||
/**
|
||||
Check that a file exists.
|
||||
|
||||
@param {string} fileName
|
||||
@return {Promise}
|
||||
*/
|
||||
hasFile: function (fileName, content) {
|
||||
return (0, promise_1.default)().then(() => {
|
||||
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 2.
|
||||
const filePath = path_2.default.resolveInRoot(outputFolder, fileName);
|
||||
return fs_1.default.exists(filePath);
|
||||
});
|
||||
},
|
||||
/**
|
||||
Write a file to the output folder,
|
||||
It creates the required folder
|
||||
|
||||
@param {string} fileName
|
||||
@param {Buffer} content
|
||||
@return {Promise}
|
||||
*/
|
||||
writeFile: function (fileName, content) {
|
||||
return (0, promise_1.default)().then(() => {
|
||||
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 2.
|
||||
const filePath = path_2.default.resolveInRoot(outputFolder, fileName);
|
||||
return fs_1.default.ensureFile(filePath).then(() => {
|
||||
return fs_1.default.writeFile(filePath, content);
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
Copy a file to the output folder
|
||||
It creates the required folder.
|
||||
|
||||
@param {string} inputFile
|
||||
@param {string} outputFile
|
||||
@param {Buffer} content
|
||||
@return {Promise}
|
||||
*/
|
||||
copyFile: function (inputFile, outputFile, content) {
|
||||
return (0, promise_1.default)().then(() => {
|
||||
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 2.
|
||||
const outputFilePath = path_2.default.resolveInRoot(outputFolder, outputFile);
|
||||
return fs_1.default.ensureFile(outputFilePath).then(() => {
|
||||
return fs_1.default.copy(inputFile, outputFilePath);
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
gitbook: {
|
||||
version: honkit_1.default.version
|
||||
},
|
||||
honkit: {
|
||||
version: honkit_1.default.version
|
||||
}
|
||||
};
|
||||
// Deprecated properties
|
||||
// @ts-expect-error ts-migrate(2554) FIXME: Expected 6 arguments, but got 5.
|
||||
deprecate_1.default.renamedMethod(output, "this.isSubBook", result, "isSubBook", "isLanguageBook");
|
||||
// @ts-expect-error ts-migrate(2554) FIXME: Expected 6 arguments, but got 5.
|
||||
deprecate_1.default.renamedMethod(output, "this.contentLink", result, "contentLink", "output.toURL");
|
||||
deprecate_1.default.field(output, "this.generator", result, "generator", output.getGenerator(), '"this.generator" property is deprecated, use "this.output.name" instead');
|
||||
deprecate_1.default.field(output, "this.navigation", result, "navigation", () => {
|
||||
return (0, encodeNavigation_1.default)(output);
|
||||
}, '"navigation" property is deprecated');
|
||||
deprecate_1.default.field(output, "this.book", result, "book", result, '"book" property is deprecated, use "this" directly instead');
|
||||
deprecate_1.default.field(output, "this.options", result, "options", result.config.values, '"options" property is deprecated, use config.get(key) instead');
|
||||
return result;
|
||||
}
|
||||
exports.default = encodeGlobal;
|
||||
19
book/node_modules/honkit/lib/api/encodeNavigation.d.ts
generated
vendored
Normal file
19
book/node_modules/honkit/lib/api/encodeNavigation.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import type Output from "../models/output";
|
||||
export type EncodedNavigation = {
|
||||
[index: string]: {
|
||||
index: number;
|
||||
title: string;
|
||||
introduction: boolean;
|
||||
prev?: unknown;
|
||||
next?: unknown;
|
||||
level: number;
|
||||
};
|
||||
};
|
||||
/**
|
||||
this.navigation is a deprecated property from GitBook v2
|
||||
|
||||
@return {Object}
|
||||
*/
|
||||
declare function encodeNavigation(output: Output): EncodedNavigation;
|
||||
export default encodeNavigation;
|
||||
//# sourceMappingURL=encodeNavigation.d.ts.map
|
||||
1
book/node_modules/honkit/lib/api/encodeNavigation.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/api/encodeNavigation.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"encodeNavigation.d.ts","sourceRoot":"","sources":["../../src/api/encodeNavigation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAoB3C,MAAM,MAAM,iBAAiB,GAAG;IAC5B,CAAC,KAAK,EAAE,MAAM,GAAG;QACb,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,OAAO,CAAC;QACtB,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;KACjB,CAAC;CACL,CAAC;AAEF;;;;GAIG;AAEH,iBAAS,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAiC3D;AAED,eAAe,gBAAgB,CAAC"}
|
||||
56
book/node_modules/honkit/lib/api/encodeNavigation.js
generated
vendored
Normal file
56
book/node_modules/honkit/lib/api/encodeNavigation.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const immutable_1 = __importDefault(require("immutable"));
|
||||
/**
|
||||
Encode an article for next/prev
|
||||
@return {Object}
|
||||
*/
|
||||
function encodeArticle(pages, article) {
|
||||
const articlePath = article.getPath();
|
||||
return {
|
||||
path: articlePath,
|
||||
title: article.getTitle(),
|
||||
level: article.getLevel(),
|
||||
exists: articlePath && pages.has(articlePath),
|
||||
external: article.isExternal()
|
||||
};
|
||||
}
|
||||
/**
|
||||
this.navigation is a deprecated property from GitBook v2
|
||||
|
||||
@return {Object}
|
||||
*/
|
||||
function encodeNavigation(output) {
|
||||
const book = output.getBook();
|
||||
const pages = output.getPages();
|
||||
const summary = book.getSummary();
|
||||
const articles = summary.getArticlesAsList();
|
||||
const navigation = articles
|
||||
.map((article, i) => {
|
||||
const ref = article.getRef();
|
||||
if (!ref) {
|
||||
return undefined;
|
||||
}
|
||||
const prev = articles.get(i - 1);
|
||||
const next = articles.get(i + 1);
|
||||
return [
|
||||
ref,
|
||||
{
|
||||
index: i,
|
||||
title: article.getTitle(),
|
||||
introduction: i === 0,
|
||||
prev: prev ? encodeArticle(pages, prev) : undefined,
|
||||
next: next ? encodeArticle(pages, next) : undefined,
|
||||
level: article.getLevel()
|
||||
}
|
||||
];
|
||||
})
|
||||
.filter((e) => {
|
||||
return Boolean(e);
|
||||
});
|
||||
return immutable_1.default.Map(navigation).toJS();
|
||||
}
|
||||
exports.default = encodeNavigation;
|
||||
16
book/node_modules/honkit/lib/api/encodePage.d.ts
generated
vendored
Normal file
16
book/node_modules/honkit/lib/api/encodePage.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import Output from "../models/output";
|
||||
import Page from "../models/page";
|
||||
import { EncodedPage } from "../json/encodePage";
|
||||
type PageAttributes = {
|
||||
type: string;
|
||||
path: string;
|
||||
rawPath: string;
|
||||
};
|
||||
export type EncodedPageWithAttributes = EncodedPage & PageAttributes;
|
||||
export type PartialEncodedPageWithAttributes = EncodedPage & Partial<PageAttributes>;
|
||||
/**
|
||||
Encode a page in a context to a JS API
|
||||
*/
|
||||
declare function encodePage(output: Output, page: Page): EncodedPageWithAttributes;
|
||||
export default encodePage;
|
||||
//# sourceMappingURL=encodePage.d.ts.map
|
||||
1
book/node_modules/honkit/lib/api/encodePage.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/api/encodePage.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"encodePage.d.ts","sourceRoot":"","sources":["../../src/api/encodePage.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,WAAW,GAAG,cAAc,CAAC;AACrE,MAAM,MAAM,gCAAgC,GAAG,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAErF;;GAEG;AAEH,iBAAS,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,yBAAyB,CAuCzE;AAED,eAAe,UAAU,CAAC"}
|
||||
33
book/node_modules/honkit/lib/api/encodePage.js
generated
vendored
Normal file
33
book/node_modules/honkit/lib/api/encodePage.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const json_1 = __importDefault(require("../json"));
|
||||
const deprecate_1 = __importDefault(require("./deprecate"));
|
||||
const encodeProgress_1 = __importDefault(require("./encodeProgress"));
|
||||
/**
|
||||
Encode a page in a context to a JS API
|
||||
*/
|
||||
function encodePage(output, page) {
|
||||
const book = output.getBook();
|
||||
const summary = book.getSummary();
|
||||
const fs = book.getContentFS();
|
||||
const file = page.getFile();
|
||||
// JS Page is based on the JSON output
|
||||
const result = json_1.default.encodePage(page, summary);
|
||||
result.type = file.getType();
|
||||
result.path = file.getPath();
|
||||
result.rawPath = fs.resolve(result.path);
|
||||
deprecate_1.default.field(output, "page.progress", result, "progress", () => {
|
||||
return (0, encodeProgress_1.default)(output, page);
|
||||
}, '"page.progress" property is deprecated');
|
||||
deprecate_1.default.field(output, "page.sections", result, "sections", [
|
||||
{
|
||||
content: result.content,
|
||||
type: "normal"
|
||||
}
|
||||
], '"sections" property is deprecated, use page.content instead');
|
||||
return result;
|
||||
}
|
||||
exports.default = encodePage;
|
||||
25
book/node_modules/honkit/lib/api/encodeProgress.d.ts
generated
vendored
Normal file
25
book/node_modules/honkit/lib/api/encodeProgress.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { EncodedNavigation } from "./encodeNavigation";
|
||||
import Output from "../models/output";
|
||||
import Page from "../models/page";
|
||||
export type EncodedChapters = Array<EncodedNavigation[string] & {
|
||||
path: string;
|
||||
done: boolean;
|
||||
percent: number;
|
||||
}>;
|
||||
export type PartialEncodedChapterValue = EncodedNavigation[string] & Partial<{
|
||||
path: string;
|
||||
done: boolean;
|
||||
percent: number;
|
||||
}>;
|
||||
export type EncodeProgress = {
|
||||
prevPercent: number;
|
||||
percent: number;
|
||||
current: number;
|
||||
chapters: EncodedChapters;
|
||||
};
|
||||
/**
|
||||
page.progress is a deprecated property from GitBook v2
|
||||
*/
|
||||
declare function encodeProgress(output: Output, page: Page): EncodeProgress;
|
||||
export default encodeProgress;
|
||||
//# sourceMappingURL=encodeProgress.d.ts.map
|
||||
1
book/node_modules/honkit/lib/api/encodeProgress.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/api/encodeProgress.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"encodeProgress.d.ts","sourceRoot":"","sources":["../../src/api/encodeProgress.ts"],"names":[],"mappings":"AACA,OAAyB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAElC,MAAM,MAAM,eAAe,GAAG,KAAK,CAC/B,iBAAiB,CAAC,MAAM,CAAC,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,CACJ,CAAC;AACF,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,CAAC,MAAM,CAAC,GAC9D,OAAO,CAAC;IACJ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AACP,MAAM,MAAM,cAAc,GAAG;IAEzB,WAAW,EAAE,MAAM,CAAC;IAEpB,OAAO,EAAE,MAAM,CAAC;IAEhB,OAAO,EAAE,MAAM,CAAC;IAEhB,QAAQ,EAAE,eAAe,CAAC;CAC7B,CAAC;AAEF;;GAEG;AAEH,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,cAAc,CAkDlE;AAED,eAAe,cAAc,CAAC"}
|
||||
53
book/node_modules/honkit/lib/api/encodeProgress.js
generated
vendored
Normal file
53
book/node_modules/honkit/lib/api/encodeProgress.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const immutable_1 = __importDefault(require("immutable"));
|
||||
const encodeNavigation_1 = __importDefault(require("./encodeNavigation"));
|
||||
/**
|
||||
page.progress is a deprecated property from GitBook v2
|
||||
*/
|
||||
function encodeProgress(output, page) {
|
||||
const current = page.getPath();
|
||||
const navigation = immutable_1.default.Map((0, encodeNavigation_1.default)(output));
|
||||
const n = navigation.size;
|
||||
let percent = 0, prevPercent = 0, currentChapter = null;
|
||||
let done = true;
|
||||
const chapters = navigation
|
||||
.map((nav, chapterPath) => {
|
||||
nav.path = chapterPath;
|
||||
return nav;
|
||||
})
|
||||
.valueSeq()
|
||||
.sortBy((nav) => {
|
||||
return nav.index;
|
||||
})
|
||||
.map((nav, i) => {
|
||||
// Calcul percent
|
||||
nav.percent = (i * 100) / Math.max(n - 1, 1);
|
||||
// Is it done
|
||||
nav.done = done;
|
||||
if (nav.path == current) {
|
||||
currentChapter = nav;
|
||||
percent = nav.percent;
|
||||
done = false;
|
||||
}
|
||||
else if (done) {
|
||||
prevPercent = nav.percent;
|
||||
}
|
||||
return nav;
|
||||
})
|
||||
.toJS();
|
||||
return {
|
||||
// Previous percent
|
||||
prevPercent: prevPercent,
|
||||
// Current percent
|
||||
percent: percent,
|
||||
// List of chapter with progress
|
||||
chapters: chapters,
|
||||
// Current chapter
|
||||
current: currentChapter
|
||||
};
|
||||
}
|
||||
exports.default = encodeProgress;
|
||||
49
book/node_modules/honkit/lib/api/encodeSummary.d.ts
generated
vendored
Normal file
49
book/node_modules/honkit/lib/api/encodeSummary.d.ts
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
Encode summary to provide an API to plugin
|
||||
|
||||
@param {Output} output
|
||||
@param {Config} config
|
||||
@return {Object}
|
||||
*/
|
||||
declare function encodeSummary(output: any, summary: any): {
|
||||
/**
|
||||
Iterate over the summary, it stops when the "iter" returns false
|
||||
|
||||
@param {Function} iter
|
||||
*/
|
||||
walk: (iter: any) => void;
|
||||
/**
|
||||
Get an article by its level
|
||||
|
||||
@param {string} level
|
||||
@return {Object}
|
||||
*/
|
||||
getArticleByLevel: (level: any) => {
|
||||
title: string;
|
||||
level: string;
|
||||
depth: number;
|
||||
anchor: string;
|
||||
url: string;
|
||||
path: string;
|
||||
ref: string;
|
||||
articles: any;
|
||||
};
|
||||
/**
|
||||
Get an article by its path
|
||||
|
||||
@param {string} level
|
||||
@return {Object}
|
||||
*/
|
||||
getArticleByPath: (level: any) => {
|
||||
title: string;
|
||||
level: string;
|
||||
depth: number;
|
||||
anchor: string;
|
||||
url: string;
|
||||
path: string;
|
||||
ref: string;
|
||||
articles: any;
|
||||
};
|
||||
};
|
||||
export default encodeSummary;
|
||||
//# sourceMappingURL=encodeSummary.d.ts.map
|
||||
1
book/node_modules/honkit/lib/api/encodeSummary.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/api/encodeSummary.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"encodeSummary.d.ts","sourceRoot":"","sources":["../../src/api/encodeSummary.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,iBAAS,aAAa,CAAC,MAAM,KAAA,EAAE,OAAO,KAAA;IAE9B;;;;OAIG;;IASH;;;;;OAKG;;;;;;;;;;;IAOH;;;;;OAKG;;;;;;;;;;;EASV;AAED,eAAe,aAAa,CAAC"}
|
||||
50
book/node_modules/honkit/lib/api/encodeSummary.js
generated
vendored
Normal file
50
book/node_modules/honkit/lib/api/encodeSummary.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const encodeSummaryArticle_1 = __importDefault(require("../json/encodeSummaryArticle"));
|
||||
/**
|
||||
Encode summary to provide an API to plugin
|
||||
|
||||
@param {Output} output
|
||||
@param {Config} config
|
||||
@return {Object}
|
||||
*/
|
||||
function encodeSummary(output, summary) {
|
||||
const result = {
|
||||
/**
|
||||
Iterate over the summary, it stops when the "iter" returns false
|
||||
|
||||
@param {Function} iter
|
||||
*/
|
||||
walk: function (iter) {
|
||||
summary.getArticle((article) => {
|
||||
const jsonArticle = (0, encodeSummaryArticle_1.default)(article, false);
|
||||
return iter(jsonArticle);
|
||||
});
|
||||
},
|
||||
/**
|
||||
Get an article by its level
|
||||
|
||||
@param {string} level
|
||||
@return {Object}
|
||||
*/
|
||||
getArticleByLevel: function (level) {
|
||||
const article = summary.getByLevel(level);
|
||||
return article ? (0, encodeSummaryArticle_1.default)(article) : undefined;
|
||||
},
|
||||
/**
|
||||
Get an article by its path
|
||||
|
||||
@param {string} level
|
||||
@return {Object}
|
||||
*/
|
||||
getArticleByPath: function (level) {
|
||||
const article = summary.getByPath(level);
|
||||
return article ? (0, encodeSummaryArticle_1.default)(article) : undefined;
|
||||
}
|
||||
};
|
||||
return result;
|
||||
}
|
||||
exports.default = encodeSummary;
|
||||
12
book/node_modules/honkit/lib/api/index.d.ts
generated
vendored
Normal file
12
book/node_modules/honkit/lib/api/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { decodeGlobal } from "./decodeGlobal";
|
||||
import encodePage0 from "./encodePage";
|
||||
import decodePage0 from "./decodePage";
|
||||
import encodeGlobal0 from "./encodeGlobal";
|
||||
declare const _default: {
|
||||
encodePage: typeof encodePage0;
|
||||
decodePage: typeof decodePage0;
|
||||
encodeGlobal: typeof encodeGlobal0;
|
||||
decodeGlobal: typeof decodeGlobal;
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
book/node_modules/honkit/lib/api/index.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/api/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,aAAa,MAAM,gBAAgB,CAAC;;;;;;;AAE3C,wBAKE"}
|
||||
15
book/node_modules/honkit/lib/api/index.js
generated
vendored
Normal file
15
book/node_modules/honkit/lib/api/index.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const decodeGlobal_1 = require("./decodeGlobal");
|
||||
const encodePage_1 = __importDefault(require("./encodePage"));
|
||||
const decodePage_1 = __importDefault(require("./decodePage"));
|
||||
const encodeGlobal_1 = __importDefault(require("./encodeGlobal"));
|
||||
exports.default = {
|
||||
encodePage: encodePage_1.default,
|
||||
decodePage: decodePage_1.default,
|
||||
encodeGlobal: encodeGlobal_1.default,
|
||||
decodeGlobal: decodeGlobal_1.decodeGlobal
|
||||
};
|
||||
2
book/node_modules/honkit/lib/bin.d.ts
generated
vendored
Normal file
2
book/node_modules/honkit/lib/bin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const run: (argv?: string[]) => Promise<void>;
|
||||
//# sourceMappingURL=bin.d.ts.map
|
||||
1
book/node_modules/honkit/lib/bin.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/bin.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,GAAG,uBAA0B,OAAO,CAAC,IAAI,CA2CrD,CAAC"}
|
||||
46
book/node_modules/honkit/lib/bin.js
generated
vendored
Normal file
46
book/node_modules/honkit/lib/bin.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.run = void 0;
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const commander_1 = require("commander");
|
||||
const index_1 = __importDefault(require("./index"));
|
||||
const pkg = require("../package.json");
|
||||
const run = (argv = process.argv) => {
|
||||
const program = new commander_1.Command();
|
||||
return new Promise((resolve, reject) => {
|
||||
program.version(pkg.version);
|
||||
index_1.default.commands.forEach((spec) => {
|
||||
let subcommand = program.command(spec.name).description(spec.description);
|
||||
const options = spec.options || [];
|
||||
options.forEach((spec) => {
|
||||
if (spec.values) {
|
||||
const template = `--${spec.name} <${spec.name}>`;
|
||||
const description = `${spec.description} (${spec.values.map(JSON.stringify).join(", ")})`;
|
||||
subcommand = subcommand.option(template, description, (value, _dummyPrevious) => {
|
||||
(0, assert_1.default)(spec.values.includes(value), `Invalid value ${value} for ${spec.name}`);
|
||||
return value;
|
||||
}, spec.defaults);
|
||||
}
|
||||
else {
|
||||
subcommand = subcommand.option(spec.defaults ? `--${spec.name} <type>` : `--${spec.name}`, spec.description, spec.defaults);
|
||||
}
|
||||
});
|
||||
subcommand = subcommand.action((...joinedArgs) => {
|
||||
const args = joinedArgs.slice(0, -1);
|
||||
const kwargs = joinedArgs.slice(-1)[0];
|
||||
spec.exec(args, kwargs)
|
||||
.then(() => {
|
||||
resolve();
|
||||
})
|
||||
.catch((err) => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
});
|
||||
program.parse(argv);
|
||||
});
|
||||
};
|
||||
exports.run = run;
|
||||
60
book/node_modules/honkit/lib/browser.d.ts
generated
vendored
Normal file
60
book/node_modules/honkit/lib/browser.d.ts
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import Book from "./models/book";
|
||||
import FS from "./models/fs";
|
||||
import File from "./models/file";
|
||||
import Summary from "./models/summary";
|
||||
import Glossary from "./models/glossary";
|
||||
import Config from "./models/config";
|
||||
import Page from "./models/page";
|
||||
import PluginDependency from "./models/pluginDependency";
|
||||
declare const _default: {
|
||||
Parse: {
|
||||
parseBook: typeof import("./parse/parseBook").default;
|
||||
parseSummary: typeof import("./parse/parseSummary").default;
|
||||
parseGlossary: typeof import("./parse/parseGlossary").default;
|
||||
parseReadme: typeof import("./parse/parseReadme").default;
|
||||
parseConfig: typeof import("./parse/parseConfig").default;
|
||||
parsePagesList: typeof import("./parse/parsePagesList").default;
|
||||
parseIgnore: typeof import("./parse/parseIgnore").default;
|
||||
listAssets: typeof import("./parse/listAssets").default;
|
||||
parseLanguages: typeof import("./parse/parseLanguages").default;
|
||||
parsePage: typeof import("./parse/parsePage").default;
|
||||
parsePageFromString: typeof import("./parse/parsePageFromString").default;
|
||||
lookupStructureFile: typeof import("./parse/lookupStructureFile").default;
|
||||
};
|
||||
Book: typeof Book;
|
||||
FS: typeof FS;
|
||||
File: typeof File;
|
||||
Summary: typeof Summary;
|
||||
Glossary: typeof Glossary;
|
||||
Config: typeof Config;
|
||||
Page: typeof Page;
|
||||
PluginDependency: typeof PluginDependency;
|
||||
SummaryModifier: {
|
||||
insertArticle: typeof import("./modifiers/summary/insertArticle").default;
|
||||
moveArticle: typeof import("./modifiers/summary/moveArticle").default;
|
||||
moveArticleAfter: typeof import("./modifiers/summary/moveArticleAfter").default;
|
||||
removeArticle: typeof import("./modifiers/summary/removeArticle").default;
|
||||
unshiftArticle: typeof import("./modifiers/summary/unshiftArticle").default;
|
||||
editArticleTitle: typeof import("./modifiers/summary/editArticleTitle").default;
|
||||
editArticleRef: typeof import("./modifiers/summary/editArticleRef").default;
|
||||
insertPart: typeof import("./modifiers/summary/insertPart").default;
|
||||
removePart: typeof import("./modifiers/summary/removePart").default;
|
||||
editPartTitle: typeof import("./modifiers/summary/editPartTitle").default;
|
||||
};
|
||||
ConfigModifier: {
|
||||
addPlugin: typeof import("./modifiers/config/addPlugin").default;
|
||||
removePlugin: typeof import("./modifiers/config/removePlugin").default;
|
||||
togglePlugin: typeof import("./modifiers/config/togglePlugin").default;
|
||||
editPlugin: typeof import("./modifiers/config/editPlugin").default;
|
||||
hasPlugin: typeof import("./modifiers/config/hasPlugin").default;
|
||||
getPluginConfig: typeof import("./modifiers/config/getPluginConfig").default;
|
||||
isDefaultPlugin: typeof import("./modifiers/config/isDefaultPlugin").default;
|
||||
};
|
||||
CONFIG_FILES: string[];
|
||||
IGNORE_FILES: string[];
|
||||
DEFAULT_PLUGINS: import("immutable").Iterable<number, PluginDependency>;
|
||||
EXTENSIONS_MARKDOWN: string[];
|
||||
EXTENSIONS_ASCIIDOC: string[];
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=browser.d.ts.map
|
||||
1
book/node_modules/honkit/lib/browser.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/browser.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,gBAAgB,MAAM,2BAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOzD,wBAuBE"}
|
||||
41
book/node_modules/honkit/lib/browser.js
generated
vendored
Normal file
41
book/node_modules/honkit/lib/browser.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const modifiers_1 = __importDefault(require("./modifiers"));
|
||||
const parse_1 = __importDefault(require("./parse"));
|
||||
const book_1 = __importDefault(require("./models/book"));
|
||||
const fs_1 = __importDefault(require("./models/fs"));
|
||||
const file_1 = __importDefault(require("./models/file"));
|
||||
const summary_1 = __importDefault(require("./models/summary"));
|
||||
const glossary_1 = __importDefault(require("./models/glossary"));
|
||||
const config_1 = __importDefault(require("./models/config"));
|
||||
const page_1 = __importDefault(require("./models/page"));
|
||||
const pluginDependency_1 = __importDefault(require("./models/pluginDependency"));
|
||||
const configFiles_1 = __importDefault(require("./constants/configFiles"));
|
||||
const ignoreFiles_1 = __importDefault(require("./constants/ignoreFiles"));
|
||||
const defaultPlugins_1 = __importDefault(require("./constants/defaultPlugins"));
|
||||
const extsMarkdown_1 = __importDefault(require("./constants/extsMarkdown"));
|
||||
const extsAsciidoc_1 = __importDefault(require("./constants/extsAsciidoc"));
|
||||
exports.default = {
|
||||
Parse: parse_1.default,
|
||||
// Models
|
||||
Book: book_1.default,
|
||||
FS: fs_1.default,
|
||||
File: file_1.default,
|
||||
Summary: summary_1.default,
|
||||
Glossary: glossary_1.default,
|
||||
Config: config_1.default,
|
||||
Page: page_1.default,
|
||||
PluginDependency: pluginDependency_1.default,
|
||||
// Modifiers
|
||||
SummaryModifier: modifiers_1.default.Summary,
|
||||
ConfigModifier: modifiers_1.default.Config,
|
||||
// Constants
|
||||
CONFIG_FILES: configFiles_1.default,
|
||||
IGNORE_FILES: ignoreFiles_1.default,
|
||||
DEFAULT_PLUGINS: defaultPlugins_1.default,
|
||||
EXTENSIONS_MARKDOWN: extsMarkdown_1.default,
|
||||
EXTENSIONS_ASCIIDOC: extsAsciidoc_1.default
|
||||
};
|
||||
17
book/node_modules/honkit/lib/cli/build.d.ts
generated
vendored
Normal file
17
book/node_modules/honkit/lib/cli/build.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
declare const _default: {
|
||||
name: string;
|
||||
description: string;
|
||||
options: ({
|
||||
name: string;
|
||||
description: string;
|
||||
values: any;
|
||||
defaults: string;
|
||||
} | {
|
||||
name: string;
|
||||
description: string;
|
||||
defaults: boolean;
|
||||
})[];
|
||||
exec: (args: any, kwargs: any) => any;
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=build.d.ts.map
|
||||
1
book/node_modules/honkit/lib/cli/build.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/cli/build.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAQA,wBAsBE"}
|
||||
36
book/node_modules/honkit/lib/cli/build.js
generated
vendored
Normal file
36
book/node_modules/honkit/lib/cli/build.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const parse_1 = __importDefault(require("../parse"));
|
||||
const output_1 = __importDefault(require("../output"));
|
||||
const timing_1 = __importDefault(require("../utils/timing"));
|
||||
const options_1 = __importDefault(require("./options"));
|
||||
const getBook_1 = __importDefault(require("./getBook"));
|
||||
const getOutputFolder_1 = __importDefault(require("./getOutputFolder"));
|
||||
const page_cache_1 = require("../output/page-cache");
|
||||
exports.default = {
|
||||
name: "build [book] [output]",
|
||||
description: "build a book",
|
||||
options: [options_1.default.log, options_1.default.format, options_1.default.timing, options_1.default.reload],
|
||||
exec: function (args, kwargs) {
|
||||
const book = (0, getBook_1.default)(args, kwargs);
|
||||
const outputFolder = (0, getOutputFolder_1.default)(args);
|
||||
const Generator = output_1.default.getGenerator(kwargs.format);
|
||||
if (kwargs.reload) {
|
||||
book.getLogger().info.ok(`Clear cache`);
|
||||
(0, page_cache_1.clearCache)();
|
||||
}
|
||||
return parse_1.default.parseBook(book)
|
||||
.then((resultBook) => {
|
||||
return output_1.default.generate(Generator, resultBook, {
|
||||
root: outputFolder
|
||||
});
|
||||
})
|
||||
.fin(() => {
|
||||
if (kwargs.timing)
|
||||
timing_1.default.dump(book.getLogger());
|
||||
});
|
||||
}
|
||||
};
|
||||
12
book/node_modules/honkit/lib/cli/buildEbook.d.ts
generated
vendored
Normal file
12
book/node_modules/honkit/lib/cli/buildEbook.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export default function (format: any): {
|
||||
name: string;
|
||||
description: string;
|
||||
options: {
|
||||
name: string;
|
||||
description: string;
|
||||
values: any;
|
||||
defaults: string;
|
||||
}[];
|
||||
exec: (args: any, kwargs: any) => any;
|
||||
};
|
||||
//# sourceMappingURL=buildEbook.d.ts.map
|
||||
1
book/node_modules/honkit/lib/cli/buildEbook.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/cli/buildEbook.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"buildEbook.d.ts","sourceRoot":"","sources":["../../src/cli/buildEbook.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,WAAW,MAAM,KAAA;;;;;;;;;;EA4D9B"}
|
||||
63
book/node_modules/honkit/lib/cli/buildEbook.js
generated
vendored
Normal file
63
book/node_modules/honkit/lib/cli/buildEbook.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const promise_1 = __importDefault(require("../utils/promise"));
|
||||
const fs_1 = __importDefault(require("../utils/fs"));
|
||||
const parse_1 = __importDefault(require("../parse"));
|
||||
const output_1 = __importDefault(require("../output"));
|
||||
const options_1 = __importDefault(require("./options"));
|
||||
const getBook_1 = __importDefault(require("./getBook"));
|
||||
const page_cache_1 = require("../output/page-cache");
|
||||
const tmpdir_1 = require("../fs/tmpdir");
|
||||
function default_1(format) {
|
||||
return {
|
||||
name: `${format} [book] [output]`,
|
||||
description: "build a book into an ebook file",
|
||||
options: [options_1.default.log],
|
||||
exec: function (args, kwargs) {
|
||||
const extension = `.${format}`;
|
||||
// Output file will be stored in
|
||||
const outputFile = args[1] || `book${extension}`;
|
||||
// Create temporary directory
|
||||
const outputFolder = (0, tmpdir_1.createTmpDirWithRealPath)();
|
||||
const book = (0, getBook_1.default)(args, kwargs);
|
||||
const logger = book.getLogger();
|
||||
const Generator = output_1.default.getGenerator("ebook");
|
||||
if (kwargs.reload) {
|
||||
(0, page_cache_1.clearCache)();
|
||||
}
|
||||
return (parse_1.default.parseBook(book)
|
||||
.then((resultBook) => {
|
||||
return output_1.default.generate(Generator, resultBook, {
|
||||
root: outputFolder,
|
||||
format: format
|
||||
});
|
||||
})
|
||||
// Extract ebook file
|
||||
.then((output) => {
|
||||
const book = output.getBook();
|
||||
const languages = book.getLanguages();
|
||||
if (book.isMultilingual()) {
|
||||
return promise_1.default.forEach(languages.getList(), (lang) => {
|
||||
const langID = lang.getID();
|
||||
const langOutputFile = path_1.default.join(path_1.default.dirname(outputFile), `${path_1.default.basename(outputFile, extension)}_${langID}${extension}`);
|
||||
return fs_1.default.copy(path_1.default.resolve(outputFolder, langID, `index${extension}`), langOutputFile);
|
||||
}).thenResolve(languages.getCount());
|
||||
}
|
||||
else {
|
||||
return fs_1.default.copy(path_1.default.resolve(outputFolder, `index${extension}`), outputFile).thenResolve(1);
|
||||
}
|
||||
})
|
||||
// Log end
|
||||
.then((count) => {
|
||||
logger.info.ok(`${count} file(s) generated`);
|
||||
logger.debug("cleaning up... ");
|
||||
return logger.debug.promise(fs_1.default.rmDir(outputFolder));
|
||||
}));
|
||||
}
|
||||
};
|
||||
}
|
||||
12
book/node_modules/honkit/lib/cli/getBook.d.ts
generated
vendored
Normal file
12
book/node_modules/honkit/lib/cli/getBook.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import Book from "../models/book";
|
||||
/**
|
||||
Return a book instance to work on from
|
||||
command line args/kwargs
|
||||
|
||||
@param {Array} args
|
||||
@param {Object} kwargs
|
||||
@return {Book}
|
||||
*/
|
||||
declare function getBook(args: any, kwargs: any): Book;
|
||||
export default getBook;
|
||||
//# sourceMappingURL=getBook.d.ts.map
|
||||
1
book/node_modules/honkit/lib/cli/getBook.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/cli/getBook.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getBook.d.ts","sourceRoot":"","sources":["../../src/cli/getBook.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAGlC;;;;;;;GAOG;AAEH,iBAAS,OAAO,CAAC,IAAI,KAAA,EAAE,MAAM,KAAA,QAS5B;AAED,eAAe,OAAO,CAAC"}
|
||||
24
book/node_modules/honkit/lib/cli/getBook.js
generated
vendored
Normal file
24
book/node_modules/honkit/lib/cli/getBook.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const book_1 = __importDefault(require("../models/book"));
|
||||
const node_1 = __importDefault(require("../fs/node"));
|
||||
/**
|
||||
Return a book instance to work on from
|
||||
command line args/kwargs
|
||||
|
||||
@param {Array} args
|
||||
@param {Object} kwargs
|
||||
@return {Book}
|
||||
*/
|
||||
function getBook(args, kwargs) {
|
||||
const input = path_1.default.resolve(args[0] || process.cwd());
|
||||
const logLevel = kwargs.log;
|
||||
const fs = (0, node_1.default)(input);
|
||||
const book = book_1.default.createForFS(fs);
|
||||
return book.setLogLevel(logLevel);
|
||||
}
|
||||
exports.default = getBook;
|
||||
9
book/node_modules/honkit/lib/cli/getOutputFolder.d.ts
generated
vendored
Normal file
9
book/node_modules/honkit/lib/cli/getOutputFolder.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
Return path to output folder
|
||||
|
||||
@param {Array} args
|
||||
@return {string}
|
||||
*/
|
||||
declare function getOutputFolder(args: any): string;
|
||||
export default getOutputFolder;
|
||||
//# sourceMappingURL=getOutputFolder.d.ts.map
|
||||
1
book/node_modules/honkit/lib/cli/getOutputFolder.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/cli/getOutputFolder.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getOutputFolder.d.ts","sourceRoot":"","sources":["../../src/cli/getOutputFolder.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,iBAAS,eAAe,CAAC,IAAI,KAAA,UAM5B;AAED,eAAe,eAAe,CAAC"}
|
||||
19
book/node_modules/honkit/lib/cli/getOutputFolder.js
generated
vendored
Normal file
19
book/node_modules/honkit/lib/cli/getOutputFolder.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
/**
|
||||
Return path to output folder
|
||||
|
||||
@param {Array} args
|
||||
@return {string}
|
||||
*/
|
||||
function getOutputFolder(args) {
|
||||
const bookRoot = path_1.default.resolve(args[0] || process.cwd());
|
||||
const defaultOutputRoot = path_1.default.join(bookRoot, "_book");
|
||||
const outputFolder = args[1] ? path_1.default.resolve(process.cwd(), args[1]) : defaultOutputRoot;
|
||||
return outputFolder;
|
||||
}
|
||||
exports.default = getOutputFolder;
|
||||
25
book/node_modules/honkit/lib/cli/index.d.ts
generated
vendored
Normal file
25
book/node_modules/honkit/lib/cli/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
declare const _default: {
|
||||
name: string;
|
||||
description: string;
|
||||
options: ({
|
||||
name: string;
|
||||
description: string;
|
||||
values: any;
|
||||
defaults: string;
|
||||
} | {
|
||||
name: string;
|
||||
description: string;
|
||||
defaults: boolean;
|
||||
} | {
|
||||
name: string;
|
||||
description: string;
|
||||
defaults: number;
|
||||
} | {
|
||||
name: string;
|
||||
description: string;
|
||||
defaults: string;
|
||||
})[];
|
||||
exec: (args: any, kwargs: any) => any;
|
||||
}[];
|
||||
export default _default;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
book/node_modules/honkit/lib/cli/index.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/cli/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKA,wBAAsG"}
|
||||
11
book/node_modules/honkit/lib/cli/index.js
generated
vendored
Normal file
11
book/node_modules/honkit/lib/cli/index.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const buildEbook_1 = __importDefault(require("./buildEbook"));
|
||||
const build_1 = __importDefault(require("./build"));
|
||||
const serve_1 = __importDefault(require("./serve"));
|
||||
const parse_1 = __importDefault(require("./parse"));
|
||||
const init_1 = __importDefault(require("./init"));
|
||||
exports.default = [build_1.default, serve_1.default, parse_1.default, init_1.default, (0, buildEbook_1.default)("pdf"), (0, buildEbook_1.default)("epub"), (0, buildEbook_1.default)("mobi")];
|
||||
13
book/node_modules/honkit/lib/cli/init.d.ts
generated
vendored
Normal file
13
book/node_modules/honkit/lib/cli/init.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
declare const _default: {
|
||||
name: string;
|
||||
description: string;
|
||||
options: {
|
||||
name: string;
|
||||
description: string;
|
||||
values: any;
|
||||
defaults: string;
|
||||
}[];
|
||||
exec: (args: any, kwargs: any) => any;
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=init.d.ts.map
|
||||
1
book/node_modules/honkit/lib/cli/init.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/cli/init.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,wBASE"}
|
||||
17
book/node_modules/honkit/lib/cli/init.js
generated
vendored
Normal file
17
book/node_modules/honkit/lib/cli/init.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const options_1 = __importDefault(require("./options"));
|
||||
const init_1 = __importDefault(require("../init"));
|
||||
exports.default = {
|
||||
name: "init [book]",
|
||||
description: "setup and create files for chapters",
|
||||
options: [options_1.default.log],
|
||||
exec: function (args, kwargs) {
|
||||
const bookRoot = path_1.default.resolve(process.cwd(), args[0] || "./");
|
||||
return (0, init_1.default)(bookRoot);
|
||||
}
|
||||
};
|
||||
26
book/node_modules/honkit/lib/cli/options.d.ts
generated
vendored
Normal file
26
book/node_modules/honkit/lib/cli/options.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
declare const _default: {
|
||||
log: {
|
||||
name: string;
|
||||
description: string;
|
||||
values: any;
|
||||
defaults: string;
|
||||
};
|
||||
format: {
|
||||
name: string;
|
||||
description: string;
|
||||
values: string[];
|
||||
defaults: string;
|
||||
};
|
||||
timing: {
|
||||
name: string;
|
||||
description: string;
|
||||
defaults: boolean;
|
||||
};
|
||||
reload: {
|
||||
name: string;
|
||||
description: string;
|
||||
defaults: boolean;
|
||||
};
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=options.d.ts.map
|
||||
1
book/node_modules/honkit/lib/cli/options.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/cli/options.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/cli/options.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgCA,wBAKE"}
|
||||
38
book/node_modules/honkit/lib/cli/options.js
generated
vendored
Normal file
38
book/node_modules/honkit/lib/cli/options.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const logger_1 = __importDefault(require("../utils/logger"));
|
||||
const logOptions = {
|
||||
name: "log",
|
||||
description: "Minimum log level to display",
|
||||
values: logger_1.default.LEVELS.keySeq()
|
||||
.map((s) => {
|
||||
return s.toLowerCase();
|
||||
})
|
||||
.toJS(),
|
||||
defaults: "info"
|
||||
};
|
||||
const formatOption = {
|
||||
name: "format",
|
||||
description: "Format to build to",
|
||||
values: ["website", "json", "ebook"],
|
||||
defaults: "website"
|
||||
};
|
||||
const timingOption = {
|
||||
name: "timing",
|
||||
description: "Print timing debug information",
|
||||
defaults: false
|
||||
};
|
||||
const reloadOption = {
|
||||
name: "reload",
|
||||
description: "Prune cache. Remove file cache",
|
||||
defaults: false
|
||||
};
|
||||
exports.default = {
|
||||
log: logOptions,
|
||||
format: formatOption,
|
||||
timing: timingOption,
|
||||
reload: reloadOption
|
||||
};
|
||||
13
book/node_modules/honkit/lib/cli/parse.d.ts
generated
vendored
Normal file
13
book/node_modules/honkit/lib/cli/parse.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
declare const _default: {
|
||||
name: string;
|
||||
description: string;
|
||||
options: {
|
||||
name: string;
|
||||
description: string;
|
||||
values: any;
|
||||
defaults: string;
|
||||
}[];
|
||||
exec: (args: any, kwargs: any) => any;
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=parse.d.ts.map
|
||||
1
book/node_modules/honkit/lib/cli/parse.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/cli/parse.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/cli/parse.ts"],"names":[],"mappings":";;;;;;;;;;;AAmDA,wBAwBE"}
|
||||
67
book/node_modules/honkit/lib/cli/parse.js
generated
vendored
Normal file
67
book/node_modules/honkit/lib/cli/parse.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const options_1 = __importDefault(require("./options"));
|
||||
const getBook_1 = __importDefault(require("./getBook"));
|
||||
const parse_1 = __importDefault(require("../parse"));
|
||||
function printBook(book) {
|
||||
const logger = book.getLogger();
|
||||
const config = book.getConfig();
|
||||
const configFile = config.getFile();
|
||||
const summary = book.getSummary();
|
||||
const summaryFile = summary.getFile();
|
||||
const readme = book.getReadme();
|
||||
const readmeFile = readme.getFile();
|
||||
const glossary = book.getGlossary();
|
||||
const glossaryFile = glossary.getFile();
|
||||
if (configFile.exists()) {
|
||||
logger.info.ln("Configuration file is", configFile.getPath());
|
||||
}
|
||||
if (readmeFile.exists()) {
|
||||
logger.info.ln("Introduction file is", readmeFile.getPath());
|
||||
}
|
||||
if (glossaryFile.exists()) {
|
||||
logger.info.ln("Glossary file is", glossaryFile.getPath());
|
||||
}
|
||||
if (summaryFile.exists()) {
|
||||
logger.info.ln("Table of Contents file is", summaryFile.getPath());
|
||||
}
|
||||
}
|
||||
function printMultingualBook(book) {
|
||||
const logger = book.getLogger();
|
||||
const languages = book.getLanguages();
|
||||
const books = book.getBooks();
|
||||
logger.info.ln(`${languages.size} languages`);
|
||||
const file = languages.getFile();
|
||||
const list = languages.getList();
|
||||
list.valueSeq().forEach((lang) => {
|
||||
logger.info.ln("Language:", lang.getTitle());
|
||||
printBook(books.get(lang.getID()));
|
||||
logger.info.ln("");
|
||||
});
|
||||
}
|
||||
exports.default = {
|
||||
name: "parse [book]",
|
||||
description: "parse and print debug information about a book",
|
||||
options: [options_1.default.log],
|
||||
exec: function (args, kwargs) {
|
||||
const book = (0, getBook_1.default)(args, kwargs);
|
||||
const logger = book.getLogger();
|
||||
return parse_1.default.parseBook(book).then((resultBook) => {
|
||||
const rootFolder = book.getRoot();
|
||||
const contentFolder = book.getContentRoot();
|
||||
logger.info.ln("Book located in:", rootFolder);
|
||||
if (contentFolder != rootFolder) {
|
||||
logger.info.ln("Content located in:", contentFolder);
|
||||
}
|
||||
if (resultBook.isMultilingual()) {
|
||||
printMultingualBook(resultBook);
|
||||
}
|
||||
else {
|
||||
printBook(resultBook);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
25
book/node_modules/honkit/lib/cli/serve.d.ts
generated
vendored
Normal file
25
book/node_modules/honkit/lib/cli/serve.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
declare const _default: {
|
||||
name: string;
|
||||
description: string;
|
||||
options: ({
|
||||
name: string;
|
||||
description: string;
|
||||
values: any;
|
||||
defaults: string;
|
||||
} | {
|
||||
name: string;
|
||||
description: string;
|
||||
defaults: boolean;
|
||||
} | {
|
||||
name: string;
|
||||
description: string;
|
||||
defaults: number;
|
||||
} | {
|
||||
name: string;
|
||||
description: string;
|
||||
defaults: string;
|
||||
})[];
|
||||
exec: (args: any, kwargs: any) => any;
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=serve.d.ts.map
|
||||
1
book/node_modules/honkit/lib/cli/serve.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/cli/serve.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/cli/serve.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4IA,wBA6DE"}
|
||||
193
book/node_modules/honkit/lib/cli/serve.js
generated
vendored
Normal file
193
book/node_modules/honkit/lib/cli/serve.js
generated
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tiny_lr_1 = __importDefault(require("tiny-lr"));
|
||||
const open_1 = __importDefault(require("open"));
|
||||
const immutable_1 = __importDefault(require("immutable"));
|
||||
const parse_1 = __importDefault(require("../parse"));
|
||||
const output_1 = __importDefault(require("../output"));
|
||||
const modifiers_1 = __importDefault(require("../modifiers"));
|
||||
const promise_1 = __importDefault(require("../utils/promise"));
|
||||
const options_1 = __importDefault(require("./options"));
|
||||
const getBook_1 = __importDefault(require("./getBook"));
|
||||
const getOutputFolder_1 = __importDefault(require("./getOutputFolder"));
|
||||
const server_1 = __importDefault(require("./server"));
|
||||
const watch_1 = __importDefault(require("./watch"));
|
||||
const page_cache_1 = require("../output/page-cache");
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
let server, lrServer, lrPath;
|
||||
function waitForCtrlC() {
|
||||
const d = promise_1.default.defer();
|
||||
process.on("SIGINT", () => {
|
||||
d.resolve();
|
||||
});
|
||||
return d.promise;
|
||||
}
|
||||
function startServer(args, kwargs) {
|
||||
const outputFolder = (0, getOutputFolder_1.default)(args);
|
||||
const port = kwargs.port;
|
||||
const browser = kwargs["browser"];
|
||||
const book = (0, getBook_1.default)(args, kwargs);
|
||||
const hasWatch = kwargs["watch"];
|
||||
const hasOpen = kwargs["open"];
|
||||
const hasLiveReloading = kwargs["live"];
|
||||
const reload = kwargs["reload"];
|
||||
const Generator = output_1.default.getGenerator(kwargs.format);
|
||||
const logger = book.getLogger();
|
||||
logger.info.ok("Starting server ...");
|
||||
let lastOutput = null;
|
||||
return promise_1.default.all([
|
||||
server.start(outputFolder, port),
|
||||
generateBook({
|
||||
book,
|
||||
outputFolder,
|
||||
hasLiveReloading,
|
||||
Generator,
|
||||
reload
|
||||
}).then((output) => {
|
||||
lastOutput = output;
|
||||
return output;
|
||||
})
|
||||
])
|
||||
.then(() => {
|
||||
console.log(`Serving book on http://localhost:${port}`);
|
||||
if (hasOpen) {
|
||||
(0, open_1.default)(`http://localhost:${port}`, { app: browser });
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
if (!hasWatch) {
|
||||
return waitForCtrlC();
|
||||
}
|
||||
// update book immutably. does not use book again
|
||||
return (0, watch_1.default)(book.getRoot(), (error, filepath) => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
return;
|
||||
}
|
||||
// If the file does not exist in file system, show a warning and skip
|
||||
// Probably, the file has been deleted
|
||||
if (!fs_1.default.existsSync(filepath)) {
|
||||
logger.warn.ok(`${filepath} does not exist in file system.`);
|
||||
return;
|
||||
}
|
||||
// set livereload path
|
||||
lrPath = filepath;
|
||||
// TODO: use parse extension
|
||||
// Incremental update for pages
|
||||
if (lastOutput && filepath.endsWith(".md")) {
|
||||
logger.warn.ok("Rebuild " + filepath);
|
||||
const changedOutput = lastOutput.reloadPage(lastOutput.book.getContentRoot(), filepath).merge({
|
||||
incrementalChangeFileSet: immutable_1.default.Set([filepath])
|
||||
});
|
||||
return incrementalBuild({
|
||||
output: changedOutput,
|
||||
Generator
|
||||
}).then(() => {
|
||||
if (lrPath && hasLiveReloading) {
|
||||
// trigger livereload
|
||||
lrServer.changed({
|
||||
body: {
|
||||
files: [lrPath]
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// Asciidoc files are not supported for incremental build
|
||||
logger.info.ok("Rebuild " + filepath);
|
||||
return generateBook({
|
||||
book,
|
||||
outputFolder,
|
||||
hasLiveReloading,
|
||||
Generator,
|
||||
reload
|
||||
}).then((output) => {
|
||||
lastOutput = output;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
function generateBook({ book, outputFolder, hasLiveReloading, Generator, reload }) {
|
||||
// Stop server if running
|
||||
if (reload) {
|
||||
book.getLogger().info.ok(`Clear cache`);
|
||||
(0, page_cache_1.clearCache)();
|
||||
}
|
||||
return parse_1.default.parseBook(book).then((resultBook) => {
|
||||
if (hasLiveReloading) {
|
||||
// Enable livereload plugin
|
||||
let config = resultBook.getConfig();
|
||||
// @ts-expect-error ts-migrate(2554) FIXME: Expected 3 arguments, but got 2.
|
||||
config = modifiers_1.default.Config.addPlugin(config, "livereload");
|
||||
resultBook = resultBook.set("config", config);
|
||||
}
|
||||
return output_1.default.generate(Generator, resultBook, {
|
||||
root: outputFolder
|
||||
});
|
||||
});
|
||||
}
|
||||
function incrementalBuild({ output, Generator }) {
|
||||
return output_1.default.incrementalBuild(Generator, output);
|
||||
}
|
||||
exports.default = {
|
||||
name: "serve [book] [output]",
|
||||
description: "serve the book as a website for testing",
|
||||
options: [
|
||||
{
|
||||
name: "port",
|
||||
description: "Port for server to listen on",
|
||||
defaults: 4000
|
||||
},
|
||||
{
|
||||
name: "lrport",
|
||||
description: "Port for livereload server to listen on",
|
||||
defaults: 35729
|
||||
},
|
||||
{
|
||||
name: "watch",
|
||||
description: "Enable file watcher and live reloading",
|
||||
defaults: true
|
||||
},
|
||||
{
|
||||
name: "live",
|
||||
description: "Enable live reloading",
|
||||
defaults: true
|
||||
},
|
||||
{
|
||||
name: "open",
|
||||
description: "Enable opening book in browser",
|
||||
defaults: false
|
||||
},
|
||||
{
|
||||
name: "browser",
|
||||
description: "Specify browser for opening book",
|
||||
defaults: ""
|
||||
},
|
||||
options_1.default.log,
|
||||
options_1.default.format,
|
||||
options_1.default.reload
|
||||
],
|
||||
exec: function (args, kwargs) {
|
||||
server = new server_1.default();
|
||||
const hasWatch = kwargs["watch"];
|
||||
const hasLiveReloading = kwargs["live"];
|
||||
return (0, promise_1.default)()
|
||||
.then(() => {
|
||||
if (!hasWatch || !hasLiveReloading) {
|
||||
return;
|
||||
}
|
||||
lrServer = (0, tiny_lr_1.default)({});
|
||||
return promise_1.default.nfcall(lrServer.listen.bind(lrServer), kwargs.lrport).then(() => {
|
||||
console.log("Live reload server started on port:", kwargs.lrport);
|
||||
console.log("Press CTRL+C to quit ...");
|
||||
console.log("");
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
return startServer(args, kwargs);
|
||||
});
|
||||
}
|
||||
};
|
||||
28
book/node_modules/honkit/lib/cli/server.d.ts
generated
vendored
Normal file
28
book/node_modules/honkit/lib/cli/server.d.ts
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import events from "events";
|
||||
declare class Server extends events.EventEmitter {
|
||||
private running;
|
||||
private dir;
|
||||
private port;
|
||||
private sockets;
|
||||
constructor();
|
||||
/**
|
||||
Return true if the server is running
|
||||
|
||||
@return {boolean}
|
||||
*/
|
||||
isRunning(): boolean;
|
||||
/**
|
||||
Stop the server
|
||||
|
||||
@return {Promise}
|
||||
*/
|
||||
stop(): any;
|
||||
/**
|
||||
Start the server
|
||||
|
||||
@return {Promise}
|
||||
*/
|
||||
start(dir: any, port: any): any;
|
||||
}
|
||||
export default Server;
|
||||
//# sourceMappingURL=server.d.ts.map
|
||||
1
book/node_modules/honkit/lib/cli/server.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/cli/server.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/cli/server.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAO5B,cAAM,MAAO,SAAQ,MAAM,CAAC,YAAY;IACpC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,GAAG,CAAO;IAClB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,OAAO,CAAQ;;IASvB;;;;OAIG;IACH,SAAS;IAIT;;;;OAIG;IACH,IAAI;IAqBJ;;;;OAIG;IACH,KAAK,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA;CA0DlB;AAcD,eAAe,MAAM,CAAC"}
|
||||
120
book/node_modules/honkit/lib/cli/server.js
generated
vendored
Normal file
120
book/node_modules/honkit/lib/cli/server.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const events_1 = __importDefault(require("events"));
|
||||
const http_1 = __importDefault(require("http"));
|
||||
const send_1 = __importDefault(require("send"));
|
||||
const url_1 = __importDefault(require("url"));
|
||||
const promise_1 = __importDefault(require("../utils/promise"));
|
||||
class Server extends events_1.default.EventEmitter {
|
||||
running;
|
||||
dir;
|
||||
port;
|
||||
sockets;
|
||||
constructor() {
|
||||
super();
|
||||
this.running = null;
|
||||
this.dir = null;
|
||||
this.port = 0;
|
||||
this.sockets = [];
|
||||
}
|
||||
/**
|
||||
Return true if the server is running
|
||||
|
||||
@return {boolean}
|
||||
*/
|
||||
isRunning() {
|
||||
return !!this.running;
|
||||
}
|
||||
/**
|
||||
Stop the server
|
||||
|
||||
@return {Promise}
|
||||
*/
|
||||
stop() {
|
||||
const that = this;
|
||||
if (!this.isRunning())
|
||||
return (0, promise_1.default)();
|
||||
const d = promise_1.default.defer();
|
||||
this.running.close((err) => {
|
||||
that.running = null;
|
||||
that.emit("state", false);
|
||||
if (err)
|
||||
d.reject(err);
|
||||
else
|
||||
d.resolve();
|
||||
});
|
||||
for (let i = 0; i < this.sockets.length; i++) {
|
||||
this.sockets[i].destroy();
|
||||
}
|
||||
return d.promise;
|
||||
}
|
||||
/**
|
||||
Start the server
|
||||
|
||||
@return {Promise}
|
||||
*/
|
||||
start(dir, port) {
|
||||
const that = this;
|
||||
let pre = (0, promise_1.default)();
|
||||
port = port || 8004;
|
||||
if (that.isRunning())
|
||||
pre = this.stop();
|
||||
return pre.then(() => {
|
||||
const d = promise_1.default.defer();
|
||||
that.running = http_1.default.createServer((req, res) => {
|
||||
// Render error
|
||||
function error(err) {
|
||||
res.statusCode = err.status || 500;
|
||||
res.end(err.message);
|
||||
}
|
||||
// Redirect to directory's index.html
|
||||
function redirect() {
|
||||
const resultURL = urlTransform(req.url, (parsed) => {
|
||||
parsed.pathname += "/";
|
||||
return parsed;
|
||||
});
|
||||
res.statusCode = 301;
|
||||
res.setHeader("Location", resultURL);
|
||||
res.end(`Redirecting to ${resultURL}`);
|
||||
}
|
||||
res.setHeader("X-Current-Location", req.url);
|
||||
// Send file
|
||||
(0, send_1.default)(req, url_1.default.parse(req.url).pathname, {
|
||||
root: dir
|
||||
})
|
||||
.on("error", error)
|
||||
.on("directory", redirect)
|
||||
.pipe(res);
|
||||
});
|
||||
that.running.on("connection", (socket) => {
|
||||
that.sockets.push(socket);
|
||||
socket.setTimeout(4000);
|
||||
socket.on("close", () => {
|
||||
that.sockets.splice(that.sockets.indexOf(socket), 1);
|
||||
});
|
||||
});
|
||||
that.running.listen(port, () => {
|
||||
that.port = port;
|
||||
that.dir = dir;
|
||||
that.emit("state", true);
|
||||
d.resolve();
|
||||
});
|
||||
return d.promise;
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
urlTransform is a helper function that allows a function to transform
|
||||
a url string in it's parsed form and returns the new url as a string
|
||||
|
||||
@param {string} uri
|
||||
@param {Function} fn
|
||||
@return {string}
|
||||
*/
|
||||
function urlTransform(uri, fn) {
|
||||
return url_1.default.format(fn(url_1.default.parse(uri)));
|
||||
}
|
||||
exports.default = Server;
|
||||
10
book/node_modules/honkit/lib/cli/watch.d.ts
generated
vendored
Normal file
10
book/node_modules/honkit/lib/cli/watch.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
Watch a folder and resolve promise once a file is modified
|
||||
|
||||
@param {string} dir
|
||||
@param callback
|
||||
@return {Promise}
|
||||
*/
|
||||
declare function watch(dir: any, callback: any): void;
|
||||
export default watch;
|
||||
//# sourceMappingURL=watch.d.ts.map
|
||||
1
book/node_modules/honkit/lib/cli/watch.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/cli/watch.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/cli/watch.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,iBAAS,KAAK,CAAC,GAAG,KAAA,EAAE,QAAQ,KAAA,QAwB3B;AAED,eAAe,KAAK,CAAC"}
|
||||
37
book/node_modules/honkit/lib/cli/watch.js
generated
vendored
Normal file
37
book/node_modules/honkit/lib/cli/watch.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const chokidar_1 = __importDefault(require("chokidar"));
|
||||
const parsers_1 = __importDefault(require("../parsers"));
|
||||
/**
|
||||
Watch a folder and resolve promise once a file is modified
|
||||
|
||||
@param {string} dir
|
||||
@param callback
|
||||
@return {Promise}
|
||||
*/
|
||||
function watch(dir, callback) {
|
||||
dir = path_1.default.resolve(dir);
|
||||
const toWatch = ["book.json", "book.js", "_layouts/**"];
|
||||
// Watch all parsable files
|
||||
parsers_1.default.extensions.forEach((ext) => {
|
||||
toWatch.push(`**/*${ext}`);
|
||||
});
|
||||
const watcher = chokidar_1.default.watch(toWatch, {
|
||||
cwd: dir,
|
||||
// prevent infinity loop
|
||||
// https://github.com/honkit/honkit/issues/269
|
||||
ignored: ["_book/**", "node_modules/**"],
|
||||
ignoreInitial: true
|
||||
});
|
||||
watcher.on("all", (e, filepath) => {
|
||||
callback(null, path_1.default.resolve(dir, filepath));
|
||||
});
|
||||
watcher.on("error", (err) => {
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
exports.default = watch;
|
||||
3
book/node_modules/honkit/lib/constants/configDefault.d.ts
generated
vendored
Normal file
3
book/node_modules/honkit/lib/constants/configDefault.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare const _default: any;
|
||||
export default _default;
|
||||
//# sourceMappingURL=configDefault.d.ts.map
|
||||
1
book/node_modules/honkit/lib/constants/configDefault.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/constants/configDefault.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"configDefault.d.ts","sourceRoot":"","sources":["../../src/constants/configDefault.ts"],"names":[],"mappings":";AAIA,wBAA4D"}
|
||||
9
book/node_modules/honkit/lib/constants/configDefault.js
generated
vendored
Normal file
9
book/node_modules/honkit/lib/constants/configDefault.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const configSchema_1 = __importDefault(require("./configSchema"));
|
||||
const immutable_1 = __importDefault(require("immutable"));
|
||||
const json_schema_defaults_1 = __importDefault(require("json-schema-defaults"));
|
||||
exports.default = immutable_1.default.fromJS((0, json_schema_defaults_1.default)(configSchema_1.default));
|
||||
3
book/node_modules/honkit/lib/constants/configFiles.d.ts
generated
vendored
Normal file
3
book/node_modules/honkit/lib/constants/configFiles.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare const _default: string[];
|
||||
export default _default;
|
||||
//# sourceMappingURL=configFiles.d.ts.map
|
||||
1
book/node_modules/honkit/lib/constants/configFiles.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/constants/configFiles.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"configFiles.d.ts","sourceRoot":"","sources":["../../src/constants/configFiles.ts"],"names":[],"mappings":";AAAA,wBAAwC"}
|
||||
3
book/node_modules/honkit/lib/constants/configFiles.js
generated
vendored
Normal file
3
book/node_modules/honkit/lib/constants/configFiles.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = ["book.js", "book.json"];
|
||||
221
book/node_modules/honkit/lib/constants/configSchema.d.ts
generated
vendored
Normal file
221
book/node_modules/honkit/lib/constants/configSchema.d.ts
generated
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
declare const _default: {
|
||||
$schema: string;
|
||||
id: string;
|
||||
title: string;
|
||||
type: string;
|
||||
properties: {
|
||||
root: {
|
||||
type: string;
|
||||
title: string;
|
||||
};
|
||||
title: {
|
||||
type: string;
|
||||
title: string;
|
||||
};
|
||||
author: {
|
||||
type: string;
|
||||
title: string;
|
||||
};
|
||||
authorSort: {
|
||||
type: string;
|
||||
title: string;
|
||||
};
|
||||
producer: {
|
||||
type: string;
|
||||
title: string;
|
||||
};
|
||||
publisher: {
|
||||
type: string;
|
||||
title: string;
|
||||
};
|
||||
pubdate: {
|
||||
type: string;
|
||||
title: string;
|
||||
};
|
||||
series: {
|
||||
type: string;
|
||||
title: string;
|
||||
};
|
||||
seriesIndex: {
|
||||
type: string;
|
||||
title: string;
|
||||
};
|
||||
isbn: {
|
||||
type: string;
|
||||
title: string;
|
||||
};
|
||||
language: {
|
||||
type: string;
|
||||
title: string;
|
||||
};
|
||||
gitbook: {
|
||||
type: string;
|
||||
default: string;
|
||||
title: string;
|
||||
};
|
||||
direction: {
|
||||
type: string;
|
||||
enum: string[];
|
||||
title: string;
|
||||
};
|
||||
theme: {
|
||||
type: string;
|
||||
default: string;
|
||||
title: string;
|
||||
};
|
||||
variables: {
|
||||
type: string;
|
||||
title: string;
|
||||
};
|
||||
plugins: {
|
||||
oneOf: {
|
||||
$ref: string;
|
||||
}[];
|
||||
default: any[];
|
||||
};
|
||||
pluginsConfig: {
|
||||
type: string;
|
||||
title: string;
|
||||
};
|
||||
structure: {
|
||||
type: string;
|
||||
properties: {
|
||||
langs: {
|
||||
default: string;
|
||||
type: string;
|
||||
title: string;
|
||||
pattern: string;
|
||||
};
|
||||
readme: {
|
||||
default: string;
|
||||
type: string;
|
||||
title: string;
|
||||
pattern: string;
|
||||
};
|
||||
glossary: {
|
||||
default: string;
|
||||
type: string;
|
||||
title: string;
|
||||
pattern: string;
|
||||
};
|
||||
summary: {
|
||||
default: string;
|
||||
type: string;
|
||||
title: string;
|
||||
pattern: string;
|
||||
};
|
||||
};
|
||||
additionalProperties: boolean;
|
||||
};
|
||||
pdf: {
|
||||
type: string;
|
||||
title: string;
|
||||
properties: {
|
||||
pageNumbers: {
|
||||
type: string;
|
||||
default: boolean;
|
||||
title: string;
|
||||
};
|
||||
fontSize: {
|
||||
type: string;
|
||||
minimum: number;
|
||||
maximum: number;
|
||||
default: number;
|
||||
title: string;
|
||||
};
|
||||
fontFamily: {
|
||||
type: string;
|
||||
default: string;
|
||||
title: string;
|
||||
};
|
||||
paperSize: {
|
||||
type: string;
|
||||
enum: string[];
|
||||
default: string;
|
||||
title: string;
|
||||
};
|
||||
chapterMark: {
|
||||
type: string;
|
||||
enum: string[];
|
||||
default: string;
|
||||
title: string;
|
||||
};
|
||||
pageBreaksBefore: {
|
||||
type: string;
|
||||
default: string;
|
||||
title: string;
|
||||
};
|
||||
margin: {
|
||||
type: string;
|
||||
properties: {
|
||||
right: {
|
||||
type: string;
|
||||
title: string;
|
||||
minimum: number;
|
||||
maximum: number;
|
||||
default: number;
|
||||
};
|
||||
left: {
|
||||
type: string;
|
||||
title: string;
|
||||
minimum: number;
|
||||
maximum: number;
|
||||
default: number;
|
||||
};
|
||||
top: {
|
||||
type: string;
|
||||
title: string;
|
||||
minimum: number;
|
||||
maximum: number;
|
||||
default: number;
|
||||
};
|
||||
bottom: {
|
||||
type: string;
|
||||
title: string;
|
||||
minimum: number;
|
||||
maximum: number;
|
||||
default: number;
|
||||
};
|
||||
};
|
||||
};
|
||||
embedFonts: {
|
||||
type: string;
|
||||
default: boolean;
|
||||
title: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
required: any[];
|
||||
definitions: {
|
||||
pluginsArray: {
|
||||
type: string;
|
||||
items: {
|
||||
oneOf: {
|
||||
$ref: string;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
pluginsString: {
|
||||
type: string;
|
||||
};
|
||||
pluginString: {
|
||||
type: string;
|
||||
};
|
||||
pluginObject: {
|
||||
type: string;
|
||||
properties: {
|
||||
name: {
|
||||
type: string;
|
||||
};
|
||||
version: {
|
||||
type: string;
|
||||
};
|
||||
};
|
||||
additionalProperties: boolean;
|
||||
required: string[];
|
||||
};
|
||||
};
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=configSchema.d.ts.map
|
||||
1
book/node_modules/honkit/lib/constants/configSchema.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/constants/configSchema.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"configSchema.d.ts","sourceRoot":"","sources":["../../src/constants/configSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAuOE"}
|
||||
235
book/node_modules/honkit/lib/constants/configSchema.js
generated
vendored
Normal file
235
book/node_modules/honkit/lib/constants/configSchema.js
generated
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const FILENAME_REGEX = "^[a-zA-Z-._d,s]+$";
|
||||
exports.default = {
|
||||
$schema: "http://json-schema.org/schema#",
|
||||
id: "https://gitbook.com/schemas/book.json",
|
||||
title: "HonKit Configuration",
|
||||
type: "object",
|
||||
properties: {
|
||||
root: {
|
||||
type: "string",
|
||||
title: "Path fro the root folder containing the book's content"
|
||||
},
|
||||
title: {
|
||||
type: "string",
|
||||
title: "Title of the book, default is extracted from README"
|
||||
},
|
||||
author: {
|
||||
type: "string",
|
||||
title: "Name of the author"
|
||||
},
|
||||
authorSort: {
|
||||
type: "string",
|
||||
title: "String to be used to sort the author(s)"
|
||||
},
|
||||
producer: {
|
||||
type: "string",
|
||||
title: "Name of the producer"
|
||||
},
|
||||
publisher: {
|
||||
type: "string",
|
||||
title: "Name of the publisher"
|
||||
},
|
||||
pubdate: {
|
||||
type: "string",
|
||||
title: "Publication date of the book"
|
||||
},
|
||||
series: {
|
||||
type: "string",
|
||||
title: "Series this book belongs to"
|
||||
},
|
||||
seriesIndex: {
|
||||
type: "string",
|
||||
title: "Index of the book in this series"
|
||||
},
|
||||
isbn: {
|
||||
type: "string",
|
||||
title: "ISBN for published book"
|
||||
},
|
||||
language: {
|
||||
type: "string",
|
||||
title: "Language of the book"
|
||||
},
|
||||
gitbook: {
|
||||
type: "string",
|
||||
default: "*",
|
||||
title: "GitBook/HonKit version to match"
|
||||
},
|
||||
direction: {
|
||||
type: "string",
|
||||
enum: ["ltr", "rtl"],
|
||||
title: "Direction of texts, default is detected in the pages"
|
||||
},
|
||||
theme: {
|
||||
type: "string",
|
||||
default: "default",
|
||||
title: "Name of the theme plugin to use"
|
||||
},
|
||||
variables: {
|
||||
type: "object",
|
||||
title: "Templating context variables"
|
||||
},
|
||||
plugins: {
|
||||
oneOf: [{ $ref: "#/definitions/pluginsArray" }, { $ref: "#/definitions/pluginsString" }],
|
||||
default: []
|
||||
},
|
||||
pluginsConfig: {
|
||||
type: "object",
|
||||
title: "Configuration for plugins"
|
||||
},
|
||||
structure: {
|
||||
type: "object",
|
||||
properties: {
|
||||
langs: {
|
||||
default: "LANGS.md",
|
||||
type: "string",
|
||||
title: "File to use as languages index",
|
||||
pattern: FILENAME_REGEX
|
||||
},
|
||||
readme: {
|
||||
default: "README.md",
|
||||
type: "string",
|
||||
title: "File to use as preface",
|
||||
pattern: FILENAME_REGEX
|
||||
},
|
||||
glossary: {
|
||||
default: "GLOSSARY.md",
|
||||
type: "string",
|
||||
title: "File to use as glossary index",
|
||||
pattern: FILENAME_REGEX
|
||||
},
|
||||
summary: {
|
||||
default: "SUMMARY.md",
|
||||
type: "string",
|
||||
title: "File to use as table of contents",
|
||||
pattern: FILENAME_REGEX
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
},
|
||||
pdf: {
|
||||
type: "object",
|
||||
title: "PDF specific configurations",
|
||||
properties: {
|
||||
pageNumbers: {
|
||||
type: "boolean",
|
||||
default: true,
|
||||
title: "Add page numbers to the bottom of every page"
|
||||
},
|
||||
fontSize: {
|
||||
type: "integer",
|
||||
minimum: 8,
|
||||
maximum: 30,
|
||||
default: 12,
|
||||
title: "Font size for the PDF output"
|
||||
},
|
||||
fontFamily: {
|
||||
type: "string",
|
||||
default: "Arial",
|
||||
title: "Font family for the PDF output"
|
||||
},
|
||||
paperSize: {
|
||||
type: "string",
|
||||
enum: [
|
||||
"a0",
|
||||
"a1",
|
||||
"a2",
|
||||
"a3",
|
||||
"a4",
|
||||
"a5",
|
||||
"a6",
|
||||
"b0",
|
||||
"b1",
|
||||
"b2",
|
||||
"b3",
|
||||
"b4",
|
||||
"b5",
|
||||
"b6",
|
||||
"legal",
|
||||
"letter"
|
||||
],
|
||||
default: "a4",
|
||||
title: "Paper size for the PDF"
|
||||
},
|
||||
chapterMark: {
|
||||
type: "string",
|
||||
enum: ["pagebreak", "rule", "both", "none"],
|
||||
default: "pagebreak",
|
||||
title: "How to mark detected chapters"
|
||||
},
|
||||
pageBreaksBefore: {
|
||||
type: "string",
|
||||
default: "/",
|
||||
title: 'An XPath expression. Page breaks are inserted before the specified elements. To disable use the expression: "/"'
|
||||
},
|
||||
margin: {
|
||||
type: "object",
|
||||
properties: {
|
||||
right: {
|
||||
type: "integer",
|
||||
title: "Right Margin",
|
||||
minimum: 0,
|
||||
maximum: 100,
|
||||
default: 62
|
||||
},
|
||||
left: {
|
||||
type: "integer",
|
||||
title: "Left Margin",
|
||||
minimum: 0,
|
||||
maximum: 100,
|
||||
default: 62
|
||||
},
|
||||
top: {
|
||||
type: "integer",
|
||||
title: "Top Margin",
|
||||
minimum: 0,
|
||||
maximum: 100,
|
||||
default: 56
|
||||
},
|
||||
bottom: {
|
||||
type: "integer",
|
||||
title: "Bottom Margin",
|
||||
minimum: 0,
|
||||
maximum: 100,
|
||||
default: 56
|
||||
}
|
||||
}
|
||||
},
|
||||
embedFonts: {
|
||||
type: "boolean",
|
||||
default: false,
|
||||
title: "Embed all fonts into the PDF"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
required: [],
|
||||
definitions: {
|
||||
pluginsArray: {
|
||||
type: "array",
|
||||
items: {
|
||||
oneOf: [{ $ref: "#/definitions/pluginObject" }, { $ref: "#/definitions/pluginString" }]
|
||||
}
|
||||
},
|
||||
pluginsString: {
|
||||
type: "string"
|
||||
},
|
||||
pluginString: {
|
||||
type: "string"
|
||||
},
|
||||
pluginObject: {
|
||||
type: "object",
|
||||
properties: {
|
||||
name: {
|
||||
type: "string"
|
||||
},
|
||||
version: {
|
||||
type: "string"
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
required: ["name"]
|
||||
}
|
||||
}
|
||||
};
|
||||
5
book/node_modules/honkit/lib/constants/defaultBlocks.d.ts
generated
vendored
Normal file
5
book/node_modules/honkit/lib/constants/defaultBlocks.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import Immutable from "immutable";
|
||||
import TemplateBlock from "../models/templateBlock";
|
||||
declare const _default: Immutable.Map<string, TemplateBlock>;
|
||||
export default _default;
|
||||
//# sourceMappingURL=defaultBlocks.d.ts.map
|
||||
1
book/node_modules/honkit/lib/constants/defaultBlocks.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/constants/defaultBlocks.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defaultBlocks.d.ts","sourceRoot":"","sources":["../../src/constants/defaultBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,aAAa,MAAM,yBAAyB,CAAC;;AAEpD,wBA6CG"}
|
||||
49
book/node_modules/honkit/lib/constants/defaultBlocks.js
generated
vendored
Normal file
49
book/node_modules/honkit/lib/constants/defaultBlocks.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const immutable_1 = __importDefault(require("immutable"));
|
||||
const templateBlock_1 = __importDefault(require("../models/templateBlock"));
|
||||
exports.default = immutable_1.default.Map({
|
||||
html: new templateBlock_1.default({
|
||||
name: "html",
|
||||
process: function (blk) {
|
||||
return blk;
|
||||
}
|
||||
}),
|
||||
code: new templateBlock_1.default({
|
||||
name: "code",
|
||||
process: function (blk) {
|
||||
return {
|
||||
html: false,
|
||||
body: blk.body
|
||||
};
|
||||
}
|
||||
}),
|
||||
markdown: new templateBlock_1.default({
|
||||
name: "markdown",
|
||||
process: function (blk) {
|
||||
console.log("blk", blk); // TODO::::::
|
||||
return this.book.renderInline("markdown", blk.body).then((out) => {
|
||||
return { body: out };
|
||||
});
|
||||
}
|
||||
}),
|
||||
asciidoc: new templateBlock_1.default({
|
||||
name: "asciidoc",
|
||||
process: function (blk) {
|
||||
return this.book.renderInline("asciidoc", blk.body).then((out) => {
|
||||
return { body: out };
|
||||
});
|
||||
}
|
||||
}),
|
||||
markup: new templateBlock_1.default({
|
||||
name: "markup",
|
||||
process: function (blk) {
|
||||
return this.book.renderInline(this.ctx.file.type, blk.body).then((out) => {
|
||||
return { body: out };
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
4
book/node_modules/honkit/lib/constants/defaultFilters.d.ts
generated
vendored
Normal file
4
book/node_modules/honkit/lib/constants/defaultFilters.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import Immutable from "immutable";
|
||||
declare const _default: Immutable.Map<string, ((time: any, format: any) => string) | ((time: any) => string)>;
|
||||
export default _default;
|
||||
//# sourceMappingURL=defaultFilters.d.ts.map
|
||||
1
book/node_modules/honkit/lib/constants/defaultFilters.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/constants/defaultFilters.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defaultFilters.d.ts","sourceRoot":"","sources":["../../src/constants/defaultFilters.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;;AAGlC,wBAWG"}
|
||||
18
book/node_modules/honkit/lib/constants/defaultFilters.js
generated
vendored
Normal file
18
book/node_modules/honkit/lib/constants/defaultFilters.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const immutable_1 = __importDefault(require("immutable"));
|
||||
const moment_1 = __importDefault(require("moment"));
|
||||
exports.default = immutable_1.default.Map({
|
||||
// Format a date
|
||||
// ex: 'MMMM Do YYYY, h:mm:ss a
|
||||
date: function (time, format) {
|
||||
return (0, moment_1.default)(time).format(format);
|
||||
},
|
||||
// Relative Time
|
||||
dateFromNow: function (time) {
|
||||
return (0, moment_1.default)(time).fromNow();
|
||||
}
|
||||
});
|
||||
5
book/node_modules/honkit/lib/constants/defaultPlugins.d.ts
generated
vendored
Normal file
5
book/node_modules/honkit/lib/constants/defaultPlugins.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import Immutable from "immutable";
|
||||
import PluginDependency from "../models/pluginDependency";
|
||||
declare const _default: Immutable.Iterable<number, PluginDependency>;
|
||||
export default _default;
|
||||
//# sourceMappingURL=defaultPlugins.d.ts.map
|
||||
1
book/node_modules/honkit/lib/constants/defaultPlugins.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/constants/defaultPlugins.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defaultPlugins.d.ts","sourceRoot":"","sources":["../../src/constants/defaultPlugins.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;;AAe1D,wBAEE"}
|
||||
19
book/node_modules/honkit/lib/constants/defaultPlugins.js
generated
vendored
Normal file
19
book/node_modules/honkit/lib/constants/defaultPlugins.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const immutable_1 = __importDefault(require("immutable"));
|
||||
const pluginDependency_1 = __importDefault(require("../models/pluginDependency"));
|
||||
const pkg = require("../../package.json");
|
||||
/**
|
||||
* Create a PluginDependency from a dependency of gitbook
|
||||
* @param {string} pluginName
|
||||
* @return {PluginDependency}
|
||||
*/
|
||||
function createFromDependency(pluginName) {
|
||||
const npmID = "gitbook-plugin-" + pluginName;
|
||||
const version = pkg.dependencies[npmID];
|
||||
return pluginDependency_1.default.create(pluginName, version);
|
||||
}
|
||||
exports.default = immutable_1.default.List(["highlight", "search", "lunr", "fontsettings", "theme-default"]).map(createFromDependency);
|
||||
3
book/node_modules/honkit/lib/constants/extsAsciidoc.d.ts
generated
vendored
Normal file
3
book/node_modules/honkit/lib/constants/extsAsciidoc.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare const _default: string[];
|
||||
export default _default;
|
||||
//# sourceMappingURL=extsAsciidoc.d.ts.map
|
||||
1
book/node_modules/honkit/lib/constants/extsAsciidoc.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/constants/extsAsciidoc.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"extsAsciidoc.d.ts","sourceRoot":"","sources":["../../src/constants/extsAsciidoc.ts"],"names":[],"mappings":";AAAA,wBAAsC"}
|
||||
3
book/node_modules/honkit/lib/constants/extsAsciidoc.js
generated
vendored
Normal file
3
book/node_modules/honkit/lib/constants/extsAsciidoc.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = [".adoc", ".asciidoc"];
|
||||
3
book/node_modules/honkit/lib/constants/extsMarkdown.d.ts
generated
vendored
Normal file
3
book/node_modules/honkit/lib/constants/extsMarkdown.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare const _default: string[];
|
||||
export default _default;
|
||||
//# sourceMappingURL=extsMarkdown.d.ts.map
|
||||
1
book/node_modules/honkit/lib/constants/extsMarkdown.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/constants/extsMarkdown.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"extsMarkdown.d.ts","sourceRoot":"","sources":["../../src/constants/extsMarkdown.ts"],"names":[],"mappings":";AAAA,wBAA8C"}
|
||||
3
book/node_modules/honkit/lib/constants/extsMarkdown.js
generated
vendored
Normal file
3
book/node_modules/honkit/lib/constants/extsMarkdown.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = [".md", ".markdown", ".mdown"];
|
||||
3
book/node_modules/honkit/lib/constants/ignoreFiles.d.ts
generated
vendored
Normal file
3
book/node_modules/honkit/lib/constants/ignoreFiles.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare const _default: string[];
|
||||
export default _default;
|
||||
//# sourceMappingURL=ignoreFiles.d.ts.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user