Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../babylon/bin/babylon.js" "$@"
ret=$?
else
node "$basedir/../babylon/bin/babylon.js" "$@"
ret=$?
fi
exit $ret

View File

@@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\babylon\bin\babylon.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\babylon\bin\babylon.js" %*
)

View File

@@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../browserslist/cli.js" "$@"
ret=$?
else
node "$basedir/../browserslist/cli.js" "$@"
ret=$?
fi
exit $ret

View File

@@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\browserslist\cli.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\browserslist\cli.js" %*
)

View File

@@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../jsesc/bin/jsesc" "$@"
ret=$?
else
node "$basedir/../jsesc/bin/jsesc" "$@"
ret=$?
fi
exit $ret

View File

@@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\jsesc\bin\jsesc" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\jsesc\bin\jsesc" %*
)

View File

@@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../loose-envify/cli.js" "$@"
ret=$?
else
node "$basedir/../loose-envify/cli.js" "$@"
ret=$?
fi
exit $ret

View File

@@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\loose-envify\cli.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\loose-envify\cli.js" %*
)

View File

@@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../regjsparser/bin/parser" "$@"
ret=$?
else
node "$basedir/../regjsparser/bin/parser" "$@"
ret=$?
fi
exit $ret

View File

@@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\regjsparser\bin\parser" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\regjsparser\bin\parser" %*
)

View File

@@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../semver/bin/semver" "$@"
ret=$?
else
node "$basedir/../semver/bin/semver" "$@"
ret=$?
fi
exit $ret

View File

@@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\semver\bin\semver" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\semver\bin\semver" %*
)

View File

