vis-dev-utils 3.0.1 → 3.0.4
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/bin/ci-utils.js +7 -7
- package/bin/generate-examples-index.js +156 -158
- package/bin/generate-examples-index.js.map +1 -1
- package/bin/test-e2e-interop.js +89 -110
- package/bin/test-e2e-interop.js.map +1 -1
- package/dist/vis-dev-utils.cjs.js +62 -62
- package/dist/vis-dev-utils.esm.js +2 -2
- package/package.json +21 -22
|
@@ -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.4
|
|
10
|
+
* @date 2022-03-10T21:24:40.299Z
|
|
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
|
|
@@ -57,9 +57,9 @@ var _Array$from = require('@babel/runtime-corejs3/core-js-stable/array/from');
|
|
|
57
57
|
var _Symbol = require('@babel/runtime-corejs3/core-js-stable/symbol');
|
|
58
58
|
var _getIteratorMethod = require('@babel/runtime-corejs3/core-js/get-iterator-method');
|
|
59
59
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
60
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
60
61
|
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
61
62
|
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
62
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
63
63
|
var _flatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flat');
|
|
64
64
|
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
65
65
|
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
@@ -111,9 +111,9 @@ var _Array$from__default = /*#__PURE__*/_interopDefaultLegacy(_Array$from);
|
|
|
111
111
|
var _Symbol__default = /*#__PURE__*/_interopDefaultLegacy(_Symbol);
|
|
112
112
|
var _getIteratorMethod__default = /*#__PURE__*/_interopDefaultLegacy(_getIteratorMethod);
|
|
113
113
|
var _Array$isArray__default = /*#__PURE__*/_interopDefaultLegacy(_Array$isArray);
|
|
114
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
114
115
|
var _classCallCheck__default = /*#__PURE__*/_interopDefaultLegacy(_classCallCheck);
|
|
115
116
|
var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
|
|
116
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
117
117
|
var _flatInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_flatInstanceProperty);
|
|
118
118
|
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_everyInstanceProperty);
|
|
119
119
|
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefaultLegacy(_sliceInstanceProperty);
|
|
@@ -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,20 @@ 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[
|
|
664
|
-
|
|
665
|
-
_defineProperty__default['default'](this, "_config", void 0);
|
|
663
|
+
_classCallCheck__default["default"](this, ContentBuilder);
|
|
666
664
|
|
|
667
665
|
this._config = _config;
|
|
668
666
|
}
|
|
@@ -677,7 +675,7 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
677
675
|
*/
|
|
678
676
|
|
|
679
677
|
|
|
680
|
-
_createClass__default[
|
|
678
|
+
_createClass__default["default"](ContentBuilder, [{
|
|
681
679
|
key: "build",
|
|
682
680
|
value: function build() {
|
|
683
681
|
var _context,
|
|
@@ -690,23 +688,23 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
690
688
|
|
|
691
689
|
var okay = [];
|
|
692
690
|
var fail = [];
|
|
693
|
-
console.info(_concatInstanceProperty__default[
|
|
691
|
+
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
692
|
process.stdout.write("\n");
|
|
695
693
|
var index = emit.index ? // Generate indexes.
|
|
696
|
-
_asyncToGenerator__default[
|
|
694
|
+
_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2() {
|
|
697
695
|
var _context3;
|
|
698
696
|
|
|
699
697
|
var getStartStopMs, results;
|
|
700
|
-
return _regeneratorRuntime__default[
|
|
698
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context5) {
|
|
701
699
|
while (1) {
|
|
702
700
|
switch (_context5.prev = _context5.next) {
|
|
703
701
|
case 0:
|
|
704
702
|
getStartStopMs = measureStartStopMs();
|
|
705
703
|
_context5.next = 3;
|
|
706
|
-
return _Promise__default[
|
|
707
|
-
var _ref3 = _asyncToGenerator__default[
|
|
704
|
+
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 () {
|
|
705
|
+
var _ref3 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(_ref2) {
|
|
708
706
|
var content, filename;
|
|
709
|
-
return _regeneratorRuntime__default[
|
|
707
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context4) {
|
|
710
708
|
while (1) {
|
|
711
709
|
switch (_context4.prev = _context4.next) {
|
|
712
710
|
case 0:
|
|
@@ -730,7 +728,7 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
730
728
|
results = _context5.sent;
|
|
731
729
|
return _context5.abrupt("return", [_objectSpread$1(_objectSpread$1({}, getStartStopMs()), {}, {
|
|
732
730
|
count: results.length,
|
|
733
|
-
result: _everyInstanceProperty__default[
|
|
731
|
+
result: _everyInstanceProperty__default["default"](results).call(results, function (_ref4) {
|
|
734
732
|
var status = _ref4.status;
|
|
735
733
|
return status === "fulfilled";
|
|
736
734
|
}) ? "fulfilled" : "rejected"
|
|
@@ -743,26 +741,26 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
743
741
|
}
|
|
744
742
|
}, _callee2);
|
|
745
743
|
}))() : // Skip indexes.
|
|
746
|
-
_Promise__default[
|
|
744
|
+
_Promise__default["default"].resolve([]);
|
|
747
745
|
var playgrounds = emit.playgrounds ? // Generate playground pages.
|
|
748
|
-
_asyncToGenerator__default[
|
|
749
|
-
return _regeneratorRuntime__default[
|
|
746
|
+
_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4() {
|
|
747
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context8) {
|
|
750
748
|
while (1) {
|
|
751
749
|
switch (_context8.prev = _context8.next) {
|
|
752
750
|
case 0:
|
|
753
751
|
_context8.next = 2;
|
|
754
|
-
return _Promise__default[
|
|
755
|
-
var _ref6 = _asyncToGenerator__default[
|
|
752
|
+
return _Promise__default["default"].all(_mapInstanceProperty__default["default"](allExamples).call(allExamples, /*#__PURE__*/function () {
|
|
753
|
+
var _ref6 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(example) {
|
|
756
754
|
var _context6;
|
|
757
755
|
|
|
758
756
|
var getStartStopMs, results;
|
|
759
|
-
return _regeneratorRuntime__default[
|
|
757
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context7) {
|
|
760
758
|
while (1) {
|
|
761
759
|
switch (_context7.prev = _context7.next) {
|
|
762
760
|
case 0:
|
|
763
761
|
getStartStopMs = measureStartStopMs();
|
|
764
762
|
_context7.next = 3;
|
|
765
|
-
return _Promise__default[
|
|
763
|
+
return _Promise__default["default"].allSettled(_mapInstanceProperty__default["default"](_context6 = [{
|
|
766
764
|
html: generateJSFiddlePage(example),
|
|
767
765
|
path: example.paths.jsfiddle.local
|
|
768
766
|
}, {
|
|
@@ -779,7 +777,7 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
779
777
|
return _context7.abrupt("return", _objectSpread$1(_objectSpread$1({}, getStartStopMs()), {}, {
|
|
780
778
|
count: results.length,
|
|
781
779
|
example: example,
|
|
782
|
-
result: _everyInstanceProperty__default[
|
|
780
|
+
result: _everyInstanceProperty__default["default"](results).call(results, function (_ref8) {
|
|
783
781
|
var status = _ref8.status;
|
|
784
782
|
return status === "fulfilled";
|
|
785
783
|
}) ? "fulfilled" : "rejected"
|
|
@@ -808,12 +806,12 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
808
806
|
}
|
|
809
807
|
}, _callee4);
|
|
810
808
|
}))() : // Skip playground pages.
|
|
811
|
-
_Promise__default[
|
|
809
|
+
_Promise__default["default"].resolve([]);
|
|
812
810
|
var screenshots = emit.screenshots ? // Generate screenshots.
|
|
813
|
-
_asyncToGenerator__default[
|
|
811
|
+
_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee7() {
|
|
814
812
|
var cleanup, _process$env$DEBUG, _context10, _context11, debug, browser, todo, total, reports, _context17, _iterator, _step, callback;
|
|
815
813
|
|
|
816
|
-
return _regeneratorRuntime__default[
|
|
814
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee7$(_context18) {
|
|
817
815
|
while (1) {
|
|
818
816
|
switch (_context18.prev = _context18.next) {
|
|
819
817
|
case 0:
|
|
@@ -821,7 +819,7 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
821
819
|
_context18.prev = 1;
|
|
822
820
|
debug = /^1|y|yes|true$/i.test((_process$env$DEBUG = process.env.DEBUG) !== null && _process$env$DEBUG !== void 0 ? _process$env$DEBUG : "");
|
|
823
821
|
_context18.next = 5;
|
|
824
|
-
return puppeteer__default[
|
|
822
|
+
return puppeteer__default["default"].launch({
|
|
825
823
|
headless: !debug,
|
|
826
824
|
slowMo: debug ? 100 : undefined
|
|
827
825
|
});
|
|
@@ -830,8 +828,8 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
830
828
|
browser = _context18.sent;
|
|
831
829
|
|
|
832
830
|
if (debug) {
|
|
833
|
-
cleanup.push( /*#__PURE__*/_asyncToGenerator__default[
|
|
834
|
-
return _regeneratorRuntime__default[
|
|
831
|
+
cleanup.push( /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee5() {
|
|
832
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee5$(_context9) {
|
|
835
833
|
while (1) {
|
|
836
834
|
switch (_context9.prev = _context9.next) {
|
|
837
835
|
case 0:
|
|
@@ -853,14 +851,14 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
853
851
|
// so it's much faster to run a lot of them at the same time.
|
|
854
852
|
|
|
855
853
|
|
|
856
|
-
todo = _sliceInstanceProperty__default[
|
|
854
|
+
todo = _sliceInstanceProperty__default["default"](allExamples).call(allExamples);
|
|
857
855
|
total = todo.length;
|
|
858
856
|
reports = [];
|
|
859
857
|
_context18.next = 12;
|
|
860
|
-
return _Promise__default[
|
|
858
|
+
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
859
|
var example, _context12, _context13, _context14, _context15, getStartStopMs, valid, report, percentage, validText, msText;
|
|
862
860
|
|
|
863
|
-
return _regeneratorRuntime__default[
|
|
861
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee6$(_context16) {
|
|
864
862
|
while (1) {
|
|
865
863
|
switch (_context16.prev = _context16.next) {
|
|
866
864
|
case 0:
|
|
@@ -894,10 +892,10 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
894
892
|
fail.push(example.path);
|
|
895
893
|
}
|
|
896
894
|
|
|
897
|
-
percentage = _padStartInstanceProperty__default[
|
|
895
|
+
percentage = _padStartInstanceProperty__default["default"](_context12 = Math.floor(reports.length / total * 100) + "%").call(_context12, 4, " ");
|
|
898
896
|
validText = valid ? "okay" : "fail";
|
|
899
897
|
msText = formatStartStopMs(report);
|
|
900
|
-
console.info(_concatInstanceProperty__default[
|
|
898
|
+
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
899
|
_context16.next = 0;
|
|
902
900
|
break;
|
|
903
901
|
|
|
@@ -914,7 +912,7 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
914
912
|
|
|
915
913
|
case 13:
|
|
916
914
|
_context18.prev = 13;
|
|
917
|
-
_iterator = _createForOfIteratorHelper$2(_reverseInstanceProperty__default[
|
|
915
|
+
_iterator = _createForOfIteratorHelper$2(_reverseInstanceProperty__default["default"](_context17 = _spliceInstanceProperty__default["default"](cleanup).call(cleanup, 0)).call(_context17));
|
|
918
916
|
_context18.prev = 15;
|
|
919
917
|
|
|
920
918
|
_iterator.s();
|
|
@@ -970,11 +968,11 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
970
968
|
}
|
|
971
969
|
}, _callee7, null, [[1,, 13, 38], [15, 31, 34, 37], [19, 24]]);
|
|
972
970
|
}))() : // Skip screenshots.
|
|
973
|
-
_Promise__default[
|
|
971
|
+
_Promise__default["default"].resolve([]);
|
|
974
972
|
|
|
975
|
-
var checks = _asyncToGenerator__default[
|
|
973
|
+
var checks = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee8() {
|
|
976
974
|
var total;
|
|
977
|
-
return _regeneratorRuntime__default[
|
|
975
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee8$(_context19) {
|
|
978
976
|
while (1) {
|
|
979
977
|
switch (_context19.prev = _context19.next) {
|
|
980
978
|
case 0:
|
|
@@ -1022,7 +1020,7 @@ var ContentBuilder = /*#__PURE__*/function () {
|
|
|
1022
1020
|
_context21,
|
|
1023
1021
|
_this2 = this;
|
|
1024
1022
|
|
|
1025
|
-
return _flatMapInstanceProperty__default[
|
|
1023
|
+
return _flatMapInstanceProperty__default["default"](_context20 = _sortInstanceProperty__default["default"](_context21 = _Object$keys__default["default"](examples)).call(_context21, collator.compare)).call(_context20, function (key) {
|
|
1026
1024
|
var example = examples[key];
|
|
1027
1025
|
|
|
1028
1026
|
if (isExample(example)) {
|
|
@@ -1041,9 +1039,9 @@ var indexTemplate = "<html>\n <head>\n <meta charset=\"utf-8\" />\n <titl
|
|
|
1041
1039
|
|
|
1042
1040
|
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
1041
|
|
|
1044
|
-
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof _Symbol__default[
|
|
1042
|
+
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
1043
|
|
|
1046
|
-
function _unsupportedIterableToArray$1(o, minLen) { var _context3; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = _sliceInstanceProperty__default[
|
|
1044
|
+
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
1045
|
|
|
1048
1046
|
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
1047
|
/**
|
|
@@ -1051,7 +1049,7 @@ function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) le
|
|
|
1051
1049
|
*/
|
|
1052
1050
|
|
|
1053
1051
|
function generateJSFiddle(example) {
|
|
1054
|
-
return $__default[
|
|
1052
|
+
return $__default["default"]("<a>").addClass("icon jsfiddle").attr("href", example.paths.jsfiddle.web).attr("title", "JSFiddle");
|
|
1055
1053
|
}
|
|
1056
1054
|
/**
|
|
1057
1055
|
* @param example
|
|
@@ -1059,7 +1057,7 @@ function generateJSFiddle(example) {
|
|
|
1059
1057
|
|
|
1060
1058
|
|
|
1061
1059
|
function generateCodePen(example) {
|
|
1062
|
-
return $__default[
|
|
1060
|
+
return $__default["default"]("<a>").addClass("icon codepen").attr("href", example.paths.codepen.web).attr("title", "CodePen");
|
|
1063
1061
|
}
|
|
1064
1062
|
/**
|
|
1065
1063
|
* @param examples
|
|
@@ -1072,13 +1070,13 @@ function generateCodePen(example) {
|
|
|
1072
1070
|
function processGroup$1(examples, title, level, collator) {
|
|
1073
1071
|
var _context;
|
|
1074
1072
|
|
|
1075
|
-
var heading = $__default[
|
|
1073
|
+
var heading = $__default["default"]("<h".concat(Math.max(1, Math.min(6, level)), ">"));
|
|
1076
1074
|
heading.text(title);
|
|
1077
|
-
var list = $__default[
|
|
1078
|
-
var section = $__default[
|
|
1075
|
+
var list = $__default["default"]("<div>");
|
|
1076
|
+
var section = $__default["default"]("<div>");
|
|
1079
1077
|
section.append(heading, list);
|
|
1080
1078
|
|
|
1081
|
-
var _iterator = _createForOfIteratorHelper$1(_sortInstanceProperty__default[
|
|
1079
|
+
var _iterator = _createForOfIteratorHelper$1(_sortInstanceProperty__default["default"](_context = _Object$keys__default["default"](examples)).call(_context, collator.compare)),
|
|
1082
1080
|
_step;
|
|
1083
1081
|
|
|
1084
1082
|
try {
|
|
@@ -1087,11 +1085,11 @@ function processGroup$1(examples, title, level, collator) {
|
|
|
1087
1085
|
var example = examples[key];
|
|
1088
1086
|
|
|
1089
1087
|
if (isExample(example)) {
|
|
1090
|
-
var header = $__default[
|
|
1088
|
+
var header = $__default["default"]("<div>").addClass("example-header").append( // Playgrounds
|
|
1091
1089
|
generateJSFiddle(example), generateCodePen(example), // Title
|
|
1092
|
-
$__default[
|
|
1093
|
-
var image = $__default[
|
|
1094
|
-
var item = $__default[
|
|
1090
|
+
$__default["default"]("<a>").attr("href", example.paths.page.web).text(key));
|
|
1091
|
+
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));
|
|
1092
|
+
var item = $__default["default"]("<span>").addClass("example-link").append(header, image);
|
|
1095
1093
|
list.append(item);
|
|
1096
1094
|
} else {
|
|
1097
1095
|
section.append(processGroup$1(example, key, level + 1, collator));
|
|
@@ -1111,10 +1109,10 @@ var htmlRenderer = {
|
|
|
1111
1109
|
var _context2;
|
|
1112
1110
|
|
|
1113
1111
|
var filename = "index.html";
|
|
1114
|
-
var root = $__default[
|
|
1112
|
+
var root = $__default["default"]("<div>");
|
|
1115
1113
|
root.addClass("examples-root");
|
|
1116
1114
|
|
|
1117
|
-
var _iterator2 = _createForOfIteratorHelper$1(_sortInstanceProperty__default[
|
|
1115
|
+
var _iterator2 = _createForOfIteratorHelper$1(_sortInstanceProperty__default["default"](_context2 = _Object$keys__default["default"](examples)).call(_context2, collator.compare)),
|
|
1118
1116
|
_step2;
|
|
1119
1117
|
|
|
1120
1118
|
try {
|
|
@@ -1128,7 +1126,7 @@ var htmlRenderer = {
|
|
|
1128
1126
|
_iterator2.f();
|
|
1129
1127
|
}
|
|
1130
1128
|
|
|
1131
|
-
var page = $__default[
|
|
1129
|
+
var page = $__default["default"].load(indexTemplate);
|
|
1132
1130
|
page("title").text(title);
|
|
1133
1131
|
page("body").append(root);
|
|
1134
1132
|
var content = formatHTML(page.html());
|
|
@@ -1148,13 +1146,13 @@ var htmlRenderer = {
|
|
|
1148
1146
|
}
|
|
1149
1147
|
};
|
|
1150
1148
|
|
|
1151
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
1149
|
+
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
1150
|
|
|
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[
|
|
1151
|
+
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
1152
|
|
|
1155
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol__default[
|
|
1153
|
+
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
1154
|
|
|
1157
|
-
function _unsupportedIterableToArray(o, minLen) { var _context13; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty__default[
|
|
1155
|
+
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
1156
|
|
|
1159
1157
|
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
1158
|
/**
|
|
@@ -1174,7 +1172,7 @@ function linesToContent(lines) {
|
|
|
1174
1172
|
function image(title, src, href) {
|
|
1175
1173
|
var _context, _context2;
|
|
1176
1174
|
|
|
1177
|
-
return href == null ? _concatInstanceProperty__default[
|
|
1175
|
+
return href == null ? _concatInstanceProperty__default["default"](_context = ").call(_context, src, ")") : link(href, _concatInstanceProperty__default["default"](_context2 = ").call(_context2, src, ")"));
|
|
1178
1176
|
}
|
|
1179
1177
|
/**
|
|
1180
1178
|
* @param href
|
|
@@ -1186,7 +1184,7 @@ function link(href) {
|
|
|
1186
1184
|
var _context3;
|
|
1187
1185
|
|
|
1188
1186
|
var text = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : href;
|
|
1189
|
-
return _concatInstanceProperty__default[
|
|
1187
|
+
return _concatInstanceProperty__default["default"](_context3 = "[".concat(text, "](")).call(_context3, href, ")");
|
|
1190
1188
|
}
|
|
1191
1189
|
/**
|
|
1192
1190
|
* @param level
|
|
@@ -1197,7 +1195,7 @@ function link(href) {
|
|
|
1197
1195
|
function header(level, text) {
|
|
1198
1196
|
var _context4, _context5;
|
|
1199
1197
|
|
|
1200
|
-
return _concatInstanceProperty__default[
|
|
1198
|
+
return _concatInstanceProperty__default["default"](_context4 = "".concat(_repeatInstanceProperty__default["default"](_context5 = "#").call(_context5, level), " ")).call(_context4, text);
|
|
1201
1199
|
}
|
|
1202
1200
|
/**
|
|
1203
1201
|
* @param examples
|
|
@@ -1214,7 +1212,7 @@ function processGroup(examples, output, title, collator) {
|
|
|
1214
1212
|
var sections = [];
|
|
1215
1213
|
var filenamePart = title.replace(/[^a-zA-Z0-9]/g, "-").toLowerCase();
|
|
1216
1214
|
|
|
1217
|
-
var _iterator = _createForOfIteratorHelper(_sortInstanceProperty__default[
|
|
1215
|
+
var _iterator = _createForOfIteratorHelper(_sortInstanceProperty__default["default"](_context8 = _Object$keys__default["default"](examples)).call(_context8, collator.compare)),
|
|
1218
1216
|
_step;
|
|
1219
1217
|
|
|
1220
1218
|
try {
|
|
@@ -1229,7 +1227,7 @@ function processGroup(examples, output, title, collator) {
|
|
|
1229
1227
|
var _context9;
|
|
1230
1228
|
|
|
1231
1229
|
// A subgroup of examples.
|
|
1232
|
-
sections.push.apply(sections, _toConsumableArray__default[
|
|
1230
|
+
sections.push.apply(sections, _toConsumableArray__default["default"](_mapInstanceProperty__default["default"](_context9 = processGroup(example, output, key, collator)).call(_context9, function (contentPart) {
|
|
1233
1231
|
return _objectSpread(_objectSpread({}, contentPart), {}, {
|
|
1234
1232
|
filename: filenamePart + "." + contentPart.filename
|
|
1235
1233
|
});
|
|
@@ -1242,8 +1240,8 @@ function processGroup(examples, output, title, collator) {
|
|
|
1242
1240
|
_iterator.f();
|
|
1243
1241
|
}
|
|
1244
1242
|
|
|
1245
|
-
return _concatInstanceProperty__default[
|
|
1246
|
-
content: linesToContent(_concatInstanceProperty__default[
|
|
1243
|
+
return _concatInstanceProperty__default["default"](_context6 = [{
|
|
1244
|
+
content: linesToContent(_concatInstanceProperty__default["default"](_context7 = [header(1, title), ""]).call(_context7, items)),
|
|
1247
1245
|
filename: filenamePart + ".md",
|
|
1248
1246
|
title: title
|
|
1249
1247
|
}]).call(_context6, sections);
|
|
@@ -1255,13 +1253,13 @@ var mdRenderer = {
|
|
|
1255
1253
|
|
|
1256
1254
|
var sections = [];
|
|
1257
1255
|
|
|
1258
|
-
var _iterator2 = _createForOfIteratorHelper(_sortInstanceProperty__default[
|
|
1256
|
+
var _iterator2 = _createForOfIteratorHelper(_sortInstanceProperty__default["default"](_context12 = _Object$keys__default["default"](examples)).call(_context12, collator.compare)),
|
|
1259
1257
|
_step2;
|
|
1260
1258
|
|
|
1261
1259
|
try {
|
|
1262
1260
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1263
1261
|
var key = _step2.value;
|
|
1264
|
-
sections.push.apply(sections, _toConsumableArray__default[
|
|
1262
|
+
sections.push.apply(sections, _toConsumableArray__default["default"](processGroup(examples[key], output, key, collator)));
|
|
1265
1263
|
}
|
|
1266
1264
|
} catch (err) {
|
|
1267
1265
|
_iterator2.e(err);
|
|
@@ -1269,8 +1267,8 @@ var mdRenderer = {
|
|
|
1269
1267
|
_iterator2.f();
|
|
1270
1268
|
}
|
|
1271
1269
|
|
|
1272
|
-
return _concatInstanceProperty__default[
|
|
1273
|
-
content: linesToContent(_concatInstanceProperty__default[
|
|
1270
|
+
return _concatInstanceProperty__default["default"](_context10 = [{
|
|
1271
|
+
content: linesToContent(_concatInstanceProperty__default["default"](_context11 = [header(1, "Examples"), ""]).call(_context11, _toConsumableArray__default["default"](_mapInstanceProperty__default["default"](sections).call(sections, function (_ref) {
|
|
1274
1272
|
var filename = _ref.filename,
|
|
1275
1273
|
title = _ref.title;
|
|
1276
1274
|
return "- " + link("./" + filename, title);
|
|
@@ -1285,7 +1283,7 @@ var mdRenderer = {
|
|
|
1285
1283
|
}
|
|
1286
1284
|
};
|
|
1287
1285
|
|
|
1288
|
-
var y = yargs__default[
|
|
1286
|
+
var y = yargs__default["default"].strict(true).usage("generate-example-index [options]").hide("version").config().help().option("assets-local-directory", {
|
|
1289
1287
|
default: "./examples/thumbnails",
|
|
1290
1288
|
describe: "The directory where assets will be written to.",
|
|
1291
1289
|
type: "string"
|
|
@@ -1376,7 +1374,7 @@ function joinURLs() {
|
|
|
1376
1374
|
urls[_key] = arguments[_key];
|
|
1377
1375
|
}
|
|
1378
1376
|
|
|
1379
|
-
return _mapInstanceProperty__default[
|
|
1377
|
+
return _mapInstanceProperty__default["default"](urls).call(urls, function (url) {
|
|
1380
1378
|
return (// Strip the parts of leading and trailing slashes if they have them.
|
|
1381
1379
|
url.replace(/^\/?(.*?)\/?$/, "$1")
|
|
1382
1380
|
);
|
|
@@ -1388,8 +1386,8 @@ function joinURLs() {
|
|
|
1388
1386
|
*/
|
|
1389
1387
|
|
|
1390
1388
|
function fixAbsoluteInputURL(baseURL, url) {
|
|
1391
|
-
return _startsWithInstanceProperty__default[
|
|
1392
|
-
baseURL + _sliceInstanceProperty__default[
|
|
1389
|
+
return _startsWithInstanceProperty__default["default"](url).call(url, "/") ? // Relative to the base URL. Base URL starts and URL ends with a slash.
|
|
1390
|
+
baseURL + _sliceInstanceProperty__default["default"](url).call(url, 1) : // Relative to some other point or absolute already.
|
|
1393
1391
|
url;
|
|
1394
1392
|
}
|
|
1395
1393
|
/**
|
|
@@ -1423,7 +1421,7 @@ function generatePaths(config, exampleAbsolutePath) {
|
|
|
1423
1421
|
function generateLocalWebPair(localRoot, webRoot, hash, prefix, extension) {
|
|
1424
1422
|
var _context, _context2;
|
|
1425
1423
|
|
|
1426
|
-
var filename = _concatInstanceProperty__default[
|
|
1424
|
+
var filename = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = "".concat(prefix, ".")).call(_context2, hash, ".")).call(_context, extension);
|
|
1427
1425
|
|
|
1428
1426
|
return {
|
|
1429
1427
|
local: path.resolve(localRoot, filename),
|
|
@@ -1433,15 +1431,15 @@ function generateLocalWebPair(localRoot, webRoot, hash, prefix, extension) {
|
|
|
1433
1431
|
|
|
1434
1432
|
var argv = parseArguments(); // Log the parsed configuration for debugging purposes.
|
|
1435
1433
|
|
|
1436
|
-
console.info("Configuration: ", _JSON$stringify__default[
|
|
1434
|
+
console.info("Configuration: ", _JSON$stringify__default["default"](argv, null, 2));
|
|
1437
1435
|
process.stdout.write("\n"); // Pageres uses quite a lot of listeners when invoked multiple times in
|
|
1438
1436
|
// parallel. This ensures there are no warnings about it.
|
|
1439
1437
|
|
|
1440
1438
|
process.setMaxListeners(40); // Resolve paths relative to PWD.
|
|
1441
1439
|
|
|
1442
1440
|
var screenshotScriptPath = typeof argv["screenshot-script"] === "string" ? path.resolve(argv["screenshot-script"]) : undefined;
|
|
1443
|
-
var mkdir = util__default[
|
|
1444
|
-
var readFile = util__default[
|
|
1441
|
+
var mkdir = util__default["default"].promisify(fs__default["default"].mkdir);
|
|
1442
|
+
var readFile = util__default["default"].promisify(fs__default["default"].readFile);
|
|
1445
1443
|
/**
|
|
1446
1444
|
* Extract and coerce a value from meta tag.
|
|
1447
1445
|
*
|
|
@@ -1458,7 +1456,7 @@ function getMeta(page, name, fallback) {
|
|
|
1458
1456
|
if (content == null) {
|
|
1459
1457
|
// No meta of this name exists in the page, use the fallback.
|
|
1460
1458
|
return fallback;
|
|
1461
|
-
} else if (!_Number$isNaN__default[
|
|
1459
|
+
} else if (!_Number$isNaN__default["default"](+content)) {
|
|
1462
1460
|
// Number.
|
|
1463
1461
|
return +content;
|
|
1464
1462
|
} else if (typeof content === "string") {
|
|
@@ -1494,10 +1492,10 @@ function lintExample(path, page) {
|
|
|
1494
1492
|
valid = false;
|
|
1495
1493
|
}
|
|
1496
1494
|
|
|
1497
|
-
var headTitle = _trimInstanceProperty__default[
|
|
1495
|
+
var headTitle = _trimInstanceProperty__default["default"](_context = page("head > title").text()).call(_context);
|
|
1498
1496
|
|
|
1499
|
-
var bodyTitle = _trimInstanceProperty__default[
|
|
1500
|
-
return $__default[
|
|
1497
|
+
var bodyTitle = _trimInstanceProperty__default["default"](_context2 = _mapInstanceProperty__default["default"](_context3 = page("#title > *")).call(_context3, function (_i, elem) {
|
|
1498
|
+
return $__default["default"](elem).text();
|
|
1501
1499
|
}).get().join(" | ")).call(_context2);
|
|
1502
1500
|
|
|
1503
1501
|
if (headTitle !== bodyTitle) {
|
|
@@ -1512,12 +1510,12 @@ function lintExample(path, page) {
|
|
|
1512
1510
|
return valid;
|
|
1513
1511
|
}
|
|
1514
1512
|
|
|
1515
|
-
_asyncToGenerator__default[
|
|
1513
|
+
_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3() {
|
|
1516
1514
|
var _context4, _context6;
|
|
1517
1515
|
|
|
1518
1516
|
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
1517
|
|
|
1520
|
-
return _regeneratorRuntime__default[
|
|
1518
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context24) {
|
|
1521
1519
|
while (1) {
|
|
1522
1520
|
switch (_context24.prev = _context24.next) {
|
|
1523
1521
|
case 0:
|
|
@@ -1528,14 +1526,14 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1528
1526
|
break;
|
|
1529
1527
|
}
|
|
1530
1528
|
|
|
1531
|
-
yargs__default[
|
|
1529
|
+
yargs__default["default"].parse("--help");
|
|
1532
1530
|
return _context24.abrupt("return");
|
|
1533
1531
|
|
|
1534
1532
|
case 4:
|
|
1535
1533
|
_context24.next = 6;
|
|
1536
|
-
return _Promise__default[
|
|
1537
|
-
var _ref2 = _asyncToGenerator__default[
|
|
1538
|
-
return _regeneratorRuntime__default[
|
|
1534
|
+
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 () {
|
|
1535
|
+
var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(path) {
|
|
1536
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context5) {
|
|
1539
1537
|
while (1) {
|
|
1540
1538
|
switch (_context5.prev = _context5.next) {
|
|
1541
1539
|
case 0:
|
|
@@ -1560,7 +1558,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1560
1558
|
case 6:
|
|
1561
1559
|
baseURL = argv["base-url"];
|
|
1562
1560
|
|
|
1563
|
-
if (_endsWithInstanceProperty__default[
|
|
1561
|
+
if (_endsWithInstanceProperty__default["default"](baseURL).call(baseURL, "/")) {
|
|
1564
1562
|
_context24.next = 9;
|
|
1565
1563
|
break;
|
|
1566
1564
|
}
|
|
@@ -1593,20 +1591,20 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1593
1591
|
examples: 0
|
|
1594
1592
|
};
|
|
1595
1593
|
skipped = [];
|
|
1596
|
-
_context24.t0 = _Promise__default[
|
|
1597
|
-
_context24.t1 = _mapInstanceProperty__default[
|
|
1594
|
+
_context24.t0 = _Promise__default["default"];
|
|
1595
|
+
_context24.t1 = _mapInstanceProperty__default["default"];
|
|
1598
1596
|
_context24.next = 18;
|
|
1599
|
-
return globby__default[
|
|
1597
|
+
return globby__default["default"](path.join(pathsConfig.page.local, "**/*.html"));
|
|
1600
1598
|
|
|
1601
1599
|
case 18:
|
|
1602
1600
|
_context24.t2 = _context6 = _context24.sent;
|
|
1603
1601
|
_context24.t3 = (0, _context24.t1)(_context24.t2).call(_context6, /*#__PURE__*/function () {
|
|
1604
|
-
var _ref3 = _asyncToGenerator__default[
|
|
1602
|
+
var _ref3 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(pagePath) {
|
|
1605
1603
|
var _context7;
|
|
1606
1604
|
|
|
1607
1605
|
var html, $page, pageDelay, pageTimeout, pageSelector, titles, _context9;
|
|
1608
1606
|
|
|
1609
|
-
return _regeneratorRuntime__default[
|
|
1607
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context10) {
|
|
1610
1608
|
while (1) {
|
|
1611
1609
|
switch (_context10.prev = _context10.next) {
|
|
1612
1610
|
case 0:
|
|
@@ -1615,7 +1613,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1615
1613
|
|
|
1616
1614
|
case 2:
|
|
1617
1615
|
html = _context10.sent;
|
|
1618
|
-
$page = $__default[
|
|
1616
|
+
$page = $__default["default"].load(html);
|
|
1619
1617
|
pageDelay = getMeta($page, "example-screenshot-delay", 6);
|
|
1620
1618
|
pageTimeout = getMeta($page, "example-screenshot-timeout", 60);
|
|
1621
1619
|
pageSelector = getMeta($page, "example-screenshot-selector", selector); // Is this an examples?
|
|
@@ -1635,15 +1633,15 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1635
1633
|
} // Body titles.
|
|
1636
1634
|
|
|
1637
1635
|
|
|
1638
|
-
titles = _mapInstanceProperty__default[
|
|
1636
|
+
titles = _mapInstanceProperty__default["default"](_context7 = $page("#title > *").get()).call(_context7, function (elem) {
|
|
1639
1637
|
var _context8;
|
|
1640
1638
|
|
|
1641
|
-
return _trimInstanceProperty__default[
|
|
1639
|
+
return _trimInstanceProperty__default["default"](_context8 = $page(elem).text()).call(_context8);
|
|
1642
1640
|
}); // Head title fallback.
|
|
1643
1641
|
|
|
1644
1642
|
if (titles.length < 2) {
|
|
1645
|
-
titles = _mapInstanceProperty__default[
|
|
1646
|
-
return _trimInstanceProperty__default[
|
|
1643
|
+
titles = _mapInstanceProperty__default["default"](_context9 = $page("head > title").text().split("|")).call(_context9, function (title) {
|
|
1644
|
+
return _trimInstanceProperty__default["default"](title).call(title);
|
|
1647
1645
|
});
|
|
1648
1646
|
} // File path fallback.
|
|
1649
1647
|
|
|
@@ -1663,7 +1661,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1663
1661
|
|
|
1664
1662
|
case 17:
|
|
1665
1663
|
// Put this example into the structure while creating any missing groups in the process.
|
|
1666
|
-
_reduceInstanceProperty__default[
|
|
1664
|
+
_reduceInstanceProperty__default["default"](titles).call(titles, function (acc, title, i, arr) {
|
|
1667
1665
|
while (acc[title] != null && acc[title].path != null) {
|
|
1668
1666
|
console.error("The following group already exists: ", titles);
|
|
1669
1667
|
title += "!";
|
|
@@ -1711,7 +1709,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1711
1709
|
case 22:
|
|
1712
1710
|
if (skipped.length) {
|
|
1713
1711
|
process.stdout.write("\n");
|
|
1714
|
-
console.info(_concatInstanceProperty__default[
|
|
1712
|
+
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
1713
|
}
|
|
1716
1714
|
|
|
1717
1715
|
if (!(stats.examples === 0)) {
|
|
@@ -1784,7 +1782,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1784
1782
|
case 45:
|
|
1785
1783
|
_context24.t7 = _context24.sent;
|
|
1786
1784
|
cummulativeReport = (0, _context24.t6)(_context24.t7);
|
|
1787
|
-
console.info(_concatInstanceProperty__default[
|
|
1785
|
+
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
1786
|
|
|
1789
1787
|
case 48:
|
|
1790
1788
|
if (!argv.index) {
|
|
@@ -1799,7 +1797,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1799
1797
|
case 52:
|
|
1800
1798
|
_context24.t9 = _context24.sent;
|
|
1801
1799
|
_cummulativeReport = (0, _context24.t8)(_context24.t9);
|
|
1802
|
-
console.info(_concatInstanceProperty__default[
|
|
1800
|
+
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
1801
|
|
|
1804
1802
|
case 55:
|
|
1805
1803
|
if (!argv.screenshots) {
|
|
@@ -1814,7 +1812,7 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1814
1812
|
case 59:
|
|
1815
1813
|
_context24.t11 = _context24.sent;
|
|
1816
1814
|
_cummulativeReport2 = (0, _context24.t10)(_context24.t11);
|
|
1817
|
-
console.info(_concatInstanceProperty__default[
|
|
1815
|
+
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
1816
|
|
|
1819
1817
|
case 62:
|
|
1820
1818
|
_context24.next = 64;
|
|
@@ -1825,16 +1823,16 @@ _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default
|
|
|
1825
1823
|
process.stdout.write("\n");
|
|
1826
1824
|
|
|
1827
1825
|
if (checks.fail === 0) {
|
|
1828
|
-
console.info(_concatInstanceProperty__default[
|
|
1826
|
+
console.info(_concatInstanceProperty__default["default"](_context18 = "Verification: ".concat(checks.okay, " passed (")).call(_context18, Math.round(checks.percentage), " %) passed."));
|
|
1829
1827
|
} else {
|
|
1830
1828
|
if (checks.percentage >= argv.verify) {
|
|
1831
|
-
console.info(_concatInstanceProperty__default[
|
|
1829
|
+
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
1830
|
} else {
|
|
1833
|
-
console.error(_concatInstanceProperty__default[
|
|
1831
|
+
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
1832
|
code = 3;
|
|
1835
1833
|
}
|
|
1836
1834
|
|
|
1837
|
-
_forEachInstanceProperty__default[
|
|
1835
|
+
_forEachInstanceProperty__default["default"](_context23 = checks.failPaths).call(_context23, function (path) {
|
|
1838
1836
|
console.error(path);
|
|
1839
1837
|
});
|
|
1840
1838
|
}
|