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

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