This commit is contained in:
2025-05-12 05:38:44 +09:00
parent dced21c3f8
commit 6d78bfa46e
8120 changed files with 1161564 additions and 0 deletions

10
book/node_modules/honkit/lib/api/decodeConfig.d.ts generated vendored Normal file
View 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

View 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
View 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
View 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

View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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

View 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
View 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
View 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

View 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
View 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
View 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

View 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
View 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
View 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
View 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
View 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
View 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

View 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
View 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
View 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

View 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
View 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
View 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
View 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
View 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
};