fix
This commit is contained in:
10
book/node_modules/honkit/lib/output/helper/fileToOutput.d.ts
generated
vendored
Normal file
10
book/node_modules/honkit/lib/output/helper/fileToOutput.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Convert a filePath (absolute) to a filename for output
|
||||
*
|
||||
* @param {Output} output
|
||||
* @param {string} filePath
|
||||
* @return {string}
|
||||
*/
|
||||
declare function fileToOutput(output: any, filePath: any): string;
|
||||
export default fileToOutput;
|
||||
//# sourceMappingURL=fileToOutput.d.ts.map
|
1
book/node_modules/honkit/lib/output/helper/fileToOutput.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/output/helper/fileToOutput.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"fileToOutput.d.ts","sourceRoot":"","sources":["../../../src/output/helper/fileToOutput.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AAEH,iBAAS,YAAY,CAAC,MAAM,KAAA,EAAE,QAAQ,KAAA,UAerC;AAED,eAAe,YAAY,CAAC"}
|
30
book/node_modules/honkit/lib/output/helper/fileToOutput.js
generated
vendored
Normal file
30
book/node_modules/honkit/lib/output/helper/fileToOutput.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
"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 path_2 = __importDefault(require("../../utils/path"));
|
||||
const location_1 = __importDefault(require("../../utils/location"));
|
||||
const OUTPUT_EXTENSION = ".html";
|
||||
/**
|
||||
* Convert a filePath (absolute) to a filename for output
|
||||
*
|
||||
* @param {Output} output
|
||||
* @param {string} filePath
|
||||
* @return {string}
|
||||
*/
|
||||
function fileToOutput(output, filePath) {
|
||||
const book = output.getBook();
|
||||
const readme = book.getReadme();
|
||||
const fileReadme = readme.getFile();
|
||||
if (path_1.default.basename(filePath, path_1.default.extname(filePath)) == "README" ||
|
||||
(fileReadme.exists() && filePath == fileReadme.getPath())) {
|
||||
filePath = path_1.default.join(path_1.default.dirname(filePath), `index${OUTPUT_EXTENSION}`);
|
||||
}
|
||||
else {
|
||||
filePath = path_2.default.setExtension(filePath, OUTPUT_EXTENSION);
|
||||
}
|
||||
return location_1.default.normalize(filePath);
|
||||
}
|
||||
exports.default = fileToOutput;
|
15
book/node_modules/honkit/lib/output/helper/fileToURL.d.ts
generated
vendored
Normal file
15
book/node_modules/honkit/lib/output/helper/fileToURL.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
Convert a filePath (absolute) to an url (without hostname).
|
||||
It returns an absolute path.
|
||||
|
||||
"README.md" -> "/"
|
||||
"test/hello.md" -> "test/hello.html"
|
||||
"test/README.md" -> "test/"
|
||||
|
||||
@param {Output} output
|
||||
@param {string} filePath
|
||||
@return {string}
|
||||
*/
|
||||
declare function fileToURL(output: any, filePath: any): string;
|
||||
export default fileToURL;
|
||||
//# sourceMappingURL=fileToURL.d.ts.map
|
1
book/node_modules/honkit/lib/output/helper/fileToURL.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/output/helper/fileToURL.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"fileToURL.d.ts","sourceRoot":"","sources":["../../../src/output/helper/fileToURL.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,iBAAS,SAAS,CAAC,MAAM,KAAA,EAAE,QAAQ,KAAA,UAWlC;AAED,eAAe,SAAS,CAAC"}
|
30
book/node_modules/honkit/lib/output/helper/fileToURL.js
generated
vendored
Normal file
30
book/node_modules/honkit/lib/output/helper/fileToURL.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
"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 location_1 = __importDefault(require("../../utils/location"));
|
||||
const fileToOutput_1 = __importDefault(require("./fileToOutput"));
|
||||
/**
|
||||
Convert a filePath (absolute) to an url (without hostname).
|
||||
It returns an absolute path.
|
||||
|
||||
"README.md" -> "/"
|
||||
"test/hello.md" -> "test/hello.html"
|
||||
"test/README.md" -> "test/"
|
||||
|
||||
@param {Output} output
|
||||
@param {string} filePath
|
||||
@return {string}
|
||||
*/
|
||||
function fileToURL(output, filePath) {
|
||||
const options = output.getOptions();
|
||||
const directoryIndex = options.get("directoryIndex");
|
||||
filePath = (0, fileToOutput_1.default)(output, filePath);
|
||||
if (directoryIndex && path_1.default.basename(filePath) == "index.html") {
|
||||
filePath = `${path_1.default.dirname(filePath)}/`;
|
||||
}
|
||||
return location_1.default.normalize(filePath);
|
||||
}
|
||||
exports.default = fileToURL;
|
3
book/node_modules/honkit/lib/output/helper/index.d.ts
generated
vendored
Normal file
3
book/node_modules/honkit/lib/output/helper/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
declare const _default: {};
|
||||
export default _default;
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
book/node_modules/honkit/lib/output/helper/index.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/output/helper/index.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/output/helper/index.ts"],"names":[],"mappings":";AAAA,wBAAkB"}
|
3
book/node_modules/honkit/lib/output/helper/index.js
generated
vendored
Normal file
3
book/node_modules/honkit/lib/output/helper/index.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = {};
|
10
book/node_modules/honkit/lib/output/helper/resolveFileToURL.d.ts
generated
vendored
Normal file
10
book/node_modules/honkit/lib/output/helper/resolveFileToURL.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Resolve an absolute path (extracted from a link)
|
||||
*
|
||||
* @param {Output} output
|
||||
* @param {string} filePath
|
||||
* @return {string}
|
||||
*/
|
||||
declare function resolveFileToURL(output: any, filePath: any): string;
|
||||
export default resolveFileToURL;
|
||||
//# sourceMappingURL=resolveFileToURL.d.ts.map
|
1
book/node_modules/honkit/lib/output/helper/resolveFileToURL.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/output/helper/resolveFileToURL.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"resolveFileToURL.d.ts","sourceRoot":"","sources":["../../../src/output/helper/resolveFileToURL.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AAEH,iBAAS,gBAAgB,CAAC,MAAM,KAAA,EAAE,QAAQ,KAAA,UAYzC;AAED,eAAe,gBAAgB,CAAC"}
|
25
book/node_modules/honkit/lib/output/helper/resolveFileToURL.js
generated
vendored
Normal file
25
book/node_modules/honkit/lib/output/helper/resolveFileToURL.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const location_1 = __importDefault(require("../../utils/location"));
|
||||
const fileToURL_1 = __importDefault(require("./fileToURL"));
|
||||
/**
|
||||
* Resolve an absolute path (extracted from a link)
|
||||
*
|
||||
* @param {Output} output
|
||||
* @param {string} filePath
|
||||
* @return {string}
|
||||
*/
|
||||
function resolveFileToURL(output, filePath) {
|
||||
// Convert /test.png -> test.png
|
||||
filePath = location_1.default.toAbsolute(filePath, "", "");
|
||||
const page = output.getPage(filePath);
|
||||
// if file is a page, return correct .html url
|
||||
if (page) {
|
||||
filePath = (0, fileToURL_1.default)(output, filePath);
|
||||
}
|
||||
return location_1.default.normalize(filePath);
|
||||
}
|
||||
exports.default = resolveFileToURL;
|
11
book/node_modules/honkit/lib/output/helper/writeFile.d.ts
generated
vendored
Normal file
11
book/node_modules/honkit/lib/output/helper/writeFile.d.ts
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
Write a file to the output folder
|
||||
|
||||
@param {Output} output
|
||||
@param {string} filePath
|
||||
@param {Buffer|String} content
|
||||
@return {Promise}
|
||||
*/
|
||||
declare function writeFile(output: any, filePath: any, content: any): any;
|
||||
export default writeFile;
|
||||
//# sourceMappingURL=writeFile.d.ts.map
|
1
book/node_modules/honkit/lib/output/helper/writeFile.d.ts.map
generated
vendored
Normal file
1
book/node_modules/honkit/lib/output/helper/writeFile.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"writeFile.d.ts","sourceRoot":"","sources":["../../../src/output/helper/writeFile.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,iBAAS,SAAS,CAAC,MAAM,KAAA,EAAE,QAAQ,KAAA,EAAE,OAAO,KAAA,OAU3C;AAED,eAAe,SAAS,CAAC"}
|
26
book/node_modules/honkit/lib/output/helper/writeFile.js
generated
vendored
Normal file
26
book/node_modules/honkit/lib/output/helper/writeFile.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 path_1 = __importDefault(require("path"));
|
||||
const fs_1 = __importDefault(require("../../utils/fs"));
|
||||
/**
|
||||
Write a file to the output folder
|
||||
|
||||
@param {Output} output
|
||||
@param {string} filePath
|
||||
@param {Buffer|String} content
|
||||
@return {Promise}
|
||||
*/
|
||||
function writeFile(output, filePath, content) {
|
||||
const rootFolder = output.getRoot();
|
||||
filePath = path_1.default.join(rootFolder, filePath);
|
||||
return fs_1.default
|
||||
.ensureFile(filePath)
|
||||
.then(() => {
|
||||
return fs_1.default.writeFile(filePath, content);
|
||||
})
|
||||
.thenResolve(output);
|
||||
}
|
||||
exports.default = writeFile;
|
Reference in New Issue
Block a user