"use strict";

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.githubUrl = githubUrl;
exports.s3Url = s3Url;
function githubUrl(options) {
    return `${options.protocol || "https"}://${options.host || "github.com"}`;
}
function s3Url(options) {
    let url;
    if (!(options.bucket.indexOf(".") !== -1)) {
        url = `https://${options.bucket}.s3.amazonaws.com`;
    } else {
        if (!options.region) {
            throw new Error(`Bucket name "${options.bucket}" includes a dot, but S3 region is missing`);
        }
        // special case, see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro
        url = options.region === "us-east-1" ? `https://s3.amazonaws.com/${options.bucket}` : `https://s3-${options.region}.amazonaws.com/${options.bucket}`;
    }
    if (options.path != null) {
        url += `/${options.path}`;
    }
    return url;
}
//# sourceMappingURL=publishOptions.js.map