"use strict";
// Copyright 2022 Google Inc. Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
Object.defineProperty(exports, "__esModule", { value: true });
exports.getJSApi = void 0;
const p = require("path");
const utils = require("./utils");
/**
 * Checks out JS API type definitions from the Sass language repo.
 *
 * Can check out a Git `ref` or link to the source at `path`. By default, checks
 * out the latest revision from GitHub.
 */
async function getJSApi(outPath, options) {
    var _a;
    const repo = 'sass';
    let source;
    if (!options || 'ref' in options) {
        utils.fetchRepo({
            repo,
            outPath: utils.BUILD_PATH,
            ref: (_a = options === null || options === void 0 ? void 0 : options.ref) !== null && _a !== void 0 ? _a : 'main',
        });
        source = p.join(utils.BUILD_PATH, repo);
    }
    else {
        source = options.path;
    }
    await utils.link(p.join(source, 'js-api-doc'), p.join(outPath, repo));
}
exports.getJSApi = getJSApi;
//# sourceMappingURL=get-js-api.js.map