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/output/json/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,10 @@
import { onFinish } from "./onFinish";
import { onPage } from "./onPage";
declare const _default: {
name: string;
Options: import("immutable").Record.Class;
onPage: typeof onPage;
onFinish: typeof onFinish;
};
export default _default;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/output/json/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;;;;;;;AAGlC,wBAKE"}

14
book/node_modules/honkit/lib/output/json/index.js generated vendored Normal file
View File

@ -0,0 +1,14 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const onFinish_1 = require("./onFinish");
const onPage_1 = require("./onPage");
const options_1 = __importDefault(require("./options"));
exports.default = {
name: "json",
Options: options_1.default,
onPage: onPage_1.onPage,
onFinish: onFinish_1.onFinish
};

View File

@ -0,0 +1,8 @@
/**
Finish the generation
@param {Output} output
@return {Output}
*/
declare function onFinish(output: any): any;
export { onFinish };
//# sourceMappingURL=onFinish.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"onFinish.d.ts","sourceRoot":"","sources":["../../../src/output/json/onFinish.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,iBAAS,QAAQ,CAAC,MAAM,KAAA,OAgCvB;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}

38
book/node_modules/honkit/lib/output/json/onFinish.js generated vendored Normal file
View 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 });
exports.onFinish = onFinish;
const path_1 = __importDefault(require("path"));
const promise_1 = __importDefault(require("../../utils/promise"));
const fs_1 = __importDefault(require("../../utils/fs"));
const json_1 = __importDefault(require("../../json"));
/**
Finish the generation
@param {Output} output
@return {Output}
*/
function onFinish(output) {
const book = output.getBook();
const outputRoot = output.getRoot();
if (!book.isMultilingual()) {
return (0, promise_1.default)(output);
}
// Get main language
const languages = book.getLanguages();
const mainLanguage = languages.getDefaultLanguage();
// Read the main JSON
return (fs_1.default
.readFile(path_1.default.resolve(outputRoot, mainLanguage.getID(), "README.json"), "utf8")
// Extend the JSON
.then((content) => {
const json = JSON.parse(content);
json.languages = json_1.default.encodeLanguages(languages);
return json;
})
.then((json) => {
return fs_1.default.writeFile(path_1.default.resolve(outputRoot, "README.json"), JSON.stringify(json, null, 4));
})
.thenResolve(output));
}

9
book/node_modules/honkit/lib/output/json/onPage.d.ts generated vendored Normal file
View File

@ -0,0 +1,9 @@
/**
* Write a page as a json file
*
* @param {Output} output
* @param {Page} page
*/
declare function onPage(output: any, page: any): any;
export { onPage };
//# sourceMappingURL=onPage.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"onPage.d.ts","sourceRoot":"","sources":["../../../src/output/json/onPage.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,iBAAS,MAAM,CAAC,MAAM,KAAA,EAAE,IAAI,KAAA,OAsB3B;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}

36
book/node_modules/honkit/lib/output/json/onPage.js generated vendored Normal file
View 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 });
exports.onPage = onPage;
const json_1 = __importDefault(require("../../json"));
const path_1 = __importDefault(require("../../utils/path"));
const modifiers_1 = __importDefault(require("../modifiers"));
const writeFile_1 = __importDefault(require("../helper/writeFile"));
const getModifiers_1 = __importDefault(require("../getModifiers"));
const JSON_VERSION = "3";
/**
* Write a page as a json file
*
* @param {Output} output
* @param {Page} page
*/
function onPage(output, page) {
const file = page.getFile();
const readme = output.getBook().getReadme().getFile();
return modifiers_1.default.modifyHTML(page, (0, getModifiers_1.default)(output, page)).then((resultPage) => {
// Generate the JSON
const json = json_1.default.encodeBookWithPage(output.getBook(), resultPage);
// Delete some private properties
delete json.config;
// Specify JSON output version
// @ts-expect-error ts-migrate(2339) FIXME: Property 'version' does not exist on type '{ summa... Remove this comment to see the full error message
json.version = JSON_VERSION;
// File path in the output folder
let filePath = file.getPath() == readme.getPath() ? "README.json" : file.getPath();
filePath = path_1.default.setExtension(filePath, ".json");
// Write it to the disk
return (0, writeFile_1.default)(output, filePath, JSON.stringify(json, null, 4));
});
}

View File

@ -0,0 +1,4 @@
import Immutable from "immutable";
declare const Options: Immutable.Record.Class;
export default Options;
//# sourceMappingURL=options.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/output/json/options.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,QAAA,MAAM,OAAO,wBAGX,CAAC;AAEH,eAAe,OAAO,CAAC"}

11
book/node_modules/honkit/lib/output/json/options.js generated vendored Normal file
View 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 immutable_1 = __importDefault(require("immutable"));
const Options = immutable_1.default.Record({
// Root folder for the output
root: String()
});
exports.default = Options;