vis-dev-utils 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babel-register/index.js +7 -7
- package/babel-register/index.js.map +1 -1
- package/bin/ci-utils.js +7 -7
- package/bin/ci-utils.js.map +1 -1
- package/bin/generate-examples-index.js +155 -155
- package/bin/generate-examples-index.js.map +1 -1
- package/bin/test-e2e-interop.js +87 -87
- package/bin/test-e2e-interop.js.map +1 -1
- package/dist/vis-dev-utils.cjs.js +62 -62
- package/dist/vis-dev-utils.cjs.js.map +1 -1
- package/dist/vis-dev-utils.esm.js +2 -2
- package/dist/vis-dev-utils.esm.js.map +1 -1
- package/package.json +9 -9
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Development utilities for the Vis family projects.
|
|
8
8
|
*
|
|
9
|
-
* @version 3.0.
|
|
10
|
-
* @date 2022-03-
|
|
9
|
+
* @version 3.0.3
|
|
10
|
+
* @date 2022-03-10T13:40:06.338Z
|
|
11
11
|
*
|
|
12
12
|
* @copyright (c) 2011-2017 Almende B.V, http://almende.com
|
|
13
13
|
* @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs
|
|
@@ -138,17 +138,17 @@ var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_s
|
|
|
138
138
|
* @param value
|
|
139
139
|
*/
|
|
140
140
|
function isExample(value) {
|
|
141
|
-
return _typeof__default[
|
|
141
|
+
return _typeof__default["default"](value) === "object" && value !== null && typeof value.path === "string";
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
*
|
|
145
145
|
*/
|
|
146
146
|
|
|
147
147
|
function measureStartStopMs() {
|
|
148
|
-
var start = _Date$now__default[
|
|
148
|
+
var start = _Date$now__default["default"]();
|
|
149
149
|
|
|
150
150
|
return function () {
|
|
151
|
-
var stop = _Date$now__default[
|
|
151
|
+
var stop = _Date$now__default["default"]();
|
|
152
152
|
|
|
153
153
|
return {
|
|
154
154
|
start: start,
|
|
@@ -170,12 +170,12 @@ function reduceReports(reports) {
|
|
|
170
170
|
start: -1,
|
|
171
171
|
stop: -1
|
|
172
172
|
};
|
|
173
|
-
return (_reports$reduce = _reduceInstanceProperty__default[
|
|
173
|
+
return (_reports$reduce = _reduceInstanceProperty__default["default"](reports).call(reports, function (acc, val) {
|
|
174
174
|
var _acc$count, _val$count, _context, _acc$result, _acc$start, _acc$stop;
|
|
175
175
|
|
|
176
176
|
return {
|
|
177
177
|
count: ((_acc$count = acc === null || acc === void 0 ? void 0 : acc.count) !== null && _acc$count !== void 0 ? _acc$count : 0) + ((_val$count = val === null || val === void 0 ? void 0 : val.count) !== null && _val$count !== void 0 ? _val$count : 0),
|
|
178
|
-
result: _everyInstanceProperty__default[
|
|
178
|
+
result: _everyInstanceProperty__default["default"](_context = [(_acc$result = acc === null || acc === void 0 ? void 0 : acc.result) !== null && _acc$result !== void 0 ? _acc$result : "fulfilled", val.result]).call(_context, function (result) {
|
|
179
179
|
return result === "fulfilled";
|
|
180
180
|
}) ? "fulfilled" : "rejected",
|
|
181
181
|
start: Math.min((_acc$start = acc === null || acc === void 0 ? void 0 : acc.start) !== null && _acc$start !== void 0 ? _acc$start : Number.POSITIVE_INFINITY, val.start),
|
|
@@ -196,22 +196,22 @@ function formatStartStopMs(_ref) {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
var formatCSS = function formatCSS(css) {
|
|
199
|
-
return prettier__default[
|
|
199
|
+
return prettier__default["default"].format(css || "", {
|
|
200
200
|
filepath: "style.css"
|
|
201
201
|
});
|
|
202
202
|
};
|
|
203
203
|
var formatHTML = function formatHTML(html) {
|
|
204
|
-
return prettier__default[
|
|
204
|
+
return prettier__default["default"].format(html || "", {
|
|
205
205
|
filepath: "index.html"
|
|
206
206
|
});
|
|
207
207
|
};
|
|
208
208
|
var formatJS = function formatJS(js) {
|
|
209
|
-
return prettier__default[
|
|
209
|
+
return prettier__default["default"].format(js || "", {
|
|
210
210
|
filepath: "script.js"
|
|
211
211
|
});
|
|
212
212
|
};
|
|
213
213
|
var formatMD = function formatMD(md) {
|
|
214
|
-
return prettier__default[
|
|
214
|
+
return prettier__default["default"].format(md || "", {
|
|
215
215
|
filepath: "README.md"
|
|
216
216
|
});
|
|
217
217
|
};
|
|
@@ -225,11 +225,11 @@ var template$1 = "<html>\n <head>\n <meta charset=\"utf-8\" />\n <title>C
|
|
|
225
225
|
function generateCodePenPage(example) {
|
|
226
226
|
var data = example.playground;
|
|
227
227
|
var title = example.titles.join(" | ");
|
|
228
|
-
var page = $__default[
|
|
228
|
+
var page = $__default["default"].load(template$1);
|
|
229
229
|
page("title").text(title);
|
|
230
230
|
var form = page("#form");
|
|
231
231
|
|
|
232
|
-
_findInstanceProperty__default[
|
|
232
|
+
_findInstanceProperty__default["default"](form).call(form, 'input[name="data"]').attr("value", _JSON$stringify__default["default"]({
|
|
233
233
|
css: data.code.css,
|
|
234
234
|
css_external: data.resources.css.join(";"),
|
|
235
235
|
html: data.code.html,
|
|
@@ -251,58 +251,58 @@ function generatePlaygroundData(baseURL, example$, examplePath) {
|
|
|
251
251
|
var _context, _context2, _context3, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14;
|
|
252
252
|
|
|
253
253
|
// JavaScript
|
|
254
|
-
var eventListeners = _mapInstanceProperty__default[
|
|
255
|
-
var _ref2 = _slicedToArray__default[
|
|
254
|
+
var eventListeners = _mapInstanceProperty__default["default"](_context = _mapInstanceProperty__default["default"](_context2 = _filterInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](example$("body").get(0).attribs)).call(_context3, function (_ref) {
|
|
255
|
+
var _ref2 = _slicedToArray__default["default"](_ref, 1),
|
|
256
256
|
name = _ref2[0];
|
|
257
257
|
|
|
258
258
|
return /^on/.test(name);
|
|
259
259
|
})).call(_context2, function (_ref3) {
|
|
260
|
-
var _ref4 = _slicedToArray__default[
|
|
260
|
+
var _ref4 = _slicedToArray__default["default"](_ref3, 2),
|
|
261
261
|
name = _ref4[0],
|
|
262
262
|
value = _ref4[1];
|
|
263
263
|
|
|
264
|
-
return [_sliceInstanceProperty__default[
|
|
264
|
+
return [_sliceInstanceProperty__default["default"](name).call(name, 2), "".concat(value)];
|
|
265
265
|
})).call(_context, function (_ref5) {
|
|
266
266
|
var _context4;
|
|
267
267
|
|
|
268
|
-
var _ref6 = _slicedToArray__default[
|
|
268
|
+
var _ref6 = _slicedToArray__default["default"](_ref5, 2),
|
|
269
269
|
name = _ref6[0],
|
|
270
270
|
value = _ref6[1];
|
|
271
271
|
|
|
272
|
-
return _concatInstanceProperty__default[
|
|
272
|
+
return _concatInstanceProperty__default["default"](_context4 = "window.addEventListener(\"".concat(name, "\", () => { ")).call(_context4, value, " });");
|
|
273
273
|
}).join("\n");
|
|
274
274
|
|
|
275
|
-
var js = formatJS(_mapInstanceProperty__default[
|
|
275
|
+
var js = formatJS(_mapInstanceProperty__default["default"](_context5 = _mapInstanceProperty__default["default"](_context6 = example$("script")).call(_context6, function (_i, elem) {
|
|
276
276
|
return elem.children[0];
|
|
277
277
|
}).get()).call(_context5, function (elem) {
|
|
278
278
|
return elem.data;
|
|
279
279
|
}).join("") + "\n\n;" + eventListeners); // Cascading Style Sheets
|
|
280
280
|
|
|
281
|
-
var css = formatCSS(_mapInstanceProperty__default[
|
|
281
|
+
var css = formatCSS(_mapInstanceProperty__default["default"](_context7 = _mapInstanceProperty__default["default"](_context8 = example$("style")).call(_context8, function (_i, elem) {
|
|
282
282
|
return elem.children[0];
|
|
283
283
|
}).get()).call(_context7, function (elem) {
|
|
284
284
|
return elem.data;
|
|
285
285
|
}).join("")); // Hypertext Markup Language
|
|
286
286
|
|
|
287
|
-
var $html = $__default[
|
|
287
|
+
var $html = $__default["default"].load(example$("body").html() || "");
|
|
288
288
|
$html("script").remove();
|
|
289
289
|
var html = formatHTML($html("body").html()); // Resources
|
|
290
290
|
|
|
291
291
|
var fixPath = function fixPath(rawPath) {
|
|
292
292
|
return /^https?:\/\//.test(rawPath) ? // World wide web absolute.
|
|
293
293
|
rawPath : /^\//.test(rawPath) ? // Domain absolute.
|
|
294
|
-
baseURL + _sliceInstanceProperty__default[
|
|
294
|
+
baseURL + _sliceInstanceProperty__default["default"](rawPath).call(rawPath, 1) : //Relative.
|
|
295
295
|
baseURL + path.relative(process.cwd(), path.resolve(path.dirname(examplePath), rawPath));
|
|
296
296
|
};
|
|
297
297
|
|
|
298
298
|
var resources = {
|
|
299
|
-
js: _mapInstanceProperty__default[
|
|
300
|
-
return $__default[
|
|
299
|
+
js: _mapInstanceProperty__default["default"](_context9 = _filterInstanceProperty__default["default"](_context10 = _mapInstanceProperty__default["default"](_context11 = example$("script")).call(_context11, function (_i, elem) {
|
|
300
|
+
return $__default["default"](elem).attr("src");
|
|
301
301
|
}).get()).call(_context10, function (src) {
|
|
302
302
|
return typeof src === "string";
|
|
303
303
|
})).call(_context9, fixPath),
|
|
304
|
-
css: _mapInstanceProperty__default[
|
|
305
|
-
return $__default[
|
|
304
|
+
css: _mapInstanceProperty__default["default"](_context12 = _filterInstanceProperty__default["default"](_context13 = _mapInstanceProperty__default["default"](_context14 = example$("link[rel='stylesheet']")).call(_context14, function (_i, elem) {
|
|
305
|
+
return $__default["default"](elem).attr("href");
|
|
306
306
|
}).get()).call(_context13, function (href) {
|
|
307
307
|
return typeof href === "string";
|
|
308
308
|
})).call(_context12, fixPath)
|
|
@@ -329,37 +329,37 @@ function generateJSFiddlePage(example) {
|
|
|
329
329
|
var data = example.playground;
|
|
330
330
|
var title = example.titles.join(" | ");
|
|
331
331
|
|
|
332
|
-
var resources = _concatInstanceProperty__default[
|
|
332
|
+
var resources = _concatInstanceProperty__default["default"](_context = []).call(_context, _toConsumableArray__default["default"](data.resources.css), _toConsumableArray__default["default"](data.resources.js)).join(",");
|
|
333
333
|
|
|
334
|
-
var page = $__default[
|
|
334
|
+
var page = $__default["default"].load(template);
|
|
335
335
|
page("title").text(title);
|
|
336
336
|
var form = page("#form"); // Playground data.
|
|
337
337
|
|
|
338
|
-
_findInstanceProperty__default[
|
|
338
|
+
_findInstanceProperty__default["default"](form).call(form, 'input[name="css"]').attr("value", data.code.css);
|
|
339
339
|
|
|
340
|
-
_findInstanceProperty__default[
|
|
340
|
+
_findInstanceProperty__default["default"](form).call(form, 'input[name="html"]').attr("value", data.code.html);
|
|
341
341
|
|
|
342
|
-
_findInstanceProperty__default[
|
|
342
|
+
_findInstanceProperty__default["default"](form).call(form, 'input[name="js"]').attr("value", data.code.js);
|
|
343
343
|
|
|
344
|
-
_findInstanceProperty__default[
|
|
344
|
+
_findInstanceProperty__default["default"](form).call(form, 'input[name="resources"]').attr("value", resources);
|
|
345
345
|
|
|
346
|
-
_findInstanceProperty__default[
|
|
346
|
+
_findInstanceProperty__default["default"](form).call(form, 'input[name="title"]').attr("value", title); // Don't run JS before the DOM is ready.
|
|
347
347
|
|
|
348
348
|
|
|
349
|
-
_findInstanceProperty__default[
|
|
349
|
+
_findInstanceProperty__default["default"](form).call(form, 'input[name="wrap"]').attr("value", "b");
|
|
350
350
|
|
|
351
351
|
return page.html();
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
var commonScreenshotScript = "/* global window: false */\n\n/**\n * Simulates confirmation usind window.confirm and window.alert otherwise the\n * screenshot generator would just hang forever.\n */\nwindow.realAlert = window.alert;\nwindow.alert = function () {};\nwindow.confirm = function () {\n return true;\n};\n\n/**\n * Wait for the page to report it's ready to take a screenshot.\n */\nwindow.readyToTakeAScreenshot = new Promise(function (resolve) {\n window.takeScreenshot = resolve;\n});\n";
|
|
355
355
|
|
|
356
|
-
function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof _Symbol__default[
|
|
356
|
+
function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof _Symbol__default["default"] !== "undefined" && _getIteratorMethod__default["default"](o) || o["@@iterator"]; if (!it) { if (_Array$isArray__default["default"](o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
357
357
|
|
|
358
|
-
function _unsupportedIterableToArray$3(o, minLen) { var _context5; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = _sliceInstanceProperty__default[
|
|
358
|
+
function _unsupportedIterableToArray$3(o, minLen) { var _context5; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = _sliceInstanceProperty__default["default"](_context5 = Object.prototype.toString.call(o)).call(_context5, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from__default["default"](o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
|
|
359
359
|
|
|
360
360
|
function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
361
|
-
var unlink = util.promisify(fs__default[
|
|
362
|
-
var writeFile$1 = util.promisify(fs__default[
|
|
361
|
+
var unlink = util.promisify(fs__default["default"].unlink);
|
|
362
|
+
var writeFile$1 = util.promisify(fs__default["default"].writeFile);
|
|
363
363
|
/**
|
|
364
364
|
* Check if the screenshot is valid. At the moment this simply considers
|
|
365
365
|
* everything except for solid color images as valid. This works pretty well
|
|
@@ -383,14 +383,14 @@ function isScreenshotValid(_x) {
|
|
|
383
383
|
|
|
384
384
|
|
|
385
385
|
function _isScreenshotValid() {
|
|
386
|
-
_isScreenshotValid = _asyncToGenerator__default[
|
|
386
|
+
_isScreenshotValid = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(screenshot) {
|
|
387
387
|
var image, firstPixel, x, y;
|
|
388
|
-
return _regeneratorRuntime__default[
|
|
388
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
389
389
|
while (1) {
|
|
390
390
|
switch (_context.prev = _context.next) {
|
|
391
391
|
case 0:
|
|
392
392
|
_context.next = 2;
|
|
393
|
-
return Jimp__default[
|
|
393
|
+
return Jimp__default["default"].read(screenshot);
|
|
394
394
|
|
|
395
395
|
case 2:
|
|
396
396
|
image = _context.sent;
|
|
@@ -446,10 +446,10 @@ function generateScreenshot(_x2, _x3) {
|
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
function _generateScreenshot() {
|
|
449
|
-
_generateScreenshot = _asyncToGenerator__default[
|
|
449
|
+
_generateScreenshot = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(browser, config) {
|
|
450
450
|
var debug, example, height, screenshotScript, width, cleanup, tmpPath, screenshotPage, context, page, $element, _context2, screenshot, _context3, _iterator, _step, callback;
|
|
451
451
|
|
|
452
|
-
return _regeneratorRuntime__default[
|
|
452
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context4) {
|
|
453
453
|
while (1) {
|
|
454
454
|
switch (_context4.prev = _context4.next) {
|
|
455
455
|
case 0:
|
|
@@ -459,8 +459,8 @@ function _generateScreenshot() {
|
|
|
459
459
|
// Prepare the page. It has to be written to the disk so that files with
|
|
460
460
|
// relative URLs can be loaded.
|
|
461
461
|
tmpPath = path.resolve(path.dirname(example.paths.page.local), ".tmp.example.screenshot." + path.basename(example.paths.page.local));
|
|
462
|
-
screenshotPage = $__default[
|
|
463
|
-
screenshotPage("head").prepend($__default[
|
|
462
|
+
screenshotPage = $__default["default"].load(example.html);
|
|
463
|
+
screenshotPage("head").prepend($__default["default"]("<script>").attr("type", "text/javascript").text("window.DEBUG = ".concat(true, ";")), $__default["default"]("<script>").attr("type", "text/javascript").text(commonScreenshotScript), $__default["default"]("<script>").attr("type", "text/javascript").text(screenshotScript), $__default["default"]("<style>").attr("type", "text/css").text(["".concat(example.selector, " {"), " border: none !important;", "", " min-width: ".concat(width, "px !important;"), " min-height: ".concat(height, "px !important;"), " width: ".concat(width, "px !important;"), " height: ".concat(height, "px !important;"), " max-width: ".concat(width, "px !important;"), " max-height: ".concat(height, "px !important;"), "}"].join("\n")));
|
|
464
464
|
_context4.next = 8;
|
|
465
465
|
return writeFile$1(tmpPath, formatHTML(screenshotPage.html()));
|
|
466
466
|
|
|
@@ -541,7 +541,7 @@ function _generateScreenshot() {
|
|
|
541
541
|
break;
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
throw new Error(_concatInstanceProperty__default[
|
|
544
|
+
throw new Error(_concatInstanceProperty__default["default"](_context2 = "Element \"".concat(example.selector, "\" not found in ")).call(_context2, example.path, "."));
|
|
545
545
|
|
|
546
546
|
case 35:
|
|
547
547
|
_context4.next = 37;
|
|
@@ -588,7 +588,7 @@ function _generateScreenshot() {
|
|
|
588
588
|
|
|
589
589
|
case 55:
|
|
590
590
|
_context4.prev = 55;
|
|
591
|
-
_iterator = _createForOfIteratorHelper$3(_reverseInstanceProperty__default[
|
|
591
|
+
_iterator = _createForOfIteratorHelper$3(_reverseInstanceProperty__default["default"](_context3 = _spliceInstanceProperty__default["default"](cleanup).call(cleanup, 0)).call(_context3));
|
|
592
592
|
_context4.prev = 57;
|
|
593
593
|
|
|
594
594
|
_iterator.s();
|
|
@@ -647,22 +647,22 @@ function _generateScreenshot() {
|
|
|
647
647
|
return _generateScreenshot.apply(this, arguments);
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
-
function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof _Symbol__default[
|
|
650
|
+
function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof _Symbol__default["default"] !== "undefined" && _getIteratorMethod__default["default"](o) || o["@@iterator"]; if (!it) { if (_Array$isArray__default["default"](o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
651
651
|
|
|
652
|
-
function _unsupportedIterableToArray$2(o, minLen) { var _context24; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = _sliceInstanceProperty__default[
|
|
652
|
+
function _unsupportedIterableToArray$2(o, minLen) { var _context24; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = _sliceInstanceProperty__default["default"](_context24 = Object.prototype.toString.call(o)).call(_context24, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from__default["default"](o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
|
|
653
653
|
|
|
654
654
|
function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
655
655
|
|
|
656
|
-
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
656
|
+
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
657
657
|
|
|
658
|
-
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context22, _context23; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default[
|
|
658
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context22, _context23; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context22 = ownKeys$1(Object(source), !0)).call(_context22, function (key) { _defineProperty__default["default"](target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context23 = ownKeys$1(Object(source))).call(_context23, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
659
659
|
var collator = new Intl.Collator("US");
|
|
660
|
-
var writeFile = util.promisify(fs__default[
|
|
660
|
+
var writeFile = util.promisify(fs__default["default"].writeFile);
|
|
661
661
|
var ContentBuilder = /*#__PURE__*/function () {
|
|
662
662
|
function ContentBuilder(_config) {
|
|
663
|
-
_classCallCheck__default[
|
|
663
|
+
_classCallCheck__default["default"](this, ContentBuilder);
|
|
664
664
|
|
|
665
|
-
_defineProperty__default[
|
|
665
|
+
_defineProperty__default["default"](this, "_config", void 0);
|
|
666
666
|
|
|
667
667
|
this._config = _config;
|
|
668
668
|
}
|
|
@@ -677,7 +677,7 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
677
677
|
*/
|
|
678
678
|
|
|
679
679
|
|
|
680
|
-
_createClass__default[
|
|
680
|
+
_createClass__default["default"](ContentBuilder, [{
|
|
681
681
|
key: "build",
|
|
682
682
|
value: function build() {
|
|
683
683
|
var _context,
|
|
@@ -690,23 +690,23 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
690
690
|
|
|
691
691
|
var okay = [];
|
|
692
692
|
var fail = [];
|
|
693
|
-
console.info(_concatInstanceProperty__default[
|
|
693
|
+
console.info(_concatInstanceProperty__default["default"](_context = "Going to generate ".concat(_flatInstanceProperty__default["default"](_context2 = [emit.index ? ["index files"] : [], emit.playgrounds ? ["playground openers"] : [], emit.screenshots ? ["screenshots"] : []]).call(_context2).join(", "), " for ")).call(_context, allExamples.length, " examples."));
|
|
694
694
|
process.stdout.write("\n");
|
|
695
695
|
var index = emit.index ? // Generate indexes.
|
|
696
|
-
_asyncToGenerator__default[
|
|
696
|
+
_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2() {
|
|
697
697
|
var _context3;
|
|
698
698
|
|
|
699
699
|
var getStartStopMs, results;
|
|
700
|
-
return _regeneratorRuntime__default[
|
|
700
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context5) {
|
|
701
701
|
while (1) {
|
|
702
702
|
switch (_context5.prev = _context5.next) {
|
|
703
703
|
case 0:
|
|
704
704
|
getStartStopMs = measureStartStopMs();
|
|
705
705
|
_context5.next = 3;
|
|
706
|
-
return _Promise__default[
|
|
707
|
-
var _ref3 = _asyncToGenerator__default[
|
|
706
|
+
return _Promise__default["default"].allSettled(_mapInstanceProperty__default["default"](_context3 = _this._config.renderer.render(_this._config.examples, _this._config.output, _this._config.title, collator)).call(_context3, /*#__PURE__*/function () {
|
|
707
|
+
var _ref3 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(_ref2) {
|
|
708
708
|
var content, filename;
|
|
709
|
-
return _regeneratorRuntime__default[
|
|
709
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context4) {
|
|
710
710
|
while (1) {
|
|
711
711
|
switch (_context4.prev = _context4.next) {
|
|
712
712
|
case 0:
|
|
@@ -730,7 +730,7 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
730
730
|
results = _context5.sent;
|
|
731
731
|
return _context5.abrupt("return", [_objectSpread$1(_objectSpread$1({}, getStartStopMs()), {}, {
|
|
732
732
|
count: results.length,
|
|
733
|
-
result: _everyInstanceProperty__default[
|
|
733
|
+
result: _everyInstanceProperty__default["default"](results).call(results, function (_ref4) {
|
|
734
734
|
var status = _ref4.status;
|
|
735
735
|
return status === "fulfilled";
|
|
736
736
|
}) ? "fulfilled" : "rejected"
|
|
@@ -743,26 +743,26 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
743
743
|
}
|
|
744
744
|
}, _callee2);
|
|
745
745
|
}))() : // Skip indexes.
|
|
746
|
-
_Promise__default[
|
|
746
|
+
_Promise__default["default"].resolve([]);
|
|
747
747
|
var playgrounds = emit.playgrounds ? // Generate playground pages.
|
|
748
|
-
_asyncToGenerator__default[
|
|
749
|
-
return _regeneratorRuntime__default[
|
|
748
|
+
_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4() {
|
|
749
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context8) {
|
|
750
750
|
while (1) {
|
|
751
751
|
switch (_context8.prev = _context8.next) {
|
|
752
752
|
case 0:
|
|
753
753
|
_context8.next = 2;
|
|
754
|
-
return _Promise__default[
|
|
755
|
-
var _ref6 = _asyncToGenerator__default[
|
|
754
|
+
return _Promise__default["default"].all(_mapInstanceProperty__default["default"](allExamples).call(allExamples, /*#__PURE__*/function () {
|
|
755
|
+
var _ref6 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(example) {
|
|
756
756
|
var _context6;
|
|
757
757
|
|
|
758
758
|
var getStartStopMs, results;
|
|
759
|
-
return _regeneratorRuntime__default[
|
|
759
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context7) {
|
|
760
760
|
while (1) {
|
|
761
761
|
switch (_context7.prev = _context7.next) {
|
|
762
762
|
case 0:
|
|
763
763
|
getStartStopMs = measureStartStopMs();
|
|
764
764
|
_context7.next = 3;
|
|
765
|
-
return _Promise__default[
|
|
765
|
+
return _Promise__default["default"].allSettled(_mapInstanceProperty__default["default"](_context6 = [{
|
|
766
766
|
html: generateJSFiddlePage(example),
|
|
767
767
|
path: example.paths.jsfiddle.local
|
|
768
768
|
}, {
|
|
@@ -779,7 +779,7 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
779
779
|
return _context7.abrupt("return", _objectSpread$1(_objectSpread$1({}, getStartStopMs()), {}, {
|
|
780
780
|
count: results.length,
|
|
781
781
|
example: example,
|
|
782
|
-
result: _everyInstanceProperty__default[
|
|
782
|
+
result: _everyInstanceProperty__default["default"](results).call(results, function (_ref8) {
|
|
783
783
|
var status = _ref8.status;
|
|
784
784
|
return status === "fulfilled";
|
|
785
785
|
}) ? "fulfilled" : "rejected"
|
|
@@ -808,12 +808,12 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
808
808
|
}
|
|
809
809
|
}, _callee4);
|
|
810
810
|
}))() : // Skip playground pages.
|
|
811
|
-
_Promise__default[
|
|
811
|
+
_Promise__default["default"].resolve([]);
|
|
812
812
|
var screenshots = emit.screenshots ? // Generate screenshots.
|
|
813
|
-
_asyncToGenerator__default[
|
|
813
|
+
_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee7() {
|
|
814
814
|
var cleanup, _process$env$DEBUG, _context10, _context11, debug, browser, todo, total, reports, _context17, _iterator, _step, callback;
|
|
815
815
|
|
|
816
|
-
return _regeneratorRuntime__default[
|
|
816
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee7$(_context18) {
|
|
817
817
|
while (1) {
|
|
818
818
|
switch (_context18.prev = _context18.next) {
|
|
819
819
|
case 0:
|
|
@@ -821,7 +821,7 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
821
821
|
_context18.prev = 1;
|
|
822
822
|
debug = /^1|y|yes|true$/i.test((_process$env$DEBUG = process.env.DEBUG) !== null && _process$env$DEBUG !== void 0 ? _process$env$DEBUG : "");
|
|
823
823
|
_context18.next = 5;
|
|
824
|
-
return puppeteer__default[
|
|
824
|
+
return puppeteer__default["default"].launch({
|
|
825
825
|
headless: !debug,
|
|
826
826
|
slowMo: debug ? 100 : undefined
|
|
827
827
|
});
|
|
@@ -830,8 +830,8 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
830
830
|
browser = _context18.sent;
|
|
831
831
|
|
|
832
832
|
if (debug) {
|
|
833
|
-
cleanup.push( /*#__PURE__*/_asyncToGenerator__default[
|
|
834
|
-
return _regeneratorRuntime__default[
|
|
833
|
+
cleanup.push( /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee5() {
|
|
834
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee5$(_context9) {
|
|
835
835
|
while (1) {
|
|
836
836
|
switch (_context9.prev = _context9.next) {
|
|
837
837
|
case 0:
|
|
@@ -853,14 +853,14 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
853
853
|
// so it's much faster to run a lot of them at the same time.
|
|
854
854
|
|
|
855
855
|
|
|
856
|
-
todo = _sliceInstanceProperty__default[
|
|
856
|
+
todo = _sliceInstanceProperty__default["default"](allExamples).call(allExamples);
|
|
857
857
|
total = todo.length;
|
|
858
858
|
reports = [];
|
|
859
859
|
_context18.next = 12;
|
|
860
|
-
return _Promise__default[
|
|
860
|
+
return _Promise__default["default"].allSettled(_mapInstanceProperty__default["default"](_context10 = _fillInstanceProperty__default["default"](_context11 = new Array(_this._config.parallel)).call(_context11, null)).call(_context10, /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee6() {
|
|
861
861
|
var example, _context12, _context13, _context14, _context15, getStartStopMs, valid, report, percentage, validText, msText;
|
|
862
862
|
|
|
863
|
-
return _regeneratorRuntime__default[
|
|
863
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee6$(_context16) {
|
|
864
864
|
while (1) {
|
|
865
865
|
switch (_context16.prev = _context16.next) {
|
|
866
866
|
case 0:
|
|
@@ -894,10 +894,10 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
894
894
|
fail.push(example.path);
|
|
895
895
|
}
|
|
896
896
|
|
|
897
|
-
percentage = _padStartInstanceProperty__default[
|
|
897
|
+
percentage = _padStartInstanceProperty__default["default"](_context12 = Math.floor(reports.length / total * 100) + "%").call(_context12, 4, " ");
|
|
898
898
|
validText = valid ? "okay" : "fail";
|
|
899
899
|
msText = formatStartStopMs(report);
|
|
900
|
-
console.info(_concatInstanceProperty__default[
|
|
900
|
+
console.info(_concatInstanceProperty__default["default"](_context13 = _concatInstanceProperty__default["default"](_context14 = _concatInstanceProperty__default["default"](_context15 = "".concat(percentage, " ")).call(_context15, validText, " ")).call(_context14, msText, " - ")).call(_context13, example.path));
|
|
901
901
|
_context16.next = 0;
|
|
902
902
|
break;
|
|
903
903
|
|
|
@@ -914,7 +914,7 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
914
914
|
|
|
915
915
|
case 13:
|
|
916
916
|
_context18.prev = 13;
|
|
917
|
-
_iterator = _createForOfIteratorHelper$2(_reverseInstanceProperty__default[
|
|
917
|
+
_iterator = _createForOfIteratorHelper$2(_reverseInstanceProperty__default["default"](_context17 = _spliceInstanceProperty__default["default"](cleanup).call(cleanup, 0)).call(_context17));
|
|
918
918
|
_context18.prev = 15;
|
|
919
919
|
|
|
920
920
|
_iterator.s();
|
|
@@ -970,11 +970,11 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
970
970
|
}
|
|
971
971
|
}, _callee7, null, [[1,, 13, 38], [15, 31, 34, 37], [19, 24]]);
|
|
972
972
|
}))() : // Skip screenshots.
|
|
973
|
-
_Promise__default[
|
|
973
|
+
_Promise__default["default"].resolve([]);
|
|
974
974
|
|
|
975
|
-
var checks = _asyncToGenerator__default[
|
|
975
|
+
var checks = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee8() {
|
|
976
976
|
var total;
|
|
977
|
-
return _regeneratorRuntime__default[
|
|
977
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee8$(_context19) {
|
|
978
978
|
while (1) {
|
|
979
979
|
switch (_context19.prev = _context19.next) {
|
|
980
980
|
case 0:
|
|
@@ -1022,7 +1022,7 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
1022
1022
|
_context21,
|
|
1023
1023
|
_this2 = this;
|
|
1024
1024
|
|
|
1025
|
-
return _flatMapInstanceProperty__default[
|
|
1025
|
+
return _flatMapInstanceProperty__default["default"](_context20 = _sortInstanceProperty__default["default"](_context21 = _Object$keys__default["default"](examples)).call(_context21, collator.compare)).call(_context20, function (key) {
|
|
1026
1026
|
var example = examples[key];
|
|
1027
1027
|
|
|
1028
1028
|
if (isExample(example)) {
|
|
@@ -1041,9 +1041,9 @@ var indexTemplate = "<html>\n <head>\n <meta charset=\"utf-8\" />\n <titl
|
|
|
1041
1041
|
|
|
1042
1042
|
var styleTemplate = ".examples-root {\n margin: 50px auto 200px;\n min-width: calc(200px + 2em);\n width: calc(100vw - 200px);\n}\n\n.examples-root a {\n color: #2b7ce9;\n}\n.examples-root a:visited {\n color: #46417a;\n}\n\n.examples-root .example-link {\n margin: 1em;\n position: relative;\n width: 200px;\n\n display: inline-block;\n}\n\n.examples-root .example-link .example-image {\n display: block;\n height: 200px;\n margin-top: 1ex;\n position: relative;\n width: 200px;\n}\n.examples-root .example-link .example-image > img {\n position: absolute;\n top: 0px;\n left: 0px;\n width: 200px;\n height: 200px;\n\n background: #2b7ce9;\n border: 1px solid #2b7ce9;\n color: #ffffff;\n\n transition: transform 0.5s ease 0s, z-index 0.5s linear 0s;\n z-index: 1;\n}\n.examples-root .example-link:hover .example-image > img {\n transform: translate(0px, 95px) scale(2, 2);\n z-index: 100;\n}\n\n.examples-root .example-header > *:last-child {\n margin-left: 0.5em;\n}\n.examples-root .icon {\n height: 1.5em;\n margin-bottom: -0.25em;\n width: 1.5em;\n\n background: none;\n border: none;\n cursor: pointer;\n display: inline-block;\n}\n.examples-root .icon.jsfiddle {\n background-size: contain;\n background-image: url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%232b7ce9' d='M16.45,17.5C17.45,17.5 18.3,17.15 19,16.5C19.67,15.8 20,15 20,14C20,13.05 19.66,12.22 18.96,11.53C18.26,10.84 17.41,10.5 16.41,10.5C15.47,10.5 14.64,10.83 13.92,11.5L9.14,15.56C8.7,16 8.17,16.22 7.55,16.22C6.92,16.22 6.39,16 5.95,15.56C5.5,15.13 5.3,14.61 5.3,14C5.3,13.42 5.5,12.91 5.95,12.47C6.39,12.03 6.92,11.81 7.55,11.81C8.14,11.81 8.69,12.03 9.19,12.47L9.94,13.13L10.92,12.23L10.08,11.53C9.39,10.84 8.55,10.5 7.55,10.5C6.58,10.5 5.74,10.84 5.04,11.53C4.34,12.22 4,13.05 4,14C4,15 4.34,15.8 5.04,16.5C5.74,17.15 6.59,17.5 7.59,17.5C8.53,17.5 9.36,17.16 10.08,16.5L14.86,12.42C15.27,12 15.8,11.81 16.45,11.81C17.08,11.81 17.61,12.03 18.05,12.47C18.5,12.91 18.7,13.42 18.7,14C18.7,14.61 18.5,15.13 18.05,15.56C17.61,16 17.08,16.22 16.45,16.22C15.89,16.22 15.34,16 14.81,15.5L14.06,14.86L13.08,15.75L13.92,16.45C14.61,17.14 15.45,17.5 16.45,17.5M19.36,10.03C20.64,10.13 21.73,10.65 22.64,11.6C23.55,12.55 24,13.69 24,15C24,16.38 23.5,17.55 22.5,18.54C21.54,19.5 20.36,20 19,20H6C4.34,20 2.93,19.43 1.76,18.26C0.59,17.09 0,15.67 0,14C0,12.55 0.5,11.23 1.57,10.05C2.62,8.88 3.88,8.22 5.34,8.06C6,6.84 6.92,5.86 8.11,5.11C9.3,4.36 10.59,4 12,4C13.69,4 15.26,4.58 16.71,5.77C18.16,6.95 19.05,8.38 19.36,10.03Z' /%3E%3C/svg%3E\");\n}\n.examples-root .icon.codepen {\n background-size: contain;\n background-image: url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%232b7ce9' d='M15.09,12L12,14.08V14.09L8.91,12L12,9.92V9.92L15.09,12M12,2C11.84,2 11.68,2.06 11.53,2.15L2.5,8.11C2.27,8.22 2.09,8.43 2,8.67V14.92C2,15.33 2,15.33 2.15,15.53L11.53,21.86C11.67,21.96 11.84,22 12,22C12.16,22 12.33,21.95 12.47,21.85L21.85,15.5C22,15.33 22,15.33 22,14.92V8.67C21.91,8.42 21.73,8.22 21.5,8.1L12.47,2.15C12.32,2.05 12.16,2 12,2M16.58,13L19.59,15.04L12.83,19.6V15.53L16.58,13M19.69,8.9L16.58,11L12.83,8.47V4.38L19.69,8.9M20.33,10.47V13.53L18.07,12L20.33,10.47M7.42,13L11.17,15.54V19.6L4.41,15.04L7.42,13M4.31,8.9L11.17,4.39V8.5L7.42,11L4.31,8.9M3.67,10.5L5.93,12L3.67,13.54V10.5Z' /%3E%3C/svg%3E\");\n}\n";
|
|
1043
1043
|
|
|
1044
|
-
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof _Symbol__default[
|
|
1044
|
+
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof _Symbol__default["default"] !== "undefined" && _getIteratorMethod__default["default"](o) || o["@@iterator"]; if (!it) { if (_Array$isArray__default["default"](o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
1045
1045
|
|
|
1046
|
-
function _unsupportedIterableToArray$1(o, minLen) { var _context3; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = _sliceInstanceProperty__default[
|
|
1046
|
+
function _unsupportedIterableToArray$1(o, minLen) { var _context3; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = _sliceInstanceProperty__default["default"](_context3 = Object.prototype.toString.call(o)).call(_context3, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from__default["default"](o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
|
1047
1047
|
|
|
1048
1048
|
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1049
1049
|
/**
|
|
@@ -1051,7 +1051,7 @@ function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) le
|
|
|
1051
1051
|
*/
|
|
1052
1052
|
|
|
1053
1053
|
function generateJSFiddle(example) {
|
|
1054
|
-
return $__default[
|
|
1054
|
+
return $__default["default"]("<a>").addClass("icon jsfiddle").attr("href", example.paths.jsfiddle.web).attr("title", "JSFiddle");
|
|
1055
1055
|
}
|
|
1056
1056
|
/**
|
|
1057
1057
|
* @param example
|
|
@@ -1059,7 +1059,7 @@ function generateJSFiddle(example) {
|
|
|
1059
1059
|
|
|
1060
1060
|
|
|
1061
1061
|
function generateCodePen(example) {
|
|
1062
|
-
return $__default[
|
|
1062
|
+
return $__default["default"]("<a>").addClass("icon codepen").attr("href", example.paths.codepen.web).attr("title", "CodePen");
|
|
1063
1063
|
}
|
|
1064
1064
|
/**
|
|
1065
1065
|
* @param examples
|
|
@@ -1072,13 +1072,13 @@ function generateCodePen(example) {
|
|
|
1072
1072
|
function processGroup$1(examples, title, level, collator) {
|
|
1073
1073
|
var _context;
|
|
1074
1074
|
|
|
1075
|
-
var heading = $__default[
|
|
1075
|
+
var heading = $__default["default"]("<h".concat(Math.max(1, Math.min(6, level)), ">"));
|
|
1076
1076
|
heading.text(title);
|
|
1077
|
-
var list = $__default[
|
|
1078
|
-
var section = $__default[
|
|
1077
|
+
var list = $__default["default"]("<div>");
|
|
1078
|
+
var section = $__default["default"]("<div>");
|
|
1079
1079
|
section.append(heading, list);
|
|
1080
1080
|
|
|
1081
|
-
var _iterator = _createForOfIteratorHelper$1(_sortInstanceProperty__default[
|
|
1081
|
+
var _iterator = _createForOfIteratorHelper$1(_sortInstanceProperty__default["default"](_context = _Object$keys__default["default"](examples)).call(_context, collator.compare)),
|
|
1082
1082
|
_step;
|
|
1083
1083
|
|
|
1084
1084
|
try {
|
|
@@ -1087,11 +1087,11 @@ function processGroup$1(examples, title, level, collator) {
|
|
|
1087
1087
|
var example = examples[key];
|
|
1088
1088
|
|
|
1089
1089
|
if (isExample(example)) {
|
|
1090
|
-
var header = $__default[
|
|
1090
|
+
var header = $__default["default"]("<div>").addClass("example-header").append( // Playgrounds
|
|
1091
1091
|
generateJSFiddle(example), generateCodePen(example), // Title
|
|
1092
|
-
$__default[
|
|
1093
|
-
var image = $__default[
|
|
1094
|
-
var item = $__default[
|
|
1092
|
+
$__default["default"]("<a>").attr("href", example.paths.page.web).text(key));
|
|
1093
|
+
var image = $__default["default"]("<a>").addClass("example-image").attr("href", example.paths.page.web).append($__default["default"]("<img>").attr("src", example.paths.screenshot.web).attr("alt", key));
|
|
1094
|
+
var item = $__default["default"]("<span>").addClass("example-link").append(header, image);
|
|
1095
1095
|
list.append(item);
|
|
1096
1096
|
} else {
|
|
1097
1097
|
section.append(processGroup$1(example, key, level + 1, collator));
|
|
@@ -1111,10 +1111,10 @@ var htmlRenderer = {
|
|
|
1111
1111
|
var _context2;
|
|
1112
1112
|
|
|
1113
1113
|
var filename = "index.html";
|
|
1114
|
-
var root = $__default[
|
|
1114
|
+
var root = $__default["default"]("<div>");
|
|
1115
1115
|
root.addClass("examples-root");
|
|
1116
1116
|
|
|
1117
|
-
var _iterator2 = _createForOfIteratorHelper$1(_sortInstanceProperty__default[
|
|
1117
|
+
var _iterator2 = _createForOfIteratorHelper$1(_sortInstanceProperty__default["default"](_context2 = _Object$keys__default["default"](examples)).call(_context2, collator.compare)),
|
|
1118
1118
|
_step2;
|
|
1119
1119
|
|
|
1120
1120
|
try {
|
|
@@ -1128,7 +1128,7 @@ var htmlRenderer = {
|
|
|
1128
1128
|
_iterator2.f();
|
|
1129
1129
|
}
|
|
1130
1130
|
|
|
1131
|
-
var page = $__default[
|
|
1131
|
+
var page = $__default["default"].load(indexTemplate);
|
|
1132
1132
|
page("title").text(title);
|
|
1133
1133
|
page("body").append(root);
|
|
1134
1134
|
var content = formatHTML(page.html());
|
|
@@ -1148,13 +1148,13 @@ var htmlRenderer = {
|
|
|
1148
1148
|
}
|
|
1149
1149
|
};
|
|
1150
1150
|
|
|
1151
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
1151
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1152
1152
|
|
|
1153
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context14, _context15; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default[
|
|
1153
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context14, _context15; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context14 = ownKeys(Object(source), !0)).call(_context14, function (key) { _defineProperty__default["default"](target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context15 = ownKeys(Object(source))).call(_context15, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
1154
1154
|
|
|
1155
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol__default[
|
|
1155
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol__default["default"] !== "undefined" && _getIteratorMethod__default["default"](o) || o["@@iterator"]; if (!it) { if (_Array$isArray__default["default"](o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
1156
1156
|
|
|
1157
|
-
function _unsupportedIterableToArray(o, minLen) { var _context13; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty__default[
|
|
1157
|
+
function _unsupportedIterableToArray(o, minLen) { var _context13; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty__default["default"](_context13 = Object.prototype.toString.call(o)).call(_context13, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from__default["default"](o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
1158
1158
|
|
|
1159
1159
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1160
1160
|
/**
|
|
@@ -1174,7 +1174,7 @@ function linesToContent(lines) {
|
|
|
1174
1174
|
function image(title, src, href) {
|
|
1175
1175
|
var _context, _context2;
|
|
1176
1176
|
|
|
1177
|
-
return href == null ? _concatInstanceProperty__default[
|
|
1177
|
+
return href == null ? _concatInstanceProperty__default["default"](_context = ").call(_context, src, ")") : link(href, _concatInstanceProperty__default["default"](_context2 = ").call(_context2, src, ")"));
|
|
1178
1178
|
}
|
|
1179
1179
|
/**
|
|
1180
1180
|
* @param href
|
|
@@ -1186,7 +1186,7 @@ function link(href) {
|
|
|
1186
1186
|
var _context3;
|
|
1187
1187
|
|
|
1188
1188
|
var text = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : href;
|
|
1189
|
-
return _concatInstanceProperty__default[
|
|
1189
|
+
return _concatInstanceProperty__default["default"](_context3 = "[".concat(text, "](")).call(_context3, href, ")");
|
|
1190
1190
|
}
|
|
1191
1191
|
/**
|
|
1192
1192
|
* @param level
|
|
@@ -1197,7 +1197,7 @@ function link(href) {
|
|
|
1197
1197
|
function header(level, text) {
|
|
1198
1198
|
var _context4, _context5;
|
|
1199
1199
|
|
|
1200
|
-
return _concatInstanceProperty__default[
|
|
1200
|
+
return _concatInstanceProperty__default["default"](_context4 = "".concat(_repeatInstanceProperty__default["default"](_context5 = "#").call(_context5, level), " ")).call(_context4, text);
|
|
1201
1201
|
}
|
|
1202
1202
|
/**
|
|
1203
1203
|
* @param examples
|
|
@@ -1214,7 +1214,7 @@ function processGroup(examples, output, title, collator) {
|
|
|
1214
1214
|
var sections = [];
|
|
1215
1215
|
var filenamePart = title.replace(/[^a-zA-Z0-9]/g, "-").toLowerCase();
|
|
1216
1216
|
|
|
1217
|
-
var _iterator = _createForOfIteratorHelper(_sortInstanceProperty__default[
|
|
1217
|
+
var _iterator = _createForOfIteratorHelper(_sortInstanceProperty__default["default"](_context8 = _Object$keys__default["default"](examples)).call(_context8, collator.compare)),
|
|
1218
1218
|
_step;
|
|
1219
1219
|
|
|
1220
1220
|
try {
|
|
@@ -1229,7 +1229,7 @@ function processGroup(examples, output, title, collator) {
|
|
|
1229
1229
|
var _context9;
|
|
1230
1230
|
|
|
1231
1231
|
// A subgroup of examples.
|
|
1232
|
-
sections.push.apply(sections, _toConsumableArray__default[
|
|
1232
|
+
sections.push.apply(sections, _toConsumableArray__default["default"](_mapInstanceProperty__default["default"](_context9 = processGroup(example, output, key, collator)).call(_context9, function (contentPart) {
|
|
1233
1233
|
return _objectSpread(_objectSpread({}, contentPart), {}, {
|
|
1234
1234
|
filename: filenamePart + "." + contentPart.filename
|
|
1235
1235
|
});
|
|
@@ -1242,8 +1242,8 @@ function processGroup(examples, output, title, collator) {
|
|
|
1242
1242
|
_iterator.f();
|
|
1243
1243
|
}
|
|
1244
1244
|
|
|
1245
|
-
return _concatInstanceProperty__default[
|
|
1246
|
-
content: linesToContent(_concatInstanceProperty__default[
|
|
1245
|
+
return _concatInstanceProperty__default["default"](_context6 = [{
|
|
1246
|
+
content: linesToContent(_concatInstanceProperty__default["default"](_context7 = [header(1, title), ""]).call(_context7, items)),
|
|
1247
1247
|
filename: filenamePart + ".md",
|
|
1248
1248
|
title: title
|
|
1249
1249
|
}]).call(_context6, sections);
|
|
@@ -1255,13 +1255,13 @@ var mdRenderer = {
|
|
|
1255
1255
|
|
|
1256
1256
|
var sections = [];
|
|
1257
1257
|
|
|
1258
|
-
var _iterator2 = _createForOfIteratorHelper(_sortInstanceProperty__default[
|
|
1258
|
+
var _iterator2 = _createForOfIteratorHelper(_sortInstanceProperty__default["default"](_context12 = _Object$keys__default["default"](examples)).call(_context12, collator.compare)),
|
|
1259
1259
|
_step2;
|
|
1260
1260
|
|
|
1261
1261
|
try {
|
|
1262
1262
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1263
1263
|
var key = _step2.value;
|
|
1264
|
-
sections.push.apply(sections, _toConsumableArray__default[
|
|
1264
|
+
sections.push.apply(sections, _toConsumableArray__default["default"](processGroup(examples[key], output, key, collator)));
|
|
1265
1265
|
}
|
|
1266
1266
|
} catch (err) {
|
|
1267
1267
|
_iterator2.e(err);
|
|
@@ -1269,8 +1269,8 @@ var mdRenderer = {
|
|
|
1269
1269
|
_iterator2.f();
|
|
1270
1270
|
}
|
|
1271
1271
|
|
|
1272
|
-
return _concatInstanceProperty__default[
|
|
1273
|
-
content: linesToContent(_concatInstanceProperty__default[
|
|
1272
|
+
return _concatInstanceProperty__default["default"](_context10 = [{
|
|
1273
|
+
content: linesToContent(_concatInstanceProperty__default["default"](_context11 = [header(1, "Examples"), ""]).call(_context11, _toConsumableArray__default["default"](_mapInstanceProperty__default["default"](sections).call(sections, function (_ref) {
|
|
1274
1274
|
var filename = _ref.filename,
|
|
1275
1275
|
title = _ref.title;
|
|
1276
1276
|
return "- " + link("./" + filename, title);
|
|
@@ -1285,7 +1285,7 @@ var mdRenderer = {
|
|
|
1285
1285
|
}
|
|
1286
1286
|
};
|
|
1287
1287
|
|
|
1288
|
-
var y = yargs__default[
|
|
1288
|
+
var y = yargs__default["default"].strict(true).usage("generate-example-index [options]").hide("version").config().help().option("assets-local-directory", {
|
|
1289
1289
|
default: "./examples/thumbnails",
|
|
1290
1290
|
describe: "The directory where assets will be written to.",
|
|
1291
1291
|
type: "string"
|
|
@@ -1376,7 +1376,7 @@ function joinURLs() {
|
|
|
1376
1376
|
urls[_key] = arguments[_key];
|
|
1377
1377
|
}
|
|
1378
1378
|
|
|
1379
|
-
return _mapInstanceProperty__default[
|
|
1379
|
+
return _mapInstanceProperty__default["default"](urls).call(urls, function (url) {
|
|
1380
1380
|
return (// Strip the parts of leading and trailing slashes if they have them.
|
|
1381
1381
|
url.replace(/^\/?(.*?)\/?$/, "$1")
|
|
1382
1382
|
);
|
|
@@ -1388,8 +1388,8 @@ function joinURLs() {
|
|
|
1388
1388
|
*/
|
|
1389
1389
|
|
|
1390
1390
|
function fixAbsoluteInputURL(baseURL, url) {
|
|
1391
|
-
return _startsWithInstanceProperty__default[
|
|
1392
|
-
baseURL + _sliceInstanceProperty__default[
|
|
1391
|
+
return _startsWithInstanceProperty__default["default"](url).call(url, "/") ? // Relative to the base URL. Base URL starts and URL ends with a slash.
|
|
1392
|
+
baseURL + _sliceInstanceProperty__default["default"](url).call(url, 1) : // Relative to some other point or absolute already.
|
|
1393
1393
|
url;
|
|
1394
1394
|
}
|
|
1395
1395
|
/**
|
|
@@ -1423,7 +1423,7 @@ function generatePaths(config, exampleAbsolutePath) {
|
|
|
1423
1423
|
function generateLocalWebPair(localRoot, webRoot, hash, prefix, extension) {
|
|
1424
1424
|
var _context, _context2;
|
|
1425
1425
|
|
|
1426
|
-
var filename = _concatInstanceProperty__default[
|
|
1426
|
+
var filename = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = "".concat(prefix, ".")).call(_context2, hash, ".")).call(_context, extension);
|
|
1427
1427
|
|
|
1428
1428
|
return {
|
|
1429
1429
|
local: path.resolve(localRoot, filename),
|
|
@@ -1433,15 +1433,15 @@ function generateLocalWebPair(localRoot, webRoot, hash, prefix, extension) {
|
|
|
1433
1433
|
|
|
1434
1434
|
var argv = parseArguments(); // Log the parsed configuration for debugging purposes.
|
|
1435
1435
|
|
|
1436
|
-
console.info("Configuration: ", _JSON$stringify__default[
|
|
1436
|
+
console.info("Configuration: ", _JSON$stringify__default["default"](argv, null, 2));
|
|
1437
1437
|
process.stdout.write("\n"); // Pageres uses quite a lot of listeners when invoked multiple times in
|
|
1438
1438
|
// parallel. This ensures there are no warnings about it.
|
|
1439
1439
|
|
|
1440
1440
|
process.setMaxListeners(40); // Resolve paths relative to PWD.
|
|
1441
1441
|
|
|
1442
1442
|
var screenshotScriptPath = typeof argv["screenshot-script"] === "string" ? path.resolve(argv["screenshot-script"]) : undefined;
|
|
1443
|
-
var mkdir = util__default[
|
|
1444
|
-
var readFile = util__default[
|
|
1443
|
+
var mkdir = util__default["default"].promisify(fs__default["default"].mkdir);
|
|
1444
|
+
var readFile = util__default["default"].promisify(fs__default["default"].readFile);
|
|
1445
1445
|
/**
|
|
1446
1446
|
* Extract and coerce a value from meta tag.
|
|
1447
1447
|
*
|
|
@@ -1458,7 +1458,7 @@ function getMeta(page, name, fallback) {
|
|
|
1458
1458
|
if (content == null) {
|
|
1459
1459
|
// No meta of this name exists in the page, use the fallback.
|
|
1460
1460
|
return fallback;
|
|
1461
|
-
} else if (!_Number$isNaN__default[
|
|
1461
|
+
} else if (!_Number$isNaN__default["default"](+content)) {
|
|
1462
1462
|
// Number.
|
|
1463
1463
|
return +content;
|
|
1464
1464
|
} else if (typeof content === "string") {
|
|
@@ -1494,10 +1494,10 @@ function lintExample(path, page) {
|
|
|
1494
1494
|
valid = false;
|
|
1495
1495
|
}
|
|
1496
1496
|
|
|
1497
|
-
var headTitle = _trimInstanceProperty__default[
|
|
1497
|
+
var headTitle = _trimInstanceProperty__default["default"](_context = page("head > title").text()).call(_context);
|
|
1498
1498
|
|
|
1499
|
-
var bodyTitle = _trimInstanceProperty__default[
|
|
1500
|
-
return $__default[
|
|
1499
|
+
var bodyTitle = _trimInstanceProperty__default["default"](_context2 = _mapInstanceProperty__default["default"](_context3 = page("#title > *")).call(_context3, function (_i, elem) {
|
|
1500
|
+
return $__default["default"](elem).text();
|
|
1501
1501
|
}).get().join(" | ")).call(_context2);
|
|
1502
1502
|
|
|
1503
1503
|
if (headTitle !== bodyTitle) {
|
|
@@ -1512,12 +1512,12 @@ function lintExample(path, page) {
|
|
|
1512
1512
|
return valid;
|
|
1513
1513
|
}
|
|
1514
1514
|
|
|
1515
|
-
_asyncToGenerator__default[
|
|
1515
|
+
_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3() {
|
|
1516
1516
|
var _context4, _context6;
|
|
1517
1517
|
|
|
1518
1518
|
var code, baseURL, pathsConfig, examples, selector, stats, skipped, _context11, screenshotScript, builtData, _context12, _context13, cummulativeReport, _context14, _context15, _cummulativeReport, _context16, _context17, _cummulativeReport2, checks, _context18, _context23, _context19, _context20, _context21, _context22;
|
|
1519
1519
|
|
|
1520
|
-
return _regeneratorRuntime__default[
|
|
1520
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context24) {
|
|
1521
1521
|
while (1) {
|
|
1522
1522
|
switch (_context24.prev = _context24.next) {
|
|
1523
1523
|
case 0:
|
|
@@ -1528,14 +1528,14 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1528
1528
|
break;
|
|
1529
1529
|
}
|
|
1530
1530
|
|
|
1531
|
-
yargs__default[
|
|
1531
|
+
yargs__default["default"].parse("--help");
|
|
1532
1532
|
return _context24.abrupt("return");
|
|
1533
1533
|
|
|
1534
1534
|
case 4:
|
|
1535
1535
|
_context24.next = 6;
|
|
1536
|
-
return _Promise__default[
|
|
1537
|
-
var _ref2 = _asyncToGenerator__default[
|
|
1538
|
-
return _regeneratorRuntime__default[
|
|
1536
|
+
return _Promise__default["default"].all(_mapInstanceProperty__default["default"](_context4 = [argv["assets-local-directory"], argv["examples-local-directory"], argv["output-directory"], argv["pages-local-directory"]]).call(_context4, /*#__PURE__*/function () {
|
|
1537
|
+
var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(path) {
|
|
1538
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context5) {
|
|
1539
1539
|
while (1) {
|
|
1540
1540
|
switch (_context5.prev = _context5.next) {
|
|
1541
1541
|
case 0:
|
|
@@ -1560,7 +1560,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1560
1560
|
case 6:
|
|
1561
1561
|
baseURL = argv["base-url"];
|
|
1562
1562
|
|
|
1563
|
-
if (_endsWithInstanceProperty__default[
|
|
1563
|
+
if (_endsWithInstanceProperty__default["default"](baseURL).call(baseURL, "/")) {
|
|
1564
1564
|
_context24.next = 9;
|
|
1565
1565
|
break;
|
|
1566
1566
|
}
|
|
@@ -1593,20 +1593,20 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1593
1593
|
examples: 0
|
|
1594
1594
|
};
|
|
1595
1595
|
skipped = [];
|
|
1596
|
-
_context24.t0 = _Promise__default[
|
|
1597
|
-
_context24.t1 = _mapInstanceProperty__default[
|
|
1596
|
+
_context24.t0 = _Promise__default["default"];
|
|
1597
|
+
_context24.t1 = _mapInstanceProperty__default["default"];
|
|
1598
1598
|
_context24.next = 18;
|
|
1599
|
-
return globby__default[
|
|
1599
|
+
return globby__default["default"](path.join(pathsConfig.page.local, "**/*.html"));
|
|
1600
1600
|
|
|
1601
1601
|
case 18:
|
|
1602
1602
|
_context24.t2 = _context6 = _context24.sent;
|
|
1603
1603
|
_context24.t3 = (0, _context24.t1)(_context24.t2).call(_context6, /*#__PURE__*/function () {
|
|
1604
|
-
var _ref3 = _asyncToGenerator__default[
|
|
1604
|
+
var _ref3 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(pagePath) {
|
|
1605
1605
|
var _context7;
|
|
1606
1606
|
|
|
1607
1607
|
var html, $page, pageDelay, pageTimeout, pageSelector, titles, _context9;
|
|
1608
1608
|
|
|
1609
|
-
return _regeneratorRuntime__default[
|
|
1609
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context10) {
|
|
1610
1610
|
while (1) {
|
|
1611
1611
|
switch (_context10.prev = _context10.next) {
|
|
1612
1612
|
case 0:
|
|
@@ -1615,7 +1615,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1615
1615
|
|
|
1616
1616
|
case 2:
|
|
1617
1617
|
html = _context10.sent;
|
|
1618
|
-
$page = $__default[
|
|
1618
|
+
$page = $__default["default"].load(html);
|
|
1619
1619
|
pageDelay = getMeta($page, "example-screenshot-delay", 6);
|
|
1620
1620
|
pageTimeout = getMeta($page, "example-screenshot-timeout", 60);
|
|
1621
1621
|
pageSelector = getMeta($page, "example-screenshot-selector", selector); // Is this an examples?
|
|
@@ -1635,15 +1635,15 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1635
1635
|
} // Body titles.
|
|
1636
1636
|
|
|
1637
1637
|
|
|
1638
|
-
titles = _mapInstanceProperty__default[
|
|
1638
|
+
titles = _mapInstanceProperty__default["default"](_context7 = $page("#title > *").get()).call(_context7, function (elem) {
|
|
1639
1639
|
var _context8;
|
|
1640
1640
|
|
|
1641
|
-
return _trimInstanceProperty__default[
|
|
1641
|
+
return _trimInstanceProperty__default["default"](_context8 = $page(elem).text()).call(_context8);
|
|
1642
1642
|
}); // Head title fallback.
|
|
1643
1643
|
|
|
1644
1644
|
if (titles.length < 2) {
|
|
1645
|
-
titles = _mapInstanceProperty__default[
|
|
1646
|
-
return _trimInstanceProperty__default[
|
|
1645
|
+
titles = _mapInstanceProperty__default["default"](_context9 = $page("head > title").text().split("|")).call(_context9, function (title) {
|
|
1646
|
+
return _trimInstanceProperty__default["default"](title).call(title);
|
|
1647
1647
|
});
|
|
1648
1648
|
} // File path fallback.
|
|
1649
1649
|
|
|
@@ -1663,7 +1663,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1663
1663
|
|
|
1664
1664
|
case 17:
|
|
1665
1665
|
// Put this example into the structure while creating any missing groups in the process.
|
|
1666
|
-
_reduceInstanceProperty__default[
|
|
1666
|
+
_reduceInstanceProperty__default["default"](titles).call(titles, function (acc, title, i, arr) {
|
|
1667
1667
|
while (acc[title] != null && acc[title].path != null) {
|
|
1668
1668
|
console.error("The following group already exists: ", titles);
|
|
1669
1669
|
title += "!";
|
|
@@ -1711,7 +1711,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1711
1711
|
case 22:
|
|
1712
1712
|
if (skipped.length) {
|
|
1713
1713
|
process.stdout.write("\n");
|
|
1714
|
-
console.info(_concatInstanceProperty__default[
|
|
1714
|
+
console.info(_concatInstanceProperty__default["default"](_context11 = ["The following files don't look like examples (there is nothing to take a screenshot of):"]).call(_context11, _toConsumableArray__default["default"](_sortInstanceProperty__default["default"](skipped).call(skipped))).join("\n "));
|
|
1715
1715
|
}
|
|
1716
1716
|
|
|
1717
1717
|
if (!(stats.examples === 0)) {
|
|
@@ -1784,7 +1784,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1784
1784
|
case 45:
|
|
1785
1785
|
_context24.t7 = _context24.sent;
|
|
1786
1786
|
cummulativeReport = (0, _context24.t6)(_context24.t7);
|
|
1787
|
-
console.info(_concatInstanceProperty__default[
|
|
1787
|
+
console.info(_concatInstanceProperty__default["default"](_context12 = _concatInstanceProperty__default["default"](_context13 = "Index with ".concat(stats.examples, " examples written (")).call(_context13, cummulativeReport.count, " files in ")).call(_context12, formatStartStopMs(cummulativeReport), ")."));
|
|
1788
1788
|
|
|
1789
1789
|
case 48:
|
|
1790
1790
|
if (!argv.index) {
|
|
@@ -1799,7 +1799,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1799
1799
|
case 52:
|
|
1800
1800
|
_context24.t9 = _context24.sent;
|
|
1801
1801
|
_cummulativeReport = (0, _context24.t8)(_context24.t9);
|
|
1802
|
-
console.info(_concatInstanceProperty__default[
|
|
1802
|
+
console.info(_concatInstanceProperty__default["default"](_context14 = _concatInstanceProperty__default["default"](_context15 = "Playground opener files for ".concat(stats.examples, " examples written (")).call(_context15, _cummulativeReport.count, " files in ")).call(_context14, formatStartStopMs(_cummulativeReport), ")."));
|
|
1803
1803
|
|
|
1804
1804
|
case 55:
|
|
1805
1805
|
if (!argv.screenshots) {
|
|
@@ -1814,7 +1814,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1814
1814
|
case 59:
|
|
1815
1815
|
_context24.t11 = _context24.sent;
|
|
1816
1816
|
_cummulativeReport2 = (0, _context24.t10)(_context24.t11);
|
|
1817
|
-
console.info(_concatInstanceProperty__default[
|
|
1817
|
+
console.info(_concatInstanceProperty__default["default"](_context16 = _concatInstanceProperty__default["default"](_context17 = "Screenshot files for ".concat(stats.examples, " written (")).call(_context17, _cummulativeReport2.count, " files in ")).call(_context16, formatStartStopMs(_cummulativeReport2), ")."));
|
|
1818
1818
|
|
|
1819
1819
|
case 62:
|
|
1820
1820
|
_context24.next = 64;
|
|
@@ -1825,16 +1825,16 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1825
1825
|
process.stdout.write("\n");
|
|
1826
1826
|
|
|
1827
1827
|
if (checks.fail === 0) {
|
|
1828
|
-
console.info(_concatInstanceProperty__default[
|
|
1828
|
+
console.info(_concatInstanceProperty__default["default"](_context18 = "Verification: ".concat(checks.okay, " passed (")).call(_context18, Math.round(checks.percentage), " %) passed."));
|
|
1829
1829
|
} else {
|
|
1830
1830
|
if (checks.percentage >= argv.verify) {
|
|
1831
|
-
console.info(_concatInstanceProperty__default[
|
|
1831
|
+
console.info(_concatInstanceProperty__default["default"](_context19 = _concatInstanceProperty__default["default"](_context20 = "Verification: ".concat(checks.okay, " passed (")).call(_context20, Math.round(checks.percentage), " %), ")).call(_context19, checks.fail, " failed.\n") + "This is within the threshold set by --verify.");
|
|
1832
1832
|
} else {
|
|
1833
|
-
console.error(_concatInstanceProperty__default[
|
|
1833
|
+
console.error(_concatInstanceProperty__default["default"](_context21 = _concatInstanceProperty__default["default"](_context22 = "Verification: Only ".concat(checks.okay, " passed (")).call(_context22, Math.round(checks.percentage), " %), ")).call(_context21, checks.fail, " failed.\n") + "This is not within the threshold set by --verify. Exiting with an error.");
|
|
1834
1834
|
code = 3;
|
|
1835
1835
|
}
|
|
1836
1836
|
|
|
1837
|
-
_forEachInstanceProperty__default[
|
|
1837
|
+
_forEachInstanceProperty__default["default"](_context23 = checks.failPaths).call(_context23, function (path) {
|
|
1838
1838
|
console.error(path);
|
|
1839
1839
|
});
|
|
1840
1840
|
}
|