From 81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Wed, 18 Nov 2020 23:26:45 +0100 Subject: rm node_modules --- .../.npmignore | 4 - .../babel-plugin-transform-es2015-for-of/README.md | 142 --------------- .../lib/index.js | 199 --------------------- .../package.json | 45 ----- 4 files changed, 390 deletions(-) delete mode 100644 node_modules/babel-plugin-transform-es2015-for-of/.npmignore delete mode 100644 node_modules/babel-plugin-transform-es2015-for-of/README.md delete mode 100644 node_modules/babel-plugin-transform-es2015-for-of/lib/index.js delete mode 100644 node_modules/babel-plugin-transform-es2015-for-of/package.json (limited to 'node_modules/babel-plugin-transform-es2015-for-of') diff --git a/node_modules/babel-plugin-transform-es2015-for-of/.npmignore b/node_modules/babel-plugin-transform-es2015-for-of/.npmignore deleted file mode 100644 index 3185290..0000000 --- a/node_modules/babel-plugin-transform-es2015-for-of/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -*.log -src -test diff --git a/node_modules/babel-plugin-transform-es2015-for-of/README.md b/node_modules/babel-plugin-transform-es2015-for-of/README.md deleted file mode 100644 index 7aff9a0..0000000 --- a/node_modules/babel-plugin-transform-es2015-for-of/README.md +++ /dev/null @@ -1,142 +0,0 @@ -# babel-plugin-transform-es2015-for-of - -> Compile ES2015 for...of to ES5 - -## Example - -**In** - -```js -for (var i of foo) {} -``` - -**Out** - -```js -var _iteratorNormalCompletion = true; -var _didIteratorError = false; -var _iteratorError = undefined; - -try { - for (var _iterator = foo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var i = _step.value; - } -} catch (err) { - _didIteratorError = true; - _iteratorError = err; -} finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } -} -``` - -## Installation - -```sh -npm install --save-dev babel-plugin-transform-es2015-for-of -``` - -## Usage - -### Via `.babelrc` (Recommended) - -**.babelrc** - -```js -// without options -{ - "plugins": ["transform-es2015-for-of"] -} - -// with options -{ - "plugins": [ - ["transform-es2015-for-of", { - "loose": true - }] - ] -} -``` - -### Via CLI - -```sh -babel --plugins transform-es2015-for-of script.js -``` - -### Via Node API - -```javascript -require("babel-core").transform("code", { - plugins: ["transform-es2015-for-of"] -}); -``` - -## Options - -### `loose` - -`boolean`, defaults to `false` - -In loose mode, arrays are put in a fast path, thus heavily increasing performance. -All other iterables will continue to work fine. - -#### Example - -**In** - -```js -for (var i of foo) {} -``` - -**Out** - -```js -for (var _iterator = foo, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var i = _ref; -} -``` - -#### Abrupt completions - -In loose mode an iterator's `return` method will not be called on abrupt completions caused by thrown errors. - -Please see [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and -[babel/babel#838](https://github.com/babel/babel/issues/838) for more information. - -### Optimization - -If a basic array is used, Babel will compile the for-of loop down to a regular for loop. - -**In** - -```js -for (let a of [1,2,3]) {} -``` - -**Out** - -```js -var _arr = [1, 2, 3]; -for (var _i = 0; _i < _arr.length; _i++) { - var a = _arr[_i]; -} -``` diff --git a/node_modules/babel-plugin-transform-es2015-for-of/lib/index.js b/node_modules/babel-plugin-transform-es2015-for-of/lib/index.js deleted file mode 100644 index 056600d..0000000 --- a/node_modules/babel-plugin-transform-es2015-for-of/lib/index.js +++ /dev/null @@ -1,199 +0,0 @@ -"use strict"; - -exports.__esModule = true; - -exports.default = function (_ref) { - var messages = _ref.messages, - template = _ref.template, - t = _ref.types; - - var buildForOfArray = template("\n for (var KEY = 0; KEY < ARR.length; KEY++) BODY;\n "); - - var buildForOfLoose = template("\n for (var LOOP_OBJECT = OBJECT,\n IS_ARRAY = Array.isArray(LOOP_OBJECT),\n INDEX = 0,\n LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) {\n var ID;\n if (IS_ARRAY) {\n if (INDEX >= LOOP_OBJECT.length) break;\n ID = LOOP_OBJECT[INDEX++];\n } else {\n INDEX = LOOP_OBJECT.next();\n if (INDEX.done) break;\n ID = INDEX.value;\n }\n }\n "); - - var buildForOf = template("\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY; !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done); ITERATOR_COMPLETION = true) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return) {\n ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n "); - - - function _ForOfStatementArray(path) { - var node = path.node, - scope = path.scope; - - var nodes = []; - var right = node.right; - - if (!t.isIdentifier(right) || !scope.hasBinding(right.name)) { - var uid = scope.generateUidIdentifier("arr"); - nodes.push(t.variableDeclaration("var", [t.variableDeclarator(uid, right)])); - right = uid; - } - - var iterationKey = scope.generateUidIdentifier("i"); - - var loop = buildForOfArray({ - BODY: node.body, - KEY: iterationKey, - ARR: right - }); - - t.inherits(loop, node); - t.ensureBlock(loop); - - var iterationValue = t.memberExpression(right, iterationKey, true); - - var left = node.left; - if (t.isVariableDeclaration(left)) { - left.declarations[0].init = iterationValue; - loop.body.body.unshift(left); - } else { - loop.body.body.unshift(t.expressionStatement(t.assignmentExpression("=", left, iterationValue))); - } - - if (path.parentPath.isLabeledStatement()) { - loop = t.labeledStatement(path.parentPath.node.label, loop); - } - - nodes.push(loop); - - return nodes; - } - - return { - visitor: { - ForOfStatement: function ForOfStatement(path, state) { - if (path.get("right").isArrayExpression()) { - if (path.parentPath.isLabeledStatement()) { - return path.parentPath.replaceWithMultiple(_ForOfStatementArray(path)); - } else { - return path.replaceWithMultiple(_ForOfStatementArray(path)); - } - } - - var callback = spec; - if (state.opts.loose) callback = loose; - - var node = path.node; - - var build = callback(path, state); - var declar = build.declar; - var loop = build.loop; - var block = loop.body; - - path.ensureBlock(); - - if (declar) { - block.body.push(declar); - } - - block.body = block.body.concat(node.body.body); - - t.inherits(loop, node); - t.inherits(loop.body, node.body); - - if (build.replaceParent) { - path.parentPath.replaceWithMultiple(build.node); - path.remove(); - } else { - path.replaceWithMultiple(build.node); - } - } - } - }; - - function loose(path, file) { - var node = path.node, - scope = path.scope, - parent = path.parent; - var left = node.left; - - var declar = void 0, - id = void 0; - - if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { - id = left; - } else if (t.isVariableDeclaration(left)) { - id = scope.generateUidIdentifier("ref"); - declar = t.variableDeclaration(left.kind, [t.variableDeclarator(left.declarations[0].id, id)]); - } else { - throw file.buildCodeFrameError(left, messages.get("unknownForHead", left.type)); - } - - var iteratorKey = scope.generateUidIdentifier("iterator"); - var isArrayKey = scope.generateUidIdentifier("isArray"); - - var loop = buildForOfLoose({ - LOOP_OBJECT: iteratorKey, - IS_ARRAY: isArrayKey, - OBJECT: node.right, - INDEX: scope.generateUidIdentifier("i"), - ID: id - }); - - if (!declar) { - loop.body.body.shift(); - } - - var isLabeledParent = t.isLabeledStatement(parent); - var labeled = void 0; - - if (isLabeledParent) { - labeled = t.labeledStatement(parent.label, loop); - } - - return { - replaceParent: isLabeledParent, - declar: declar, - node: labeled || loop, - loop: loop - }; - } - - function spec(path, file) { - var node = path.node, - scope = path.scope, - parent = path.parent; - - var left = node.left; - var declar = void 0; - - var stepKey = scope.generateUidIdentifier("step"); - var stepValue = t.memberExpression(stepKey, t.identifier("value")); - - if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { - declar = t.expressionStatement(t.assignmentExpression("=", left, stepValue)); - } else if (t.isVariableDeclaration(left)) { - declar = t.variableDeclaration(left.kind, [t.variableDeclarator(left.declarations[0].id, stepValue)]); - } else { - throw file.buildCodeFrameError(left, messages.get("unknownForHead", left.type)); - } - - var iteratorKey = scope.generateUidIdentifier("iterator"); - - var template = buildForOf({ - ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"), - ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"), - ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"), - ITERATOR_KEY: iteratorKey, - STEP_KEY: stepKey, - OBJECT: node.right, - BODY: null - }); - - var isLabeledParent = t.isLabeledStatement(parent); - - var tryBody = template[3].block.body; - var loop = tryBody[0]; - - if (isLabeledParent) { - tryBody[0] = t.labeledStatement(parent.label, loop); - } - - return { - replaceParent: isLabeledParent, - declar: declar, - loop: loop, - node: template - }; - } -}; - -module.exports = exports["default"]; \ No newline at end of file diff --git a/node_modules/babel-plugin-transform-es2015-for-of/package.json b/node_modules/babel-plugin-transform-es2015-for-of/package.json deleted file mode 100644 index 80edee4..0000000 --- a/node_modules/babel-plugin-transform-es2015-for-of/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "_from": "babel-plugin-transform-es2015-for-of@^6.22.0", - "_id": "babel-plugin-transform-es2015-for-of@6.23.0", - "_inBundle": false, - "_integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", - "_location": "/babel-plugin-transform-es2015-for-of", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "babel-plugin-transform-es2015-for-of@^6.22.0", - "name": "babel-plugin-transform-es2015-for-of", - "escapedName": "babel-plugin-transform-es2015-for-of", - "rawSpec": "^6.22.0", - "saveSpec": null, - "fetchSpec": "^6.22.0" - }, - "_requiredBy": [ - "/babel-preset-es2015" - ], - "_resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", - "_shasum": "f47c95b2b613df1d3ecc2fdb7573623c75248691", - "_spec": "babel-plugin-transform-es2015-for-of@^6.22.0", - "_where": "/home/pruss/Dev/3-minute-website/node_modules/babel-preset-es2015", - "bundleDependencies": false, - "dependencies": { - "babel-runtime": "^6.22.0" - }, - "deprecated": false, - "description": "Compile ES2015 for...of to ES5", - "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" - }, - "keywords": [ - "babel-plugin" - ], - "license": "MIT", - "main": "lib/index.js", - "name": "babel-plugin-transform-es2015-for-of", - "repository": { - "type": "git", - "url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-for-of" - }, - "version": "6.23.0" -} -- cgit v1.2.3