1 | "use strict";
|
2 | var __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 | };
|
11 | Object.defineProperty(exports, "__esModule", { value: true });
|
12 | exports.build = exports.Boilerplate = void 0;
|
13 | const Spec_1 = require("./Spec");
|
14 | const utils = require("./utils");
|
15 | const prex_1 = require("prex");
|
16 | class Boilerplate {
|
17 | }
|
18 | exports.Boilerplate = Boilerplate;
|
19 | function 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 : {}, html, token);
|
24 | yield spec.build();
|
25 | return spec;
|
26 | });
|
27 | }
|
28 | exports.build = build;
|