wabur 0.4.0d1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -66
- data/bin/wabur +48 -11
- data/export/assets/css/wab.css +2 -0
- data/export/assets/css/wab.css.map +7 -0
- data/export/assets/fonts/wabfont/README +18 -0
- data/export/assets/fonts/wabfont/fonts/WAB.eot +0 -0
- data/export/assets/fonts/wabfont/fonts/WAB.svg +25 -0
- data/export/assets/fonts/wabfont/fonts/WAB.ttf +0 -0
- data/export/assets/fonts/wabfont/fonts/WAB.woff +0 -0
- data/export/assets/fonts/wabfont/selection.json +460 -0
- data/export/assets/fonts/wabfont/style.css +74 -0
- data/export/assets/js/transpile.js +8 -0
- data/export/assets/js/ui.js +377 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers.js +558 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/asyncGenerator.js +112 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/asyncGeneratorDelegate.js +51 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/asyncIterator.js +14 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/asyncToGenerator.js +28 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/classCallCheck.js +5 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/createClass.js +17 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/defaults.js +14 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/defineEnumerableProperties.js +10 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/defineProperty.js +14 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/extends.js +13 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/get.js +24 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/inherits.js +15 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/instanceof.js +7 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/interopRequireDefault.js +5 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/interopRequireWildcard.js +16 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/jsx.js +42 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/newArrowCheck.js +5 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/objectDestructuringEmpty.js +3 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/objectWithoutProperties.js +11 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/possibleConstructorReturn.js +7 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/selfGlobal.js +1 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/set.js +21 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/slicedToArray.js +37 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/slicedToArrayLoose.js +17 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/taggedTemplateLiteral.js +7 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/taggedTemplateLiteralLoose.js +4 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/temporalRef.js +7 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/temporalUndefined.js +1 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/toArray.js +3 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/toConsumableArray.js +9 -0
- data/export/assets/js/vendor/plugin-babel/babel-helpers/typeof.js +5 -0
- data/export/assets/js/vendor/plugin-babel/plugin-babel.js +222 -0
- data/export/assets/js/vendor/plugin-babel/regenerator-runtime.js +685 -0
- data/export/assets/js/vendor/plugin-babel/systemjs-babel-browser.js +1 -0
- data/export/assets/js/vendor/plugin-babel/systemjs-babel-node.js +55086 -0
- data/export/assets/js/vendor/systemjs/system-production.js +4 -0
- data/export/assets/js/vendor/systemjs/system-production.js.map +1 -0
- data/export/assets/js/vendor/systemjs/system-production.src.js +1711 -0
- data/export/assets/js/vendor/systemjs/system-production.src.js.map +1 -0
- data/export/assets/js/vendor/systemjs/system.js +4 -0
- data/export/assets/js/vendor/systemjs/system.js.map +1 -0
- data/export/assets/js/vendor/systemjs/system.src.js +4000 -0
- data/export/assets/js/vendor/systemjs/system.src.js.map +1 -0
- data/export/assets/js/wab.js +109 -0
- data/export/index.html +41 -0
- data/lib/wab.rb +13 -0
- data/lib/wab/controller.rb +2 -2
- data/lib/wab/errors.rb +12 -0
- data/lib/wab/impl.rb +2 -0
- data/lib/wab/impl/configuration.rb +24 -6
- data/lib/wab/impl/export_proxy.rb +39 -0
- data/lib/wab/impl/exprs/regex.rb +1 -1
- data/lib/wab/impl/handler.rb +14 -14
- data/lib/wab/impl/init.rb +108 -0
- data/lib/wab/impl/model.rb +4 -3
- data/lib/wab/impl/shell.rb +14 -4
- data/lib/wab/impl/templates/opo-rub.conf.template +253 -0
- data/lib/wab/impl/templates/opo.conf.template +224 -0
- data/lib/wab/impl/templates/spawn.rb.template +42 -0
- data/lib/wab/impl/templates/ui_controller.rb.template +12 -0
- data/lib/wab/impl/templates/wabur.conf.template +40 -0
- data/lib/wab/ui.rb +19 -0
- data/lib/wab/ui/create.rb +26 -0
- data/lib/wab/ui/display.rb +34 -0
- data/lib/wab/ui/flow.rb +54 -0
- data/lib/wab/ui/list.rb +59 -0
- data/lib/wab/ui/multi_flow.rb +23 -0
- data/lib/wab/ui/rest_flow.rb +89 -0
- data/lib/wab/ui/update.rb +27 -0
- data/lib/wab/ui/view.rb +62 -0
- data/lib/wab/utils.rb +4 -4
- data/lib/wab/version.rb +1 -1
- data/pages/Architecture.md +104 -1
- data/test/test_configuration.rb +1 -1
- data/test/test_impl.rb +1 -0
- data/test/test_init.rb +33 -0
- metadata +94 -7
- data/pages/Plan.md +0 -27
@@ -0,0 +1 @@
|
|
1
|
+
export default typeof global === "undefined" ? self : global;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export default (function set(object, property, value, receiver) {
|
2
|
+
var desc = Object.getOwnPropertyDescriptor(object, property);
|
3
|
+
|
4
|
+
if (desc === undefined) {
|
5
|
+
var parent = Object.getPrototypeOf(object);
|
6
|
+
|
7
|
+
if (parent !== null) {
|
8
|
+
set(parent, property, value, receiver);
|
9
|
+
}
|
10
|
+
} else if ("value" in desc && desc.writable) {
|
11
|
+
desc.value = value;
|
12
|
+
} else {
|
13
|
+
var setter = desc.set;
|
14
|
+
|
15
|
+
if (setter !== undefined) {
|
16
|
+
setter.call(receiver, value);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
return value;
|
21
|
+
});
|
@@ -0,0 +1,37 @@
|
|
1
|
+
export default (function () {
|
2
|
+
function sliceIterator(arr, i) {
|
3
|
+
var _arr = [];
|
4
|
+
var _n = true;
|
5
|
+
var _d = false;
|
6
|
+
var _e = undefined;
|
7
|
+
|
8
|
+
try {
|
9
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
10
|
+
_arr.push(_s.value);
|
11
|
+
|
12
|
+
if (i && _arr.length === i) break;
|
13
|
+
}
|
14
|
+
} catch (err) {
|
15
|
+
_d = true;
|
16
|
+
_e = err;
|
17
|
+
} finally {
|
18
|
+
try {
|
19
|
+
if (!_n && _i["return"]) _i["return"]();
|
20
|
+
} finally {
|
21
|
+
if (_d) throw _e;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
return _arr;
|
26
|
+
}
|
27
|
+
|
28
|
+
return function (arr, i) {
|
29
|
+
if (Array.isArray(arr)) {
|
30
|
+
return arr;
|
31
|
+
} else if (Symbol.iterator in Object(arr)) {
|
32
|
+
return sliceIterator(arr, i);
|
33
|
+
} else {
|
34
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
35
|
+
}
|
36
|
+
};
|
37
|
+
})();
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export default (function (arr, i) {
|
2
|
+
if (Array.isArray(arr)) {
|
3
|
+
return arr;
|
4
|
+
} else if (Symbol.iterator in Object(arr)) {
|
5
|
+
var _arr = [];
|
6
|
+
|
7
|
+
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
8
|
+
_arr.push(_step.value);
|
9
|
+
|
10
|
+
if (i && _arr.length === i) break;
|
11
|
+
}
|
12
|
+
|
13
|
+
return _arr;
|
14
|
+
} else {
|
15
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
16
|
+
}
|
17
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export default {};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export default typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
2
|
+
return typeof obj;
|
3
|
+
} : function (obj) {
|
4
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
5
|
+
};
|
@@ -0,0 +1,222 @@
|
|
1
|
+
var babel = require('systemjs-babel-build').babel;
|
2
|
+
|
3
|
+
// the SystemJS babel build includes standard presets
|
4
|
+
var es2015 = require('systemjs-babel-build').presetES2015;
|
5
|
+
var es2015Register = require('systemjs-babel-build').presetES2015Register;
|
6
|
+
var modulesRegister = require('systemjs-babel-build').modulesRegister;
|
7
|
+
var stage3 = require('systemjs-babel-build').pluginsStage3;
|
8
|
+
var stage2 = require('systemjs-babel-build').pluginsStage2;
|
9
|
+
var stage1 = require('systemjs-babel-build').pluginsStage1;
|
10
|
+
var react = require('systemjs-babel-build').pluginsReact;
|
11
|
+
|
12
|
+
var externalHelpers = require('systemjs-babel-build').externalHelpers;
|
13
|
+
var runtimeTransform = require('systemjs-babel-build').runtimeTransform;
|
14
|
+
|
15
|
+
var babelRuntimePath;
|
16
|
+
var modularHelpersPath = System.decanonicalize('./babel-helpers/', module.id);
|
17
|
+
var externalHelpersPath = System.decanonicalize('./babel-helpers.js', module.id);
|
18
|
+
var regeneratorRuntimePath = System.decanonicalize('./regenerator-runtime.js', module.id);
|
19
|
+
|
20
|
+
if (modularHelpersPath.substr(modularHelpersPath.length - 3, 3) == '.js')
|
21
|
+
modularHelpersPath = modularHelpersPath.substr(0, modularHelpersPath.length - 3);
|
22
|
+
|
23
|
+
// in builds we want to embed canonical names to helpers
|
24
|
+
if (System.getCanonicalName) {
|
25
|
+
modularHelpersPath = System.getCanonicalName(modularHelpersPath);
|
26
|
+
externalHelpersPath = System.getCanonicalName(externalHelpersPath);
|
27
|
+
regeneratorRuntimePath = System.getCanonicalName(regeneratorRuntimePath);
|
28
|
+
}
|
29
|
+
|
30
|
+
// disable SystemJS runtime detection
|
31
|
+
SystemJS._loader.loadedTranspilerRuntime = true;
|
32
|
+
|
33
|
+
function prepend(a, b) {
|
34
|
+
for (var p in b)
|
35
|
+
if (!(p in a))
|
36
|
+
a[p] = b[p];
|
37
|
+
return a;
|
38
|
+
}
|
39
|
+
|
40
|
+
/*
|
41
|
+
* babelOptions:
|
42
|
+
* modularRuntime: true / false (whether to use babel-runtime or babel/external-helpers respectively)
|
43
|
+
* sourceMaps: true / false (defaults to true)
|
44
|
+
* es2015: true / false (defaults to true)
|
45
|
+
* stage3: true / false (defaults to true)
|
46
|
+
* stage2: true / false (defaults to true)
|
47
|
+
* stage1: true / false (defaults to false)
|
48
|
+
* react: true / false (defaults to false)
|
49
|
+
* plugins: array of custom plugins (objects or module name strings)
|
50
|
+
* presets: array of custom presets (objects or module name strings)
|
51
|
+
* compact: as in Babel
|
52
|
+
* comments: as in Babel
|
53
|
+
*
|
54
|
+
* babelOptions can be set at SystemJS.babelOptions OR on the metadata object for a given module
|
55
|
+
*/
|
56
|
+
var defaultBabelOptions = {
|
57
|
+
modularRuntime: true,
|
58
|
+
sourceMaps: true,
|
59
|
+
es2015: true,
|
60
|
+
stage3: true,
|
61
|
+
stage2: true,
|
62
|
+
stage1: false,
|
63
|
+
react: false,
|
64
|
+
compact: false,
|
65
|
+
comments: true
|
66
|
+
};
|
67
|
+
|
68
|
+
exports.translate = function(load, traceOpts) {
|
69
|
+
// we don't transpile anything other than CommonJS or ESM
|
70
|
+
if (load.metadata.format == 'global' || load.metadata.format == 'amd' || load.metadata.format == 'json')
|
71
|
+
throw new TypeError('plugin-babel cannot transpile ' + load.metadata.format + ' modules. Ensure "' + load.name + '" is configured not to use this loader.');
|
72
|
+
|
73
|
+
var loader = this;
|
74
|
+
var pluginLoader = loader.pluginLoader || loader;
|
75
|
+
|
76
|
+
// we only output ES modules when running in the builder
|
77
|
+
var outputESM = traceOpts ? traceOpts.outputESM : loader.builder;
|
78
|
+
|
79
|
+
var babelOptions = {};
|
80
|
+
|
81
|
+
if (load.metadata.babelOptions)
|
82
|
+
prepend(babelOptions, load.metadata.babelOptions);
|
83
|
+
|
84
|
+
if (loader.babelOptions)
|
85
|
+
prepend(babelOptions, loader.babelOptions);
|
86
|
+
|
87
|
+
prepend(babelOptions, defaultBabelOptions);
|
88
|
+
|
89
|
+
// determine any plugins or preset strings which need to be imported as modules
|
90
|
+
var pluginAndPresetModuleLoads = [];
|
91
|
+
|
92
|
+
if (babelOptions.presets)
|
93
|
+
babelOptions.presets.forEach(function(preset) {
|
94
|
+
if (typeof preset == 'string')
|
95
|
+
pluginAndPresetModuleLoads.push(pluginLoader['import'](preset, module.id));
|
96
|
+
});
|
97
|
+
|
98
|
+
if (babelOptions.plugins)
|
99
|
+
babelOptions.plugins.forEach(function(plugin) {
|
100
|
+
plugin = typeof plugin == 'string' ? plugin : Array.isArray(plugin) && typeof plugin[0] == 'string' && plugin[0];
|
101
|
+
if (!plugin)
|
102
|
+
return;
|
103
|
+
pluginAndPresetModuleLoads.push(pluginLoader.import(plugin, module.id).then(function (m) {
|
104
|
+
return m.default || m;
|
105
|
+
}));
|
106
|
+
});
|
107
|
+
|
108
|
+
return Promise.all(pluginAndPresetModuleLoads)
|
109
|
+
.then(function(pluginAndPresetModules) {
|
110
|
+
var curPluginOrPresetModule = 0;
|
111
|
+
|
112
|
+
var presets = [];
|
113
|
+
var plugins = [];
|
114
|
+
|
115
|
+
if (babelOptions.modularRuntime) {
|
116
|
+
if (load.metadata.format == 'cjs')
|
117
|
+
throw new TypeError('plugin-babel does not support modular runtime for CJS module transpilations. Set babelOptions.modularRuntime: false if needed.');
|
118
|
+
presets.push(runtimeTransform);
|
119
|
+
}
|
120
|
+
else {
|
121
|
+
if (load.metadata.format == 'cjs')
|
122
|
+
load.source = 'var babelHelpers = require("' + externalHelpersPath + '");' + load.source;
|
123
|
+
else
|
124
|
+
load.source = 'import babelHelpers from "' + externalHelpersPath + '";' + load.source;
|
125
|
+
presets.push(externalHelpers);
|
126
|
+
}
|
127
|
+
|
128
|
+
if (babelOptions.es2015)
|
129
|
+
presets.push((outputESM || load.metadata.format == 'cjs') ? es2015 : es2015Register);
|
130
|
+
else if (!(outputESM || load.metadata.format == 'cjs'))
|
131
|
+
presets.push(modulesRegister);
|
132
|
+
|
133
|
+
if (babelOptions.stage3)
|
134
|
+
presets.push({
|
135
|
+
plugins: stage3
|
136
|
+
});
|
137
|
+
|
138
|
+
if (babelOptions.stage2)
|
139
|
+
presets.push({
|
140
|
+
plugins: stage2
|
141
|
+
});
|
142
|
+
|
143
|
+
if (babelOptions.stage1)
|
144
|
+
presets.push({
|
145
|
+
plugins: stage1
|
146
|
+
});
|
147
|
+
|
148
|
+
if (babelOptions.react)
|
149
|
+
presets.push({
|
150
|
+
plugins: react
|
151
|
+
});
|
152
|
+
|
153
|
+
if (babelOptions.presets)
|
154
|
+
babelOptions.presets.forEach(function(preset) {
|
155
|
+
if (typeof preset == 'string')
|
156
|
+
presets.push(pluginAndPresetModules[curPluginOrPresetModule++]);
|
157
|
+
else
|
158
|
+
presets.push(preset);
|
159
|
+
});
|
160
|
+
|
161
|
+
if (babelOptions.plugins)
|
162
|
+
babelOptions.plugins.forEach(function(plugin) {
|
163
|
+
if (typeof plugin == 'string')
|
164
|
+
plugins.push(pluginAndPresetModules[curPluginOrPresetModule++]);
|
165
|
+
else if (Array.isArray(plugin) && typeof plugin[0] == 'string')
|
166
|
+
plugins.push([pluginAndPresetModules[curPluginOrPresetModule++], plugin[1]]);
|
167
|
+
else
|
168
|
+
plugins.push(plugin);
|
169
|
+
});
|
170
|
+
|
171
|
+
var output = babel.transform(load.source, {
|
172
|
+
babelrc: false,
|
173
|
+
plugins: plugins,
|
174
|
+
presets: presets,
|
175
|
+
filename: load.address,
|
176
|
+
sourceFileName: load.address,
|
177
|
+
moduleIds: false,
|
178
|
+
sourceMaps: traceOpts && traceOpts.sourceMaps || babelOptions.sourceMaps,
|
179
|
+
inputSourceMap: load.metadata.sourceMap,
|
180
|
+
compact: babelOptions.compact,
|
181
|
+
comments: babelOptions.comments,
|
182
|
+
code: true,
|
183
|
+
ast: true,
|
184
|
+
resolveModuleSource: function(m) {
|
185
|
+
if (m.substr(0, 22) == 'babel-runtime/helpers/') {
|
186
|
+
m = modularHelpersPath + m.substr(22) + '.js';
|
187
|
+
}
|
188
|
+
else if (m == 'babel-runtime/regenerator') {
|
189
|
+
m = regeneratorRuntimePath;
|
190
|
+
}
|
191
|
+
else if (m.substr(0, 14) == 'babel-runtime/') {
|
192
|
+
if (!babelRuntimePath) {
|
193
|
+
babelRuntimePath = System.decanonicalize('babel-runtime/', module.id);
|
194
|
+
if (babelRuntimePath[babelRuntimePath.length - 1] !== '/')
|
195
|
+
babelRuntimePath += '/';
|
196
|
+
if (babelRuntimePath.substr(babelRuntimePath.length - 3, 3) == '.js')
|
197
|
+
babelRuntimePath = babelRuntimePath.substr(0, babelRuntimePath.length - 3);
|
198
|
+
if (loader.getCanonicalName)
|
199
|
+
babelRuntimePath = loader.getCanonicalName(babelRuntimePath);
|
200
|
+
if (babelRuntimePath == 'babel-runtime/')
|
201
|
+
throw new Error('The babel-runtime module must be mapped to support modular helpers and builtins. If using jspm run jspm install npm:babel-runtime.');
|
202
|
+
}
|
203
|
+
m = babelRuntimePath + m.substr(14) + '.js';
|
204
|
+
}
|
205
|
+
return m;
|
206
|
+
}
|
207
|
+
});
|
208
|
+
|
209
|
+
// add babelHelpers as a dependency for non-modular runtime
|
210
|
+
if (!babelOptions.modularRuntime)
|
211
|
+
load.metadata.deps.push(externalHelpersPath);
|
212
|
+
|
213
|
+
// set output module format
|
214
|
+
// (in builder we output modules as esm)
|
215
|
+
if (!load.metadata.format || load.metadata.format == 'detect' || load.metadata.format == 'esm')
|
216
|
+
load.metadata.format = outputESM ? 'esm' : 'register';
|
217
|
+
|
218
|
+
load.metadata.sourceMap = output.map;
|
219
|
+
|
220
|
+
return output.code;
|
221
|
+
});
|
222
|
+
};
|
@@ -0,0 +1,685 @@
|
|
1
|
+
export default (function(module) {
|
2
|
+
/**
|
3
|
+
* Copyright (c) 2014, Facebook, Inc.
|
4
|
+
* All rights reserved.
|
5
|
+
*
|
6
|
+
* This source code is licensed under the BSD-style license found in the
|
7
|
+
* https://raw.github.com/facebook/regenerator/master/LICENSE file. An
|
8
|
+
* additional grant of patent rights can be found in the PATENTS file in
|
9
|
+
* the same directory.
|
10
|
+
*/
|
11
|
+
|
12
|
+
!(function(global) {
|
13
|
+
"use strict";
|
14
|
+
|
15
|
+
var Op = Object.prototype;
|
16
|
+
var hasOwn = Op.hasOwnProperty;
|
17
|
+
var undefined; // More compressible than void 0.
|
18
|
+
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
19
|
+
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
20
|
+
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
21
|
+
|
22
|
+
var inModule = typeof module === "object";
|
23
|
+
var runtime = global.regeneratorRuntime;
|
24
|
+
if (runtime) {
|
25
|
+
if (inModule) {
|
26
|
+
// If regeneratorRuntime is defined globally and we're in a module,
|
27
|
+
// make the exports object identical to regeneratorRuntime.
|
28
|
+
module.exports = runtime;
|
29
|
+
}
|
30
|
+
// Don't bother evaluating the rest of this file if the runtime was
|
31
|
+
// already defined globally.
|
32
|
+
return;
|
33
|
+
}
|
34
|
+
|
35
|
+
// Define the runtime globally (as expected by generated code) as either
|
36
|
+
// module.exports (if we're in a module) or a new, empty object.
|
37
|
+
runtime = global.regeneratorRuntime = inModule ? module.exports : {};
|
38
|
+
|
39
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
40
|
+
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
41
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
42
|
+
var generator = Object.create(protoGenerator.prototype);
|
43
|
+
var context = new Context(tryLocsList || []);
|
44
|
+
|
45
|
+
// The ._invoke method unifies the implementations of the .next,
|
46
|
+
// .throw, and .return methods.
|
47
|
+
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
48
|
+
|
49
|
+
return generator;
|
50
|
+
}
|
51
|
+
runtime.wrap = wrap;
|
52
|
+
|
53
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
54
|
+
// record like context.tryEntries[i].completion. This interface could
|
55
|
+
// have been (and was previously) designed to take a closure to be
|
56
|
+
// invoked without arguments, but in all the cases we care about we
|
57
|
+
// already have an existing method we want to call, so there's no need
|
58
|
+
// to create a new function object. We can even get away with assuming
|
59
|
+
// the method takes exactly one argument, since that happens to be true
|
60
|
+
// in every case, so we don't have to touch the arguments object. The
|
61
|
+
// only additional allocation required is the completion record, which
|
62
|
+
// has a stable shape and so hopefully should be cheap to allocate.
|
63
|
+
function tryCatch(fn, obj, arg) {
|
64
|
+
try {
|
65
|
+
return { type: "normal", arg: fn.call(obj, arg) };
|
66
|
+
} catch (err) {
|
67
|
+
return { type: "throw", arg: err };
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
var GenStateSuspendedStart = "suspendedStart";
|
72
|
+
var GenStateSuspendedYield = "suspendedYield";
|
73
|
+
var GenStateExecuting = "executing";
|
74
|
+
var GenStateCompleted = "completed";
|
75
|
+
|
76
|
+
// Returning this object from the innerFn has the same effect as
|
77
|
+
// breaking out of the dispatch switch statement.
|
78
|
+
var ContinueSentinel = {};
|
79
|
+
|
80
|
+
// Dummy constructor functions that we use as the .constructor and
|
81
|
+
// .constructor.prototype properties for functions that return Generator
|
82
|
+
// objects. For full spec compliance, you may wish to configure your
|
83
|
+
// minifier not to mangle the names of these two functions.
|
84
|
+
function Generator() {}
|
85
|
+
function GeneratorFunction() {}
|
86
|
+
function GeneratorFunctionPrototype() {}
|
87
|
+
|
88
|
+
// This is a polyfill for %IteratorPrototype% for environments that
|
89
|
+
// don't natively support it.
|
90
|
+
var IteratorPrototype = {};
|
91
|
+
IteratorPrototype[iteratorSymbol] = function () {
|
92
|
+
return this;
|
93
|
+
};
|
94
|
+
|
95
|
+
var getProto = Object.getPrototypeOf;
|
96
|
+
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
97
|
+
if (NativeIteratorPrototype &&
|
98
|
+
NativeIteratorPrototype !== Op &&
|
99
|
+
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
100
|
+
// This environment has a native %IteratorPrototype%; use it instead
|
101
|
+
// of the polyfill.
|
102
|
+
IteratorPrototype = NativeIteratorPrototype;
|
103
|
+
}
|
104
|
+
|
105
|
+
var Gp = GeneratorFunctionPrototype.prototype =
|
106
|
+
Generator.prototype = Object.create(IteratorPrototype);
|
107
|
+
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
108
|
+
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
109
|
+
GeneratorFunctionPrototype[toStringTagSymbol] =
|
110
|
+
GeneratorFunction.displayName = "GeneratorFunction";
|
111
|
+
|
112
|
+
// Helper for defining the .next, .throw, and .return methods of the
|
113
|
+
// Iterator interface in terms of a single ._invoke method.
|
114
|
+
function defineIteratorMethods(prototype) {
|
115
|
+
["next", "throw", "return"].forEach(function(method) {
|
116
|
+
prototype[method] = function(arg) {
|
117
|
+
return this._invoke(method, arg);
|
118
|
+
};
|
119
|
+
});
|
120
|
+
}
|
121
|
+
|
122
|
+
runtime.isGeneratorFunction = function(genFun) {
|
123
|
+
var ctor = typeof genFun === "function" && genFun.constructor;
|
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;
|
130
|
+
};
|
131
|
+
|
132
|
+
runtime.mark = function(genFun) {
|
133
|
+
if (Object.setPrototypeOf) {
|
134
|
+
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
135
|
+
} else {
|
136
|
+
genFun.__proto__ = GeneratorFunctionPrototype;
|
137
|
+
if (!(toStringTagSymbol in genFun)) {
|
138
|
+
genFun[toStringTagSymbol] = "GeneratorFunction";
|
139
|
+
}
|
140
|
+
}
|
141
|
+
genFun.prototype = Object.create(Gp);
|
142
|
+
return genFun;
|
143
|
+
};
|
144
|
+
|
145
|
+
// Within the body of any async function, `await x` is transformed to
|
146
|
+
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
147
|
+
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
148
|
+
// meant to be awaited.
|
149
|
+
runtime.awrap = function(arg) {
|
150
|
+
return { __await: arg };
|
151
|
+
};
|
152
|
+
|
153
|
+
function AsyncIterator(generator) {
|
154
|
+
function invoke(method, arg, resolve, reject) {
|
155
|
+
var record = tryCatch(generator[method], generator, arg);
|
156
|
+
if (record.type === "throw") {
|
157
|
+
reject(record.arg);
|
158
|
+
} else {
|
159
|
+
var result = record.arg;
|
160
|
+
var value = result.value;
|
161
|
+
if (value &&
|
162
|
+
typeof value === "object" &&
|
163
|
+
hasOwn.call(value, "__await")) {
|
164
|
+
return Promise.resolve(value.__await).then(function(value) {
|
165
|
+
invoke("next", value, resolve, reject);
|
166
|
+
}, function(err) {
|
167
|
+
invoke("throw", err, resolve, reject);
|
168
|
+
});
|
169
|
+
}
|
170
|
+
|
171
|
+
return Promise.resolve(value).then(function(unwrapped) {
|
172
|
+
// When a yielded Promise is resolved, its final value becomes
|
173
|
+
// the .value of the Promise<{value,done}> result for the
|
174
|
+
// current iteration. If the Promise is rejected, however, the
|
175
|
+
// result for this iteration will be rejected with the same
|
176
|
+
// reason. Note that rejections of yielded Promises are not
|
177
|
+
// thrown back into the generator function, as is the case
|
178
|
+
// when an awaited Promise is rejected. This difference in
|
179
|
+
// behavior between yield and await is important, because it
|
180
|
+
// allows the consumer to decide what to do with the yielded
|
181
|
+
// rejection (swallow it and continue, manually .throw it back
|
182
|
+
// into the generator, abandon iteration, whatever). With
|
183
|
+
// await, by contrast, there is no opportunity to examine the
|
184
|
+
// rejection reason outside the generator function, so the
|
185
|
+
// only option is to throw it from the await expression, and
|
186
|
+
// let the generator function handle the exception.
|
187
|
+
result.value = unwrapped;
|
188
|
+
resolve(result);
|
189
|
+
}, reject);
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
if (typeof process === "object" && process.domain) {
|
194
|
+
invoke = process.domain.bind(invoke);
|
195
|
+
}
|
196
|
+
|
197
|
+
var previousPromise;
|
198
|
+
|
199
|
+
function enqueue(method, arg) {
|
200
|
+
function callInvokeWithMethodAndArg() {
|
201
|
+
return new Promise(function(resolve, reject) {
|
202
|
+
invoke(method, arg, resolve, reject);
|
203
|
+
});
|
204
|
+
}
|
205
|
+
|
206
|
+
return previousPromise =
|
207
|
+
// If enqueue has been called before, then we want to wait until
|
208
|
+
// all previous Promises have been resolved before calling invoke,
|
209
|
+
// so that results are always delivered in the correct order. If
|
210
|
+
// enqueue has not been called before, then it is important to
|
211
|
+
// call invoke immediately, without waiting on a callback to fire,
|
212
|
+
// so that the async generator function has the opportunity to do
|
213
|
+
// any necessary setup in a predictable way. This predictability
|
214
|
+
// is why the Promise constructor synchronously invokes its
|
215
|
+
// executor callback, and why async functions synchronously
|
216
|
+
// execute code before the first await. Since we implement simple
|
217
|
+
// async functions in terms of async generators, it is especially
|
218
|
+
// important to get this right, even though it requires care.
|
219
|
+
previousPromise ? previousPromise.then(
|
220
|
+
callInvokeWithMethodAndArg,
|
221
|
+
// Avoid propagating failures to Promises returned by later
|
222
|
+
// invocations of the iterator.
|
223
|
+
callInvokeWithMethodAndArg
|
224
|
+
) : callInvokeWithMethodAndArg();
|
225
|
+
}
|
226
|
+
|
227
|
+
// Define the unified helper method that is used to implement .next,
|
228
|
+
// .throw, and .return (see defineIteratorMethods).
|
229
|
+
this._invoke = enqueue;
|
230
|
+
}
|
231
|
+
|
232
|
+
defineIteratorMethods(AsyncIterator.prototype);
|
233
|
+
runtime.AsyncIterator = AsyncIterator;
|
234
|
+
|
235
|
+
// Note that simple async functions are implemented on top of
|
236
|
+
// AsyncIterator objects; they just return a Promise for the value of
|
237
|
+
// the final result produced by the iterator.
|
238
|
+
runtime.async = function(innerFn, outerFn, self, tryLocsList) {
|
239
|
+
var iter = new AsyncIterator(
|
240
|
+
wrap(innerFn, outerFn, self, tryLocsList)
|
241
|
+
);
|
242
|
+
|
243
|
+
return runtime.isGeneratorFunction(outerFn)
|
244
|
+
? iter // If outerFn is a generator, return the full iterator.
|
245
|
+
: iter.next().then(function(result) {
|
246
|
+
return result.done ? result.value : iter.next();
|
247
|
+
});
|
248
|
+
};
|
249
|
+
|
250
|
+
function makeInvokeMethod(innerFn, self, context) {
|
251
|
+
var state = GenStateSuspendedStart;
|
252
|
+
|
253
|
+
return function invoke(method, arg) {
|
254
|
+
if (state === GenStateExecuting) {
|
255
|
+
throw new Error("Generator is already running");
|
256
|
+
}
|
257
|
+
|
258
|
+
if (state === GenStateCompleted) {
|
259
|
+
if (method === "throw") {
|
260
|
+
throw arg;
|
261
|
+
}
|
262
|
+
|
263
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
264
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
265
|
+
return doneResult();
|
266
|
+
}
|
267
|
+
|
268
|
+
while (true) {
|
269
|
+
var delegate = context.delegate;
|
270
|
+
if (delegate) {
|
271
|
+
if (method === "return" ||
|
272
|
+
(method === "throw" && delegate.iterator[method] === undefined)) {
|
273
|
+
// A return or throw (when the delegate iterator has no throw
|
274
|
+
// method) always terminates the yield* loop.
|
275
|
+
context.delegate = null;
|
276
|
+
|
277
|
+
// If the delegate iterator has a return method, give it a
|
278
|
+
// chance to clean up.
|
279
|
+
var returnMethod = delegate.iterator["return"];
|
280
|
+
if (returnMethod) {
|
281
|
+
var record = tryCatch(returnMethod, delegate.iterator, arg);
|
282
|
+
if (record.type === "throw") {
|
283
|
+
// If the return method threw an exception, let that
|
284
|
+
// exception prevail over the original return or throw.
|
285
|
+
method = "throw";
|
286
|
+
arg = record.arg;
|
287
|
+
continue;
|
288
|
+
}
|
289
|
+
}
|
290
|
+
|
291
|
+
if (method === "return") {
|
292
|
+
// Continue with the outer return, now that the delegate
|
293
|
+
// iterator has been terminated.
|
294
|
+
continue;
|
295
|
+
}
|
296
|
+
}
|
297
|
+
|
298
|
+
var record = tryCatch(
|
299
|
+
delegate.iterator[method],
|
300
|
+
delegate.iterator,
|
301
|
+
arg
|
302
|
+
);
|
303
|
+
|
304
|
+
if (record.type === "throw") {
|
305
|
+
context.delegate = null;
|
306
|
+
|
307
|
+
// Like returning generator.throw(uncaught), but without the
|
308
|
+
// overhead of an extra function call.
|
309
|
+
method = "throw";
|
310
|
+
arg = record.arg;
|
311
|
+
continue;
|
312
|
+
}
|
313
|
+
|
314
|
+
// Delegate generator ran and handled its own exceptions so
|
315
|
+
// regardless of what the method was, we continue as if it is
|
316
|
+
// "next" with an undefined arg.
|
317
|
+
method = "next";
|
318
|
+
arg = undefined;
|
319
|
+
|
320
|
+
var info = record.arg;
|
321
|
+
if (info.done) {
|
322
|
+
context[delegate.resultName] = info.value;
|
323
|
+
context.next = delegate.nextLoc;
|
324
|
+
} else {
|
325
|
+
state = GenStateSuspendedYield;
|
326
|
+
return info;
|
327
|
+
}
|
328
|
+
|
329
|
+
context.delegate = null;
|
330
|
+
}
|
331
|
+
|
332
|
+
if (method === "next") {
|
333
|
+
// Setting context._sent for legacy support of Babel's
|
334
|
+
// function.sent implementation.
|
335
|
+
context.sent = context._sent = arg;
|
336
|
+
|
337
|
+
} else if (method === "throw") {
|
338
|
+
if (state === GenStateSuspendedStart) {
|
339
|
+
state = GenStateCompleted;
|
340
|
+
throw arg;
|
341
|
+
}
|
342
|
+
|
343
|
+
if (context.dispatchException(arg)) {
|
344
|
+
// If the dispatched exception was caught by a catch block,
|
345
|
+
// then let that catch block handle the exception normally.
|
346
|
+
method = "next";
|
347
|
+
arg = undefined;
|
348
|
+
}
|
349
|
+
|
350
|
+
} else if (method === "return") {
|
351
|
+
context.abrupt("return", arg);
|
352
|
+
}
|
353
|
+
|
354
|
+
state = GenStateExecuting;
|
355
|
+
|
356
|
+
var record = tryCatch(innerFn, self, context);
|
357
|
+
if (record.type === "normal") {
|
358
|
+
// If an exception is thrown from innerFn, we leave state ===
|
359
|
+
// GenStateExecuting and loop back for another invocation.
|
360
|
+
state = context.done
|
361
|
+
? GenStateCompleted
|
362
|
+
: GenStateSuspendedYield;
|
363
|
+
|
364
|
+
var info = {
|
365
|
+
value: record.arg,
|
366
|
+
done: context.done
|
367
|
+
};
|
368
|
+
|
369
|
+
if (record.arg === ContinueSentinel) {
|
370
|
+
if (context.delegate && method === "next") {
|
371
|
+
// Deliberately forget the last sent value so that we don't
|
372
|
+
// accidentally pass it on to the delegate.
|
373
|
+
arg = undefined;
|
374
|
+
}
|
375
|
+
} else {
|
376
|
+
return info;
|
377
|
+
}
|
378
|
+
|
379
|
+
} else if (record.type === "throw") {
|
380
|
+
state = GenStateCompleted;
|
381
|
+
// Dispatch the exception by looping back around to the
|
382
|
+
// context.dispatchException(arg) call above.
|
383
|
+
method = "throw";
|
384
|
+
arg = record.arg;
|
385
|
+
}
|
386
|
+
}
|
387
|
+
};
|
388
|
+
}
|
389
|
+
|
390
|
+
// Define Generator.prototype.{next,throw,return} in terms of the
|
391
|
+
// unified ._invoke helper method.
|
392
|
+
defineIteratorMethods(Gp);
|
393
|
+
|
394
|
+
Gp[toStringTagSymbol] = "Generator";
|
395
|
+
|
396
|
+
Gp.toString = function() {
|
397
|
+
return "[object Generator]";
|
398
|
+
};
|
399
|
+
|
400
|
+
function pushTryEntry(locs) {
|
401
|
+
var entry = { tryLoc: locs[0] };
|
402
|
+
|
403
|
+
if (1 in locs) {
|
404
|
+
entry.catchLoc = locs[1];
|
405
|
+
}
|
406
|
+
|
407
|
+
if (2 in locs) {
|
408
|
+
entry.finallyLoc = locs[2];
|
409
|
+
entry.afterLoc = locs[3];
|
410
|
+
}
|
411
|
+
|
412
|
+
this.tryEntries.push(entry);
|
413
|
+
}
|
414
|
+
|
415
|
+
function resetTryEntry(entry) {
|
416
|
+
var record = entry.completion || {};
|
417
|
+
record.type = "normal";
|
418
|
+
delete record.arg;
|
419
|
+
entry.completion = record;
|
420
|
+
}
|
421
|
+
|
422
|
+
function Context(tryLocsList) {
|
423
|
+
// The root entry object (effectively a try statement without a catch
|
424
|
+
// or a finally block) gives us a place to store values thrown from
|
425
|
+
// locations where there is no enclosing try statement.
|
426
|
+
this.tryEntries = [{ tryLoc: "root" }];
|
427
|
+
tryLocsList.forEach(pushTryEntry, this);
|
428
|
+
this.reset(true);
|
429
|
+
}
|
430
|
+
|
431
|
+
runtime.keys = function(object) {
|
432
|
+
var keys = [];
|
433
|
+
for (var key in object) {
|
434
|
+
keys.push(key);
|
435
|
+
}
|
436
|
+
keys.reverse();
|
437
|
+
|
438
|
+
// Rather than returning an object with a next method, we keep
|
439
|
+
// things simple and return the next function itself.
|
440
|
+
return function next() {
|
441
|
+
while (keys.length) {
|
442
|
+
var key = keys.pop();
|
443
|
+
if (key in object) {
|
444
|
+
next.value = key;
|
445
|
+
next.done = false;
|
446
|
+
return next;
|
447
|
+
}
|
448
|
+
}
|
449
|
+
|
450
|
+
// To avoid creating an additional object, we just hang the .value
|
451
|
+
// and .done properties off the next function object itself. This
|
452
|
+
// also ensures that the minifier will not anonymize the function.
|
453
|
+
next.done = true;
|
454
|
+
return next;
|
455
|
+
};
|
456
|
+
};
|
457
|
+
|
458
|
+
function values(iterable) {
|
459
|
+
if (iterable) {
|
460
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
461
|
+
if (iteratorMethod) {
|
462
|
+
return iteratorMethod.call(iterable);
|
463
|
+
}
|
464
|
+
|
465
|
+
if (typeof iterable.next === "function") {
|
466
|
+
return iterable;
|
467
|
+
}
|
468
|
+
|
469
|
+
if (!isNaN(iterable.length)) {
|
470
|
+
var i = -1, next = function next() {
|
471
|
+
while (++i < iterable.length) {
|
472
|
+
if (hasOwn.call(iterable, i)) {
|
473
|
+
next.value = iterable[i];
|
474
|
+
next.done = false;
|
475
|
+
return next;
|
476
|
+
}
|
477
|
+
}
|
478
|
+
|
479
|
+
next.value = undefined;
|
480
|
+
next.done = true;
|
481
|
+
|
482
|
+
return next;
|
483
|
+
};
|
484
|
+
|
485
|
+
return next.next = next;
|
486
|
+
}
|
487
|
+
}
|
488
|
+
|
489
|
+
// Return an iterator with no values.
|
490
|
+
return { next: doneResult };
|
491
|
+
}
|
492
|
+
runtime.values = values;
|
493
|
+
|
494
|
+
function doneResult() {
|
495
|
+
return { value: undefined, done: true };
|
496
|
+
}
|
497
|
+
|
498
|
+
Context.prototype = {
|
499
|
+
constructor: Context,
|
500
|
+
|
501
|
+
reset: function(skipTempReset) {
|
502
|
+
this.prev = 0;
|
503
|
+
this.next = 0;
|
504
|
+
// Resetting context._sent for legacy support of Babel's
|
505
|
+
// function.sent implementation.
|
506
|
+
this.sent = this._sent = undefined;
|
507
|
+
this.done = false;
|
508
|
+
this.delegate = null;
|
509
|
+
|
510
|
+
this.tryEntries.forEach(resetTryEntry);
|
511
|
+
|
512
|
+
if (!skipTempReset) {
|
513
|
+
for (var name in this) {
|
514
|
+
// Not sure about the optimal order of these conditions:
|
515
|
+
if (name.charAt(0) === "t" &&
|
516
|
+
hasOwn.call(this, name) &&
|
517
|
+
!isNaN(+name.slice(1))) {
|
518
|
+
this[name] = undefined;
|
519
|
+
}
|
520
|
+
}
|
521
|
+
}
|
522
|
+
},
|
523
|
+
|
524
|
+
stop: function() {
|
525
|
+
this.done = true;
|
526
|
+
|
527
|
+
var rootEntry = this.tryEntries[0];
|
528
|
+
var rootRecord = rootEntry.completion;
|
529
|
+
if (rootRecord.type === "throw") {
|
530
|
+
throw rootRecord.arg;
|
531
|
+
}
|
532
|
+
|
533
|
+
return this.rval;
|
534
|
+
},
|
535
|
+
|
536
|
+
dispatchException: function(exception) {
|
537
|
+
if (this.done) {
|
538
|
+
throw exception;
|
539
|
+
}
|
540
|
+
|
541
|
+
var context = this;
|
542
|
+
function handle(loc, caught) {
|
543
|
+
record.type = "throw";
|
544
|
+
record.arg = exception;
|
545
|
+
context.next = loc;
|
546
|
+
return !!caught;
|
547
|
+
}
|
548
|
+
|
549
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
550
|
+
var entry = this.tryEntries[i];
|
551
|
+
var record = entry.completion;
|
552
|
+
|
553
|
+
if (entry.tryLoc === "root") {
|
554
|
+
// Exception thrown outside of any try block that could handle
|
555
|
+
// it, so set the completion value of the entire function to
|
556
|
+
// throw the exception.
|
557
|
+
return handle("end");
|
558
|
+
}
|
559
|
+
|
560
|
+
if (entry.tryLoc <= this.prev) {
|
561
|
+
var hasCatch = hasOwn.call(entry, "catchLoc");
|
562
|
+
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
563
|
+
|
564
|
+
if (hasCatch && hasFinally) {
|
565
|
+
if (this.prev < entry.catchLoc) {
|
566
|
+
return handle(entry.catchLoc, true);
|
567
|
+
} else if (this.prev < entry.finallyLoc) {
|
568
|
+
return handle(entry.finallyLoc);
|
569
|
+
}
|
570
|
+
|
571
|
+
} else if (hasCatch) {
|
572
|
+
if (this.prev < entry.catchLoc) {
|
573
|
+
return handle(entry.catchLoc, true);
|
574
|
+
}
|
575
|
+
|
576
|
+
} else if (hasFinally) {
|
577
|
+
if (this.prev < entry.finallyLoc) {
|
578
|
+
return handle(entry.finallyLoc);
|
579
|
+
}
|
580
|
+
|
581
|
+
} else {
|
582
|
+
throw new Error("try statement without catch or finally");
|
583
|
+
}
|
584
|
+
}
|
585
|
+
}
|
586
|
+
},
|
587
|
+
|
588
|
+
abrupt: function(type, arg) {
|
589
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
590
|
+
var entry = this.tryEntries[i];
|
591
|
+
if (entry.tryLoc <= this.prev &&
|
592
|
+
hasOwn.call(entry, "finallyLoc") &&
|
593
|
+
this.prev < entry.finallyLoc) {
|
594
|
+
var finallyEntry = entry;
|
595
|
+
break;
|
596
|
+
}
|
597
|
+
}
|
598
|
+
|
599
|
+
if (finallyEntry &&
|
600
|
+
(type === "break" ||
|
601
|
+
type === "continue") &&
|
602
|
+
finallyEntry.tryLoc <= arg &&
|
603
|
+
arg <= finallyEntry.finallyLoc) {
|
604
|
+
// Ignore the finally entry if control is not jumping to a
|
605
|
+
// location outside the try/catch block.
|
606
|
+
finallyEntry = null;
|
607
|
+
}
|
608
|
+
|
609
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
610
|
+
record.type = type;
|
611
|
+
record.arg = arg;
|
612
|
+
|
613
|
+
if (finallyEntry) {
|
614
|
+
this.next = finallyEntry.finallyLoc;
|
615
|
+
} else {
|
616
|
+
this.complete(record);
|
617
|
+
}
|
618
|
+
|
619
|
+
return ContinueSentinel;
|
620
|
+
},
|
621
|
+
|
622
|
+
complete: function(record, afterLoc) {
|
623
|
+
if (record.type === "throw") {
|
624
|
+
throw record.arg;
|
625
|
+
}
|
626
|
+
|
627
|
+
if (record.type === "break" ||
|
628
|
+
record.type === "continue") {
|
629
|
+
this.next = record.arg;
|
630
|
+
} else if (record.type === "return") {
|
631
|
+
this.rval = record.arg;
|
632
|
+
this.next = "end";
|
633
|
+
} else if (record.type === "normal" && afterLoc) {
|
634
|
+
this.next = afterLoc;
|
635
|
+
}
|
636
|
+
},
|
637
|
+
|
638
|
+
finish: function(finallyLoc) {
|
639
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
640
|
+
var entry = this.tryEntries[i];
|
641
|
+
if (entry.finallyLoc === finallyLoc) {
|
642
|
+
this.complete(entry.completion, entry.afterLoc);
|
643
|
+
resetTryEntry(entry);
|
644
|
+
return ContinueSentinel;
|
645
|
+
}
|
646
|
+
}
|
647
|
+
},
|
648
|
+
|
649
|
+
"catch": function(tryLoc) {
|
650
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
651
|
+
var entry = this.tryEntries[i];
|
652
|
+
if (entry.tryLoc === tryLoc) {
|
653
|
+
var record = entry.completion;
|
654
|
+
if (record.type === "throw") {
|
655
|
+
var thrown = record.arg;
|
656
|
+
resetTryEntry(entry);
|
657
|
+
}
|
658
|
+
return thrown;
|
659
|
+
}
|
660
|
+
}
|
661
|
+
|
662
|
+
// The context.catch method must only be called with a location
|
663
|
+
// argument that corresponds to a known catch block.
|
664
|
+
throw new Error("illegal catch attempt");
|
665
|
+
},
|
666
|
+
|
667
|
+
delegateYield: function(iterable, resultName, nextLoc) {
|
668
|
+
this.delegate = {
|
669
|
+
iterator: values(iterable),
|
670
|
+
resultName: resultName,
|
671
|
+
nextLoc: nextLoc
|
672
|
+
};
|
673
|
+
|
674
|
+
return ContinueSentinel;
|
675
|
+
}
|
676
|
+
};
|
677
|
+
})(
|
678
|
+
// Among the various tricks for obtaining a reference to the global
|
679
|
+
// object, this seems to be the most reliable technique that does not
|
680
|
+
// use indirect eval (which violates Content Security Policy).
|
681
|
+
typeof global === "object" ? global :
|
682
|
+
typeof window === "object" ? window :
|
683
|
+
typeof self === "object" ? self : this
|
684
|
+
);
|
685
|
+
return module.exports; })({exports:{}});
|