@jsenv/core 36.2.1 → 36.3.0
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/dist/babel_helpers/AsyncGenerator/AsyncGenerator.js +45 -35
- package/dist/babel_helpers/AwaitValue/AwaitValue.js +3 -3
- package/dist/babel_helpers/applyDecoratedDescriptor/applyDecoratedDescriptor.js +13 -13
- package/dist/babel_helpers/applyDecs/applyDecs.js +227 -42
- package/dist/babel_helpers/applyDecs2203/applyDecs2203.js +559 -418
- package/dist/babel_helpers/applyDecs2203R/applyDecs2203R.js +235 -87
- package/dist/babel_helpers/applyDecs2301/applyDecs2301.js +591 -456
- package/dist/babel_helpers/applyDecs2305/applyDecs2305.js +681 -0
- package/dist/babel_helpers/arrayLikeToArray/arrayLikeToArray.js +5 -5
- package/dist/babel_helpers/arrayWithHoles/arrayWithHoles.js +3 -3
- package/dist/babel_helpers/arrayWithoutHoles/arrayWithoutHoles.js +4 -4
- package/dist/babel_helpers/assertThisInitialized/assertThisInitialized.js +4 -4
- package/dist/babel_helpers/asyncGeneratorDelegate/asyncGeneratorDelegate.js +12 -4
- package/dist/babel_helpers/asyncIterator/asyncIterator.js +13 -11
- package/dist/babel_helpers/asyncToGenerator/asyncToGenerator.js +18 -17
- package/dist/babel_helpers/awaitAsyncGenerator/awaitAsyncGenerator.js +2 -1
- package/dist/babel_helpers/checkInRHS/checkInRHS.js +8 -5
- package/dist/babel_helpers/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +7 -7
- package/dist/babel_helpers/classApplyDescriptorGet/classApplyDescriptorGet.js +3 -3
- package/dist/babel_helpers/classApplyDescriptorSet/classApplyDescriptorSet.js +4 -4
- package/dist/babel_helpers/classCallCheck/classCallCheck.js +2 -2
- package/dist/babel_helpers/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +2 -2
- package/dist/babel_helpers/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +2 -2
- package/dist/babel_helpers/classExtractFieldDescriptor/classExtractFieldDescriptor.js +3 -3
- package/dist/babel_helpers/classNameTDZError/classNameTDZError.js +2 -2
- package/dist/babel_helpers/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +6 -5
- package/dist/babel_helpers/classPrivateFieldGet/classPrivateFieldGet.js +6 -5
- package/dist/babel_helpers/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +3 -3
- package/dist/babel_helpers/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +3 -3
- package/dist/babel_helpers/classPrivateFieldSet/classPrivateFieldSet.js +7 -6
- package/dist/babel_helpers/classPrivateMethodGet/classPrivateMethodGet.js +3 -3
- package/dist/babel_helpers/classPrivateMethodSet/classPrivateMethodSet.js +2 -2
- package/dist/babel_helpers/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +8 -7
- package/dist/babel_helpers/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +15 -9
- package/dist/babel_helpers/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +5 -4
- package/dist/babel_helpers/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +2 -2
- package/dist/babel_helpers/construct/construct.js +10 -9
- package/dist/babel_helpers/createClass/createClass.js +2 -3
- package/dist/babel_helpers/createForOfIteratorHelper/createForOfIteratorHelper.js +30 -29
- package/dist/babel_helpers/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +18 -16
- package/dist/babel_helpers/createRawReactElement/createRawReactElement.js +23 -17
- package/dist/babel_helpers/createSuper/createSuper.js +14 -12
- package/dist/babel_helpers/decorate/decorate.js +242 -210
- package/dist/babel_helpers/defaults/defaults.js +6 -6
- package/dist/babel_helpers/defineAccessor/defineAccessor.js +1 -4
- package/dist/babel_helpers/defineEnumerableProperties/defineEnumerableProperties.js +12 -12
- package/dist/babel_helpers/defineProperty/defineProperty.js +7 -6
- package/dist/babel_helpers/extends/extends.js +5 -4
- package/dist/babel_helpers/get/get.js +2 -1
- package/dist/babel_helpers/getPrototypeOf/getPrototypeOf.js +4 -3
- package/dist/babel_helpers/inherits/inherits.js +3 -4
- package/dist/babel_helpers/inheritsLoose/inheritsLoose.js +6 -5
- package/dist/babel_helpers/initializerDefineProperty/initializerDefineProperty.js +4 -4
- package/dist/babel_helpers/initializerWarningHelper/initializerWarningHelper.js +5 -2
- package/dist/babel_helpers/instanceof/instanceof.js +3 -3
- package/dist/babel_helpers/interopRequireDefault/interopRequireDefault.js +2 -4
- package/dist/babel_helpers/interopRequireWildcard/interopRequireWildcard.js +19 -21
- package/dist/babel_helpers/isNativeFunction/isNativeFunction.js +2 -2
- package/dist/babel_helpers/isNativeReflectConstruct/isNativeReflectConstruct.js +7 -7
- package/dist/babel_helpers/iterableToArray/iterableToArray.js +6 -2
- package/dist/babel_helpers/iterableToArrayLimit/iterableToArrayLimit.js +6 -1
- package/dist/babel_helpers/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +6 -2
- package/dist/babel_helpers/jsx/jsx.js +14 -7
- package/dist/babel_helpers/maybeArrayLike/maybeArrayLike.js +6 -5
- package/dist/babel_helpers/newArrowCheck/newArrowCheck.js +2 -2
- package/dist/babel_helpers/nonIterableRest/nonIterableRest.js +5 -3
- package/dist/babel_helpers/nonIterableSpread/nonIterableSpread.js +5 -3
- package/dist/babel_helpers/objectDestructuringEmpty/objectDestructuringEmpty.js +2 -2
- package/dist/babel_helpers/objectSpread/objectSpread.js +15 -12
- package/dist/babel_helpers/objectSpread2/objectSpread2.js +7 -2
- package/dist/babel_helpers/objectWithoutProperties/objectWithoutProperties.js +15 -13
- package/dist/babel_helpers/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +11 -11
- package/dist/babel_helpers/possibleConstructorReturn/possibleConstructorReturn.js +7 -6
- package/dist/babel_helpers/readOnlyError/readOnlyError.js +2 -2
- package/dist/babel_helpers/regeneratorRuntime/regeneratorRuntime.js +124 -73
- package/dist/babel_helpers/set/set.js +23 -20
- package/dist/babel_helpers/setPrototypeOf/setPrototypeOf.js +6 -5
- package/dist/babel_helpers/skipFirstGeneratorNext/skipFirstGeneratorNext.js +5 -5
- package/dist/babel_helpers/slicedToArray/slicedToArray.js +10 -5
- package/dist/babel_helpers/slicedToArrayLoose/slicedToArrayLoose.js +12 -6
- package/dist/babel_helpers/superPropBase/superPropBase.js +6 -5
- package/dist/babel_helpers/taggedTemplateLiteral/taggedTemplateLiteral.js +7 -7
- package/dist/babel_helpers/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +4 -4
- package/dist/babel_helpers/tdz/tdz.js +2 -2
- package/dist/babel_helpers/temporalRef/temporalRef.js +5 -4
- package/dist/babel_helpers/temporalUndefined/temporalUndefined.js +1 -1
- package/dist/babel_helpers/toArray/toArray.js +10 -5
- package/dist/babel_helpers/toConsumableArray/toConsumableArray.js +10 -5
- package/dist/babel_helpers/toPrimitive/toPrimitive.js +7 -7
- package/dist/babel_helpers/toPropertyKey/toPropertyKey.js +5 -4
- package/dist/babel_helpers/typeof/typeof.js +14 -5
- package/dist/babel_helpers/unsupportedIterableToArray/unsupportedIterableToArray.js +10 -8
- package/dist/babel_helpers/wrapAsyncGenerator/wrapAsyncGenerator.js +5 -4
- package/dist/babel_helpers/wrapNativeSuper/wrapNativeSuper.js +17 -15
- package/dist/babel_helpers/wrapRegExp/wrapRegExp.js +19 -8
- package/dist/babel_helpers/writeOnlyError/writeOnlyError.js +2 -2
- package/dist/js/autoreload.js +148 -133
- package/dist/js/import_meta_hot.js +19 -13
- package/dist/js/inline_content.js +1 -3
- package/dist/js/new_stylesheet.js +119 -60
- package/dist/js/regenerator_runtime.js +204 -102
- package/dist/js/ribbon.js +11 -6
- package/dist/js/server_events_client.js +122 -98
- package/dist/js/ws.js +968 -265
- package/dist/jsenv_core.js +8513 -6162
- package/package.json +9 -9
- package/src/build/build.js +497 -486
- package/src/build/version_mappings_injection.js +21 -44
- package/src/kitchen/errors.js +2 -2
- package/src/kitchen/fetched_content_compliance.js +6 -2
- package/src/kitchen/kitchen.js +285 -80
- package/src/kitchen/prepend_content.js +135 -0
- package/src/kitchen/url_graph/url_graph_visitor.js +99 -0
- package/src/kitchen/url_graph/url_info_transformations.js +140 -21
- package/src/kitchen/url_graph.js +59 -29
- package/src/plugins/autoreload/jsenv_plugin_hmr.js +1 -2
- package/src/plugins/import_meta_hot/jsenv_plugin_import_meta_hot.js +2 -2
- package/src/plugins/importmap/jsenv_plugin_importmap.js +2 -2
- package/src/plugins/inlining/jsenv_plugin_inlining_as_data_url.js +1 -1
- package/src/plugins/reference_analysis/html/jsenv_plugin_html_reference_analysis.js +44 -23
- package/src/plugins/reference_analysis/js/jsenv_plugin_js_reference_analysis.js +2 -1
- package/dist/js/global_this_js_classic.js +0 -24
- package/dist/js/global_this_js_module.js +0 -20
- package/src/build/graph_utils.js +0 -34
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
var runtime = function (exports) {
|
|
8
|
+
var runtime = (function (exports) {
|
|
9
9
|
|
|
10
10
|
var Op = Object.prototype;
|
|
11
11
|
var hasOwn = Op.hasOwnProperty;
|
|
@@ -14,6 +14,7 @@ var runtime = function (exports) {
|
|
|
14
14
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
15
15
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
16
16
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
17
|
+
|
|
17
18
|
function define(obj, key, value) {
|
|
18
19
|
Object.defineProperty(obj, key, {
|
|
19
20
|
value: value,
|
|
@@ -27,10 +28,11 @@ var runtime = function (exports) {
|
|
|
27
28
|
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
28
29
|
define({}, "");
|
|
29
30
|
} catch (err) {
|
|
30
|
-
define = function
|
|
31
|
+
define = function(obj, key, value) {
|
|
31
32
|
return obj[key] = value;
|
|
32
33
|
};
|
|
33
34
|
}
|
|
35
|
+
|
|
34
36
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
35
37
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
36
38
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
@@ -40,6 +42,7 @@ var runtime = function (exports) {
|
|
|
40
42
|
// The ._invoke method unifies the implementations of the .next,
|
|
41
43
|
// .throw, and .return methods.
|
|
42
44
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
45
|
+
|
|
43
46
|
return generator;
|
|
44
47
|
}
|
|
45
48
|
exports.wrap = wrap;
|
|
@@ -56,17 +59,12 @@ var runtime = function (exports) {
|
|
|
56
59
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|
57
60
|
function tryCatch(fn, obj, arg) {
|
|
58
61
|
try {
|
|
59
|
-
return {
|
|
60
|
-
type: "normal",
|
|
61
|
-
arg: fn.call(obj, arg)
|
|
62
|
-
};
|
|
62
|
+
return { type: "normal", arg: fn.call(obj, arg) };
|
|
63
63
|
} catch (err) {
|
|
64
|
-
return {
|
|
65
|
-
type: "throw",
|
|
66
|
-
arg: err
|
|
67
|
-
};
|
|
64
|
+
return { type: "throw", arg: err };
|
|
68
65
|
}
|
|
69
66
|
}
|
|
67
|
+
|
|
70
68
|
var GenStateSuspendedStart = "suspendedStart";
|
|
71
69
|
var GenStateSuspendedYield = "suspendedYield";
|
|
72
70
|
var GenStateExecuting = "executing";
|
|
@@ -90,35 +88,48 @@ var runtime = function (exports) {
|
|
|
90
88
|
IteratorPrototype[iteratorSymbol] = function () {
|
|
91
89
|
return this;
|
|
92
90
|
};
|
|
91
|
+
|
|
93
92
|
var getProto = Object.getPrototypeOf;
|
|
94
93
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
95
|
-
if (NativeIteratorPrototype &&
|
|
94
|
+
if (NativeIteratorPrototype &&
|
|
95
|
+
NativeIteratorPrototype !== Op &&
|
|
96
|
+
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
96
97
|
// This environment has a native %IteratorPrototype%; use it instead
|
|
97
98
|
// of the polyfill.
|
|
98
99
|
IteratorPrototype = NativeIteratorPrototype;
|
|
99
100
|
}
|
|
100
|
-
|
|
101
|
+
|
|
102
|
+
var Gp = GeneratorFunctionPrototype.prototype =
|
|
103
|
+
Generator.prototype = Object.create(IteratorPrototype);
|
|
101
104
|
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
|
102
105
|
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
|
103
|
-
GeneratorFunction.displayName = define(
|
|
106
|
+
GeneratorFunction.displayName = define(
|
|
107
|
+
GeneratorFunctionPrototype,
|
|
108
|
+
toStringTagSymbol,
|
|
109
|
+
"GeneratorFunction"
|
|
110
|
+
);
|
|
104
111
|
|
|
105
112
|
// Helper for defining the .next, .throw, and .return methods of the
|
|
106
113
|
// Iterator interface in terms of a single ._invoke method.
|
|
107
114
|
function defineIteratorMethods(prototype) {
|
|
108
|
-
["next", "throw", "return"].forEach(function
|
|
109
|
-
define(prototype, method, function
|
|
115
|
+
["next", "throw", "return"].forEach(function(method) {
|
|
116
|
+
define(prototype, method, function(arg) {
|
|
110
117
|
return this._invoke(method, arg);
|
|
111
118
|
});
|
|
112
119
|
});
|
|
113
120
|
}
|
|
114
|
-
|
|
121
|
+
|
|
122
|
+
exports.isGeneratorFunction = function(genFun) {
|
|
115
123
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
116
|
-
return ctor
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
124
|
+
return ctor
|
|
125
|
+
? ctor === GeneratorFunction ||
|
|
126
|
+
// For the native GeneratorFunction constructor, the best we can
|
|
127
|
+
// do is to check its .name property.
|
|
128
|
+
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
|
129
|
+
: false;
|
|
120
130
|
};
|
|
121
|
-
|
|
131
|
+
|
|
132
|
+
exports.mark = function(genFun) {
|
|
122
133
|
if (Object.setPrototypeOf) {
|
|
123
134
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
124
135
|
} else {
|
|
@@ -133,11 +144,10 @@ var runtime = function (exports) {
|
|
|
133
144
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
134
145
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
135
146
|
// meant to be awaited.
|
|
136
|
-
exports.awrap = function
|
|
137
|
-
return {
|
|
138
|
-
__await: arg
|
|
139
|
-
};
|
|
147
|
+
exports.awrap = function(arg) {
|
|
148
|
+
return { __await: arg };
|
|
140
149
|
};
|
|
150
|
+
|
|
141
151
|
function AsyncIterator(generator, PromiseImpl) {
|
|
142
152
|
function invoke(method, arg, resolve, reject) {
|
|
143
153
|
var record = tryCatch(generator[method], generator, arg);
|
|
@@ -146,56 +156,65 @@ var runtime = function (exports) {
|
|
|
146
156
|
} else {
|
|
147
157
|
var result = record.arg;
|
|
148
158
|
var value = result.value;
|
|
149
|
-
if (value &&
|
|
150
|
-
|
|
159
|
+
if (value &&
|
|
160
|
+
typeof value === "object" &&
|
|
161
|
+
hasOwn.call(value, "__await")) {
|
|
162
|
+
return PromiseImpl.resolve(value.__await).then(function(value) {
|
|
151
163
|
invoke("next", value, resolve, reject);
|
|
152
|
-
}, function
|
|
164
|
+
}, function(err) {
|
|
153
165
|
invoke("throw", err, resolve, reject);
|
|
154
166
|
});
|
|
155
167
|
}
|
|
156
|
-
|
|
168
|
+
|
|
169
|
+
return PromiseImpl.resolve(value).then(function(unwrapped) {
|
|
157
170
|
// When a yielded Promise is resolved, its final value becomes
|
|
158
171
|
// the .value of the Promise<{value,done}> result for the
|
|
159
172
|
// current iteration.
|
|
160
173
|
result.value = unwrapped;
|
|
161
174
|
resolve(result);
|
|
162
|
-
}, function
|
|
175
|
+
}, function(error) {
|
|
163
176
|
// If a rejected Promise was yielded, throw the rejection back
|
|
164
177
|
// into the async generator function so it can be handled there.
|
|
165
178
|
return invoke("throw", error, resolve, reject);
|
|
166
179
|
});
|
|
167
180
|
}
|
|
168
181
|
}
|
|
182
|
+
|
|
169
183
|
var previousPromise;
|
|
184
|
+
|
|
170
185
|
function enqueue(method, arg) {
|
|
171
186
|
function callInvokeWithMethodAndArg() {
|
|
172
|
-
return new PromiseImpl(function
|
|
187
|
+
return new PromiseImpl(function(resolve, reject) {
|
|
173
188
|
invoke(method, arg, resolve, reject);
|
|
174
189
|
});
|
|
175
190
|
}
|
|
191
|
+
|
|
176
192
|
return previousPromise =
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
// If enqueue has been called before, then we want to wait until
|
|
194
|
+
// all previous Promises have been resolved before calling invoke,
|
|
195
|
+
// so that results are always delivered in the correct order. If
|
|
196
|
+
// enqueue has not been called before, then it is important to
|
|
197
|
+
// call invoke immediately, without waiting on a callback to fire,
|
|
198
|
+
// so that the async generator function has the opportunity to do
|
|
199
|
+
// any necessary setup in a predictable way. This predictability
|
|
200
|
+
// is why the Promise constructor synchronously invokes its
|
|
201
|
+
// executor callback, and why async functions synchronously
|
|
202
|
+
// execute code before the first await. Since we implement simple
|
|
203
|
+
// async functions in terms of async generators, it is especially
|
|
204
|
+
// important to get this right, even though it requires care.
|
|
205
|
+
previousPromise ? previousPromise.then(
|
|
206
|
+
callInvokeWithMethodAndArg,
|
|
207
|
+
// Avoid propagating failures to Promises returned by later
|
|
208
|
+
// invocations of the iterator.
|
|
209
|
+
callInvokeWithMethodAndArg
|
|
210
|
+
) : callInvokeWithMethodAndArg();
|
|
193
211
|
}
|
|
194
212
|
|
|
195
213
|
// Define the unified helper method that is used to implement .next,
|
|
196
214
|
// .throw, and .return (see defineIteratorMethods).
|
|
197
215
|
this._invoke = enqueue;
|
|
198
216
|
}
|
|
217
|
+
|
|
199
218
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
200
219
|
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
|
201
220
|
return this;
|
|
@@ -205,20 +224,29 @@ var runtime = function (exports) {
|
|
|
205
224
|
// Note that simple async functions are implemented on top of
|
|
206
225
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
207
226
|
// the final result produced by the iterator.
|
|
208
|
-
exports.async = function
|
|
227
|
+
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
209
228
|
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
229
|
+
|
|
230
|
+
var iter = new AsyncIterator(
|
|
231
|
+
wrap(innerFn, outerFn, self, tryLocsList),
|
|
232
|
+
PromiseImpl
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
return exports.isGeneratorFunction(outerFn)
|
|
236
|
+
? iter // If outerFn is a generator, return the full iterator.
|
|
237
|
+
: iter.next().then(function(result) {
|
|
238
|
+
return result.done ? result.value : iter.next();
|
|
239
|
+
});
|
|
215
240
|
};
|
|
241
|
+
|
|
216
242
|
function makeInvokeMethod(innerFn, self, context) {
|
|
217
243
|
var state = GenStateSuspendedStart;
|
|
244
|
+
|
|
218
245
|
return function invoke(method, arg) {
|
|
219
246
|
if (state === GenStateExecuting) {
|
|
220
247
|
throw new Error("Generator is already running");
|
|
221
248
|
}
|
|
249
|
+
|
|
222
250
|
if (state === GenStateCompleted) {
|
|
223
251
|
if (method === "throw") {
|
|
224
252
|
throw arg;
|
|
@@ -228,8 +256,10 @@ var runtime = function (exports) {
|
|
|
228
256
|
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
229
257
|
return doneResult();
|
|
230
258
|
}
|
|
259
|
+
|
|
231
260
|
context.method = method;
|
|
232
261
|
context.arg = arg;
|
|
262
|
+
|
|
233
263
|
while (true) {
|
|
234
264
|
var delegate = context.delegate;
|
|
235
265
|
if (delegate) {
|
|
@@ -239,32 +269,43 @@ var runtime = function (exports) {
|
|
|
239
269
|
return delegateResult;
|
|
240
270
|
}
|
|
241
271
|
}
|
|
272
|
+
|
|
242
273
|
if (context.method === "next") {
|
|
243
274
|
// Setting context._sent for legacy support of Babel's
|
|
244
275
|
// function.sent implementation.
|
|
245
276
|
context.sent = context._sent = context.arg;
|
|
277
|
+
|
|
246
278
|
} else if (context.method === "throw") {
|
|
247
279
|
if (state === GenStateSuspendedStart) {
|
|
248
280
|
state = GenStateCompleted;
|
|
249
281
|
throw context.arg;
|
|
250
282
|
}
|
|
283
|
+
|
|
251
284
|
context.dispatchException(context.arg);
|
|
285
|
+
|
|
252
286
|
} else if (context.method === "return") {
|
|
253
287
|
context.abrupt("return", context.arg);
|
|
254
288
|
}
|
|
289
|
+
|
|
255
290
|
state = GenStateExecuting;
|
|
291
|
+
|
|
256
292
|
var record = tryCatch(innerFn, self, context);
|
|
257
293
|
if (record.type === "normal") {
|
|
258
294
|
// If an exception is thrown from innerFn, we leave state ===
|
|
259
295
|
// GenStateExecuting and loop back for another invocation.
|
|
260
|
-
state = context.done
|
|
296
|
+
state = context.done
|
|
297
|
+
? GenStateCompleted
|
|
298
|
+
: GenStateSuspendedYield;
|
|
299
|
+
|
|
261
300
|
if (record.arg === ContinueSentinel) {
|
|
262
301
|
continue;
|
|
263
302
|
}
|
|
303
|
+
|
|
264
304
|
return {
|
|
265
305
|
value: record.arg,
|
|
266
306
|
done: context.done
|
|
267
307
|
};
|
|
308
|
+
|
|
268
309
|
} else if (record.type === "throw") {
|
|
269
310
|
state = GenStateCompleted;
|
|
270
311
|
// Dispatch the exception by looping back around to the
|
|
@@ -286,6 +327,7 @@ var runtime = function (exports) {
|
|
|
286
327
|
// A .throw or .return when the delegate iterator has no .throw
|
|
287
328
|
// method always terminates the yield* loop.
|
|
288
329
|
context.delegate = null;
|
|
330
|
+
|
|
289
331
|
if (context.method === "throw") {
|
|
290
332
|
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
291
333
|
if (delegate.iterator["return"]) {
|
|
@@ -294,31 +336,40 @@ var runtime = function (exports) {
|
|
|
294
336
|
context.method = "return";
|
|
295
337
|
context.arg = undefined$1;
|
|
296
338
|
maybeInvokeDelegate(delegate, context);
|
|
339
|
+
|
|
297
340
|
if (context.method === "throw") {
|
|
298
341
|
// If maybeInvokeDelegate(context) changed context.method from
|
|
299
342
|
// "return" to "throw", let that override the TypeError below.
|
|
300
343
|
return ContinueSentinel;
|
|
301
344
|
}
|
|
302
345
|
}
|
|
346
|
+
|
|
303
347
|
context.method = "throw";
|
|
304
|
-
context.arg = new TypeError(
|
|
348
|
+
context.arg = new TypeError(
|
|
349
|
+
"The iterator does not provide a 'throw' method");
|
|
305
350
|
}
|
|
351
|
+
|
|
306
352
|
return ContinueSentinel;
|
|
307
353
|
}
|
|
354
|
+
|
|
308
355
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
356
|
+
|
|
309
357
|
if (record.type === "throw") {
|
|
310
358
|
context.method = "throw";
|
|
311
359
|
context.arg = record.arg;
|
|
312
360
|
context.delegate = null;
|
|
313
361
|
return ContinueSentinel;
|
|
314
362
|
}
|
|
363
|
+
|
|
315
364
|
var info = record.arg;
|
|
316
|
-
|
|
365
|
+
|
|
366
|
+
if (! info) {
|
|
317
367
|
context.method = "throw";
|
|
318
368
|
context.arg = new TypeError("iterator result is not an object");
|
|
319
369
|
context.delegate = null;
|
|
320
370
|
return ContinueSentinel;
|
|
321
371
|
}
|
|
372
|
+
|
|
322
373
|
if (info.done) {
|
|
323
374
|
// Assign the result of the finished delegate to the temporary
|
|
324
375
|
// variable specified by delegate.resultName (see delegateYield).
|
|
@@ -337,6 +388,7 @@ var runtime = function (exports) {
|
|
|
337
388
|
context.method = "next";
|
|
338
389
|
context.arg = undefined$1;
|
|
339
390
|
}
|
|
391
|
+
|
|
340
392
|
} else {
|
|
341
393
|
// Re-yield the result returned by the delegate method.
|
|
342
394
|
return info;
|
|
@@ -351,6 +403,7 @@ var runtime = function (exports) {
|
|
|
351
403
|
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
352
404
|
// unified ._invoke helper method.
|
|
353
405
|
defineIteratorMethods(Gp);
|
|
406
|
+
|
|
354
407
|
define(Gp, toStringTagSymbol, "Generator");
|
|
355
408
|
|
|
356
409
|
// A Generator should always return itself as the iterator object when the
|
|
@@ -358,42 +411,46 @@ var runtime = function (exports) {
|
|
|
358
411
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
359
412
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
360
413
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
361
|
-
Gp[iteratorSymbol] = function
|
|
414
|
+
Gp[iteratorSymbol] = function() {
|
|
362
415
|
return this;
|
|
363
416
|
};
|
|
364
|
-
|
|
417
|
+
|
|
418
|
+
Gp.toString = function() {
|
|
365
419
|
return "[object Generator]";
|
|
366
420
|
};
|
|
421
|
+
|
|
367
422
|
function pushTryEntry(locs) {
|
|
368
|
-
var entry = {
|
|
369
|
-
|
|
370
|
-
};
|
|
423
|
+
var entry = { tryLoc: locs[0] };
|
|
424
|
+
|
|
371
425
|
if (1 in locs) {
|
|
372
426
|
entry.catchLoc = locs[1];
|
|
373
427
|
}
|
|
428
|
+
|
|
374
429
|
if (2 in locs) {
|
|
375
430
|
entry.finallyLoc = locs[2];
|
|
376
431
|
entry.afterLoc = locs[3];
|
|
377
432
|
}
|
|
433
|
+
|
|
378
434
|
this.tryEntries.push(entry);
|
|
379
435
|
}
|
|
436
|
+
|
|
380
437
|
function resetTryEntry(entry) {
|
|
381
438
|
var record = entry.completion || {};
|
|
382
439
|
record.type = "normal";
|
|
383
440
|
delete record.arg;
|
|
384
441
|
entry.completion = record;
|
|
385
442
|
}
|
|
443
|
+
|
|
386
444
|
function Context(tryLocsList) {
|
|
387
445
|
// The root entry object (effectively a try statement without a catch
|
|
388
446
|
// or a finally block) gives us a place to store values thrown from
|
|
389
447
|
// locations where there is no enclosing try statement.
|
|
390
|
-
this.tryEntries = [{
|
|
391
|
-
tryLoc: "root"
|
|
392
|
-
}];
|
|
448
|
+
this.tryEntries = [{ tryLoc: "root" }];
|
|
393
449
|
tryLocsList.forEach(pushTryEntry, this);
|
|
394
450
|
this.reset(true);
|
|
395
451
|
}
|
|
396
|
-
|
|
452
|
+
|
|
453
|
+
exports.keys = function(object) {
|
|
397
454
|
var keys = [];
|
|
398
455
|
for (var key in object) {
|
|
399
456
|
keys.push(key);
|
|
@@ -419,48 +476,51 @@ var runtime = function (exports) {
|
|
|
419
476
|
return next;
|
|
420
477
|
};
|
|
421
478
|
};
|
|
479
|
+
|
|
422
480
|
function values(iterable) {
|
|
423
481
|
if (iterable) {
|
|
424
482
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
425
483
|
if (iteratorMethod) {
|
|
426
484
|
return iteratorMethod.call(iterable);
|
|
427
485
|
}
|
|
486
|
+
|
|
428
487
|
if (typeof iterable.next === "function") {
|
|
429
488
|
return iterable;
|
|
430
489
|
}
|
|
490
|
+
|
|
431
491
|
if (!isNaN(iterable.length)) {
|
|
432
|
-
var i = -1,
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
return next;
|
|
439
|
-
}
|
|
492
|
+
var i = -1, next = function next() {
|
|
493
|
+
while (++i < iterable.length) {
|
|
494
|
+
if (hasOwn.call(iterable, i)) {
|
|
495
|
+
next.value = iterable[i];
|
|
496
|
+
next.done = false;
|
|
497
|
+
return next;
|
|
440
498
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
next.value = undefined$1;
|
|
502
|
+
next.done = true;
|
|
503
|
+
|
|
504
|
+
return next;
|
|
505
|
+
};
|
|
506
|
+
|
|
445
507
|
return next.next = next;
|
|
446
508
|
}
|
|
447
509
|
}
|
|
448
510
|
|
|
449
511
|
// Return an iterator with no values.
|
|
450
|
-
return {
|
|
451
|
-
next: doneResult
|
|
452
|
-
};
|
|
512
|
+
return { next: doneResult };
|
|
453
513
|
}
|
|
454
514
|
exports.values = values;
|
|
515
|
+
|
|
455
516
|
function doneResult() {
|
|
456
|
-
return {
|
|
457
|
-
value: undefined$1,
|
|
458
|
-
done: true
|
|
459
|
-
};
|
|
517
|
+
return { value: undefined$1, done: true };
|
|
460
518
|
}
|
|
519
|
+
|
|
461
520
|
Context.prototype = {
|
|
462
521
|
constructor: Context,
|
|
463
|
-
|
|
522
|
+
|
|
523
|
+
reset: function(skipTempReset) {
|
|
464
524
|
this.prev = 0;
|
|
465
525
|
this.next = 0;
|
|
466
526
|
// Resetting context._sent for legacy support of Babel's
|
|
@@ -468,104 +528,137 @@ var runtime = function (exports) {
|
|
|
468
528
|
this.sent = this._sent = undefined$1;
|
|
469
529
|
this.done = false;
|
|
470
530
|
this.delegate = null;
|
|
531
|
+
|
|
471
532
|
this.method = "next";
|
|
472
533
|
this.arg = undefined$1;
|
|
534
|
+
|
|
473
535
|
this.tryEntries.forEach(resetTryEntry);
|
|
536
|
+
|
|
474
537
|
if (!skipTempReset) {
|
|
475
538
|
for (var name in this) {
|
|
476
539
|
// Not sure about the optimal order of these conditions:
|
|
477
|
-
if (name.charAt(0) === "t" &&
|
|
540
|
+
if (name.charAt(0) === "t" &&
|
|
541
|
+
hasOwn.call(this, name) &&
|
|
542
|
+
!isNaN(+name.slice(1))) {
|
|
478
543
|
this[name] = undefined$1;
|
|
479
544
|
}
|
|
480
545
|
}
|
|
481
546
|
}
|
|
482
547
|
},
|
|
483
|
-
|
|
548
|
+
|
|
549
|
+
stop: function() {
|
|
484
550
|
this.done = true;
|
|
551
|
+
|
|
485
552
|
var rootEntry = this.tryEntries[0];
|
|
486
553
|
var rootRecord = rootEntry.completion;
|
|
487
554
|
if (rootRecord.type === "throw") {
|
|
488
555
|
throw rootRecord.arg;
|
|
489
556
|
}
|
|
557
|
+
|
|
490
558
|
return this.rval;
|
|
491
559
|
},
|
|
492
|
-
|
|
560
|
+
|
|
561
|
+
dispatchException: function(exception) {
|
|
493
562
|
if (this.done) {
|
|
494
563
|
throw exception;
|
|
495
564
|
}
|
|
565
|
+
|
|
496
566
|
var context = this;
|
|
497
567
|
function handle(loc, caught) {
|
|
498
568
|
record.type = "throw";
|
|
499
569
|
record.arg = exception;
|
|
500
570
|
context.next = loc;
|
|
571
|
+
|
|
501
572
|
if (caught) {
|
|
502
573
|
// If the dispatched exception was caught by a catch block,
|
|
503
574
|
// then let that catch block handle the exception normally.
|
|
504
575
|
context.method = "next";
|
|
505
576
|
context.arg = undefined$1;
|
|
506
577
|
}
|
|
507
|
-
|
|
578
|
+
|
|
579
|
+
return !! caught;
|
|
508
580
|
}
|
|
581
|
+
|
|
509
582
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
510
583
|
var entry = this.tryEntries[i];
|
|
511
584
|
var record = entry.completion;
|
|
585
|
+
|
|
512
586
|
if (entry.tryLoc === "root") {
|
|
513
587
|
// Exception thrown outside of any try block that could handle
|
|
514
588
|
// it, so set the completion value of the entire function to
|
|
515
589
|
// throw the exception.
|
|
516
590
|
return handle("end");
|
|
517
591
|
}
|
|
592
|
+
|
|
518
593
|
if (entry.tryLoc <= this.prev) {
|
|
519
594
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
520
595
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
596
|
+
|
|
521
597
|
if (hasCatch && hasFinally) {
|
|
522
598
|
if (this.prev < entry.catchLoc) {
|
|
523
599
|
return handle(entry.catchLoc, true);
|
|
524
600
|
} else if (this.prev < entry.finallyLoc) {
|
|
525
601
|
return handle(entry.finallyLoc);
|
|
526
602
|
}
|
|
603
|
+
|
|
527
604
|
} else if (hasCatch) {
|
|
528
605
|
if (this.prev < entry.catchLoc) {
|
|
529
606
|
return handle(entry.catchLoc, true);
|
|
530
607
|
}
|
|
608
|
+
|
|
531
609
|
} else if (hasFinally) {
|
|
532
610
|
if (this.prev < entry.finallyLoc) {
|
|
533
611
|
return handle(entry.finallyLoc);
|
|
534
612
|
}
|
|
613
|
+
|
|
535
614
|
} else {
|
|
536
615
|
throw new Error("try statement without catch or finally");
|
|
537
616
|
}
|
|
538
617
|
}
|
|
539
618
|
}
|
|
540
619
|
},
|
|
541
|
-
|
|
620
|
+
|
|
621
|
+
abrupt: function(type, arg) {
|
|
542
622
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
543
623
|
var entry = this.tryEntries[i];
|
|
544
|
-
if (entry.tryLoc <= this.prev &&
|
|
624
|
+
if (entry.tryLoc <= this.prev &&
|
|
625
|
+
hasOwn.call(entry, "finallyLoc") &&
|
|
626
|
+
this.prev < entry.finallyLoc) {
|
|
545
627
|
var finallyEntry = entry;
|
|
546
628
|
break;
|
|
547
629
|
}
|
|
548
630
|
}
|
|
549
|
-
|
|
631
|
+
|
|
632
|
+
if (finallyEntry &&
|
|
633
|
+
(type === "break" ||
|
|
634
|
+
type === "continue") &&
|
|
635
|
+
finallyEntry.tryLoc <= arg &&
|
|
636
|
+
arg <= finallyEntry.finallyLoc) {
|
|
550
637
|
// Ignore the finally entry if control is not jumping to a
|
|
551
638
|
// location outside the try/catch block.
|
|
552
639
|
finallyEntry = null;
|
|
553
640
|
}
|
|
641
|
+
|
|
554
642
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
555
643
|
record.type = type;
|
|
556
644
|
record.arg = arg;
|
|
645
|
+
|
|
557
646
|
if (finallyEntry) {
|
|
558
647
|
this.method = "next";
|
|
559
648
|
this.next = finallyEntry.finallyLoc;
|
|
560
649
|
return ContinueSentinel;
|
|
561
650
|
}
|
|
651
|
+
|
|
562
652
|
return this.complete(record);
|
|
563
653
|
},
|
|
564
|
-
|
|
654
|
+
|
|
655
|
+
complete: function(record, afterLoc) {
|
|
565
656
|
if (record.type === "throw") {
|
|
566
657
|
throw record.arg;
|
|
567
658
|
}
|
|
568
|
-
|
|
659
|
+
|
|
660
|
+
if (record.type === "break" ||
|
|
661
|
+
record.type === "continue") {
|
|
569
662
|
this.next = record.arg;
|
|
570
663
|
} else if (record.type === "return") {
|
|
571
664
|
this.rval = this.arg = record.arg;
|
|
@@ -574,9 +667,11 @@ var runtime = function (exports) {
|
|
|
574
667
|
} else if (record.type === "normal" && afterLoc) {
|
|
575
668
|
this.next = afterLoc;
|
|
576
669
|
}
|
|
670
|
+
|
|
577
671
|
return ContinueSentinel;
|
|
578
672
|
},
|
|
579
|
-
|
|
673
|
+
|
|
674
|
+
finish: function(finallyLoc) {
|
|
580
675
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
581
676
|
var entry = this.tryEntries[i];
|
|
582
677
|
if (entry.finallyLoc === finallyLoc) {
|
|
@@ -586,7 +681,8 @@ var runtime = function (exports) {
|
|
|
586
681
|
}
|
|
587
682
|
}
|
|
588
683
|
},
|
|
589
|
-
|
|
684
|
+
|
|
685
|
+
"catch": function(tryLoc) {
|
|
590
686
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
591
687
|
var entry = this.tryEntries[i];
|
|
592
688
|
if (entry.tryLoc === tryLoc) {
|
|
@@ -603,17 +699,20 @@ var runtime = function (exports) {
|
|
|
603
699
|
// argument that corresponds to a known catch block.
|
|
604
700
|
throw new Error("illegal catch attempt");
|
|
605
701
|
},
|
|
606
|
-
|
|
702
|
+
|
|
703
|
+
delegateYield: function(iterable, resultName, nextLoc) {
|
|
607
704
|
this.delegate = {
|
|
608
705
|
iterator: values(iterable),
|
|
609
706
|
resultName: resultName,
|
|
610
707
|
nextLoc: nextLoc
|
|
611
708
|
};
|
|
709
|
+
|
|
612
710
|
if (this.method === "next") {
|
|
613
711
|
// Deliberately forget the last sent value so that we don't
|
|
614
712
|
// accidentally pass it on to the delegate.
|
|
615
713
|
this.arg = undefined$1;
|
|
616
714
|
}
|
|
715
|
+
|
|
617
716
|
return ContinueSentinel;
|
|
618
717
|
}
|
|
619
718
|
};
|
|
@@ -623,12 +722,15 @@ var runtime = function (exports) {
|
|
|
623
722
|
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
624
723
|
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
625
724
|
return exports;
|
|
725
|
+
|
|
626
726
|
}(
|
|
627
|
-
// If this script is executing as a CommonJS module, use module.exports
|
|
628
|
-
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
629
|
-
// object. Either way, the resulting object will be used to initialize
|
|
630
|
-
// the regeneratorRuntime variable at the top of this file.
|
|
631
|
-
typeof module === "object" ? module.exports : {}
|
|
727
|
+
// If this script is executing as a CommonJS module, use module.exports
|
|
728
|
+
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
729
|
+
// object. Either way, the resulting object will be used to initialize
|
|
730
|
+
// the regeneratorRuntime variable at the top of this file.
|
|
731
|
+
typeof module === "object" ? module.exports : {}
|
|
732
|
+
));
|
|
733
|
+
|
|
632
734
|
try {
|
|
633
735
|
regeneratorRuntime = runtime;
|
|
634
736
|
} catch (accidentalStrictMode) {
|