UNPKG

1.4 kBJavaScriptView Raw
1"use strict";
2var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4 return new (P || (P = Promise))(function (resolve, reject) {
5 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8 step((generator = generator.apply(thisArg, _arguments || [])).next());
9 });
10};
11Object.defineProperty(exports, "__esModule", { value: true });
12exports.build = exports.Boilerplate = void 0;
13const Spec_1 = require("./Spec");
14const utils = require("./utils");
15const prex_1 = require("prex");
16class Boilerplate {
17}
18exports.Boilerplate = Boilerplate;
19function build(path, fetch, opts, token = prex_1.CancellationToken.none) {
20 return __awaiter(this, void 0, void 0, function* () {
21 const html = yield fetch(path, token);
22 const dom = utils.htmlToDom(html);
23 const spec = new Spec_1.default(path, fetch, dom, opts !== null && opts !== void 0 ? opts : {}, /*sourceText*/ html, token);
24 yield spec.build();
25 return spec;
26 });
27}
28exports.build = build;