@@ -0,0 +1,4 @@
'use strict';
module.exports = function () {
return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,112 @@
{
"_args": [
[
"ansi-regex@2.1.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "ansi-regex@2.1.1",
"_id": "ansi-regex@2.1.1",
"_inBundle": false,
"_integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"_location": "/babel-preset-env/ansi-regex",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "ansi-regex@2.1.1",
"name": "ansi-regex",
"escapedName": "ansi-regex",
"rawSpec": "2.1.1",
"saveSpec": null,
"fetchSpec": "2.1.1"
},
"_requiredBy": [
"/babel-preset-env/has-ansi",
"/babel-preset-env/strip-ansi"
],
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"_spec": "2.1.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/chalk/ansi-regex/issues"
},
"description": "Regular expression for matching ANSI escape codes",
"devDependencies": {
"ava": "0.17.0",
"xo": "0.16.0"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/chalk/ansi-regex#readme",
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"command-line",
"text",
"regex",
"regexp",
"re",
"match",
"test",
"find",
"pattern"
],
"license": "MIT",
"maintainers": [
{
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
{
"name": "Joshua Appelman",
"email": "jappelman@xebia.com",
"url": "jbnicolai.com"
},
{
"name": "JD Ballard",
"email": "i.am.qix@gmail.com",
"url": "github.com/qix-"
}
],
"name": "ansi-regex",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/ansi-regex.git"
},
"scripts": {
"test": "xo && ava --verbose",
"view-supported": "node fixtures/view-codes.js"
},
"version": "2.1.1",
"xo": {
"rules": {
"guard-for-in": 0,
"no-loop-func": 0
}
}
}

View File

@@ -0,0 +1,39 @@
# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)
> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
## Install
```
$ npm install --save ansi-regex
```
## Usage
```js
const ansiRegex = require('ansi-regex');
ansiRegex().test('\u001b[4mcake\u001b[0m');
//=> true
ansiRegex().test('cake');
//=> false
'\u001b[4mcake\u001b[0m'.match(ansiRegex());
//=> ['\u001b[4m', '\u001b[0m']
```
## FAQ
### Why do you test for codes not in the ECMA 48 standard?
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,65 @@
'use strict';
function assembleStyles () {
var styles = {
modifiers: {
reset: [0, 0],
bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
colors: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
gray: [90, 39]
},
bgColors: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49]
}
};
// fix humans
styles.colors.grey = styles.colors.gray;
Object.keys(styles).forEach(function (groupName) {
var group = styles[groupName];
Object.keys(group).forEach(function (styleName) {
var style = group[styleName];
styles[styleName] = group[styleName] = {
open: '\u001b[' + style[0] + 'm',
close: '\u001b[' + style[1] + 'm'
};
});
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
});
return styles;
}
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,93 @@
{
"_args": [
[
"ansi-styles@2.2.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "ansi-styles@2.2.1",
"_id": "ansi-styles@2.2.1",
"_inBundle": false,
"_integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
"_location": "/babel-preset-env/ansi-styles",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "ansi-styles@2.2.1",
"name": "ansi-styles",
"escapedName": "ansi-styles",
"rawSpec": "2.2.1",
"saveSpec": null,
"fetchSpec": "2.2.1"
},
"_requiredBy": [
"/babel-preset-env/chalk"
],
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"_spec": "2.2.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/chalk/ansi-styles/issues"
},
"description": "ANSI escape codes for styling strings in the terminal",
"devDependencies": {
"mocha": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/chalk/ansi-styles#readme",
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"license": "MIT",
"maintainers": [
{
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
{
"name": "Joshua Appelman",
"email": "jappelman@xebia.com",
"url": "jbnicolai.com"
}
],
"name": "ansi-styles",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/ansi-styles.git"
},
"scripts": {
"test": "mocha"
},
"version": "2.2.1"
}

View File

@@ -0,0 +1,86 @@
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
![](screenshot.png)
## Install
```
$ npm install --save ansi-styles
```
## Usage
```js
var ansi = require('ansi-styles');
console.log(ansi.green.open + 'Hello world!' + ansi.green.close);
```
## API
Each style has an `open` and `close` property.
## Styles
### Modifiers
- `reset`
- `bold`
- `dim`
- `italic` *(not widely supported)*
- `underline`
- `inverse`
- `hidden`
- `strikethrough` *(not widely supported)*
### Colors
- `black`
- `red`
- `green`
- `yellow`
- `blue`
- `magenta`
- `cyan`
- `white`
- `gray`
### Background colors
- `bgBlack`
- `bgRed`
- `bgGreen`
- `bgYellow`
- `bgBlue`
- `bgMagenta`
- `bgCyan`
- `bgWhite`
## Advanced usage
By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
- `ansi.modifiers`
- `ansi.colors`
- `ansi.bgColors`
###### Example
```js
console.log(ansi.colors.green.open);
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,60 @@
# babel-code-frame
> Generate errors that contain a code frame that point to source locations.
## Install
```sh
npm install --save-dev babel-code-frame
```
## Usage
```js
import codeFrame from 'babel-code-frame';
const rawLines = `class Foo {
constructor()
}`;
const lineNumber = 2;
const colNumber = 16;
const result = codeFrame(rawLines, lineNumber, colNumber, { /* options */ });
console.log(result);
```
```sh
1 | class Foo {
> 2 | constructor()
| ^
3 | }
```
If the column number is not known, you may pass `null` instead.
## Options
### `highlightCode`
`boolean`, defaults to `false`.
Toggles syntax highlighting the code as JavaScript for terminals.
### `linesAbove`
`number`, defaults to `2`.
Adjust the number of lines to show above the error.
### `linesBelow`
`number`, defaults to `3`.
Adjust the number of lines to show below the error.
### `forceColor`
`boolean`, defaults to `false`.
Enable this to forcibly syntax highlight the code as JavaScript (for non-terminals); overrides `highlightCode`.

View File

@@ -0,0 +1,141 @@
"use strict";
exports.__esModule = true;
exports.default = function (rawLines, lineNumber, colNumber) {
var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
colNumber = Math.max(colNumber, 0);
var highlighted = opts.highlightCode && _chalk2.default.supportsColor || opts.forceColor;
var chalk = _chalk2.default;
if (opts.forceColor) {
chalk = new _chalk2.default.constructor({ enabled: true });
}
var maybeHighlight = function maybeHighlight(chalkFn, string) {
return highlighted ? chalkFn(string) : string;
};
var defs = getDefs(chalk);
if (highlighted) rawLines = highlight(defs, rawLines);
var linesAbove = opts.linesAbove || 2;
var linesBelow = opts.linesBelow || 3;
var lines = rawLines.split(NEWLINE);
var start = Math.max(lineNumber - (linesAbove + 1), 0);
var end = Math.min(lines.length, lineNumber + linesBelow);
if (!lineNumber && !colNumber) {
start = 0;
end = lines.length;
}
var numberMaxWidth = String(end).length;
var frame = lines.slice(start, end).map(function (line, index) {
var number = start + 1 + index;
var paddedNumber = (" " + number).slice(-numberMaxWidth);
var gutter = " " + paddedNumber + " | ";
if (number === lineNumber) {
var markerLine = "";
if (colNumber) {
var markerSpacing = line.slice(0, colNumber - 1).replace(/[^\t]/g, " ");
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^")].join("");
}
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
} else {
return " " + maybeHighlight(defs.gutter, gutter) + line;
}
}).join("\n");
if (highlighted) {
return chalk.reset(frame);
} else {
return frame;
}
};
var _jsTokens = require("js-tokens");
var _jsTokens2 = _interopRequireDefault(_jsTokens);
var _esutils = require("esutils");
var _esutils2 = _interopRequireDefault(_esutils);
var _chalk = require("chalk");
var _chalk2 = _interopRequireDefault(_chalk);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getDefs(chalk) {
return {
keyword: chalk.cyan,
capitalized: chalk.yellow,
jsx_tag: chalk.yellow,
punctuator: chalk.yellow,
number: chalk.magenta,
string: chalk.green,
regex: chalk.magenta,
comment: chalk.grey,
invalid: chalk.white.bgRed.bold,
gutter: chalk.grey,
marker: chalk.red.bold
};
}
var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
var JSX_TAG = /^[a-z][\w-]*$/i;
var BRACKET = /^[()\[\]{}]$/;
function getTokenType(match) {
var _match$slice = match.slice(-2),
offset = _match$slice[0],
text = _match$slice[1];
var token = (0, _jsTokens.matchToToken)(match);
if (token.type === "name") {
if (_esutils2.default.keyword.isReservedWordES6(token.value)) {
return "keyword";
}
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
return "jsx_tag";
}
if (token.value[0] !== token.value[0].toLowerCase()) {
return "capitalized";
}
}
if (token.type === "punctuator" && BRACKET.test(token.value)) {
return "bracket";
}
return token.type;
}
function highlight(defs, text) {
return text.replace(_jsTokens2.default, function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var type = getTokenType(args);
var colorize = defs[type];
if (colorize) {
return args[0].split(NEWLINE).map(function (str) {
return colorize(str);
}).join("\n");
} else {
return args[0];
}
});
}
module.exports = exports["default"];

View File

@@ -0,0 +1,66 @@
{
"name": "babel-code-frame",
"version": "6.22.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
},
"ansi-styles": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
},
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"requires": {
"ansi-styles": "2.2.1",
"escape-string-regexp": "1.0.5",
"has-ansi": "2.0.0",
"strip-ansi": "3.0.1",
"supports-color": "2.0.0"
}
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
"esutils": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs="
},
"has-ansi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"requires": {
"ansi-regex": "2.1.1"
}
},
"js-tokens": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls="
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"requires": {
"ansi-regex": "2.1.1"
}
},
"supports-color": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc="
}
}
}

View File

@@ -0,0 +1,49 @@
{
"_args": [
[
"babel-code-frame@6.26.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-code-frame@6.26.0",
"_id": "babel-code-frame@6.26.0",
"_inBundle": false,
"_integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
"_location": "/babel-preset-env/babel-code-frame",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-code-frame@6.26.0",
"name": "babel-code-frame",
"escapedName": "babel-code-frame",
"rawSpec": "6.26.0",
"saveSpec": null,
"fetchSpec": "6.26.0"
},
"_requiredBy": [
"/babel-preset-env/babel-traverse"
],
"_resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
"_spec": "6.26.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"author": {
"name": "Sebastian McKenzie",
"email": "sebmck@gmail.com"
},
"dependencies": {
"chalk": "^1.1.3",
"esutils": "^2.0.2",
"js-tokens": "^3.0.2"
},
"description": "Generate errors that contain a code frame that point to source locations.",
"homepage": "https://babeljs.io/",
"license": "MIT",
"main": "lib/index.js",
"name": "babel-code-frame",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-code-frame"
},
"version": "6.26.0"
}

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,5 @@
# babel-helper-builder-binary-assignment-operator-visitor
## Usage
TODO

View File

@@ -0,0 +1,65 @@
"use strict";
exports.__esModule = true;
exports.default = function (opts) {
var visitor = {};
function isAssignment(node) {
return node && node.operator === opts.operator + "=";
}
function buildAssignment(left, right) {
return t.assignmentExpression("=", left, right);
}
visitor.ExpressionStatement = function (path, file) {
if (path.isCompletionRecord()) return;
var expr = path.node.expression;
if (!isAssignment(expr)) return;
var nodes = [];
var exploded = (0, _babelHelperExplodeAssignableExpression2.default)(expr.left, nodes, file, path.scope, true);
nodes.push(t.expressionStatement(buildAssignment(exploded.ref, opts.build(exploded.uid, expr.right))));
path.replaceWithMultiple(nodes);
};
visitor.AssignmentExpression = function (path, file) {
var node = path.node,
scope = path.scope;
if (!isAssignment(node)) return;
var nodes = [];
var exploded = (0, _babelHelperExplodeAssignableExpression2.default)(node.left, nodes, file, scope);
nodes.push(buildAssignment(exploded.ref, opts.build(exploded.uid, node.right)));
path.replaceWithMultiple(nodes);
};
visitor.BinaryExpression = function (path) {
var node = path.node;
if (node.operator === opts.operator) {
path.replaceWith(opts.build(node.left, node.right));
}
};
return visitor;
};
var _babelHelperExplodeAssignableExpression = require("babel-helper-explode-assignable-expression");
var _babelHelperExplodeAssignableExpression2 = _interopRequireDefault(_babelHelperExplodeAssignableExpression);
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = exports["default"];

View File

@@ -0,0 +1,44 @@
{
"_args": [
[
"babel-helper-builder-binary-assignment-operator-visitor@6.24.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-helper-builder-binary-assignment-operator-visitor@6.24.1",
"_id": "babel-helper-builder-binary-assignment-operator-visitor@6.24.1",
"_inBundle": false,
"_integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=",
"_location": "/babel-preset-env/babel-helper-builder-binary-assignment-operator-visitor",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-helper-builder-binary-assignment-operator-visitor@6.24.1",
"name": "babel-helper-builder-binary-assignment-operator-visitor",
"escapedName": "babel-helper-builder-binary-assignment-operator-visitor",
"rawSpec": "6.24.1",
"saveSpec": null,
"fetchSpec": "6.24.1"
},
"_requiredBy": [
"/babel-preset-env/babel-plugin-transform-exponentiation-operator"
],
"_resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz",
"_spec": "6.24.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-helper-explode-assignable-expression": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
},
"description": "Helper function to build binary assignment operator visitors",
"license": "MIT",
"main": "lib/index.js",
"name": "babel-helper-builder-binary-assignment-operator-visitor",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-binary-assignment-operator-visitor"
},
"version": "6.24.1"
}

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,5 @@
# babel-helper-call-delegate
## Usage
TODO

View File

@@ -0,0 +1,72 @@
"use strict";
exports.__esModule = true;
exports.default = function (path) {
var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : path.scope;
var node = path.node;
var container = t.functionExpression(null, [], node.body, node.generator, node.async);
var callee = container;
var args = [];
(0, _babelHelperHoistVariables2.default)(path, function (id) {
return scope.push({ id: id });
});
var state = {
foundThis: false,
foundArguments: false
};
path.traverse(visitor, state);
if (state.foundArguments) {
callee = t.memberExpression(container, t.identifier("apply"));
args = [];
if (state.foundThis) {
args.push(t.thisExpression());
}
if (state.foundArguments) {
if (!state.foundThis) args.push(t.nullLiteral());
args.push(t.identifier("arguments"));
}
}
var call = t.callExpression(callee, args);
if (node.generator) call = t.yieldExpression(call, true);
return t.returnStatement(call);
};
var _babelHelperHoistVariables = require("babel-helper-hoist-variables");
var _babelHelperHoistVariables2 = _interopRequireDefault(_babelHelperHoistVariables);
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var visitor = {
enter: function enter(path, state) {
if (path.isThisExpression()) {
state.foundThis = true;
}
if (path.isReferencedIdentifier({ name: "arguments" })) {
state.foundArguments = true;
}
},
Function: function Function(path) {
path.skip();
}
};
module.exports = exports["default"];

View File

@@ -0,0 +1,45 @@
{
"_args": [
[
"babel-helper-call-delegate@6.24.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-helper-call-delegate@6.24.1",
"_id": "babel-helper-call-delegate@6.24.1",
"_inBundle": false,
"_integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=",
"_location": "/babel-preset-env/babel-helper-call-delegate",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-helper-call-delegate@6.24.1",
"name": "babel-helper-call-delegate",
"escapedName": "babel-helper-call-delegate",
"rawSpec": "6.24.1",
"saveSpec": null,
"fetchSpec": "6.24.1"
},
"_requiredBy": [
"/babel-preset-env/babel-plugin-transform-es2015-parameters"
],
"_resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz",
"_spec": "6.24.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-helper-hoist-variables": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
},
"description": "Helper function to call delegate",
"license": "MIT",
"main": "lib/index.js",
"name": "babel-helper-call-delegate",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-call-delegate"
},
"version": "6.24.1"
}

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,5 @@
# babel-helper-define-map
## Usage
TODO

View File

@@ -0,0 +1,159 @@
"use strict";
exports.__esModule = true;
var _keys = require("babel-runtime/core-js/object/keys");
var _keys2 = _interopRequireDefault(_keys);
exports.push = push;
exports.hasComputed = hasComputed;
exports.toComputedObjectFromClass = toComputedObjectFromClass;
exports.toClassObject = toClassObject;
exports.toDefineObject = toDefineObject;
var _babelHelperFunctionName = require("babel-helper-function-name");
var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName);
var _has = require("lodash/has");
var _has2 = _interopRequireDefault(_has);
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function toKind(node) {
if (t.isClassMethod(node) || t.isObjectMethod(node)) {
if (node.kind === "get" || node.kind === "set") {
return node.kind;
}
}
return "value";
}
function push(mutatorMap, node, kind, file, scope) {
var alias = t.toKeyAlias(node);
var map = {};
if ((0, _has2.default)(mutatorMap, alias)) map = mutatorMap[alias];
mutatorMap[alias] = map;
map._inherits = map._inherits || [];
map._inherits.push(node);
map._key = node.key;
if (node.computed) {
map._computed = true;
}
if (node.decorators) {
var decorators = map.decorators = map.decorators || t.arrayExpression([]);
decorators.elements = decorators.elements.concat(node.decorators.map(function (dec) {
return dec.expression;
}).reverse());
}
if (map.value || map.initializer) {
throw file.buildCodeFrameError(node, "Key conflict with sibling node");
}
var key = void 0,
value = void 0;
if (t.isObjectProperty(node) || t.isObjectMethod(node) || t.isClassMethod(node)) {
key = t.toComputedKey(node, node.key);
}
if (t.isObjectProperty(node) || t.isClassProperty(node)) {
value = node.value;
} else if (t.isObjectMethod(node) || t.isClassMethod(node)) {
value = t.functionExpression(null, node.params, node.body, node.generator, node.async);
value.returnType = node.returnType;
}
var inheritedKind = toKind(node);
if (!kind || inheritedKind !== "value") {
kind = inheritedKind;
}
if (scope && t.isStringLiteral(key) && (kind === "value" || kind === "initializer") && t.isFunctionExpression(value)) {
value = (0, _babelHelperFunctionName2.default)({ id: key, node: value, scope: scope });
}
if (value) {
t.inheritsComments(value, node);
map[kind] = value;
}
return map;
}
function hasComputed(mutatorMap) {
for (var key in mutatorMap) {
if (mutatorMap[key]._computed) {
return true;
}
}
return false;
}
function toComputedObjectFromClass(obj) {
var objExpr = t.arrayExpression([]);
for (var i = 0; i < obj.properties.length; i++) {
var prop = obj.properties[i];
var val = prop.value;
val.properties.unshift(t.objectProperty(t.identifier("key"), t.toComputedKey(prop)));
objExpr.elements.push(val);
}
return objExpr;
}
function toClassObject(mutatorMap) {
var objExpr = t.objectExpression([]);
(0, _keys2.default)(mutatorMap).forEach(function (mutatorMapKey) {
var map = mutatorMap[mutatorMapKey];
var mapNode = t.objectExpression([]);
var propNode = t.objectProperty(map._key, mapNode, map._computed);
(0, _keys2.default)(map).forEach(function (key) {
var node = map[key];
if (key[0] === "_") return;
var inheritNode = node;
if (t.isClassMethod(node) || t.isClassProperty(node)) node = node.value;
var prop = t.objectProperty(t.identifier(key), node);
t.inheritsComments(prop, inheritNode);
t.removeComments(inheritNode);
mapNode.properties.push(prop);
});
objExpr.properties.push(propNode);
});
return objExpr;
}
function toDefineObject(mutatorMap) {
(0, _keys2.default)(mutatorMap).forEach(function (key) {
var map = mutatorMap[key];
if (map.value) map.writable = t.booleanLiteral(true);
map.configurable = t.booleanLiteral(true);
map.enumerable = t.booleanLiteral(true);
});
return toClassObject(mutatorMap);
}

View File

@@ -0,0 +1,13 @@
{
"name": "babel-helper-define-map",
"version": "6.24.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"lodash": {
"version": "4.17.4",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4="
}
}
}

View File

@@ -0,0 +1,45 @@
{
"_args": [
[
"babel-helper-define-map@6.26.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-helper-define-map@6.26.0",
"_id": "babel-helper-define-map@6.26.0",
"_inBundle": false,
"_integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=",
"_location": "/babel-preset-env/babel-helper-define-map",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-helper-define-map@6.26.0",
"name": "babel-helper-define-map",
"escapedName": "babel-helper-define-map",
"rawSpec": "6.26.0",
"saveSpec": null,
"fetchSpec": "6.26.0"
},
"_requiredBy": [
"/babel-preset-env/babel-plugin-transform-es2015-classes"
],
"_resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz",
"_spec": "6.26.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-helper-function-name": "^6.24.1",
"babel-runtime": "^6.26.0",
"babel-types": "^6.26.0",
"lodash": "^4.17.4"
},
"description": "Helper function to define a map",
"license": "MIT",
"main": "lib/index.js",
"name": "babel-helper-define-map",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-define-map"
},
"version": "6.26.0"
}

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,5 @@
# babel-helper-explode-assignable-expression
## Usage
TODO

View File

@@ -0,0 +1,72 @@
"use strict";
exports.__esModule = true;
exports.default = function (node, nodes, file, scope, allowedSingleIdent) {
var obj = void 0;
if (t.isIdentifier(node) && allowedSingleIdent) {
obj = node;
} else {
obj = getObjRef(node, nodes, file, scope);
}
var ref = void 0,
uid = void 0;
if (t.isIdentifier(node)) {
ref = node;
uid = obj;
} else {
var prop = getPropRef(node, nodes, file, scope);
var computed = node.computed || t.isLiteral(prop);
uid = ref = t.memberExpression(obj, prop, computed);
}
return {
uid: uid,
ref: ref
};
};
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function getObjRef(node, nodes, file, scope) {
var ref = void 0;
if (t.isSuper(node)) {
return node;
} else if (t.isIdentifier(node)) {
if (scope.hasBinding(node.name)) {
return node;
} else {
ref = node;
}
} else if (t.isMemberExpression(node)) {
ref = node.object;
if (t.isSuper(ref) || t.isIdentifier(ref) && scope.hasBinding(ref.name)) {
return ref;
}
} else {
throw new Error("We can't explode this node type " + node.type);
}
var temp = scope.generateUidIdentifierBasedOnNode(ref);
nodes.push(t.variableDeclaration("var", [t.variableDeclarator(temp, ref)]));
return temp;
}
function getPropRef(node, nodes, file, scope) {
var prop = node.property;
var key = t.toComputedKey(node, prop);
if (t.isLiteral(key) && t.isPureish(key)) return key;
var temp = scope.generateUidIdentifierBasedOnNode(prop);
nodes.push(t.variableDeclaration("var", [t.variableDeclarator(temp, prop)]));
return temp;
}
module.exports = exports["default"];

View File

@@ -0,0 +1,44 @@
{
"_args": [
[
"babel-helper-explode-assignable-expression@6.24.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-helper-explode-assignable-expression@6.24.1",
"_id": "babel-helper-explode-assignable-expression@6.24.1",
"_inBundle": false,
"_integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=",
"_location": "/babel-preset-env/babel-helper-explode-assignable-expression",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-helper-explode-assignable-expression@6.24.1",
"name": "babel-helper-explode-assignable-expression",
"escapedName": "babel-helper-explode-assignable-expression",
"rawSpec": "6.24.1",
"saveSpec": null,
"fetchSpec": "6.24.1"
},
"_requiredBy": [
"/babel-preset-env/babel-helper-builder-binary-assignment-operator-visitor"
],
"_resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz",
"_spec": "6.24.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-runtime": "^6.22.0",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
},
"description": "Helper function to explode an assignable expression",
"license": "MIT",
"main": "lib/index.js",
"name": "babel-helper-explode-assignable-expression",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-assignable-expression"
},
"version": "6.24.1"
}

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,5 @@
# babel-helper-function-name
## Usage
TODO

View File

@@ -0,0 +1,133 @@
"use strict";
exports.__esModule = true;
exports.default = function (_ref) {
var node = _ref.node,
parent = _ref.parent,
scope = _ref.scope,
id = _ref.id;
if (node.id) return;
if ((t.isObjectProperty(parent) || t.isObjectMethod(parent, { kind: "method" })) && (!parent.computed || t.isLiteral(parent.key))) {
id = parent.key;
} else if (t.isVariableDeclarator(parent)) {
id = parent.id;
if (t.isIdentifier(id)) {
var binding = scope.parent.getBinding(id.name);
if (binding && binding.constant && scope.getBinding(id.name) === binding) {
node.id = id;
node.id[t.NOT_LOCAL_BINDING] = true;
return;
}
}
} else if (t.isAssignmentExpression(parent)) {
id = parent.left;
} else if (!id) {
return;
}
var name = void 0;
if (id && t.isLiteral(id)) {
name = id.value;
} else if (id && t.isIdentifier(id)) {
name = id.name;
} else {
return;
}
name = t.toBindingIdentifierName(name);
id = t.identifier(name);
id[t.NOT_LOCAL_BINDING] = true;
var state = visit(node, name, scope);
return wrap(state, node, id, scope) || node;
};
var _babelHelperGetFunctionArity = require("babel-helper-get-function-arity");
var _babelHelperGetFunctionArity2 = _interopRequireDefault(_babelHelperGetFunctionArity);
var _babelTemplate = require("babel-template");
var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var buildPropertyMethodAssignmentWrapper = (0, _babelTemplate2.default)("\n (function (FUNCTION_KEY) {\n function FUNCTION_ID() {\n return FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n }\n\n return FUNCTION_ID;\n })(FUNCTION)\n");
var buildGeneratorPropertyMethodAssignmentWrapper = (0, _babelTemplate2.default)("\n (function (FUNCTION_KEY) {\n function* FUNCTION_ID() {\n return yield* FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n };\n\n return FUNCTION_ID;\n })(FUNCTION)\n");
var visitor = {
"ReferencedIdentifier|BindingIdentifier": function ReferencedIdentifierBindingIdentifier(path, state) {
if (path.node.name !== state.name) return;
var localDeclar = path.scope.getBindingIdentifier(state.name);
if (localDeclar !== state.outerDeclar) return;
state.selfReference = true;
path.stop();
}
};
function wrap(state, method, id, scope) {
if (state.selfReference) {
if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) {
scope.rename(id.name);
} else {
if (!t.isFunction(method)) return;
var build = buildPropertyMethodAssignmentWrapper;
if (method.generator) build = buildGeneratorPropertyMethodAssignmentWrapper;
var _template = build({
FUNCTION: method,
FUNCTION_ID: id,
FUNCTION_KEY: scope.generateUidIdentifier(id.name)
}).expression;
_template.callee._skipModulesRemap = true;
var params = _template.callee.body.body[0].params;
for (var i = 0, len = (0, _babelHelperGetFunctionArity2.default)(method); i < len; i++) {
params.push(scope.generateUidIdentifier("x"));
}
return _template;
}
}
method.id = id;
scope.getProgramParent().references[id.name] = true;
}
function visit(node, name, scope) {
var state = {
selfAssignment: false,
selfReference: false,
outerDeclar: scope.getBindingIdentifier(name),
references: [],
name: name
};
var binding = scope.getOwnBinding(name);
if (binding) {
if (binding.kind === "param") {
state.selfReference = true;
} else {}
} else if (state.outerDeclar || scope.hasGlobal(name)) {
scope.traverse(node, visitor, state);
}
return state;
}
module.exports = exports["default"];

View File

@@ -0,0 +1,49 @@
{
"_args": [
[
"babel-helper-function-name@6.24.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-helper-function-name@6.24.1",
"_id": "babel-helper-function-name@6.24.1",
"_inBundle": false,
"_integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=",
"_location": "/babel-preset-env/babel-helper-function-name",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-helper-function-name@6.24.1",
"name": "babel-helper-function-name",
"escapedName": "babel-helper-function-name",
"rawSpec": "6.24.1",
"saveSpec": null,
"fetchSpec": "6.24.1"
},
"_requiredBy": [
"/babel-preset-env/babel-helper-define-map",
"/babel-preset-env/babel-helper-remap-async-to-generator",
"/babel-preset-env/babel-plugin-transform-es2015-classes",
"/babel-preset-env/babel-plugin-transform-es2015-function-name"
],
"_resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz",
"_spec": "6.24.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-helper-get-function-arity": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
},
"description": "Helper function to change the property 'name' of every function",
"license": "MIT",
"main": "lib/index.js",
"name": "babel-helper-function-name",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name"
},
"version": "6.24.1"
}

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,5 @@
# babel-helper-get-function-arity
## Usage
TODO

View File

@@ -0,0 +1,22 @@
"use strict";
exports.__esModule = true;
exports.default = function (node) {
var params = node.params;
for (var i = 0; i < params.length; i++) {
var param = params[i];
if (t.isAssignmentPattern(param) || t.isRestElement(param)) {
return i;
}
}
return params.length;
};
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
module.exports = exports["default"];

View File

@@ -0,0 +1,44 @@
{
"_args": [
[
"babel-helper-get-function-arity@6.24.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-helper-get-function-arity@6.24.1",
"_id": "babel-helper-get-function-arity@6.24.1",
"_inBundle": false,
"_integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=",
"_location": "/babel-preset-env/babel-helper-get-function-arity",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-helper-get-function-arity@6.24.1",
"name": "babel-helper-get-function-arity",
"escapedName": "babel-helper-get-function-arity",
"rawSpec": "6.24.1",
"saveSpec": null,
"fetchSpec": "6.24.1"
},
"_requiredBy": [
"/babel-preset-env/babel-helper-function-name",
"/babel-preset-env/babel-plugin-transform-es2015-parameters"
],
"_resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz",
"_spec": "6.24.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
},
"description": "Helper function to get function arity",
"license": "MIT",
"main": "lib/index.js",
"name": "babel-helper-get-function-arity",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-get-function-arity"
},
"version": "6.24.1"
}

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,5 @@
# babel-helper-hoist-variables
## Usage
TODO

View File

@@ -0,0 +1,71 @@
"use strict";
exports.__esModule = true;
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _getIterator3 = _interopRequireDefault(_getIterator2);
exports.default = function (path, emit) {
var kind = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "var";
path.traverse(visitor, { kind: kind, emit: emit });
};
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var visitor = {
Scope: function Scope(path, state) {
if (state.kind === "let") path.skip();
},
Function: function Function(path) {
path.skip();
},
VariableDeclaration: function VariableDeclaration(path, state) {
if (state.kind && path.node.kind !== state.kind) return;
var nodes = [];
var declarations = path.get("declarations");
var firstId = void 0;
for (var _iterator = declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_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 declar = _ref;
firstId = declar.node.id;
if (declar.node.init) {
nodes.push(t.expressionStatement(t.assignmentExpression("=", declar.node.id, declar.node.init)));
}
for (var name in declar.getBindingIdentifiers()) {
state.emit(t.identifier(name), name);
}
}
if (path.parentPath.isFor({ left: path.node })) {
path.replaceWith(firstId);
} else {
path.replaceWithMultiple(nodes);
}
}
};
module.exports = exports["default"];

View File

@@ -0,0 +1,44 @@
{
"_args": [
[
"babel-helper-hoist-variables@6.24.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-helper-hoist-variables@6.24.1",
"_id": "babel-helper-hoist-variables@6.24.1",
"_inBundle": false,
"_integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=",
"_location": "/babel-preset-env/babel-helper-hoist-variables",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-helper-hoist-variables@6.24.1",
"name": "babel-helper-hoist-variables",
"escapedName": "babel-helper-hoist-variables",
"rawSpec": "6.24.1",
"saveSpec": null,
"fetchSpec": "6.24.1"
},
"_requiredBy": [
"/babel-preset-env/babel-helper-call-delegate",
"/babel-preset-env/babel-plugin-transform-es2015-modules-systemjs"
],
"_resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz",
"_spec": "6.24.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
},
"description": "Helper function to hoist variables",
"license": "MIT",
"main": "lib/index.js",
"name": "babel-helper-hoist-variables",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-hoist-variables"
},
"version": "6.24.1"
}

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,5 @@
# babel-helper-optimise-call-expression
## Usage
TODO

View File

@@ -0,0 +1,19 @@
"use strict";
exports.__esModule = true;
exports.default = function (callee, thisNode, args) {
if (args.length === 1 && t.isSpreadElement(args[0]) && t.isIdentifier(args[0].argument, { name: "arguments" })) {
return t.callExpression(t.memberExpression(callee, t.identifier("apply")), [thisNode, args[0].argument]);
} else {
return t.callExpression(t.memberExpression(callee, t.identifier("call")), [thisNode].concat(args));
}
};
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
module.exports = exports["default"];

View File

@@ -0,0 +1,44 @@
{
"_args": [
[
"babel-helper-optimise-call-expression@6.24.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-helper-optimise-call-expression@6.24.1",
"_id": "babel-helper-optimise-call-expression@6.24.1",
"_inBundle": false,
"_integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=",
"_location": "/babel-preset-env/babel-helper-optimise-call-expression",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-helper-optimise-call-expression@6.24.1",
"name": "babel-helper-optimise-call-expression",
"escapedName": "babel-helper-optimise-call-expression",
"rawSpec": "6.24.1",
"saveSpec": null,
"fetchSpec": "6.24.1"
},
"_requiredBy": [
"/babel-preset-env/babel-helper-replace-supers",
"/babel-preset-env/babel-plugin-transform-es2015-classes"
],
"_resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz",
"_spec": "6.24.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-runtime": "^6.22.0",
"babel-types": "^6.24.1"
},
"description": "Helper function to optimise call expression",
"license": "MIT",
"main": "lib/index.js",
"name": "babel-helper-optimise-call-expression",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-optimise-call-expression"
},
"version": "6.24.1"
}

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,5 @@
# babel-helper-regex
## Usage
TODO

View File

@@ -0,0 +1,28 @@
"use strict";
exports.__esModule = true;
exports.is = is;
exports.pullFlag = pullFlag;
var _pull = require("lodash/pull");
var _pull2 = _interopRequireDefault(_pull);
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function is(node, flag) {
return t.isRegExpLiteral(node) && node.flags.indexOf(flag) >= 0;
}
function pullFlag(node, flag) {
var flags = node.flags.split("");
if (node.flags.indexOf(flag) < 0) return;
(0, _pull2.default)(flags, flag);
node.flags = flags.join("");
}

View File

@@ -0,0 +1,13 @@
{
"name": "babel-helper-regex",
"version": "6.24.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"lodash": {
"version": "4.17.4",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4="
}
}
}

View File

@@ -0,0 +1,45 @@
{
"_args": [
[
"babel-helper-regex@6.26.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-helper-regex@6.26.0",
"_id": "babel-helper-regex@6.26.0",
"_inBundle": false,
"_integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=",
"_location": "/babel-preset-env/babel-helper-regex",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-helper-regex@6.26.0",
"name": "babel-helper-regex",
"escapedName": "babel-helper-regex",
"rawSpec": "6.26.0",
"saveSpec": null,
"fetchSpec": "6.26.0"
},
"_requiredBy": [
"/babel-preset-env/babel-plugin-transform-es2015-sticky-regex",
"/babel-preset-env/babel-plugin-transform-es2015-unicode-regex"
],
"_resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz",
"_spec": "6.26.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-runtime": "^6.26.0",
"babel-types": "^6.26.0",
"lodash": "^4.17.4"
},
"description": "Helper function to check for literal RegEx",
"license": "MIT",
"main": "lib/index.js",
"name": "babel-helper-regex",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-regex"
},
"version": "6.26.0"
}

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,5 @@
# babel-helper-remap-async-to-generator
## Usage
TODO

View File

@@ -0,0 +1,89 @@
"use strict";
exports.__esModule = true;
exports.default = function (path, helpers) {
var node = path.node,
scope = path.scope,
parent = path.parent;
var stepKey = scope.generateUidIdentifier("step");
var stepValue = scope.generateUidIdentifier("value");
var left = node.left;
var declar = void 0;
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)]);
}
var template = buildForAwait();
(0, _babelTraverse2.default)(template, forAwaitVisitor, null, {
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: helpers.getAsyncIterator,
OBJECT: node.right,
STEP_VALUE: stepValue,
STEP_KEY: stepKey,
AWAIT: helpers.wrapAwait
});
template = template.body.body;
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,
node: template,
declar: declar,
loop: loop
};
};
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
var _babelTemplate = require("babel-template");
var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
var _babelTraverse = require("babel-traverse");
var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
var buildForAwait = (0, _babelTemplate2.default)("\n function* wrapper() {\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (\n var ITERATOR_KEY = GET_ITERATOR(OBJECT), STEP_KEY, STEP_VALUE;\n (\n STEP_KEY = yield AWAIT(ITERATOR_KEY.next()),\n ITERATOR_COMPLETION = STEP_KEY.done,\n STEP_VALUE = yield AWAIT(STEP_KEY.value),\n !ITERATOR_COMPLETION\n );\n 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 yield AWAIT(ITERATOR_KEY.return());\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n }\n");
var forAwaitVisitor = {
noScope: true,
Identifier: function Identifier(path, replacements) {
if (path.node.name in replacements) {
path.replaceInline(replacements[path.node.name]);
}
},
CallExpression: function CallExpression(path, replacements) {
var callee = path.node.callee;
if (t.isIdentifier(callee) && callee.name === "AWAIT" && !replacements.AWAIT) {
path.replaceWith(path.node.arguments[0]);
}
}
};
module.exports = exports["default"];

View File

@@ -0,0 +1,175 @@
"use strict";
exports.__esModule = true;
exports.default = function (path, file, helpers) {
if (!helpers) {
helpers = { wrapAsync: file };
file = null;
}
path.traverse(awaitVisitor, {
file: file,
wrapAwait: helpers.wrapAwait
});
if (path.isClassMethod() || path.isObjectMethod()) {
classOrObjectMethod(path, helpers.wrapAsync);
} else {
plainFunction(path, helpers.wrapAsync);
}
};
var _babelHelperFunctionName = require("babel-helper-function-name");
var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName);
var _babelTemplate = require("babel-template");
var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
var _forAwait = require("./for-await");
var _forAwait2 = _interopRequireDefault(_forAwait);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var buildWrapper = (0, _babelTemplate2.default)("\n (() => {\n var REF = FUNCTION;\n return function NAME(PARAMS) {\n return REF.apply(this, arguments);\n };\n })\n");
var namedBuildWrapper = (0, _babelTemplate2.default)("\n (() => {\n var REF = FUNCTION;\n function NAME(PARAMS) {\n return REF.apply(this, arguments);\n }\n return NAME;\n })\n");
var awaitVisitor = {
Function: function Function(path) {
if (path.isArrowFunctionExpression() && !path.node.async) {
path.arrowFunctionToShadowed();
return;
}
path.skip();
},
AwaitExpression: function AwaitExpression(_ref, _ref2) {
var node = _ref.node;
var wrapAwait = _ref2.wrapAwait;
node.type = "YieldExpression";
if (wrapAwait) {
node.argument = t.callExpression(wrapAwait, [node.argument]);
}
},
ForAwaitStatement: function ForAwaitStatement(path, _ref3) {
var file = _ref3.file,
wrapAwait = _ref3.wrapAwait;
var node = path.node;
var build = (0, _forAwait2.default)(path, {
getAsyncIterator: file.addHelper("asyncIterator"),
wrapAwait: wrapAwait
});
var declar = build.declar,
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 classOrObjectMethod(path, callId) {
var node = path.node;
var body = node.body;
node.async = false;
var container = t.functionExpression(null, [], t.blockStatement(body.body), true);
container.shadow = true;
body.body = [t.returnStatement(t.callExpression(t.callExpression(callId, [container]), []))];
node.generator = false;
}
function plainFunction(path, callId) {
var node = path.node;
var isDeclaration = path.isFunctionDeclaration();
var asyncFnId = node.id;
var wrapper = buildWrapper;
if (path.isArrowFunctionExpression()) {
path.arrowFunctionToShadowed();
} else if (!isDeclaration && asyncFnId) {
wrapper = namedBuildWrapper;
}
node.async = false;
node.generator = true;
node.id = null;
if (isDeclaration) {
node.type = "FunctionExpression";
}
var built = t.callExpression(callId, [node]);
var container = wrapper({
NAME: asyncFnId,
REF: path.scope.generateUidIdentifier("ref"),
FUNCTION: built,
PARAMS: node.params.reduce(function (acc, param) {
acc.done = acc.done || t.isAssignmentPattern(param) || t.isRestElement(param);
if (!acc.done) {
acc.params.push(path.scope.generateUidIdentifier("x"));
}
return acc;
}, {
params: [],
done: false
}).params
}).expression;
if (isDeclaration) {
var declar = t.variableDeclaration("let", [t.variableDeclarator(t.identifier(asyncFnId.name), t.callExpression(container, []))]);
declar._blockHoist = true;
path.replaceWith(declar);
} else {
var retFunction = container.body.body[1].argument;
if (!asyncFnId) {
(0, _babelHelperFunctionName2.default)({
node: retFunction,
parent: path.parent,
scope: path.scope
});
}
if (!retFunction || retFunction.id || node.params.length) {
path.replaceWith(t.callExpression(container, []));
} else {
path.replaceWith(built);
}
}
}
module.exports = exports["default"];

View File

@@ -0,0 +1,46 @@
{
"_args": [
[
"babel-helper-remap-async-to-generator@6.24.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-helper-remap-async-to-generator@6.24.1",
"_id": "babel-helper-remap-async-to-generator@6.24.1",
"_inBundle": false,
"_integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=",
"_location": "/babel-preset-env/babel-helper-remap-async-to-generator",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-helper-remap-async-to-generator@6.24.1",
"name": "babel-helper-remap-async-to-generator",
"escapedName": "babel-helper-remap-async-to-generator",
"rawSpec": "6.24.1",
"saveSpec": null,
"fetchSpec": "6.24.1"
},
"_requiredBy": [
"/babel-preset-env/babel-plugin-transform-async-to-generator"
],
"_resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz",
"_spec": "6.24.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-helper-function-name": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
},
"description": "Helper function to remap async functions to generators",
"license": "MIT",
"main": "lib/index.js",
"name": "babel-helper-remap-async-to-generator",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-remap-async-to-generator"
},
"version": "6.24.1"
}

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,5 @@
# babel-helper-replace-supers
## Usage
TODO

View File

@@ -0,0 +1,228 @@
"use strict";
exports.__esModule = true;
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _symbol = require("babel-runtime/core-js/symbol");
var _symbol2 = _interopRequireDefault(_symbol);
var _babelHelperOptimiseCallExpression = require("babel-helper-optimise-call-expression");
var _babelHelperOptimiseCallExpression2 = _interopRequireDefault(_babelHelperOptimiseCallExpression);
var _babelMessages = require("babel-messages");
var messages = _interopRequireWildcard(_babelMessages);
var _babelTypes = require("babel-types");
var t = _interopRequireWildcard(_babelTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var HARDCORE_THIS_REF = (0, _symbol2.default)();
function isIllegalBareSuper(node, parent) {
if (!t.isSuper(node)) return false;
if (t.isMemberExpression(parent, { computed: false })) return false;
if (t.isCallExpression(parent, { callee: node })) return false;
return true;
}
function isMemberExpressionSuper(node) {
return t.isMemberExpression(node) && t.isSuper(node.object);
}
function getPrototypeOfExpression(objectRef, isStatic) {
var targetRef = isStatic ? objectRef : t.memberExpression(objectRef, t.identifier("prototype"));
return t.logicalExpression("||", t.memberExpression(targetRef, t.identifier("__proto__")), t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")), [targetRef]));
}
var visitor = {
Function: function Function(path) {
if (!path.inShadow("this")) {
path.skip();
}
},
ReturnStatement: function ReturnStatement(path, state) {
if (!path.inShadow("this")) {
state.returns.push(path);
}
},
ThisExpression: function ThisExpression(path, state) {
if (!path.node[HARDCORE_THIS_REF]) {
state.thises.push(path);
}
},
enter: function enter(path, state) {
var callback = state.specHandle;
if (state.isLoose) callback = state.looseHandle;
var isBareSuper = path.isCallExpression() && path.get("callee").isSuper();
var result = callback.call(state, path);
if (result) {
state.hasSuper = true;
}
if (isBareSuper) {
state.bareSupers.push(path);
}
if (result === true) {
path.requeue();
}
if (result !== true && result) {
if (Array.isArray(result)) {
path.replaceWithMultiple(result);
} else {
path.replaceWith(result);
}
}
}
};
var ReplaceSupers = function () {
function ReplaceSupers(opts) {
var inClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
(0, _classCallCheck3.default)(this, ReplaceSupers);
this.forceSuperMemoisation = opts.forceSuperMemoisation;
this.methodPath = opts.methodPath;
this.methodNode = opts.methodNode;
this.superRef = opts.superRef;
this.isStatic = opts.isStatic;
this.hasSuper = false;
this.inClass = inClass;
this.isLoose = opts.isLoose;
this.scope = this.methodPath.scope;
this.file = opts.file;
this.opts = opts;
this.bareSupers = [];
this.returns = [];
this.thises = [];
}
ReplaceSupers.prototype.getObjectRef = function getObjectRef() {
return this.opts.objectRef || this.opts.getObjectRef();
};
ReplaceSupers.prototype.setSuperProperty = function setSuperProperty(property, value, isComputed) {
return t.callExpression(this.file.addHelper("set"), [getPrototypeOfExpression(this.getObjectRef(), this.isStatic), isComputed ? property : t.stringLiteral(property.name), value, t.thisExpression()]);
};
ReplaceSupers.prototype.getSuperProperty = function getSuperProperty(property, isComputed) {
return t.callExpression(this.file.addHelper("get"), [getPrototypeOfExpression(this.getObjectRef(), this.isStatic), isComputed ? property : t.stringLiteral(property.name), t.thisExpression()]);
};
ReplaceSupers.prototype.replace = function replace() {
this.methodPath.traverse(visitor, this);
};
ReplaceSupers.prototype.getLooseSuperProperty = function getLooseSuperProperty(id, parent) {
var methodNode = this.methodNode;
var superRef = this.superRef || t.identifier("Function");
if (parent.property === id) {
return;
} else if (t.isCallExpression(parent, { callee: id })) {
return;
} else if (t.isMemberExpression(parent) && !methodNode.static) {
return t.memberExpression(superRef, t.identifier("prototype"));
} else {
return superRef;
}
};
ReplaceSupers.prototype.looseHandle = function looseHandle(path) {
var node = path.node;
if (path.isSuper()) {
return this.getLooseSuperProperty(node, path.parent);
} else if (path.isCallExpression()) {
var callee = node.callee;
if (!t.isMemberExpression(callee)) return;
if (!t.isSuper(callee.object)) return;
t.appendToMemberExpression(callee, t.identifier("call"));
node.arguments.unshift(t.thisExpression());
return true;
}
};
ReplaceSupers.prototype.specHandleAssignmentExpression = function specHandleAssignmentExpression(ref, path, node) {
if (node.operator === "=") {
return this.setSuperProperty(node.left.property, node.right, node.left.computed);
} else {
ref = ref || path.scope.generateUidIdentifier("ref");
return [t.variableDeclaration("var", [t.variableDeclarator(ref, node.left)]), t.expressionStatement(t.assignmentExpression("=", node.left, t.binaryExpression(node.operator[0], ref, node.right)))];
}
};
ReplaceSupers.prototype.specHandle = function specHandle(path) {
var property = void 0;
var computed = void 0;
var args = void 0;
var parent = path.parent;
var node = path.node;
if (isIllegalBareSuper(node, parent)) {
throw path.buildCodeFrameError(messages.get("classesIllegalBareSuper"));
}
if (t.isCallExpression(node)) {
var callee = node.callee;
if (t.isSuper(callee)) {
return;
} else if (isMemberExpressionSuper(callee)) {
property = callee.property;
computed = callee.computed;
args = node.arguments;
}
} else if (t.isMemberExpression(node) && t.isSuper(node.object)) {
property = node.property;
computed = node.computed;
} else if (t.isUpdateExpression(node) && isMemberExpressionSuper(node.argument)) {
var binary = t.binaryExpression(node.operator[0], node.argument, t.numericLiteral(1));
if (node.prefix) {
return this.specHandleAssignmentExpression(null, path, binary);
} else {
var ref = path.scope.generateUidIdentifier("ref");
return this.specHandleAssignmentExpression(ref, path, binary).concat(t.expressionStatement(ref));
}
} else if (t.isAssignmentExpression(node) && isMemberExpressionSuper(node.left)) {
return this.specHandleAssignmentExpression(null, path, node);
}
if (!property) return;
var superProperty = this.getSuperProperty(property, computed);
if (args) {
return this.optimiseCall(superProperty, args);
} else {
return superProperty;
}
};
ReplaceSupers.prototype.optimiseCall = function optimiseCall(callee, args) {
var thisNode = t.thisExpression();
thisNode[HARDCORE_THIS_REF] = true;
return (0, _babelHelperOptimiseCallExpression2.default)(callee, thisNode, args);
};
return ReplaceSupers;
}();
exports.default = ReplaceSupers;
module.exports = exports["default"];

View File

@@ -0,0 +1,48 @@
{
"_args": [
[
"babel-helper-replace-supers@6.24.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-helper-replace-supers@6.24.1",
"_id": "babel-helper-replace-supers@6.24.1",
"_inBundle": false,
"_integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=",
"_location": "/babel-preset-env/babel-helper-replace-supers",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-helper-replace-supers@6.24.1",
"name": "babel-helper-replace-supers",
"escapedName": "babel-helper-replace-supers",
"rawSpec": "6.24.1",
"saveSpec": null,
"fetchSpec": "6.24.1"
},
"_requiredBy": [
"/babel-preset-env/babel-plugin-transform-es2015-classes",
"/babel-preset-env/babel-plugin-transform-es2015-object-super"
],
"_resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz",
"_spec": "6.24.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-helper-optimise-call-expression": "^6.24.1",
"babel-messages": "^6.23.0",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
},
"description": "Helper function to replace supers",
"license": "MIT",
"main": "lib/index.js",
"name": "babel-helper-replace-supers",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-replace-supers"
},
"version": "6.24.1"
}

View File

@@ -0,0 +1,3 @@
src
test
node_modules

View File

@@ -0,0 +1,18 @@
# babel-messages
> Collection of debug messages used by Babel.
## Install
```sh
npm install --save-dev babel-messages
```
## Usage
```js
import * as messages from 'babel-messages';
messages.get('tailCallReassignmentDeopt');
// > "Function reference has been..."
```

View File

@@ -0,0 +1,84 @@
"use strict";
exports.__esModule = true;
exports.MESSAGES = undefined;
var _stringify = require("babel-runtime/core-js/json/stringify");
var _stringify2 = _interopRequireDefault(_stringify);
exports.get = get;
exports.parseArgs = parseArgs;
var _util = require("util");
var util = _interopRequireWildcard(_util);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var MESSAGES = exports.MESSAGES = {
tailCallReassignmentDeopt: "Function reference has been reassigned, so it will probably be dereferenced, therefore we can't optimise this with confidence",
classesIllegalBareSuper: "Illegal use of bare super",
classesIllegalSuperCall: "Direct super call is illegal in non-constructor, use super.$1() instead",
scopeDuplicateDeclaration: "Duplicate declaration $1",
settersNoRest: "Setters aren't allowed to have a rest",
noAssignmentsInForHead: "No assignments allowed in for-in/of head",
expectedMemberExpressionOrIdentifier: "Expected type MemberExpression or Identifier",
invalidParentForThisNode: "We don't know how to handle this node within the current parent - please open an issue",
readOnly: "$1 is read-only",
unknownForHead: "Unknown node type $1 in ForStatement",
didYouMean: "Did you mean $1?",
codeGeneratorDeopt: "Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.",
missingTemplatesDirectory: "no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues",
unsupportedOutputType: "Unsupported output type $1",
illegalMethodName: "Illegal method name $1",
lostTrackNodePath: "We lost track of this node's position, likely because the AST was directly manipulated",
modulesIllegalExportName: "Illegal export $1",
modulesDuplicateDeclarations: "Duplicate module declarations with the same source but in different scopes",
undeclaredVariable: "Reference to undeclared variable $1",
undeclaredVariableType: "Referencing a type alias outside of a type annotation",
undeclaredVariableSuggestion: "Reference to undeclared variable $1 - did you mean $2?",
traverseNeedsParent: "You must pass a scope and parentPath unless traversing a Program/File. Instead of that you tried to traverse a $1 node without passing scope and parentPath.",
traverseVerifyRootFunction: "You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?",
traverseVerifyVisitorProperty: "You passed `traverse()` a visitor object with the property $1 that has the invalid property $2",
traverseVerifyNodeType: "You gave us a visitor for the node type $1 but it's not a valid type",
pluginNotObject: "Plugin $2 specified in $1 was expected to return an object when invoked but returned $3",
pluginNotFunction: "Plugin $2 specified in $1 was expected to return a function but returned $3",
pluginUnknown: "Unknown plugin $1 specified in $2 at $3, attempted to resolve relative to $4",
pluginInvalidProperty: "Plugin $2 specified in $1 provided an invalid property of $3"
};
function get(key) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var msg = MESSAGES[key];
if (!msg) throw new ReferenceError("Unknown message " + (0, _stringify2.default)(key));
args = parseArgs(args);
return msg.replace(/\$(\d+)/g, function (str, i) {
return args[i - 1];
});
}
function parseArgs(args) {
return args.map(function (val) {
if (val != null && val.inspect) {
return val.inspect();
} else {
try {
return (0, _stringify2.default)(val) || val + "";
} catch (e) {
return util.inspect(val);
}
}
});
}

View File

@@ -0,0 +1,49 @@
{
"_args": [
[
"babel-messages@6.23.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-messages@6.23.0",
"_id": "babel-messages@6.23.0",
"_inBundle": false,
"_integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=",
"_location": "/babel-preset-env/babel-messages",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-messages@6.23.0",
"name": "babel-messages",
"escapedName": "babel-messages",
"rawSpec": "6.23.0",
"saveSpec": null,
"fetchSpec": "6.23.0"
},
"_requiredBy": [
"/babel-preset-env/babel-helper-replace-supers",
"/babel-preset-env/babel-plugin-transform-es2015-classes",
"/babel-preset-env/babel-traverse"
],
"_resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz",
"_spec": "6.23.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"author": {
"name": "Sebastian McKenzie",
"email": "sebmck@gmail.com"
},
"dependencies": {
"babel-runtime": "^6.22.0"
},
"description": "Collection of debug messages used by Babel.",
"homepage": "https://babeljs.io/",
"license": "MIT",
"main": "lib/index.js",
"name": "babel-messages",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-messages"
},
"version": "6.23.0"
}

View File

@@ -0,0 +1,4 @@
node_modules
*.log
src
test

View File

@@ -0,0 +1,59 @@
# babel-plugin-check-es2015-constants
Validate ES2015 constants (prevents reassignment of const variables).
## Example
**In**
```js
const a = 1;
a = 2;
```
**Out**
```bash
repl: "a" is read-only
1 | const a = 1;
> 2 | a = 2;
| ^
```
[Try in REPL](http://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=es2015&experimental=false&loose=false&spec=false&code=const%20a%20%3D%201%3B%0Aa%20%3D%202%3B&playground=true)
## Installation
```sh
npm install --save-dev babel-plugin-check-es2015-constants
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["check-es2015-constants"]
}
```
### Via CLI
```sh
babel --plugins check-es2015-constants script.js
```
### Via Node API
```javascript
require("babel-core").transform("code", {
plugins: ["check-es2015-constants"]
});
```
## Note
This check will only validate consts. If you need it to compile down to `var` then you must also install and enable [`transform-es2015-block-scoping`](http://babeljs.io/docs/plugins/transform-es2015-block-scoping/).

View File

@@ -0,0 +1,45 @@
"use strict";
exports.__esModule = true;
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _getIterator3 = _interopRequireDefault(_getIterator2);
exports.default = function (_ref) {
var messages = _ref.messages;
return {
visitor: {
Scope: function Scope(_ref2) {
var scope = _ref2.scope;
for (var name in scope.bindings) {
var binding = scope.bindings[name];
if (binding.kind !== "const" && binding.kind !== "module") continue;
for (var _iterator = binding.constantViolations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
var _ref3;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref3 = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref3 = _i.value;
}
var violation = _ref3;
throw violation.buildCodeFrameError(messages.get("readOnly", name));
}
}
}
}
};
};
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = exports["default"];

View File

@@ -0,0 +1,48 @@
{
"_args": [
[
"babel-plugin-check-es2015-constants@6.22.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-plugin-check-es2015-constants@6.22.0",
"_id": "babel-plugin-check-es2015-constants@6.22.0",
"_inBundle": false,
"_integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=",
"_location": "/babel-preset-env/babel-plugin-check-es2015-constants",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-plugin-check-es2015-constants@6.22.0",
"name": "babel-plugin-check-es2015-constants",
"escapedName": "babel-plugin-check-es2015-constants",
"rawSpec": "6.22.0",
"saveSpec": null,
"fetchSpec": "6.22.0"
},
"_requiredBy": [
"/babel-preset-env"
],
"_resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz",
"_spec": "6.22.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-runtime": "^6.22.0"
},
"description": "Compile ES2015 constants to ES5",
"devDependencies": {
"babel-helper-plugin-test-runner": "^6.22.0"
},
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "babel-plugin-check-es2015-constants",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-check-es2015-constants"
},
"version": "6.22.0"
}

View File

@@ -0,0 +1,3 @@
node_modules
*.log
src

View File

@@ -0,0 +1,35 @@
# babel-plugin-syntax-async-functions
Allow parsing of async functions.
## Installation
```sh
$ npm install babel-plugin-syntax-async-functions
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["syntax-async-functions"]
}
```
### Via CLI
```sh
$ babel --plugins syntax-async-functions script.js
```
### Via Node API
```javascript
require("babel-core").transform("code", {
plugins: ["syntax-async-functions"]
});
```

View File

@@ -0,0 +1,13 @@
"use strict";
exports.__esModule = true;
exports.default = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("asyncFunctions");
}
};
};
module.exports = exports["default"];

View File

@@ -0,0 +1,44 @@
{
"_args": [
[
"babel-plugin-syntax-async-functions@6.13.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-plugin-syntax-async-functions@6.13.0",
"_id": "babel-plugin-syntax-async-functions@6.13.0",
"_inBundle": false,
"_integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=",
"_location": "/babel-preset-env/babel-plugin-syntax-async-functions",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-plugin-syntax-async-functions@6.13.0",
"name": "babel-plugin-syntax-async-functions",
"escapedName": "babel-plugin-syntax-async-functions",
"rawSpec": "6.13.0",
"saveSpec": null,
"fetchSpec": "6.13.0"
},
"_requiredBy": [
"/babel-preset-env/babel-plugin-transform-async-to-generator"
],
"_resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz",
"_spec": "6.13.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {},
"description": "Allow parsing of async functions",
"devDependencies": {},
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "babel-plugin-syntax-async-functions",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-async-functions"
},
"version": "6.13.0"
}

View File

@@ -0,0 +1,3 @@
node_modules
*.log
src

View File

@@ -0,0 +1,35 @@
# babel-plugin-syntax-exponentiation-operator
Allow parsing of the exponentiation operator.
## Installation
```sh
$ npm install babel-plugin-syntax-exponentiation-operator
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["syntax-exponentiation-operator"]
}
```
### Via CLI
```sh
$ babel --plugins syntax-exponentiation-operator script.js
```
### Via Node API
```javascript
require("babel-core").transform("code", {
plugins: ["syntax-exponentiation-operator"]
});
```

View File

@@ -0,0 +1,13 @@
"use strict";
exports.__esModule = true;
exports.default = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("exponentiationOperator");
}
};
};
module.exports = exports["default"];

View File

@@ -0,0 +1,44 @@
{
"_args": [
[
"babel-plugin-syntax-exponentiation-operator@6.13.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-plugin-syntax-exponentiation-operator@6.13.0",
"_id": "babel-plugin-syntax-exponentiation-operator@6.13.0",
"_inBundle": false,
"_integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=",
"_location": "/babel-preset-env/babel-plugin-syntax-exponentiation-operator",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-plugin-syntax-exponentiation-operator@6.13.0",
"name": "babel-plugin-syntax-exponentiation-operator",
"escapedName": "babel-plugin-syntax-exponentiation-operator",
"rawSpec": "6.13.0",
"saveSpec": null,
"fetchSpec": "6.13.0"
},
"_requiredBy": [
"/babel-preset-env/babel-plugin-transform-exponentiation-operator"
],
"_resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz",
"_spec": "6.13.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {},
"description": "Allow parsing of the exponentiation operator",
"devDependencies": {},
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "babel-plugin-syntax-exponentiation-operator",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-exponentation-operator"
},
"version": "6.13.0"
}

View File

@@ -0,0 +1,4 @@
node_modules
*.log
src
test

View File

@@ -0,0 +1,123 @@
# babel-plugin-syntax-trailing-function-commas
Compile trailing function commas to ES5
```js
function clownPuppiesEverywhere(
param1,
param2,
) { /* ... */ }
clownPuppiesEverywhere(
'foo',
'bar',
);
```
[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=function%20clownPuppiesEverywhere(%0A%20%20param1%2C%0A%20%20param2%2C%0A)%20%7B%20%2F*%20...%20*%2F%20%7D%0A%0AclownPuppiesEverywhere(%0A%20%20'foo'%2C%0A%20%20'bar'%2C%0A)%3B)
## Example
### Basic
This is an example from the [Proposal](https://github.com/jeffmo/es-trailing-function-commas).
Let's say you have this function:
```js
function clownPuppiesEverywhere(
param1,
param2
) { /* ... */ }
clownPuppiesEverywhere(
'foo',
'bar'
);
```
If you want to have a new parameter called `param3`, the diff output would be like that:
```diff
function clownPuppiesEverywhere(
param1,
- param2
+ param2, // Change this line to add a comma
+ param3 // Add param3
) { /* ... */ }
clownPuppiesEverywhere(
'foo',
- 'bar'
+ 'bar', // Change this line to add a comma
+ 'baz' // Add param3
);
```
In total, you have to change 2 lines for the function declaration and 2 lines for each usage.
If you had your function defined with trailing commas:
```js
function clownPuppiesEverywhere(
param1,
param2,
) { /* ... */ }
clownPuppiesEverywhere(
'foo',
'bar',
);
```
Adding a new parameter would only change one line in the function declaration and one line for each usage:
```diff
function clownPuppiesEverywhere(
param1,
param2,
+ param3, // Add param3
) { /* ... */ }
clownPuppiesEverywhere(
'foo',
'bar',
+ 'baz', // Add param3
);
```
In the end, your diff output will be cleaner and easier to read, it would be much quicker to add a new parameter to your functions, it also makes it easier to copy paste elements and move code around.
## Installation
```sh
npm install --save-dev babel-plugin-syntax-trailing-function-commas
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["syntax-trailing-function-commas"]
}
```
### Via CLI
```sh
babel --plugins syntax-trailing-function-commas script.js
```
### Via Node API
```javascript
require("babel-core").transform("code", {
plugins: ["syntax-trailing-function-commas"]
});
```
## References
* [Proposal](https://github.com/jeffmo/es-trailing-function-commas)
* [Spec](http://jeffmo.github.io/es-trailing-function-commas/)
* [Why you should enforce Dangling Commas for Multiline Statements](https://medium.com/@nikgraf/why-you-should-enforce-dangling-commas-for-multiline-statements-d034c98e36f8)

View File

@@ -0,0 +1,13 @@
"use strict";
exports.__esModule = true;
exports.default = function () {
return {
manipulateOptions: function manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("trailingFunctionCommas");
}
};
};
module.exports = exports["default"];

View File

@@ -0,0 +1,46 @@
{
"_args": [
[
"babel-plugin-syntax-trailing-function-commas@6.22.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-plugin-syntax-trailing-function-commas@6.22.0",
"_id": "babel-plugin-syntax-trailing-function-commas@6.22.0",
"_inBundle": false,
"_integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=",
"_location": "/babel-preset-env/babel-plugin-syntax-trailing-function-commas",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-plugin-syntax-trailing-function-commas@6.22.0",
"name": "babel-plugin-syntax-trailing-function-commas",
"escapedName": "babel-plugin-syntax-trailing-function-commas",
"rawSpec": "6.22.0",
"saveSpec": null,
"fetchSpec": "6.22.0"
},
"_requiredBy": [
"/babel-preset-env"
],
"_resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz",
"_spec": "6.22.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {},
"description": "Compile trailing function commas to ES5",
"devDependencies": {
"babel-helper-plugin-test-runner": "^6.22.0"
},
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "babel-plugin-syntax-trailing-function-commas",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-trailing-function-commas"
},
"version": "6.22.0"
}

View File

@@ -0,0 +1,4 @@
node_modules
*.log
src
test

View File

@@ -0,0 +1,60 @@
# babel-plugin-transform-async-to-generator
> Turn async functions into ES2015 generators
## Example
**In**
```javascript
async function foo() {
await bar();
}
```
**Out**
```javascript
var _asyncToGenerator = function (fn) {
...
};
var foo = _asyncToGenerator(function* () {
yield bar();
});
```
## Installation
```sh
npm install --save-dev babel-plugin-transform-async-to-generator
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["transform-async-to-generator"]
}
```
### Via CLI
```sh
babel --plugins transform-async-to-generator script.js
```
### Via Node API
```javascript
require("babel-core").transform("code", {
plugins: ["transform-async-to-generator"]
});
```
## References
* [Proposal: Async Functions for ECMAScript](https://github.com/tc39/ecmascript-asyncawait)

View File

@@ -0,0 +1,27 @@
"use strict";
exports.__esModule = true;
exports.default = function () {
return {
inherits: require("babel-plugin-syntax-async-functions"),
visitor: {
Function: function Function(path, state) {
if (!path.node.async || path.node.generator) return;
(0, _babelHelperRemapAsyncToGenerator2.default)(path, state.file, {
wrapAsync: state.addHelper("asyncToGenerator")
});
}
}
};
};
var _babelHelperRemapAsyncToGenerator = require("babel-helper-remap-async-to-generator");
var _babelHelperRemapAsyncToGenerator2 = _interopRequireDefault(_babelHelperRemapAsyncToGenerator);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = exports["default"];

View File

@@ -0,0 +1,50 @@
{
"_args": [
[
"babel-plugin-transform-async-to-generator@6.24.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-plugin-transform-async-to-generator@6.24.1",
"_id": "babel-plugin-transform-async-to-generator@6.24.1",
"_inBundle": false,
"_integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=",
"_location": "/babel-preset-env/babel-plugin-transform-async-to-generator",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-plugin-transform-async-to-generator@6.24.1",
"name": "babel-plugin-transform-async-to-generator",
"escapedName": "babel-plugin-transform-async-to-generator",
"rawSpec": "6.24.1",
"saveSpec": null,
"fetchSpec": "6.24.1"
},
"_requiredBy": [
"/babel-preset-env"
],
"_resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz",
"_spec": "6.24.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-helper-remap-async-to-generator": "^6.24.1",
"babel-plugin-syntax-async-functions": "^6.8.0",
"babel-runtime": "^6.22.0"
},
"description": "Turn async functions into ES2015 generators",
"devDependencies": {
"babel-helper-plugin-test-runner": "^6.24.1"
},
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "babel-plugin-transform-async-to-generator",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-to-generator"
},
"version": "6.24.1"
}

View File

@@ -0,0 +1,4 @@
node_modules
*.log
src
test

View File

@@ -0,0 +1,98 @@
# babel-plugin-transform-es2015-arrow-functions
> Compile ES2015 arrow functions to ES5
## Example
**In**
```javascript
var a = () => {};
var a = (b) => b;
const double = [1,2,3].map((num) => num * 2);
console.log(double); // [2,4,6]
var bob = {
_name: "Bob",
_friends: ["Sally", "Tom"],
printFriends() {
this._friends.forEach(f =>
console.log(this._name + " knows " + f));
}
};
console.log(bob.printFriends());
```
**Out**
```javascript
var a = function a() {};
var a = function a(b) {
return b;
};
var double = [1, 2, 3].map(function (num) {
return num * 2;
});
console.log(double); // [2,4,6]
var bob = {
_name: "Bob",
_friends: ["Sally", "Tom"],
printFriends: function printFriends() {
var _this = this;
this._friends.forEach(function (f) {
return console.log(_this._name + " knows " + f);
});
}
};
console.log(bob.printFriends());
```
[Try in REPL](http://babeljs.io/repl/#?evaluate=true&lineWrap=true&presets=es2015%2Ces2015-loose&experimental=false&loose=false&spec=false&code=var%20a%20%3D%20()%20%3D%3E%20%7B%7D%3B%0Avar%20a%20%3D%20(b)%20%3D%3E%20b%3B%0A%0Aconst%20double%20%3D%20%5B1%2C2%2C3%5D.map((num)%20%3D%3E%20num%20*%202)%3B%0Aconsole.log(double)%3B%20%2F%2F%20%5B2%2C4%2C6%5D%0A%0Avar%20bob%20%3D%20%7B%0A%20%20_name%3A%20%22Bob%22%2C%0A%20%20_friends%3A%20%5B%22Sally%22%2C%20%22Tom%22%5D%2C%0A%20%20printFriends()%20%7B%0A%20%20%20%20this._friends.forEach(f%20%3D%3E%0A%20%20%20%20%20%20console.log(this._name%20%2B%20%22%20knows%20%22%20%2B%20f))%3B%0A%20%20%7D%0A%7D%3B%0Aconsole.log(bob.printFriends())%3B&playground=true)
## Installation
```sh
npm install --save-dev babel-plugin-transform-es2015-arrow-functions
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```js
// without options
{
"plugins": ["transform-es2015-arrow-functions"]
}
// with options
{
"plugins": [
["transform-es2015-arrow-functions", { "spec": true }]
]
}
```
### Via CLI
```sh
babel --plugins transform-es2015-arrow-functions script.js
```
### Via Node API
```javascript
require("babel-core").transform("code", {
plugins: ["transform-es2015-arrow-functions"]
});
```
## Options
* `spec` - This option wraps the generated function in `.bind(this)` and keeps uses of `this` inside the function as-is, instead of using a renamed `this`. It also adds a runtime check to ensure the functions are not instantiated.

