jqtree 1.6.3 → 1.7.1
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/.github/workflows/ci.yml +15 -21
- package/.github/workflows/codeql-analysis.yml +2 -2
- package/README.md +1 -1
- package/bower.json +10 -3
- package/config/production +2 -2
- package/config/{rollup.config.js → rollup.config.mjs} +3 -8
- package/docs/Gemfile.lock +34 -37
- package/docs/_config.yml +1 -1
- package/docs/_entries/10_changelog.md +13 -0
- package/docs/_entries/93_getnextnode.md +4 -1
- package/docs/_entries/{95_getpreviousnode.md → 95_getnextvisiblenode.md} +1 -1
- package/docs/_entries/96_getpreviousnode.md +0 -0
- package/docs/_entries/98_getpreviousvisiblenode.md +14 -0
- package/docs/package.json +7 -7
- package/docs/pnpm-lock.yaml +413 -265
- package/docs/static/bower.json +2 -2
- package/docs/static/bower_components/fontawesome/css/all.min.css +6 -2
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-v4compatibility.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-v4compatibility.woff2 +0 -0
- package/docs/static/bower_components/jquery/dist/jquery.js +944 -1121
- package/docs/static/bower_components/jquery/dist/jquery.min.js +2 -2
- package/docs/static/documentation.css +181 -159
- package/docs/static/example.css +0 -1
- package/docs/tree.jquery.js +3 -3
- package/lib/dataLoader.js +5 -31
- package/lib/dragAndDropHandler.js +40 -142
- package/lib/elementsRenderer.js +52 -72
- package/lib/keyHandler.js +8 -32
- package/lib/mouse.widget.js +24 -74
- package/lib/node.js +72 -134
- package/lib/nodeElement.js +24 -84
- package/lib/playwright/coverage.js +58 -97
- package/lib/playwright/playwright.test.js +148 -210
- package/lib/playwright/testUtils.js +116 -182
- package/lib/saveStateHandler.js +13 -62
- package/lib/scrollHandler.js +24 -77
- package/lib/selectNodeHandler.js +6 -25
- package/lib/simple.widget.js +20 -53
- package/lib/test/jqTree/accessibility.test.js +37 -0
- package/lib/test/jqTree/create.test.js +0 -4
- package/lib/test/jqTree/events.test.js +73 -84
- package/lib/test/jqTree/keyboard.test.js +0 -6
- package/lib/test/jqTree/loadOnDemand.test.js +84 -121
- package/lib/test/jqTree/methods.test.js +107 -150
- package/lib/test/jqTree/options.test.js +32 -54
- package/lib/test/node.test.js +134 -76
- package/lib/test/nodeUtil.test.js +0 -1
- package/lib/test/support/jqTreeMatchers.js +4 -9
- package/lib/test/support/setupTests.js +0 -4
- package/lib/test/support/testUtil.js +2 -11
- package/lib/test/support/treeStructure.js +0 -6
- package/lib/test/util.test.js +0 -1
- package/lib/tree.jquery.js +28 -239
- package/lib/util.js +0 -6
- package/lib/version.js +1 -1
- package/package.json +44 -47
- package/src/dragAndDropHandler.ts +24 -10
- package/src/elementsRenderer.ts +49 -42
- package/src/jqtreeOptions.ts +3 -3
- package/src/keyHandler.ts +3 -3
- package/src/mouse.widget.ts +12 -0
- package/src/node.ts +52 -16
- package/src/nodeElement.ts +27 -21
- package/src/saveStateHandler.ts +1 -1
- package/src/scrollHandler.ts +6 -2
- package/src/selectNodeHandler.ts +1 -1
- package/src/simple.widget.ts +2 -0
- package/src/test/.eslintrc +3 -1
- package/src/test/jqTree/accessibility.test.ts +25 -0
- package/src/test/jqTree/events.test.ts +79 -93
- package/src/test/jqTree/methods.test.ts +1 -1
- package/src/test/node.test.ts +152 -58
- package/src/test/nodeUtil.test.ts +1 -1
- package/src/tree.jquery.ts +7 -6
- package/src/version.ts +1 -1
- package/tree.jquery.debug.js +297 -904
- package/tree.jquery.debug.js.map +1 -1
- package/tree.jquery.js +3 -3
- package/tree.jquery.js.map +1 -1
- package/tsconfig.json +1 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.eot +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.svg +0 -3717
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.woff +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.eot +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.svg +0 -801
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.woff +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.eot +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.svg +0 -5028
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff +0 -0
- /package/docs/_entries/{96_getprevioussibling.md → 97_getprevioussibling.md} +0 -0
- /package/docs/_entries/{97_parent.md → 99_parent.md} +0 -0
package/lib/nodeElement.js
CHANGED
|
@@ -1,63 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.NodeElement = exports.FolderElement = exports.BorderDropHint = void 0;
|
|
9
|
-
|
|
10
7
|
var _node = require("./node");
|
|
11
|
-
|
|
8
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
12
9
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
13
|
-
|
|
14
10
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
-
|
|
16
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17
|
-
|
|
18
12
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
19
|
-
|
|
20
13
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21
|
-
|
|
22
14
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
23
|
-
|
|
24
15
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
|
-
|
|
26
16
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
27
|
-
|
|
28
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
29
|
-
|
|
17
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
30
18
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
19
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
21
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
34
22
|
var NodeElement = /*#__PURE__*/function () {
|
|
35
23
|
function NodeElement(node, treeWidget) {
|
|
36
24
|
_classCallCheck(this, NodeElement);
|
|
37
|
-
|
|
38
25
|
_defineProperty(this, "node", void 0);
|
|
39
|
-
|
|
40
26
|
_defineProperty(this, "$element", void 0);
|
|
41
|
-
|
|
42
27
|
_defineProperty(this, "treeWidget", void 0);
|
|
43
|
-
|
|
44
28
|
this.init(node, treeWidget);
|
|
45
29
|
}
|
|
46
|
-
|
|
47
30
|
_createClass(NodeElement, [{
|
|
48
31
|
key: "init",
|
|
49
32
|
value: function init(node, treeWidget) {
|
|
50
33
|
this.node = node;
|
|
51
34
|
this.treeWidget = treeWidget;
|
|
52
|
-
|
|
53
35
|
if (!node.element) {
|
|
54
36
|
var element = this.treeWidget.element.get(0);
|
|
55
|
-
|
|
56
37
|
if (element) {
|
|
57
38
|
node.element = element;
|
|
58
39
|
}
|
|
59
40
|
}
|
|
60
|
-
|
|
61
41
|
if (node.element) {
|
|
62
42
|
this.$element = jQuery(node.element);
|
|
63
43
|
}
|
|
@@ -75,13 +55,11 @@ var NodeElement = /*#__PURE__*/function () {
|
|
|
75
55
|
key: "select",
|
|
76
56
|
value: function select(mustSetFocus) {
|
|
77
57
|
var _this$treeWidget$opti;
|
|
78
|
-
|
|
79
58
|
var $li = this.getLi();
|
|
80
59
|
$li.addClass("jqtree-selected");
|
|
81
|
-
$li.attr("aria-selected", "true");
|
|
82
60
|
var $span = this.getSpan();
|
|
83
61
|
$span.attr("tabindex", (_this$treeWidget$opti = this.treeWidget.options.tabIndex) !== null && _this$treeWidget$opti !== void 0 ? _this$treeWidget$opti : null);
|
|
84
|
-
|
|
62
|
+
$span.attr("aria-selected", "true");
|
|
85
63
|
if (mustSetFocus) {
|
|
86
64
|
$span.trigger("focus");
|
|
87
65
|
}
|
|
@@ -91,10 +69,10 @@ var NodeElement = /*#__PURE__*/function () {
|
|
|
91
69
|
value: function deselect() {
|
|
92
70
|
var $li = this.getLi();
|
|
93
71
|
$li.removeClass("jqtree-selected");
|
|
94
|
-
$li.attr("aria-selected", "false");
|
|
95
72
|
var $span = this.getSpan();
|
|
96
73
|
$span.removeAttr("tabindex");
|
|
97
|
-
$span.
|
|
74
|
+
$span.attr("aria-selected", "false");
|
|
75
|
+
$span.trigger("blur");
|
|
98
76
|
}
|
|
99
77
|
}, {
|
|
100
78
|
key: "getUl",
|
|
@@ -117,64 +95,49 @@ var NodeElement = /*#__PURE__*/function () {
|
|
|
117
95
|
return position === _node.Position.Inside;
|
|
118
96
|
}
|
|
119
97
|
}]);
|
|
120
|
-
|
|
121
98
|
return NodeElement;
|
|
122
99
|
}();
|
|
123
|
-
|
|
124
100
|
exports.NodeElement = NodeElement;
|
|
125
|
-
|
|
126
101
|
var FolderElement = /*#__PURE__*/function (_NodeElement) {
|
|
127
102
|
_inherits(FolderElement, _NodeElement);
|
|
128
|
-
|
|
129
103
|
var _super = _createSuper(FolderElement);
|
|
130
|
-
|
|
131
104
|
function FolderElement() {
|
|
132
105
|
_classCallCheck(this, FolderElement);
|
|
133
|
-
|
|
134
106
|
return _super.apply(this, arguments);
|
|
135
107
|
}
|
|
136
|
-
|
|
137
108
|
_createClass(FolderElement, [{
|
|
138
109
|
key: "open",
|
|
139
110
|
value: function open(onFinished) {
|
|
140
111
|
var _this = this;
|
|
141
|
-
|
|
142
112
|
var slide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
143
113
|
var animationSpeed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "fast";
|
|
144
|
-
|
|
145
114
|
if (this.node.is_open) {
|
|
146
115
|
return;
|
|
147
116
|
}
|
|
148
|
-
|
|
149
117
|
this.node.is_open = true;
|
|
150
118
|
var $button = this.getButton();
|
|
151
119
|
$button.removeClass("jqtree-closed");
|
|
152
120
|
$button.html("");
|
|
153
121
|
var buttonEl = $button.get(0);
|
|
154
|
-
|
|
155
122
|
if (buttonEl) {
|
|
156
|
-
var
|
|
157
|
-
|
|
123
|
+
var openedIconElement = this.treeWidget.renderer.openedIconElement;
|
|
124
|
+
if (openedIconElement) {
|
|
125
|
+
var icon = openedIconElement.cloneNode(true);
|
|
126
|
+
buttonEl.appendChild(icon);
|
|
127
|
+
}
|
|
158
128
|
}
|
|
159
|
-
|
|
160
129
|
var doOpen = function doOpen() {
|
|
161
130
|
var $li = _this.getLi();
|
|
162
|
-
|
|
163
131
|
$li.removeClass("jqtree-closed");
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
$span.attr("aria-expanded", "true");
|
|
168
|
-
|
|
132
|
+
var $titleSpan = _this.getSpan();
|
|
133
|
+
$titleSpan.attr("aria-expanded", "true");
|
|
169
134
|
if (onFinished) {
|
|
170
135
|
onFinished(_this.node);
|
|
171
136
|
}
|
|
172
|
-
|
|
173
137
|
_this.treeWidget._triggerEvent("tree.open", {
|
|
174
138
|
node: _this.node
|
|
175
139
|
});
|
|
176
140
|
};
|
|
177
|
-
|
|
178
141
|
if (slide) {
|
|
179
142
|
this.getUl().slideDown(animationSpeed, doOpen);
|
|
180
143
|
} else {
|
|
@@ -186,39 +149,32 @@ var FolderElement = /*#__PURE__*/function (_NodeElement) {
|
|
|
186
149
|
key: "close",
|
|
187
150
|
value: function close() {
|
|
188
151
|
var _this2 = this;
|
|
189
|
-
|
|
190
152
|
var slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
191
153
|
var animationSpeed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "fast";
|
|
192
|
-
|
|
193
154
|
if (!this.node.is_open) {
|
|
194
155
|
return;
|
|
195
156
|
}
|
|
196
|
-
|
|
197
157
|
this.node.is_open = false;
|
|
198
158
|
var $button = this.getButton();
|
|
199
159
|
$button.addClass("jqtree-closed");
|
|
200
160
|
$button.html("");
|
|
201
161
|
var buttonEl = $button.get(0);
|
|
202
|
-
|
|
203
162
|
if (buttonEl) {
|
|
204
|
-
var
|
|
205
|
-
|
|
163
|
+
var closedIconElement = this.treeWidget.renderer.closedIconElement;
|
|
164
|
+
if (closedIconElement) {
|
|
165
|
+
var icon = closedIconElement.cloneNode(true);
|
|
166
|
+
buttonEl.appendChild(icon);
|
|
167
|
+
}
|
|
206
168
|
}
|
|
207
|
-
|
|
208
169
|
var doClose = function doClose() {
|
|
209
170
|
var $li = _this2.getLi();
|
|
210
|
-
|
|
211
171
|
$li.addClass("jqtree-closed");
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
$span.attr("aria-expanded", "false");
|
|
216
|
-
|
|
172
|
+
var $titleSpan = _this2.getSpan();
|
|
173
|
+
$titleSpan.attr("aria-expanded", "false");
|
|
217
174
|
_this2.treeWidget._triggerEvent("tree.close", {
|
|
218
175
|
node: _this2.node
|
|
219
176
|
});
|
|
220
177
|
};
|
|
221
|
-
|
|
222
178
|
if (slide) {
|
|
223
179
|
this.getUl().slideUp(animationSpeed, doClose);
|
|
224
180
|
} else {
|
|
@@ -237,18 +193,13 @@ var FolderElement = /*#__PURE__*/function (_NodeElement) {
|
|
|
237
193
|
return this.$element.children(".jqtree-element").find("a.jqtree-toggler");
|
|
238
194
|
}
|
|
239
195
|
}]);
|
|
240
|
-
|
|
241
196
|
return FolderElement;
|
|
242
197
|
}(NodeElement);
|
|
243
|
-
|
|
244
198
|
exports.FolderElement = FolderElement;
|
|
245
|
-
|
|
246
199
|
var BorderDropHint = /*#__PURE__*/function () {
|
|
247
200
|
function BorderDropHint($element, scrollLeft) {
|
|
248
201
|
_classCallCheck(this, BorderDropHint);
|
|
249
|
-
|
|
250
202
|
_defineProperty(this, "$hint", void 0);
|
|
251
|
-
|
|
252
203
|
var $div = $element.children(".jqtree-element");
|
|
253
204
|
var elWidth = $element.width() || 0;
|
|
254
205
|
var width = Math.max(elWidth + scrollLeft - 4, 0);
|
|
@@ -261,33 +212,24 @@ var BorderDropHint = /*#__PURE__*/function () {
|
|
|
261
212
|
height: height
|
|
262
213
|
});
|
|
263
214
|
}
|
|
264
|
-
|
|
265
215
|
_createClass(BorderDropHint, [{
|
|
266
216
|
key: "remove",
|
|
267
217
|
value: function remove() {
|
|
268
218
|
this.$hint.remove();
|
|
269
219
|
}
|
|
270
220
|
}]);
|
|
271
|
-
|
|
272
221
|
return BorderDropHint;
|
|
273
222
|
}();
|
|
274
|
-
|
|
275
223
|
exports.BorderDropHint = BorderDropHint;
|
|
276
|
-
|
|
277
224
|
var GhostDropHint = /*#__PURE__*/function () {
|
|
278
225
|
function GhostDropHint(node, $element, position) {
|
|
279
226
|
_classCallCheck(this, GhostDropHint);
|
|
280
|
-
|
|
281
227
|
_defineProperty(this, "$element", void 0);
|
|
282
|
-
|
|
283
228
|
_defineProperty(this, "node", void 0);
|
|
284
|
-
|
|
285
229
|
_defineProperty(this, "$ghost", void 0);
|
|
286
|
-
|
|
287
230
|
this.$element = $element;
|
|
288
231
|
this.node = node;
|
|
289
232
|
this.$ghost = jQuery("<li class=\"jqtree_common jqtree-ghost\"><span class=\"jqtree_common jqtree-circle\"></span>\n <span class=\"jqtree_common jqtree-line\"></span></li>");
|
|
290
|
-
|
|
291
233
|
if (position === _node.Position.After) {
|
|
292
234
|
this.moveAfter();
|
|
293
235
|
} else if (position === _node.Position.Before) {
|
|
@@ -300,7 +242,6 @@ var GhostDropHint = /*#__PURE__*/function () {
|
|
|
300
242
|
}
|
|
301
243
|
}
|
|
302
244
|
}
|
|
303
|
-
|
|
304
245
|
_createClass(GhostDropHint, [{
|
|
305
246
|
key: "remove",
|
|
306
247
|
value: function remove() {
|
|
@@ -319,8 +260,8 @@ var GhostDropHint = /*#__PURE__*/function () {
|
|
|
319
260
|
}, {
|
|
320
261
|
key: "moveInsideOpenFolder",
|
|
321
262
|
value: function moveInsideOpenFolder() {
|
|
322
|
-
var
|
|
323
|
-
|
|
263
|
+
var _this$node$children$;
|
|
264
|
+
var childElement = (_this$node$children$ = this.node.children[0]) === null || _this$node$children$ === void 0 ? void 0 : _this$node$children$.element;
|
|
324
265
|
if (childElement) {
|
|
325
266
|
jQuery(childElement).before(this.$ghost);
|
|
326
267
|
}
|
|
@@ -332,6 +273,5 @@ var GhostDropHint = /*#__PURE__*/function () {
|
|
|
332
273
|
this.$ghost.addClass("jqtree-inside");
|
|
333
274
|
}
|
|
334
275
|
}]);
|
|
335
|
-
|
|
336
276
|
return GhostDropHint;
|
|
337
277
|
}();
|
|
@@ -1,140 +1,101 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.saveCoverage = exports.initCoverage = void 0;
|
|
9
|
-
|
|
10
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
11
|
-
|
|
12
9
|
var _path = _interopRequireDefault(require("path"));
|
|
13
|
-
|
|
14
10
|
var _crypto = _interopRequireDefault(require("crypto"));
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
|
|
18
12
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(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; } } }; }
|
|
19
|
-
|
|
20
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
24
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
25
|
-
|
|
14
|
+
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; }
|
|
15
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
26
16
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
27
|
-
|
|
28
17
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
29
|
-
|
|
30
18
|
var istanbulCLIOutput = _path["default"].join(process.cwd(), ".nyc_output");
|
|
31
|
-
|
|
32
19
|
var generateUUID = function generateUUID() {
|
|
33
20
|
return _crypto["default"].randomBytes(16).toString("hex");
|
|
34
21
|
};
|
|
35
|
-
|
|
36
22
|
var initCoverage = /*#__PURE__*/function () {
|
|
37
23
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(context) {
|
|
38
24
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
39
|
-
while (1) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
case 4:
|
|
62
|
-
case "end":
|
|
63
|
-
return _context.stop();
|
|
64
|
-
}
|
|
25
|
+
while (1) switch (_context.prev = _context.next) {
|
|
26
|
+
case 0:
|
|
27
|
+
_context.next = 2;
|
|
28
|
+
return _fs["default"].promises.mkdir(istanbulCLIOutput, {
|
|
29
|
+
recursive: true
|
|
30
|
+
});
|
|
31
|
+
case 2:
|
|
32
|
+
_context.next = 4;
|
|
33
|
+
return context.exposeFunction("collectIstanbulCoverage", function (coverageJSON) {
|
|
34
|
+
if (!coverageJSON) {
|
|
35
|
+
console.log("No coverage");
|
|
36
|
+
} else {
|
|
37
|
+
var filename = _path["default"].join(istanbulCLIOutput, "playwright_coverage_".concat(generateUUID(), ".json"));
|
|
38
|
+
console.log("Writing coverage to ".concat(filename));
|
|
39
|
+
_fs["default"].writeFileSync(filename, coverageJSON);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
case 4:
|
|
43
|
+
case "end":
|
|
44
|
+
return _context.stop();
|
|
65
45
|
}
|
|
66
46
|
}, _callee);
|
|
67
47
|
}));
|
|
68
|
-
|
|
69
48
|
return function initCoverage(_x) {
|
|
70
49
|
return _ref.apply(this, arguments);
|
|
71
50
|
};
|
|
72
51
|
}();
|
|
73
|
-
|
|
74
52
|
exports.initCoverage = initCoverage;
|
|
75
|
-
|
|
76
53
|
var saveCoverage = /*#__PURE__*/function () {
|
|
77
54
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(context) {
|
|
78
55
|
var _iterator, _step, page;
|
|
79
|
-
|
|
80
56
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
81
|
-
while (1) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
case 3:
|
|
90
|
-
if ((_step = _iterator.n()).done) {
|
|
91
|
-
_context2.next = 9;
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
page = _step.value;
|
|
96
|
-
_context2.next = 7;
|
|
97
|
-
return page.evaluate(function () {
|
|
98
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
99
|
-
var anyWindow = window; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
100
|
-
|
|
101
|
-
var coverageData = anyWindow.__coverage__; // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
102
|
-
|
|
103
|
-
anyWindow.collectIstanbulCoverage(JSON.stringify(coverageData));
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
case 7:
|
|
107
|
-
_context2.next = 3;
|
|
57
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
58
|
+
case 0:
|
|
59
|
+
_iterator = _createForOfIteratorHelper(context.pages());
|
|
60
|
+
_context2.prev = 1;
|
|
61
|
+
_iterator.s();
|
|
62
|
+
case 3:
|
|
63
|
+
if ((_step = _iterator.n()).done) {
|
|
64
|
+
_context2.next = 9;
|
|
108
65
|
break;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
66
|
+
}
|
|
67
|
+
page = _step.value;
|
|
68
|
+
_context2.next = 7;
|
|
69
|
+
return page.evaluate(function () {
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
71
|
+
var anyWindow = window;
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
73
|
+
var coverageData = anyWindow.__coverage__;
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
75
|
+
anyWindow.collectIstanbulCoverage(JSON.stringify(coverageData));
|
|
76
|
+
});
|
|
77
|
+
case 7:
|
|
78
|
+
_context2.next = 3;
|
|
79
|
+
break;
|
|
80
|
+
case 9:
|
|
81
|
+
_context2.next = 14;
|
|
82
|
+
break;
|
|
83
|
+
case 11:
|
|
84
|
+
_context2.prev = 11;
|
|
85
|
+
_context2.t0 = _context2["catch"](1);
|
|
86
|
+
_iterator.e(_context2.t0);
|
|
87
|
+
case 14:
|
|
88
|
+
_context2.prev = 14;
|
|
89
|
+
_iterator.f();
|
|
90
|
+
return _context2.finish(14);
|
|
91
|
+
case 17:
|
|
92
|
+
case "end":
|
|
93
|
+
return _context2.stop();
|
|
131
94
|
}
|
|
132
95
|
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
133
96
|
}));
|
|
134
|
-
|
|
135
97
|
return function saveCoverage(_x2) {
|
|
136
98
|
return _ref2.apply(this, arguments);
|
|
137
99
|
};
|
|
138
100
|
}();
|
|
139
|
-
|
|
140
101
|
exports.saveCoverage = saveCoverage;
|