aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@babel/plugin-proposal-async-generator-functions/lib
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:43:05 +0800
committerruki <waruqi@gmail.com>2018-11-07 22:18:30 +0800
commit89e95b3f143682ed9a006991bacf45c9dcba4818 (patch)
tree4f44cf41b828577d583890bdd5a1c31e8491a6ba /node_modules/@babel/plugin-proposal-async-generator-functions/lib
parentaa7f0199255277949790b41c56e8ec97dd4f0da4 (diff)
downloadxmake-docs-89e95b3f143682ed9a006991bacf45c9dcba4818.tar.gz
xmake-docs-89e95b3f143682ed9a006991bacf45c9dcba4818.zip
remove node_modulesvuepress
Diffstat (limited to 'node_modules/@babel/plugin-proposal-async-generator-functions/lib')
-rw-r--r--node_modules/@babel/plugin-proposal-async-generator-functions/lib/for-await.js95
-rw-r--r--node_modules/@babel/plugin-proposal-async-generator-functions/lib/index.js128
2 files changed, 0 insertions, 223 deletions
diff --git a/node_modules/@babel/plugin-proposal-async-generator-functions/lib/for-await.js b/node_modules/@babel/plugin-proposal-async-generator-functions/lib/for-await.js
deleted file mode 100644
index 54571bc3..00000000
--- a/node_modules/@babel/plugin-proposal-async-generator-functions/lib/for-await.js
+++ /dev/null
@@ -1,95 +0,0 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = _default;
-
-function _core() {
- const data = require("@babel/core");
-
- _core = function _core() {
- return data;
- };
-
- return data;
-}
-
-const buildForAwait = (0, _core().template)(`
- async function wrapper() {
- var ITERATOR_COMPLETION = true;
- var ITERATOR_HAD_ERROR_KEY = false;
- var ITERATOR_ERROR_KEY;
- try {
- for (
- var ITERATOR_KEY = GET_ITERATOR(OBJECT), STEP_KEY, STEP_VALUE;
- (
- STEP_KEY = await ITERATOR_KEY.next(),
- ITERATOR_COMPLETION = STEP_KEY.done,
- STEP_VALUE = await STEP_KEY.value,
- !ITERATOR_COMPLETION
- );
- ITERATOR_COMPLETION = true) {
- }
- } catch (err) {
- ITERATOR_HAD_ERROR_KEY = true;
- ITERATOR_ERROR_KEY = err;
- } finally {
- try {
- if (!ITERATOR_COMPLETION && ITERATOR_KEY.return != null) {
- await ITERATOR_KEY.return();
- }
- } finally {
- if (ITERATOR_HAD_ERROR_KEY) {
- throw ITERATOR_ERROR_KEY;
- }
- }
- }
- }
-`);
-
-function _default(path, {
- getAsyncIterator
-}) {
- const node = path.node,
- scope = path.scope,
- parent = path.parent;
- const stepKey = scope.generateUidIdentifier("step");
- const stepValue = scope.generateUidIdentifier("value");
- const left = node.left;
- let declar;
-
- if (_core().types.isIdentifier(left) || _core().types.isPattern(left) || _core().types.isMemberExpression(left)) {
- declar = _core().types.expressionStatement(_core().types.assignmentExpression("=", left, stepValue));
- } else if (_core().types.isVariableDeclaration(left)) {
- declar = _core().types.variableDeclaration(left.kind, [_core().types.variableDeclarator(left.declarations[0].id, stepValue)]);
- }
-
- let template = buildForAwait({
- ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"),
- ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"),
- ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"),
- ITERATOR_KEY: scope.generateUidIdentifier("iterator"),
- GET_ITERATOR: getAsyncIterator,
- OBJECT: node.right,
- STEP_VALUE: stepValue,
- STEP_KEY: stepKey
- });
- template = template.body.body;
-
- const isLabeledParent = _core().types.isLabeledStatement(parent);
-
- const tryBody = template[3].block.body;
- const loop = tryBody[0];
-
- if (isLabeledParent) {
- tryBody[0] = _core().types.labeledStatement(parent.label, loop);
- }
-
- return {
- replaceParent: isLabeledParent,
- node: template,
- declar,
- loop
- };
-} \ No newline at end of file
diff --git a/node_modules/@babel/plugin-proposal-async-generator-functions/lib/index.js b/node_modules/@babel/plugin-proposal-async-generator-functions/lib/index.js
deleted file mode 100644
index 534575b8..00000000
--- a/node_modules/@babel/plugin-proposal-async-generator-functions/lib/index.js
+++ /dev/null
@@ -1,128 +0,0 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = void 0;
-
-function _helperPluginUtils() {
- const data = require("@babel/helper-plugin-utils");
-
- _helperPluginUtils = function _helperPluginUtils() {
- return data;
- };
-
- return data;
-}
-
-function _helperRemapAsyncToGenerator() {
- const data = _interopRequireDefault(require("@babel/helper-remap-async-to-generator"));
-
- _helperRemapAsyncToGenerator = function _helperRemapAsyncToGenerator() {
- return data;
- };
-
- return data;
-}
-
-function _pluginSyntaxAsyncGenerators() {
- const data = _interopRequireDefault(require("@babel/plugin-syntax-async-generators"));
-
- _pluginSyntaxAsyncGenerators = function _pluginSyntaxAsyncGenerators() {
- return data;
- };
-
- return data;
-}
-
-function _core() {
- const data = require("@babel/core");
-
- _core = function _core() {
- return data;
- };
-
- return data;
-}
-
-var _forAwait = _interopRequireDefault(require("./for-await"));
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var _default = (0, _helperPluginUtils().declare)(api => {
- api.assertVersion(7);
- const yieldStarVisitor = {
- Function(path) {
- path.skip();
- },
-
- YieldExpression({
- node
- }, state) {
- if (!node.delegate) return;
- const callee = state.addHelper("asyncGeneratorDelegate");
- node.argument = _core().types.callExpression(callee, [_core().types.callExpression(state.addHelper("asyncIterator"), [node.argument]), state.addHelper("awaitAsyncGenerator")]);
- }
-
- };
- const forAwaitVisitor = {
- Function(path) {
- path.skip();
- },
-
- ForOfStatement(path, {
- file
- }) {
- const node = path.node;
- if (!node.await) return;
- const build = (0, _forAwait.default)(path, {
- getAsyncIterator: file.addHelper("asyncIterator")
- });
- const declar = build.declar,
- loop = build.loop;
- const block = loop.body;
- path.ensureBlock();
-
- if (declar) {
- block.body.push(declar);
- }
-
- block.body = block.body.concat(node.body.body);
-
- _core().types.inherits(loop, node);
-
- _core().types.inherits(loop.body, node.body);
-
- if (build.replaceParent) {
- path.parentPath.replaceWithMultiple(build.node);
- } else {
- path.replaceWithMultiple(build.node);
- }
- }
-
- };
- const visitor = {
- Function(path, state) {
- if (!path.node.async) return;
- path.traverse(forAwaitVisitor, state);
- if (!path.node.generator) return;
- path.traverse(yieldStarVisitor, state);
- (0, _helperRemapAsyncToGenerator().default)(path, {
- wrapAsync: state.addHelper("wrapAsyncGenerator"),
- wrapAwait: state.addHelper("awaitAsyncGenerator")
- });
- }
-
- };
- return {
- inherits: _pluginSyntaxAsyncGenerators().default,
- visitor: {
- Program(path, state) {
- path.traverse(visitor, state);
- }
-
- }
- };
-});
-
-exports.default = _default; \ No newline at end of file