View File

@@ -0,0 +1,34 @@
"use strict";
exports.__esModule = true;
exports.default = function (_ref) {
var t = _ref.types;
return {
visitor: {
ArrowFunctionExpression: function ArrowFunctionExpression(path, state) {
if (state.opts.spec) {
var node = path.node;
if (node.shadow) return;
node.shadow = { this: false };
node.type = "FunctionExpression";
var boundThis = t.thisExpression();
boundThis._forceShadow = path;
path.ensureBlock();
path.get("body").unshiftContainer("body", t.expressionStatement(t.callExpression(state.addHelper("newArrowCheck"), [t.thisExpression(), boundThis])));
path.replaceWith(t.callExpression(t.memberExpression(node, t.identifier("bind")), [t.thisExpression()]));
} else {
path.arrowFunctionToShadowed();
}
}
}
};
};
module.exports = exports["default"];

View File

@@ -0,0 +1,48 @@
{
"_args": [
[
"babel-plugin-transform-es2015-arrow-functions@6.22.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "babel-plugin-transform-es2015-arrow-functions@6.22.0",
"_id": "babel-plugin-transform-es2015-arrow-functions@6.22.0",
"_inBundle": false,
"_integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=",
"_location": "/babel-preset-env/babel-plugin-transform-es2015-arrow-functions",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-plugin-transform-es2015-arrow-functions@6.22.0",
"name": "babel-plugin-transform-es2015-arrow-functions",
"escapedName": "babel-plugin-transform-es2015-arrow-functions",
"rawSpec": "6.22.0",
"saveSpec": null,
"fetchSpec": "6.22.0"
},
"_requiredBy": [
"/babel-preset-env"
],
"_resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz",
"_spec": "6.22.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"dependencies": {
"babel-runtime": "^6.22.0"
},
"description": "Compile ES2015 arrow functions 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-arrow-functions",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-arrow-functions"
},
"version": "6.22.0"
}

Some files were not shown because too many files have changed in this diff Show More