Template Upload
This commit is contained in:
3
node_modules/bubleify/.babelrc
generated
vendored
Normal file
3
node_modules/bubleify/.babelrc
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"presets": ["es2015"]
|
||||
}
|
17
node_modules/bubleify/.editorconfig
generated
vendored
Normal file
17
node_modules/bubleify/.editorconfig
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
7
node_modules/bubleify/.eslintrc
generated
vendored
Normal file
7
node_modules/bubleify/.eslintrc
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "airbnb/base",
|
||||
"rules": {
|
||||
"no-underscore-dangle": 0,
|
||||
"import/no-mutable-exports": 0
|
||||
}
|
||||
}
|
3
node_modules/bubleify/.npmignore
generated
vendored
Normal file
3
node_modules/bubleify/.npmignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
src/
|
||||
tests/
|
||||
.nyc_output/
|
16
node_modules/bubleify/.travis.yml
generated
vendored
Normal file
16
node_modules/bubleify/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
language: node_js
|
||||
matrix:
|
||||
include:
|
||||
- node_js: "6"
|
||||
- node_js: "5"
|
||||
env: BABEL=true
|
||||
- node_js: "4"
|
||||
env: BABEL=true
|
||||
- node_js: "0.12"
|
||||
env: BABEL=true
|
||||
- node_js: "0.10"
|
||||
env: BABEL=true
|
||||
|
||||
script: "[[ $BABEL == true ]] && npm run test:babel || npm test"
|
||||
after_success:
|
||||
- npm run travis-coverage
|
21
node_modules/bubleify/LICENSE
generated
vendored
Normal file
21
node_modules/bubleify/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Jannick Garthen
|
||||
|
||||
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.
|
88
node_modules/bubleify/README.md
generated
vendored
Normal file
88
node_modules/bubleify/README.md
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
# Bubléify [![build status][1]][2] [![Coverage Status][3]][4]
|
||||
|
||||
A browserify transform for [Bublé](https://www.npmjs.com/package/buble) to transform ES2015 to ES5.
|
||||
|
||||
## Installation
|
||||
|
||||
``` bash
|
||||
npm install --save-dev bubleify
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Node
|
||||
|
||||
``` javascript
|
||||
const browserify = require('browserify');
|
||||
const bubleify = require('bubleify');
|
||||
|
||||
const b = browserify();
|
||||
b.add('./file.es2015.js'));
|
||||
b.transform(bubleify, {
|
||||
target: {
|
||||
chrome: 48,
|
||||
firefox: 44,
|
||||
},
|
||||
transforms: {
|
||||
arrow: true,
|
||||
defaultParameter: false,
|
||||
dangerousForOf: true,
|
||||
},
|
||||
});
|
||||
b.bundle();
|
||||
```
|
||||
|
||||
### CLI
|
||||
|
||||
``` bash
|
||||
browserify script.js -o bundle.js -t [ bubleify ]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### target: Object
|
||||
|
||||
Target specifies a list of environments the output file should be compatible to. Bublè will decide based on this list which transforms should be used.
|
||||
|
||||
### transforms: Object
|
||||
|
||||
Transforms define which ES2015 features should or should not be transformed into ES5.
|
||||
|
||||
Bublèify by default disables the `module` transform to not throw an error when ES2015 `import` and `export` statements are used. If you want to use ES2015 modules you should add another transform to do so.
|
||||
|
||||
Find a list of all transforms on the Bublè documentation in section [list of transforms](http://buble.surge.sh/guide/#list-of-transforms). For more detailed information about each transform also see [supported features](http://buble.surge.sh/guide/#supported-features) and [dangerous transforms](http://buble.surge.sh/guide/#dangerous-transforms).
|
||||
|
||||
### sourceMap: Boolean
|
||||
|
||||
Define whether an inline source map should or should not be created by Bublé.
|
||||
|
||||
Default is `true`.
|
||||
|
||||
_Please note that browserify will not output any source map if debug mode is `false`, even if sourceMap was set to `true`._
|
||||
|
||||
### extensions: Array
|
||||
|
||||
The allowed file extensions that should be transformed with Bublé. Files included into the stream that do not match an extension will be ignored by Bubléify.
|
||||
|
||||
Default is `['.js', '.jsx', '.es', '.es6']`.
|
||||
|
||||
### bubleError: Boolean
|
||||
|
||||
Define whether the error generated by Bublè or a the Bublè error message as a string should be emitted in case of an error.
|
||||
|
||||
Default is `false`.
|
||||
|
||||
_Bublè may in some situations throw a custom error. Browserify will, when used on the command line, just output the call stack in this situation but does not show the error message. Turning this option on will display the error message but suppresses the call stack._
|
||||
|
||||
## Credits
|
||||
|
||||
Thanks goes to [Rich Harris](https://twitter.com/rich_harris) for the [Bublè](https://www.npmjs.com/package/buble) package.
|
||||
|
||||
## License
|
||||
|
||||
Licensed under the [MIT License](https://opensource.org/licenses/mit-license.php).
|
||||
|
||||
[1]: https://travis-ci.org/garthenweb/bubleify.svg
|
||||
[2]: https://travis-ci.org/garthenweb/bubleify
|
||||
[3]: https://coveralls.io/repos/github/garthenweb/bubleify/badge.svg?branch=master
|
||||
[4]: https://coveralls.io/github/garthenweb/bubleify?branch=master
|
1
node_modules/bubleify/index.js
generated
vendored
Normal file
1
node_modules/bubleify/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require('./lib/Bubleify').default;
|
121
node_modules/bubleify/lib/Bubleify.js
generated
vendored
Normal file
121
node_modules/bubleify/lib/Bubleify.js
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _buble = require('buble');
|
||||
|
||||
var _objectAssign = require('object-assign');
|
||||
|
||||
var _objectAssign2 = _interopRequireDefault(_objectAssign);
|
||||
|
||||
var _stream = require('stream');
|
||||
|
||||
var _os = require('os');
|
||||
|
||||
var _path = require('path');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Bubleify = function (_Transform) {
|
||||
_inherits(Bubleify, _Transform);
|
||||
|
||||
function Bubleify(filename, options) {
|
||||
_classCallCheck(this, Bubleify);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Bubleify).call(this));
|
||||
|
||||
_this._data = '';
|
||||
_this._filename = filename;
|
||||
_this._options = options;
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Bubleify, [{
|
||||
key: '_transform',
|
||||
value: function _transform(buf, enc, cb) {
|
||||
this._data += buf;
|
||||
cb();
|
||||
}
|
||||
}, {
|
||||
key: '_flush',
|
||||
value: function _flush(cb) {
|
||||
try {
|
||||
var result = (0, _buble.transform)(this._data, this._bubleOptions);
|
||||
var code = result.code;
|
||||
|
||||
|
||||
if (this._options.sourceMap) {
|
||||
// append sourcemaps to code
|
||||
code += _os.EOL + '//# sourceMappingURL=' + result.map.toUrl();
|
||||
}
|
||||
|
||||
this.emit('bubleify', result, this._filename);
|
||||
this.push(code);
|
||||
} catch (err) {
|
||||
// emit buble error message instead of the default error
|
||||
if (this._options.bubleError && err.snippet) {
|
||||
this.emit('error', '---' + _os.EOL + err.snippet + _os.EOL + _os.EOL + err.message + _os.EOL);
|
||||
} else {
|
||||
this.emit('error', err);
|
||||
}
|
||||
return;
|
||||
}
|
||||
cb();
|
||||
}
|
||||
}, {
|
||||
key: '_bubleOptions',
|
||||
get: function get() {
|
||||
var defaults = { source: this._filename };
|
||||
var options = (0, _objectAssign2.default)(defaults, this._options);
|
||||
|
||||
// copy properties to not modify the existing objects
|
||||
// set default transforms with deactivated modules
|
||||
options.transforms = (0, _objectAssign2.default)({ modules: false }, this._options.transforms);
|
||||
options.target = (0, _objectAssign2.default)({}, this._options.target);
|
||||
|
||||
// remove browserify options
|
||||
delete options._flags;
|
||||
delete options.sourceMap;
|
||||
delete options.extensions;
|
||||
delete options.bubleError;
|
||||
|
||||
return options;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Bubleify;
|
||||
}(_stream.Transform);
|
||||
|
||||
exports.default = function (filename, options) {
|
||||
// get extensions or defaults
|
||||
var _options$extensions = options.extensions;
|
||||
var extensions = _options$extensions === undefined ? ['.js', '.jsx', '.es', '.es6'] : _options$extensions;
|
||||
// convert to json
|
||||
|
||||
extensions = Array.isArray(extensions) ? extensions : [extensions];
|
||||
|
||||
var enrishedOptions = (0, _objectAssign2.default)({
|
||||
sourceMap: true,
|
||||
bubleError: false
|
||||
}, options, { extensions: extensions });
|
||||
|
||||
var shouldIgnoreFile = extensions.indexOf((0, _path.extname)(filename)) === -1;
|
||||
// return empty stream for files that should not be transformed
|
||||
if (shouldIgnoreFile) {
|
||||
// eslint-disable-next-line new-cap
|
||||
return (0, _stream.PassThrough)();
|
||||
}
|
||||
|
||||
return new Bubleify(filename, enrishedOptions);
|
||||
};
|
||||
//# sourceMappingURL=Bubleify.js.map
|
1
node_modules/bubleify/lib/Bubleify.js.map
generated
vendored
Normal file
1
node_modules/bubleify/lib/Bubleify.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/Bubleify.js"],"names":[],"mappings":";;;;;;;;AAAA;;AACA;;;;AACA;;AACA;;AACA;;;;;;;;;;IAEM,Q;;;AACJ,oBAAY,QAAZ,EAAsB,OAAtB,EAA+B;AAAA;;AAAA;;AAE7B,UAAK,KAAL,GAAa,EAAb;AACA,UAAK,SAAL,GAAiB,QAAjB;AACA,UAAK,QAAL,GAAgB,OAAhB;AAJ6B;AAK9B;;;;+BAoBU,G,EAAK,G,EAAK,E,EAAI;AACvB,WAAK,KAAL,IAAc,GAAd;AACA;AACD;;;2BAEM,E,EAAI;AACT,UAAI;AACF,YAAM,SAAS,sBAAU,KAAK,KAAf,EAAsB,KAAK,aAA3B,CAAf;AADE,YAEI,IAFJ,GAEa,MAFb,CAEI,IAFJ;;;AAIF,YAAI,KAAK,QAAL,CAAc,SAAlB,EAA6B;AAC3B;AACA,sDAAsC,OAAO,GAAP,CAAW,KAAX,EAAtC;AACD;;AAED,aAAK,IAAL,CAAU,UAAV,EAAsB,MAAtB,EAA8B,KAAK,SAAnC;AACA,aAAK,IAAL,CAAU,IAAV;AACD,OAXD,CAWE,OAAO,GAAP,EAAY;AACZ;AACA,YAAI,KAAK,QAAL,CAAc,UAAd,IAA4B,IAAI,OAApC,EAA6C;AAC3C,eAAK,IAAL,CAAU,OAAV,oBAA+B,IAAI,OAAnC,uBAAyD,IAAI,OAA7D;AACD,SAFD,MAEO;AACL,eAAK,IAAL,CAAU,OAAV,EAAmB,GAAnB;AACD;AACD;AACD;AACD;AACD;;;wBA7CmB;AAClB,UAAM,WAAW,EAAE,QAAQ,KAAK,SAAf,EAAjB;AACA,UAAM,UAAU,4BAAO,QAAP,EAAiB,KAAK,QAAtB,CAAhB;;AAEA;AACA;AACA,cAAQ,UAAR,GAAqB,4BAAO,EAAE,SAAS,KAAX,EAAP,EAA2B,KAAK,QAAL,CAAc,UAAzC,CAArB;AACA,cAAQ,MAAR,GAAiB,4BAAO,EAAP,EAAW,KAAK,QAAL,CAAc,MAAzB,CAAjB;;AAEA;AACA,aAAO,QAAQ,MAAf;AACA,aAAO,QAAQ,SAAf;AACA,aAAO,QAAQ,UAAf;AACA,aAAO,QAAQ,UAAf;;AAEA,aAAO,OAAP;AACD;;;;;;kBAgCY,UAAC,QAAD,EAAW,OAAX,EAAuB;AACpC;AADoC,4BAEkB,OAFlB,CAE9B,UAF8B;AAAA,MAE9B,UAF8B,uCAEjB,CAAC,KAAD,EAAQ,MAAR,EAAgB,KAAhB,EAAuB,MAAvB,CAFiB;AAGpC;;AACA,eAAa,MAAM,OAAN,CAAc,UAAd,IAA4B,UAA5B,GAAyC,CAAC,UAAD,CAAtD;;AAEA,MAAM,kBAAkB,4BAAO;AAC7B,eAAW,IADkB;AAE7B,gBAAY;AAFiB,GAAP,EAGrB,OAHqB,EAGZ,EAAE,sBAAF,EAHY,CAAxB;;AAKA,MAAM,mBAAmB,WAAW,OAAX,CAAmB,mBAAQ,QAAR,CAAnB,MAA0C,CAAC,CAApE;AACA;AACA,MAAI,gBAAJ,EAAsB;AACpB;AACA,WAAO,0BAAP;AACD;;AAED,SAAO,IAAI,QAAJ,CAAa,QAAb,EAAuB,eAAvB,CAAP;AACD,C","file":"Bubleify.js","sourcesContent":["import { transform } from 'buble';\nimport assign from 'object-assign';\nimport { Transform, PassThrough } from 'stream';\nimport { EOL } from 'os';\nimport { extname } from 'path';\n\nclass Bubleify extends Transform {\n constructor(filename, options) {\n super();\n this._data = '';\n this._filename = filename;\n this._options = options;\n }\n\n get _bubleOptions() {\n const defaults = { source: this._filename };\n const options = assign(defaults, this._options);\n\n // copy properties to not modify the existing objects\n // set default transforms with deactivated modules\n options.transforms = assign({ modules: false }, this._options.transforms);\n options.target = assign({}, this._options.target);\n\n // remove browserify options\n delete options._flags;\n delete options.sourceMap;\n delete options.extensions;\n delete options.bubleError;\n\n return options;\n }\n\n _transform(buf, enc, cb) {\n this._data += buf;\n cb();\n }\n\n _flush(cb) {\n try {\n const result = transform(this._data, this._bubleOptions);\n let { code } = result;\n\n if (this._options.sourceMap) {\n // append sourcemaps to code\n code += `${EOL}//# sourceMappingURL=${result.map.toUrl()}`;\n }\n\n this.emit('bubleify', result, this._filename);\n this.push(code);\n } catch (err) {\n // emit buble error message instead of the default error\n if (this._options.bubleError && err.snippet) {\n this.emit('error', `---${EOL}${err.snippet}${EOL}${EOL}${err.message}${EOL}`);\n } else {\n this.emit('error', err);\n }\n return;\n }\n cb();\n }\n}\n\nexport default (filename, options) => {\n // get extensions or defaults\n let { extensions = ['.js', '.jsx', '.es', '.es6'] } = options;\n // convert to json\n extensions = Array.isArray(extensions) ? extensions : [extensions];\n\n const enrishedOptions = assign({\n sourceMap: true,\n bubleError: false,\n }, options, { extensions });\n\n const shouldIgnoreFile = extensions.indexOf(extname(filename)) === -1;\n // return empty stream for files that should not be transformed\n if (shouldIgnoreFile) {\n // eslint-disable-next-line new-cap\n return PassThrough();\n }\n\n return new Bubleify(filename, enrishedOptions);\n};\n"]}
|
15
node_modules/bubleify/node_modules/.bin/buble
generated
vendored
Normal file
15
node_modules/bubleify/node_modules/.bin/buble
generated
vendored
Normal 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/../buble/bin/buble" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../buble/bin/buble" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
7
node_modules/bubleify/node_modules/.bin/buble.cmd
generated
vendored
Normal file
7
node_modules/bubleify/node_modules/.bin/buble.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\buble\bin\buble" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\buble\bin\buble" %*
|
||||
)
|
4
node_modules/bubleify/node_modules/ansi-regex/index.js
generated
vendored
Normal file
4
node_modules/bubleify/node_modules/ansi-regex/index.js
generated
vendored
Normal 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;
|
||||
};
|
21
node_modules/bubleify/node_modules/ansi-regex/license
generated
vendored
Normal file
21
node_modules/bubleify/node_modules/ansi-regex/license
generated
vendored
Normal 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.
|
144
node_modules/bubleify/node_modules/ansi-regex/package.json
generated
vendored
Normal file
144
node_modules/bubleify/node_modules/ansi-regex/package.json
generated
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "ansi-regex@^2.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "ansi-regex",
|
||||
"name": "ansi-regex",
|
||||
"rawSpec": "^2.0.0",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\tfunk\\node_modules\\has-ansi"
|
||||
],
|
||||
[
|
||||
{
|
||||
"raw": "ansi-regex@^2.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "ansi-regex",
|
||||
"name": "ansi-regex",
|
||||
"rawSpec": "^2.0.0",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\bubleify\\node_modules\\has-ansi"
|
||||
]
|
||||
],
|
||||
"_from": "ansi-regex@^2.0.0",
|
||||
"_id": "ansi-regex@2.1.1",
|
||||
"_inCache": true,
|
||||
"_location": "/bubleify/ansi-regex",
|
||||
"_nodeVersion": "0.10.32",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/ansi-regex-2.1.1.tgz_1484363378013_0.4482989883981645"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "qix",
|
||||
"email": "i.am.qix@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.14.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "ansi-regex@^2.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "ansi-regex",
|
||||
"name": "ansi-regex",
|
||||
"rawSpec": "^2.0.0",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/bubleify/has-ansi",
|
||||
"/bubleify/strip-ansi"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||
"_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "ansi-regex@^2.0.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\bubleify\\node_modules\\has-ansi",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chalk/ansi-regex/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Regular expression for matching ANSI escape codes",
|
||||
"devDependencies": {
|
||||
"ava": "0.17.0",
|
||||
"xo": "0.16.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df",
|
||||
"tarball": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "7c908e7b4eb6cd82bfe1295e33fdf6d166c7ed85",
|
||||
"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": "qix",
|
||||
"email": "i.am.qix@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "ansi-regex",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"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
|
||||
}
|
||||
}
|
||||
}
|
39
node_modules/bubleify/node_modules/ansi-regex/readme.md
generated
vendored
Normal file
39
node_modules/bubleify/node_modules/ansi-regex/readme.md
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
# ansi-regex [](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)
|
65
node_modules/bubleify/node_modules/ansi-styles/index.js
generated
vendored
Normal file
65
node_modules/bubleify/node_modules/ansi-styles/index.js
generated
vendored
Normal 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
|
||||
});
|
21
node_modules/bubleify/node_modules/ansi-styles/license
generated
vendored
Normal file
21
node_modules/bubleify/node_modules/ansi-styles/license
generated
vendored
Normal 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.
|
126
node_modules/bubleify/node_modules/ansi-styles/package.json
generated
vendored
Normal file
126
node_modules/bubleify/node_modules/ansi-styles/package.json
generated
vendored
Normal file
@ -0,0 +1,126 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "ansi-styles@^2.2.1",
|
||||
"scope": null,
|
||||
"escapedName": "ansi-styles",
|
||||
"name": "ansi-styles",
|
||||
"rawSpec": "^2.2.1",
|
||||
"spec": ">=2.2.1 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\tfunk\\node_modules\\chalk"
|
||||
],
|
||||
[
|
||||
{
|
||||
"raw": "ansi-styles@^2.2.1",
|
||||
"scope": null,
|
||||
"escapedName": "ansi-styles",
|
||||
"name": "ansi-styles",
|
||||
"rawSpec": "^2.2.1",
|
||||
"spec": ">=2.2.1 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\bubleify\\node_modules\\chalk"
|
||||
]
|
||||
],
|
||||
"_from": "ansi-styles@^2.2.1",
|
||||
"_id": "ansi-styles@2.2.1",
|
||||
"_inCache": true,
|
||||
"_location": "/bubleify/ansi-styles",
|
||||
"_nodeVersion": "4.3.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/ansi-styles-2.2.1.tgz_1459197317833_0.9694824463222176"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"_npmVersion": "3.8.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "ansi-styles@^2.2.1",
|
||||
"scope": null,
|
||||
"escapedName": "ansi-styles",
|
||||
"name": "ansi-styles",
|
||||
"rawSpec": "^2.2.1",
|
||||
"spec": ">=2.2.1 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/bubleify/chalk"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
||||
"_shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "ansi-styles@^2.2.1",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\bubleify\\node_modules\\chalk",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chalk/ansi-styles/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "ANSI escape codes for styling strings in the terminal",
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe",
|
||||
"tarball": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "95c59b23be760108b6530ca1c89477c21b258032",
|
||||
"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": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "ansi-styles",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/chalk/ansi-styles.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "2.2.1"
|
||||
}
|
86
node_modules/bubleify/node_modules/ansi-styles/readme.md
generated
vendored
Normal file
86
node_modules/bubleify/node_modules/ansi-styles/readme.md
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
# ansi-styles [](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.
|
||||
|
||||

|
||||
|
||||
|
||||
## 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)
|
381
node_modules/bubleify/node_modules/buble/CHANGELOG.md
generated
vendored
Normal file
381
node_modules/bubleify/node_modules/buble/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,381 @@
|
||||
# buble changelog
|
||||
|
||||
## 0.12.5
|
||||
|
||||
* Prevent reserved words being used as identifiers ([#86](https://gitlab.com/Rich-Harris/buble/issues/86))
|
||||
* Use correct `this` when transpiling `super` inside arrow function ([#89](https://gitlab.com/Rich-Harris/buble/issues/89))
|
||||
* Handle body-less `for-of` loops ([#80](https://gitlab.com/Rich-Harris/buble/issues/80))
|
||||
|
||||
## 0.12.4
|
||||
|
||||
* Allow references to precede declaration (inside function) in block scoping ([#87](https://gitlab.com/Rich-Harris/buble/issues/87))
|
||||
|
||||
## 0.12.3
|
||||
|
||||
* Argh, npm
|
||||
|
||||
## 0.12.2
|
||||
|
||||
* Files missing in 0.12.1 (???)
|
||||
|
||||
## 0.12.1
|
||||
|
||||
* Don't require space before parens of shorthand computed method ([#82](https://gitlab.com/Rich-Harris/buble/issues/82))
|
||||
* Allow string keys for shorthand methods ([#82](https://gitlab.com/Rich-Harris/buble/issues/82))
|
||||
|
||||
## 0.12.0
|
||||
|
||||
* Support `u` flag in regular expression literals ([!62](https://gitlab.com/Rich-Harris/buble/merge_requests/62))
|
||||
* Save `buble/register` transformations to `$HOME/.buble-cache` ([!63](https://gitlab.com/Rich-Harris/buble/merge_requests/63))
|
||||
|
||||
## 0.11.6
|
||||
|
||||
* Allow shorthand methods with computed names ([#78](https://gitlab.com/Rich-Harris/buble/issues/78))
|
||||
* Include code snippet in `error.toString()` ([#79](https://gitlab.com/Rich-Harris/buble/issues/79))
|
||||
|
||||
## 0.11.5
|
||||
|
||||
* Preserve whitespace between JSX tags on single line ([#65](https://gitlab.com/Rich-Harris/buble/issues/65))
|
||||
|
||||
## 0.11.4
|
||||
|
||||
* Allow computed class methods, except accessors ([!56](https://gitlab.com/Rich-Harris/buble/merge_requests/56))
|
||||
* Compound destructuring ([!58](https://gitlab.com/Rich-Harris/buble/merge_requests/58))
|
||||
|
||||
## 0.11.3
|
||||
|
||||
* Ensure inserted statements follow use strict pragma ([#72](https://gitlab.com/Rich-Harris/buble/issues/72))
|
||||
|
||||
## 0.11.2
|
||||
|
||||
* Ensure closing parenthesis is in correct place when transpiling inline computed property object expressions ([#73](https://gitlab.com/Rich-Harris/buble/issues/73))
|
||||
|
||||
## 0.11.1
|
||||
|
||||
* Fix computed property followed by non-computed property in inline expression
|
||||
|
||||
## 0.11.0
|
||||
|
||||
* Computed properties ([#67](https://gitlab.com/Rich-Harris/buble/issues/67))
|
||||
* Allow `super(...)` to use rest arguments ([#69](https://gitlab.com/Rich-Harris/buble/issues/69))
|
||||
|
||||
## 0.10.7
|
||||
|
||||
* Allow customisation of `Object.assign` (used in object spread) ([!51](https://gitlab.com/Rich-Harris/buble/merge_requests/51))
|
||||
|
||||
## 0.10.6
|
||||
|
||||
* Handle sparse arrays ([#62](https://gitlab.com/Rich-Harris/buble/issues/62))
|
||||
* Handle spread expressions in JSX ([#64](https://gitlab.com/Rich-Harris/buble/issues/64))
|
||||
|
||||
## 0.10.5
|
||||
|
||||
* Create intermediate directories when transforming via CLI ([#63](https://gitlab.com/Rich-Harris/buble/issues/63))
|
||||
* Update README ([#57](https://gitlab.com/Rich-Harris/buble/issues/57))
|
||||
|
||||
## 0.10.4
|
||||
|
||||
* Support spread operator in object literals ([!45](https://gitlab.com/Rich-Harris/buble/merge_requests/45)) and JSX elements ([!46](https://gitlab.com/Rich-Harris/buble/merge_requests/46))
|
||||
|
||||
## 0.10.3
|
||||
|
||||
* Disable intelligent destructuring, temporarily ([#53](https://gitlab.com/Rich-Harris/buble/issues/53))
|
||||
* Fix whitespace in JSX literals ([!39](https://gitlab.com/Rich-Harris/buble/merge_requests/39))
|
||||
* Add `: true` to value-less JSX attributes ([!40](https://gitlab.com/Rich-Harris/buble/merge_requests/40))
|
||||
* Quote invalid attribute names ([!41](https://gitlab.com/Rich-Harris/buble/merge_requests/41))
|
||||
|
||||
## 0.10.2
|
||||
|
||||
* Don't add closing quote to JSX component without attributes ([#58](https://gitlab.com/Rich-Harris/buble/issues/58))
|
||||
|
||||
## 0.10.1
|
||||
|
||||
* Fix handling of literals inside JSX
|
||||
|
||||
## 0.10.0
|
||||
|
||||
* Basic JSX support
|
||||
|
||||
## 0.9.3
|
||||
|
||||
* Better spread operator support, including with `arguments` ([#40](https://gitlab.com/Rich-Harris/buble/issues/40))
|
||||
* Fix indentation of inserted statements in class constructors ([#39](https://gitlab.com/Rich-Harris/buble/issues/39))
|
||||
|
||||
## 0.9.2
|
||||
|
||||
* Allow class to have accessors and no constructor ([#48](https://gitlab.com/Rich-Harris/buble/issues/48))
|
||||
* Fix help message in CLI
|
||||
|
||||
## 0.9.1
|
||||
|
||||
* Prevent confusion over `Literal` node keys
|
||||
|
||||
## 0.9.0
|
||||
|
||||
* More complete and robust destructuring support ([#37](https://gitlab.com/Rich-Harris/buble/issues/37), [#43](https://gitlab.com/Rich-Harris/buble/issues/43))
|
||||
* Correct `this`/`arguments` references inside for-of loop
|
||||
|
||||
## 0.8.5
|
||||
|
||||
* Allow destructured parameter to have default ([#43](https://gitlab.com/Rich-Harris/buble/issues/43))
|
||||
* Allow `continue`/`break` statements inside a for-of loop
|
||||
|
||||
## 0.8.4
|
||||
|
||||
* Allow class body to follow ID/superclass without whitespace ([#46](https://gitlab.com/Rich-Harris/buble/issues/46))
|
||||
|
||||
## 0.8.3
|
||||
|
||||
* Performance enhancements ([!23](https://gitlab.com/Rich-Harris/buble/merge_requests/23))
|
||||
|
||||
## 0.8.2
|
||||
|
||||
* More robust version of ([!22](https://gitlab.com/Rich-Harris/buble/merge_requests/22))
|
||||
|
||||
## 0.8.1
|
||||
|
||||
* Fix `export default class A extends B` (broken in 0.8.0) ([!22](https://gitlab.com/Rich-Harris/buble/merge_requests/22))
|
||||
|
||||
## 0.8.0
|
||||
|
||||
* Subclasses inherit static methods ([#33](https://gitlab.com/Rich-Harris/buble/issues/33))
|
||||
* Performance enhancements ([!21](https://gitlab.com/Rich-Harris/buble/merge_requests/21))
|
||||
|
||||
## 0.7.1
|
||||
|
||||
* Prevent omission of closing paren in template string ([#42](https://gitlab.com/Rich-Harris/buble/issues/42))
|
||||
* Separate variable declarations for each name in destructured declaration ([#18](https://gitlab.com/Rich-Harris/buble/merge_requests/18))
|
||||
|
||||
## 0.7.0
|
||||
|
||||
* Allow arrow functions to be used as default parameter values ([#36](https://gitlab.com/Rich-Harris/buble/issues/36))
|
||||
|
||||
## 0.6.7
|
||||
|
||||
* Support `static get` and `set` in classes ([#34](https://gitlab.com/Rich-Harris/buble/issues/34))
|
||||
* Support spread operator in expression method call ([!14](https://gitlab.com/Rich-Harris/buble/merge_requests/14))
|
||||
* Fix `for-of` loops with no space after opening paren ([#35](https://gitlab.com/Rich-Harris/buble/issues/35))
|
||||
|
||||
## 0.6.6
|
||||
|
||||
* Fix another subclass `super()` bug ([#32](https://gitlab.com/Rich-Harris/buble/issues/32))
|
||||
|
||||
## 0.6.5
|
||||
|
||||
* Fix `super()` call in subclass expression ([#32](https://gitlab.com/Rich-Harris/buble/issues/32))
|
||||
* Less defensive template string parenthesising ([!9](https://gitlab.com/Rich-Harris/buble/merge_requests/9))
|
||||
|
||||
## 0.6.4
|
||||
|
||||
* Add Node 6 to support matrix
|
||||
|
||||
## 0.6.3
|
||||
|
||||
* Handle empty template strings ([#28](https://gitlab.com/Rich-Harris/buble/issues/28))
|
||||
|
||||
## 0.6.2
|
||||
|
||||
* Handle body-less do-while blocks ([#27](https://gitlab.com/Rich-Harris/buble/issues/27))
|
||||
|
||||
## 0.6.1
|
||||
|
||||
* Always remember to close parens in template strings
|
||||
|
||||
## 0.6.0
|
||||
|
||||
* Strip unnecessary empty strings from template literals
|
||||
* Intelligent destructuring for object patterns in parameters ([#17](https://gitlab.com/Rich-Harris/buble/issues/17))
|
||||
|
||||
## 0.5.8
|
||||
|
||||
* Fix exponentiation assignment operator edge case
|
||||
|
||||
## 0.5.7
|
||||
|
||||
* Exponentiation operator support ([#24](https://gitlab.com/Rich-Harris/buble/issues/24))
|
||||
* More informative error messages for for-of and tagged template strings
|
||||
|
||||
## 0.5.6
|
||||
|
||||
* Add `dangerousTaggedTemplateString` ([!2](https://gitlab.com/Rich-Harris/buble/merge_requests/2)) and `dangerousForOf` ([!3](https://gitlab.com/Rich-Harris/buble/merge_requests/3)) transforms
|
||||
* Prevent deindentation causing errors with removed whitespace in class methods
|
||||
* Use correct identifier with default destructured function parameters ([#23](https://gitlab.com/Rich-Harris/buble/issues/23))
|
||||
|
||||
|
||||
## 0.5.5
|
||||
|
||||
* Ensure `return` is in correct place when creating bodies for arrow functions ([#21](https://gitlab.com/Rich-Harris/buble/issues/21))
|
||||
* Prevent deindentation of class methods causing breakage with destructuring statements ([#22](https://gitlab.com/Rich-Harris/buble/issues/22))
|
||||
|
||||
## 0.5.4
|
||||
|
||||
* Install missing `chalk` dependency
|
||||
* Informative error messages when `buble/register` fails
|
||||
|
||||
## 0.5.3
|
||||
|
||||
* Add `register.js` to package. Yes I'm an idiot
|
||||
|
||||
## 0.5.2
|
||||
|
||||
* Add `buble/register` for use with e.g. Mocha
|
||||
|
||||
## 0.5.1
|
||||
|
||||
* Remove unused dependency
|
||||
|
||||
## 0.5.0
|
||||
|
||||
* Support `--target`, `--yes` and `--no` in CLI
|
||||
* Compile entire directory of files via CLI
|
||||
* Sourcemap support in CLI
|
||||
* All transforms can be disabled (or errors suppressed) with the `transforms` option (or `--yes` and `--no`, in the CLI)
|
||||
* `import` and `export` will throw an error unless `--no modules` transform is specified
|
||||
* Fix bug with destructuring
|
||||
* Fix bug with block scoping and loops
|
||||
|
||||
|
||||
## 0.4.24
|
||||
|
||||
* Throw if `let`/`const` is redeclared, or `var` is redeclared with a `let`/`const` (0.4.22 regression)
|
||||
|
||||
## 0.4.23
|
||||
|
||||
* Add `buble.VERSION`
|
||||
* Tidy up build process (don't bundle Acorn incorrectly)
|
||||
|
||||
## 0.4.22
|
||||
|
||||
* Allow double `var` declarations (only throw if `let` or `const` is redeclared)
|
||||
|
||||
## 0.4.21
|
||||
|
||||
* Add `find` and `findIndex` helpers for 0.12 support
|
||||
|
||||
## 0.4.20
|
||||
|
||||
* Bump to resolve unknown npm issue
|
||||
|
||||
## 0.4.19
|
||||
|
||||
* Fix block scoping bug with for loops that don't need to be rewritten as functions
|
||||
|
||||
## 0.4.18
|
||||
|
||||
* Fix break-inside-switch bug
|
||||
|
||||
## 0.4.17
|
||||
|
||||
* Support `for...in` loops and block scoping
|
||||
|
||||
## 0.4.16
|
||||
|
||||
* Add `ie` and `edge` to support matrix
|
||||
|
||||
## 0.4.15
|
||||
|
||||
* Rewrite reserved properties if specified ([#9](https://gitlab.com/Rich-Harris/buble/issues/9))
|
||||
|
||||
## 0.4.14
|
||||
|
||||
* Allow classes to extend expressions ([#15](https://gitlab.com/Rich-Harris/buble/issues/15))
|
||||
* Experimental (partially implemented) API for disabling transforms based on target environment or custom requirements
|
||||
|
||||
## 0.4.13
|
||||
|
||||
* Fix return statement bug
|
||||
|
||||
## 0.4.12
|
||||
|
||||
* More complete and robust transpilation of loops that need to be rewritten as functions to simulate block scoping ([#11](https://gitlab.com/Rich-Harris/buble/issues/11), [#12](https://gitlab.com/Rich-Harris/buble/issues/12), [#13](https://gitlab.com/Rich-Harris/buble/issues/13))
|
||||
|
||||
## 0.4.11
|
||||
|
||||
* Remove source-map-support from CLI (only useful during development)
|
||||
|
||||
## 0.4.10
|
||||
|
||||
* Basic support for spread operator
|
||||
|
||||
## 0.4.9
|
||||
|
||||
* Support getters and setters on subclasses
|
||||
* Disallow unsupported features e.g. generators
|
||||
|
||||
## 0.4.8
|
||||
|
||||
* Support getters and setters on classes
|
||||
* Allow identifiers to be renamed in block-scoped destructuring ([#8](https://gitlab.com/Rich-Harris/buble/issues/8))
|
||||
* Transpile body-less arrow functions correctly ([#9](https://gitlab.com/Rich-Harris/buble/issues/4))
|
||||
|
||||
## 0.4.7
|
||||
|
||||
* Add browser version
|
||||
|
||||
## 0.4.6
|
||||
|
||||
* Report locations of parse/compile errors ([#4](https://gitlab.com/Rich-Harris/buble/issues/4))
|
||||
|
||||
## 0.4.5
|
||||
|
||||
* Sourcemap support
|
||||
|
||||
## 0.4.4
|
||||
|
||||
* Support for class expressions
|
||||
* More robust deconflicting
|
||||
* Various bugfixes
|
||||
|
||||
## 0.4.3
|
||||
|
||||
* Handle arbitrary whitespace inside template literals
|
||||
|
||||
## 0.4.2
|
||||
|
||||
* Fix bug-inducing typo
|
||||
|
||||
## 0.4.1
|
||||
|
||||
* Rest parameters
|
||||
|
||||
## 0.4.0
|
||||
|
||||
* Self-hosting!
|
||||
|
||||
## 0.3.4
|
||||
|
||||
* Class inheritance
|
||||
|
||||
## 0.3.3
|
||||
|
||||
* Handle quote marks in template literals
|
||||
|
||||
## 0.3.2
|
||||
|
||||
* Handle empty `class` declarations
|
||||
|
||||
## 0.3.1
|
||||
|
||||
* Add `bin` to package
|
||||
|
||||
## 0.3.0
|
||||
|
||||
* (Very) basic CLI
|
||||
* Handle `export default class ...`
|
||||
|
||||
## 0.2.2
|
||||
|
||||
* Initialise children of Property nodes
|
||||
* Prevent false positives with reference detection
|
||||
|
||||
## 0.2.1
|
||||
|
||||
* Add missing files
|
||||
|
||||
## 0.2.0
|
||||
|
||||
* Support for a bunch more ES2015 features
|
||||
|
||||
## 0.1.0
|
||||
|
||||
* First (experimental) release
|
28
node_modules/bubleify/node_modules/buble/bin/buble
generated
vendored
Normal file
28
node_modules/bubleify/node_modules/buble/bin/buble
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env node
|
||||
var minimist = require( 'minimist' );
|
||||
|
||||
var command = minimist( process.argv.slice( 2 ), {
|
||||
alias: {
|
||||
// Short options
|
||||
h: 'help',
|
||||
i: 'input',
|
||||
m: 'sourcemap',
|
||||
o: 'output',
|
||||
v: 'version',
|
||||
t: 'target',
|
||||
y: 'yes',
|
||||
n: 'no'
|
||||
}
|
||||
});
|
||||
|
||||
if ( command.help || ( process.argv.length <= 2 && process.stdin.isTTY ) ) {
|
||||
require( './showHelp' )();
|
||||
}
|
||||
|
||||
else if ( command.version ) {
|
||||
console.log( 'Bublé version ' + require( '../package.json' ).version );
|
||||
}
|
||||
|
||||
else {
|
||||
require( './runBuble' )( command );
|
||||
}
|
46
node_modules/bubleify/node_modules/buble/bin/handleError.js
generated
vendored
Normal file
46
node_modules/bubleify/node_modules/buble/bin/handleError.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
var chalk = require( 'chalk' );
|
||||
|
||||
var handlers = {
|
||||
MISSING_INPUT_OPTION: function () {
|
||||
console.error( chalk.red( 'You must specify an --input (-i) option' ) );
|
||||
},
|
||||
|
||||
MISSING_OUTPUT_DIR: function () {
|
||||
console.error( chalk.red( 'You must specify an --output (-o) option when compiling a directory of files' ) );
|
||||
},
|
||||
|
||||
MISSING_OUTPUT_FILE: function () {
|
||||
console.error( chalk.red( 'You must specify an --output (-o) option when creating a file with a sourcemap' ) );
|
||||
},
|
||||
|
||||
ONE_AT_A_TIME: function ( err ) {
|
||||
console.error( chalk.red( 'Bublé can only compile one file/directory at a time' ) );
|
||||
},
|
||||
|
||||
DUPLICATE_IMPORT_OPTIONS: function ( err ) {
|
||||
console.error( chalk.red( 'use --input, or pass input path as argument – not both' ) );
|
||||
},
|
||||
|
||||
BAD_TARGET: function ( err ) {
|
||||
console.error( chalk.red( 'illegal --target option' ) );
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = function handleError ( err ) {
|
||||
var handler;
|
||||
|
||||
if ( handler = handlers[ err && err.code ] ) {
|
||||
handler( err );
|
||||
} else {
|
||||
if ( err.snippet ) console.error( chalk.red( '---\n' + err.snippet ) );
|
||||
console.error( chalk.red( err.message || err ) );
|
||||
|
||||
if ( err.stack ) {
|
||||
console.error( chalk.grey( err.stack ) );
|
||||
}
|
||||
}
|
||||
|
||||
console.error( 'Type ' + chalk.cyan( 'buble --help' ) + ' for help, or visit https://buble.surge.sh/guide/' );
|
||||
|
||||
process.exit( 1 );
|
||||
};
|
42
node_modules/bubleify/node_modules/buble/bin/help.md
generated
vendored
Normal file
42
node_modules/bubleify/node_modules/buble/bin/help.md
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
Bublé version <%= version %>
|
||||
=====================================
|
||||
|
||||
Usage: buble [options] <entry file>
|
||||
|
||||
Basic options:
|
||||
|
||||
-v, --version Show version number
|
||||
-h, --help Show this help message
|
||||
-i, --input Input (alternative to <entry file>)
|
||||
-o, --output <output> Output (if absent, prints to stdout)
|
||||
-m, --sourcemap Generate sourcemap (`-m inline` for inline map)
|
||||
-t, --target Select compilation targets
|
||||
-y, --yes Transforms to always apply (overrides --target)
|
||||
-n, --no Transforms to always skip (overrides --target)
|
||||
--jsx Custom JSX pragma
|
||||
|
||||
Examples:
|
||||
|
||||
# Compile input.js to output.js
|
||||
buble input.js > output.js
|
||||
|
||||
# Compile input.js to output.js, write sourcemap to output.js.map
|
||||
buble input.js -o output.js -m
|
||||
|
||||
# Compile input.js to output.js with inline sourcemap
|
||||
buble input.js -o output.js -m inline
|
||||
|
||||
# Only use transforms necessary for output.js to run in FF43 and Node 5
|
||||
buble input.js -o output.js -t firefox:43,node:5
|
||||
|
||||
# As above, but use arrow function and destructuring transforms
|
||||
buble input.js -o output.js -t firefox:43,node:5 -y arrow,destructuring
|
||||
|
||||
# Compile all the files in src/ to dest/
|
||||
buble src -o dest
|
||||
|
||||
Notes:
|
||||
|
||||
* When piping to stdout, only inline sourcemaps are permitted
|
||||
|
||||
For more information visit http://buble.surge.sh/guide
|
136
node_modules/bubleify/node_modules/buble/bin/runBuble.js
generated
vendored
Normal file
136
node_modules/bubleify/node_modules/buble/bin/runBuble.js
generated
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
var fs = require( 'fs' );
|
||||
var path = require( 'path' );
|
||||
var buble = require( '../dist/buble.deps.js' );
|
||||
var handleError = require( './handleError.js' );
|
||||
var EOL = require('os').EOL;
|
||||
|
||||
function compile ( from, to, command, options ) {
|
||||
try {
|
||||
var stats = fs.statSync( from );
|
||||
if ( stats.isDirectory() ) {
|
||||
compileDir( from, to, command, options );
|
||||
} else {
|
||||
compileFile( from, to, command, options );
|
||||
}
|
||||
} catch ( err ) {
|
||||
handleError( err );
|
||||
}
|
||||
}
|
||||
|
||||
function compileDir ( from, to, command, options ) {
|
||||
if ( !command.output ) handleError({ code: 'MISSING_OUTPUT_DIR' });
|
||||
|
||||
try {
|
||||
fs.mkdirSync( to )
|
||||
} catch ( e ) {
|
||||
if ( e.code !== 'EEXIST' ) throw e
|
||||
}
|
||||
|
||||
fs.readdirSync( from ).forEach( function ( file ) {
|
||||
compile( path.resolve( from, file ), path.resolve( to, file ), command, options );
|
||||
});
|
||||
}
|
||||
|
||||
function compileFile ( from, to, command, options ) {
|
||||
var ext = path.extname( from );
|
||||
|
||||
if ( ext !== '.js' && ext !== '.jsm' && ext !== '.es6' ) return;
|
||||
|
||||
if ( to ) to = to.slice( 0, -ext.length ) + '.js';
|
||||
|
||||
var source = fs.readFileSync( from, 'utf-8' );
|
||||
var result = buble.transform( source, {
|
||||
target: options.target,
|
||||
transforms: options.transforms,
|
||||
source: from,
|
||||
file: to,
|
||||
jsx: options.jsx
|
||||
});
|
||||
|
||||
write( result, to, command );
|
||||
}
|
||||
|
||||
function write ( result, to, command ) {
|
||||
if ( command.sourcemap === 'inline' ) {
|
||||
result.code += EOL + '//# sourceMappingURL=' + result.map.toUrl();
|
||||
} else if ( command.sourcemap ) {
|
||||
if ( !to ) {
|
||||
handleError({ code: 'MISSING_OUTPUT_FILE' });
|
||||
}
|
||||
|
||||
result.code += EOL + '//# sourceMappingURL=' + path.basename( to ) + '.map';
|
||||
fs.writeFileSync( to + '.map', result.map.toString() );
|
||||
}
|
||||
|
||||
if ( to ) {
|
||||
fs.writeFileSync( to, result.code );
|
||||
} else {
|
||||
console.log( result.code ); // eslint-disable-line no-console
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function ( command ) {
|
||||
if ( command._.length > 1 ) {
|
||||
handleError({ code: 'ONE_AT_A_TIME' });
|
||||
}
|
||||
|
||||
if ( command._.length === 1 ) {
|
||||
if ( command.input ) {
|
||||
handleError({ code: 'DUPLICATE_IMPORT_OPTIONS' });
|
||||
}
|
||||
|
||||
command.input = command._[0];
|
||||
}
|
||||
|
||||
var options = {
|
||||
target: {},
|
||||
transforms: {},
|
||||
jsx: command.jsx
|
||||
};
|
||||
|
||||
if ( command.target ) {
|
||||
if ( !/^(?:(\w+):([\d\.]+),)*(\w+):([\d\.]+)$/.test( command.target ) ) {
|
||||
handleError({ code: 'BAD_TARGET' });
|
||||
}
|
||||
|
||||
command.target.split( ',' )
|
||||
.map( function ( target ) {
|
||||
return target.split( ':' );
|
||||
})
|
||||
.forEach( function ( pair ) {
|
||||
options.target[ pair[0] ] = pair[1];
|
||||
});
|
||||
}
|
||||
|
||||
if ( command.yes ) {
|
||||
command.yes.split( ',' ).forEach( function ( transform ) {
|
||||
options.transforms[ transform ] = true;
|
||||
});
|
||||
}
|
||||
|
||||
if ( command.no ) {
|
||||
command.no.split( ',' ).forEach( function ( transform ) {
|
||||
options.transforms[ transform ] = false;
|
||||
});
|
||||
}
|
||||
|
||||
if ( command.input ) {
|
||||
compile( command.input, command.output, command, options );
|
||||
}
|
||||
|
||||
else {
|
||||
process.stdin.resume();
|
||||
process.stdin.setEncoding( 'utf8' );
|
||||
|
||||
var source = '';
|
||||
|
||||
process.stdin.on( 'data', function ( chunk ) {
|
||||
source += chunk;
|
||||
});
|
||||
|
||||
process.stdin.on( 'end', function () {
|
||||
var result = buble.transform( source, options );
|
||||
write( result, null, command );
|
||||
});
|
||||
}
|
||||
};
|
13
node_modules/bubleify/node_modules/buble/bin/showHelp.js
generated
vendored
Normal file
13
node_modules/bubleify/node_modules/buble/bin/showHelp.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
var fs = require( 'fs' );
|
||||
var path = require( 'path' );
|
||||
|
||||
module.exports = function () {
|
||||
fs.readFile( path.join( __dirname, 'help.md' ), function ( err, result ) {
|
||||
var help;
|
||||
|
||||
if ( err ) throw err;
|
||||
|
||||
help = result.toString().replace( '<%= version %>', require( '../package.json' ).version );
|
||||
console.log( '\n' + help + '\n' );
|
||||
});
|
||||
};
|
14464
node_modules/bubleify/node_modules/buble/dist/buble.deps.js
generated
vendored
Normal file
14464
node_modules/bubleify/node_modules/buble/dist/buble.deps.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/bubleify/node_modules/buble/dist/buble.deps.js.map
generated
vendored
Normal file
1
node_modules/bubleify/node_modules/buble/dist/buble.deps.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
9865
node_modules/bubleify/node_modules/buble/dist/buble.es.js
generated
vendored
Normal file
9865
node_modules/bubleify/node_modules/buble/dist/buble.es.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/bubleify/node_modules/buble/dist/buble.es.js.map
generated
vendored
Normal file
1
node_modules/bubleify/node_modules/buble/dist/buble.es.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
9877
node_modules/bubleify/node_modules/buble/dist/buble.umd.js
generated
vendored
Normal file
9877
node_modules/bubleify/node_modules/buble/dist/buble.umd.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/bubleify/node_modules/buble/dist/buble.umd.js.map
generated
vendored
Normal file
1
node_modules/bubleify/node_modules/buble/dist/buble.umd.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
135
node_modules/bubleify/node_modules/buble/package.json
generated
vendored
Normal file
135
node_modules/bubleify/node_modules/buble/package.json
generated
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "buble@^0.12.0",
|
||||
"scope": null,
|
||||
"escapedName": "buble",
|
||||
"name": "buble",
|
||||
"rawSpec": "^0.12.0",
|
||||
"spec": ">=0.12.0 <0.13.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\bubleify"
|
||||
]
|
||||
],
|
||||
"_from": "buble@>=0.12.0 <0.13.0",
|
||||
"_id": "buble@0.12.5",
|
||||
"_inCache": true,
|
||||
"_location": "/bubleify/buble",
|
||||
"_nodeVersion": "6.2.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/buble-0.12.5.tgz_1468122059663_0.31926094298250973"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "rich_harris",
|
||||
"email": "richard.a.harris@gmail.com"
|
||||
},
|
||||
"_npmVersion": "3.8.9",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "buble@^0.12.0",
|
||||
"scope": null,
|
||||
"escapedName": "buble",
|
||||
"name": "buble",
|
||||
"rawSpec": "^0.12.0",
|
||||
"spec": ">=0.12.0 <0.13.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/bubleify"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/buble/-/buble-0.12.5.tgz",
|
||||
"_shasum": "c66ffe92f9f4a3c65d3256079b711e2bd0bc5013",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "buble@^0.12.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\bubleify",
|
||||
"author": {
|
||||
"name": "Rich Harris"
|
||||
},
|
||||
"bin": {
|
||||
"buble": "./bin/buble"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://gitlab.com/Rich-Harris/buble/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": "^3.1.0",
|
||||
"acorn-jsx": "^3.0.1",
|
||||
"acorn-object-spread": "^1.0.0",
|
||||
"chalk": "^1.1.3",
|
||||
"magic-string": "^0.14.0",
|
||||
"minimist": "^1.2.0",
|
||||
"os-homedir": "^1.0.1"
|
||||
},
|
||||
"description": "The blazing fast, batteries-included ES2015 compiler",
|
||||
"devDependencies": {
|
||||
"buble": "0.8.2",
|
||||
"console-group": "^0.2.1",
|
||||
"eslint": "^2.10.1",
|
||||
"glob": "^7.0.3",
|
||||
"mocha": "^2.4.5",
|
||||
"regexpu-core": "^2.0.0",
|
||||
"rimraf": "^2.5.2",
|
||||
"rollup": "^0.26.3",
|
||||
"rollup-plugin-buble": "^0.8.0",
|
||||
"rollup-plugin-commonjs": "^2.2.1",
|
||||
"rollup-plugin-json": "^2.0.0",
|
||||
"rollup-plugin-node-resolve": "^1.5.0",
|
||||
"source-map": "^0.5.6",
|
||||
"source-map-support": "^0.4.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "c66ffe92f9f4a3c65d3256079b711e2bd0bc5013",
|
||||
"tarball": "https://registry.npmjs.org/buble/-/buble-0.12.5.tgz"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"src",
|
||||
"dist",
|
||||
"register.js",
|
||||
"README.md"
|
||||
],
|
||||
"gitHead": "048673f53927c2c086b13877e04e79c921db9440",
|
||||
"homepage": "https://gitlab.com/Rich-Harris/buble#README",
|
||||
"jsnext:main": "dist/buble.es.js",
|
||||
"keywords": [
|
||||
"javascript",
|
||||
"transpilation",
|
||||
"compilation",
|
||||
"esnext",
|
||||
"es2015",
|
||||
"es2017",
|
||||
"es6",
|
||||
"es7"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/buble.umd.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "rich_harris",
|
||||
"email": "richard.a.harris@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "buble",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://gitlab.com/Rich-Harris/buble.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build:umd && npm run build:es && npm run build:browser",
|
||||
"build:browser": "rollup -c --environment DEPS -f umd -o dist/buble.deps.js",
|
||||
"build:es": "rollup -c -f es6 -o dist/buble.es.js",
|
||||
"build:umd": "rollup -c -f umd -o dist/buble.umd.js",
|
||||
"prepublish": "npm test && npm run build:es",
|
||||
"pretest": "npm run build:umd && npm run build:browser",
|
||||
"pretest:node": "npm run build:umd",
|
||||
"test": "mocha test/test.js --compilers js:buble/register",
|
||||
"test:node": "mocha test/test.js --compilers js:buble/register"
|
||||
},
|
||||
"version": "0.12.5"
|
||||
}
|
86
node_modules/bubleify/node_modules/buble/register.js
generated
vendored
Normal file
86
node_modules/bubleify/node_modules/buble/register.js
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
var fs = require( 'fs' );
|
||||
var path = require( 'path' );
|
||||
var crypto = require( 'crypto' );
|
||||
var homedir = require( 'os-homedir' );
|
||||
var buble = require( './' );
|
||||
|
||||
var original = require.extensions[ '.js' ];
|
||||
var nodeModulesPattern = path.sep === '/' ? /\/node_modules\// : /\\node_modules\\/;
|
||||
|
||||
var nodeVersion = /(?:0\.)?\d+/.exec( process.version )[0];
|
||||
var versions = [ '0.10', '0.12', '4', '5', '6' ];
|
||||
|
||||
if ( !~versions.indexOf( nodeVersion ) ) {
|
||||
if ( +nodeVersion > 6 ) {
|
||||
nodeVersion = 6;
|
||||
} else {
|
||||
throw new Error( 'Unsupported version (' + nodeVersion + '). Please raise an issue at https://gitlab.com/Rich-Harris/buble/issues' );
|
||||
}
|
||||
}
|
||||
|
||||
var options = {
|
||||
target: {
|
||||
node: nodeVersion
|
||||
}
|
||||
};
|
||||
|
||||
function mkdirp ( dir ) {
|
||||
var parent = path.dirname( dir );
|
||||
if ( dir === parent ) return;
|
||||
mkdirp( parent );
|
||||
|
||||
try {
|
||||
fs.mkdirSync( dir );
|
||||
} catch ( err ) {
|
||||
if ( err.code !== 'EEXIST' ) throw err;
|
||||
}
|
||||
}
|
||||
|
||||
var home = homedir();
|
||||
if ( home ) {
|
||||
var cachedir = path.join( home, '.buble-cache', nodeVersion );
|
||||
mkdirp( cachedir );
|
||||
fs.writeFileSync( path.join( home, '.buble-cache/README.txt' ), 'These files enable a faster startup when using buble/register. You can safely delete this folder at any time. See https://buble.surge.sh/guide/ for more information.' );
|
||||
}
|
||||
|
||||
require.extensions[ '.js' ] = function ( m, filename ) {
|
||||
if ( nodeModulesPattern.test( filename ) ) return original( m, filename );
|
||||
|
||||
var source = fs.readFileSync( filename, 'utf-8' );
|
||||
var hash = crypto.createHash( 'sha256' );
|
||||
hash.update( source );
|
||||
var key = hash.digest( 'hex' ) + '.json';
|
||||
var cachepath = path.join( cachedir, key );
|
||||
|
||||
var compiled;
|
||||
|
||||
if ( cachedir ) {
|
||||
try {
|
||||
compiled = JSON.parse( fs.readFileSync( cachepath, 'utf-8' ) );
|
||||
} catch ( err ) {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
if ( !compiled ) {
|
||||
try {
|
||||
compiled = buble.transform( source, options );
|
||||
|
||||
if ( cachedir ) {
|
||||
fs.writeFileSync( cachepath, JSON.stringify( compiled ) );
|
||||
}
|
||||
} catch ( err ) {
|
||||
if ( err.snippet ) {
|
||||
console.log( 'Error compiling ' + filename + ':\n---' );
|
||||
console.log( err.snippet );
|
||||
console.log( err.message );
|
||||
console.log( '' )
|
||||
process.exit( 1 );
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
m._compile( '"use strict";\n' + compiled.code, filename );
|
||||
};
|
81
node_modules/bubleify/node_modules/buble/src/index.js
generated
vendored
Normal file
81
node_modules/bubleify/node_modules/buble/src/index.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
import acorn from 'acorn';
|
||||
import acornJsx from 'acorn-jsx/inject';
|
||||
import acornObjectSpread from 'acorn-object-spread/inject';
|
||||
import Program from './program/Program.js';
|
||||
import { features, matrix } from './support.js';
|
||||
import getSnippet from './utils/getSnippet.js';
|
||||
|
||||
const { parse } = [
|
||||
acornObjectSpread,
|
||||
acornJsx
|
||||
].reduce( ( final, plugin ) => plugin( final ), acorn );
|
||||
|
||||
const dangerousTransforms = [
|
||||
'dangerousTaggedTemplateString',
|
||||
'dangerousForOf'
|
||||
];
|
||||
|
||||
export function target ( target ) {
|
||||
const targets = Object.keys( target );
|
||||
let bitmask = targets.length ?
|
||||
0b1111111111111111111111111111111 :
|
||||
0b1000000000000000000000000000000;
|
||||
|
||||
Object.keys( target ).forEach( environment => {
|
||||
const versions = matrix[ environment ];
|
||||
if ( !versions ) throw new Error( `Unknown environment '${environment}'. Please raise an issue at https://gitlab.com/Rich-Harris/buble/issues` );
|
||||
|
||||
const targetVersion = target[ environment ];
|
||||
if ( !( targetVersion in versions ) ) throw new Error( `Support data exists for the following versions of ${environment}: ${Object.keys( versions ).join( ', ')}. Please raise an issue at https://gitlab.com/Rich-Harris/buble/issues` );
|
||||
const support = versions[ targetVersion ];
|
||||
|
||||
bitmask &= support;
|
||||
});
|
||||
|
||||
let transforms = Object.create( null );
|
||||
features.forEach( ( name, i ) => {
|
||||
transforms[ name ] = !( bitmask & 1 << i );
|
||||
});
|
||||
|
||||
dangerousTransforms.forEach( name => {
|
||||
transforms[ name ] = false;
|
||||
});
|
||||
|
||||
return transforms;
|
||||
}
|
||||
|
||||
export function transform ( source, options = {} ) {
|
||||
let ast;
|
||||
|
||||
try {
|
||||
ast = parse( source, {
|
||||
ecmaVersion: 7,
|
||||
preserveParens: true,
|
||||
sourceType: 'module',
|
||||
plugins: {
|
||||
jsx: true,
|
||||
objectSpread: true
|
||||
}
|
||||
});
|
||||
} catch ( err ) {
|
||||
err.snippet = getSnippet( source, err.loc );
|
||||
err.toString = () => `${err.name}: ${err.message}\n${err.snippet}`;
|
||||
throw err;
|
||||
}
|
||||
|
||||
let transforms = target( options.target || {} );
|
||||
Object.keys( options.transforms || {} ).forEach( name => {
|
||||
if ( name === 'modules' ) {
|
||||
if ( !( 'moduleImport' in options.transforms ) ) transforms.moduleImport = options.transforms.modules;
|
||||
if ( !( 'moduleExport' in options.transforms ) ) transforms.moduleExport = options.transforms.modules;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !( name in transforms ) ) throw new Error( `Unknown transform '${name}'` );
|
||||
transforms[ name ] = options.transforms[ name ];
|
||||
});
|
||||
|
||||
return new Program( source, ast, transforms, options ).export( options );
|
||||
}
|
||||
|
||||
export { version as VERSION } from '../package.json';
|
305
node_modules/bubleify/node_modules/buble/src/program/BlockStatement.js
generated
vendored
Normal file
305
node_modules/bubleify/node_modules/buble/src/program/BlockStatement.js
generated
vendored
Normal file
@ -0,0 +1,305 @@
|
||||
import wrap from './wrap.js';
|
||||
import Node from './Node.js';
|
||||
import Scope from './Scope.js';
|
||||
import CompileError from '../utils/CompileError.js';
|
||||
import destructure from '../utils/destructure.js';
|
||||
|
||||
function isUseStrict ( node ) {
|
||||
if ( !node ) return false;
|
||||
if ( node.type !== 'ExpressionStatement' ) return false;
|
||||
if ( node.expression.type !== 'Literal' ) return false;
|
||||
return node.expression.value === 'use strict';
|
||||
}
|
||||
|
||||
export default class BlockStatement extends Node {
|
||||
createScope () {
|
||||
this.parentIsFunction = /Function/.test( this.parent.type );
|
||||
this.isFunctionBlock = this.parentIsFunction || this.parent.type === 'Root';
|
||||
this.scope = new Scope({
|
||||
block: !this.isFunctionBlock,
|
||||
parent: this.parent.findScope( false )
|
||||
});
|
||||
|
||||
if ( this.parentIsFunction ) {
|
||||
this.parent.params.forEach( node => {
|
||||
this.scope.addDeclaration( node, 'param' );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
initialise ( transforms ) {
|
||||
this.thisAlias = null;
|
||||
this.argumentsAlias = null;
|
||||
this.defaultParameters = [];
|
||||
|
||||
// normally the scope gets created here, during initialisation,
|
||||
// but in some cases (e.g. `for` statements), we need to create
|
||||
// the scope early, as it pertains to both the init block and
|
||||
// the body of the statement
|
||||
if ( !this.scope ) this.createScope();
|
||||
|
||||
this.body.forEach( node => node.initialise( transforms ) );
|
||||
|
||||
this.scope.consolidate();
|
||||
}
|
||||
|
||||
findLexicalBoundary () {
|
||||
if ( this.type === 'Program' ) return this;
|
||||
if ( /^Function/.test( this.parent.type ) ) return this;
|
||||
|
||||
return this.parent.findLexicalBoundary();
|
||||
}
|
||||
|
||||
findScope ( functionScope ) {
|
||||
if ( functionScope && !this.isFunctionBlock ) return this.parent.findScope( functionScope );
|
||||
return this.scope;
|
||||
}
|
||||
|
||||
getArgumentsAlias () {
|
||||
if ( !this.argumentsAlias ) {
|
||||
this.argumentsAlias = this.scope.createIdentifier( 'arguments' );
|
||||
}
|
||||
|
||||
return this.argumentsAlias;
|
||||
}
|
||||
|
||||
getArgumentsArrayAlias () {
|
||||
if ( !this.argumentsArrayAlias ) {
|
||||
this.argumentsArrayAlias = this.scope.createIdentifier( 'argsArray' );
|
||||
}
|
||||
|
||||
return this.argumentsArrayAlias;
|
||||
}
|
||||
|
||||
getThisAlias () {
|
||||
if ( !this.thisAlias ) {
|
||||
this.thisAlias = this.scope.createIdentifier( 'this' );
|
||||
}
|
||||
|
||||
return this.thisAlias;
|
||||
}
|
||||
|
||||
getIndentation () {
|
||||
if ( this.indentation === undefined ) {
|
||||
const source = this.program.magicString.original;
|
||||
|
||||
const useOuter = this.synthetic || !this.body.length;
|
||||
let c = useOuter ? this.start : this.body[0].start;
|
||||
|
||||
while ( c && source[c] !== '\n' ) c -= 1;
|
||||
|
||||
this.indentation = '';
|
||||
|
||||
while ( true ) {
|
||||
c += 1;
|
||||
const char = source[c];
|
||||
|
||||
if ( char !== ' ' && char !== '\t' ) break;
|
||||
|
||||
this.indentation += char;
|
||||
}
|
||||
|
||||
const indentString = this.program.magicString.getIndentString();
|
||||
|
||||
// account for dedented class constructors
|
||||
let parent = this.parent;
|
||||
while ( parent ) {
|
||||
if ( parent.kind === 'constructor' && !parent.parent.parent.superClass ) {
|
||||
this.indentation = this.indentation.replace( indentString, '' );
|
||||
}
|
||||
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
||||
if ( useOuter ) this.indentation += indentString;
|
||||
}
|
||||
|
||||
return this.indentation;
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
const indentation = this.getIndentation();
|
||||
|
||||
let introStatementGenerators = [];
|
||||
|
||||
if ( this.argumentsAlias ) {
|
||||
introStatementGenerators.push( ( start, prefix, suffix ) => {
|
||||
const assignment = `${prefix}var ${this.argumentsAlias} = arguments;${suffix}`;
|
||||
code.insertLeft( start, assignment );
|
||||
});
|
||||
}
|
||||
|
||||
if ( this.thisAlias ) {
|
||||
introStatementGenerators.push( ( start, prefix, suffix ) => {
|
||||
const assignment = `${prefix}var ${this.thisAlias} = this;${suffix}`;
|
||||
code.insertLeft( start, assignment );
|
||||
});
|
||||
}
|
||||
|
||||
if ( this.argumentsArrayAlias ) {
|
||||
introStatementGenerators.push( ( start, prefix, suffix ) => {
|
||||
const i = this.scope.createIdentifier( 'i' );
|
||||
const assignment = `${prefix}var ${i} = arguments.length, ${this.argumentsArrayAlias} = Array(${i});\n${indentation}while ( ${i}-- ) ${this.argumentsArrayAlias}[${i}] = arguments[${i}];${suffix}`;
|
||||
code.insertLeft( start, assignment );
|
||||
});
|
||||
}
|
||||
|
||||
if ( /Function/.test( this.parent.type ) ) {
|
||||
this.transpileParameters( code, transforms, indentation, introStatementGenerators );
|
||||
}
|
||||
|
||||
if ( transforms.letConst && this.isFunctionBlock ) {
|
||||
this.transpileBlockScopedIdentifiers( code );
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
|
||||
if ( this.synthetic ) {
|
||||
if ( this.parent.type === 'ArrowFunctionExpression' ) {
|
||||
const expr = this.body[0];
|
||||
|
||||
if ( introStatementGenerators.length ) {
|
||||
code.insertLeft( this.start, `{` ).insertRight( this.end, `${this.parent.getIndentation()}}` );
|
||||
|
||||
code.insertRight( expr.start, `\n${indentation}return ` );
|
||||
code.insertLeft( expr.end, `;\n` );
|
||||
} else if ( transforms.arrow ) {
|
||||
code.insertRight( expr.start, `{ return ` );
|
||||
code.insertLeft( expr.end, `; }` );
|
||||
}
|
||||
}
|
||||
|
||||
else if ( introStatementGenerators.length ) {
|
||||
code.insertLeft( this.start, `{` ).insertRight( this.end, `}` );
|
||||
}
|
||||
}
|
||||
|
||||
let start;
|
||||
if ( isUseStrict( this.body[0] ) ) {
|
||||
start = this.body[0].end;
|
||||
} else if ( this.synthetic || this.parent.type === 'Root' ) {
|
||||
start = this.start;
|
||||
} else {
|
||||
start = this.start + 1;
|
||||
}
|
||||
|
||||
let prefix = `\n${indentation}`;
|
||||
let suffix = '';
|
||||
introStatementGenerators.forEach( ( fn, i ) => {
|
||||
if ( i === introStatementGenerators.length - 1 ) suffix = `\n`;
|
||||
fn( start, prefix, suffix );
|
||||
});
|
||||
}
|
||||
|
||||
transpileParameters ( code, transforms, indentation, introStatementGenerators ) {
|
||||
const params = this.parent.params;
|
||||
|
||||
params.forEach( param => {
|
||||
if ( param.type === 'AssignmentPattern' && param.left.type === 'Identifier' ) {
|
||||
if ( transforms.defaultParameter ) {
|
||||
introStatementGenerators.push( ( start, prefix, suffix ) => {
|
||||
const lhs = `${prefix}if ( ${param.left.name} === void 0 ) ${param.left.name}`;
|
||||
|
||||
code
|
||||
.insertRight( param.left.end, `${lhs}` )
|
||||
.move( param.left.end, param.right.end, start )
|
||||
.insertLeft( param.right.end, `;${suffix}` );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
else if ( param.type === 'RestElement' ) {
|
||||
if ( transforms.spreadRest ) {
|
||||
introStatementGenerators.push( ( start, prefix, suffix ) => {
|
||||
const penultimateParam = params[ params.length - 2 ];
|
||||
|
||||
if ( penultimateParam ) {
|
||||
code.remove( penultimateParam ? penultimateParam.end : param.start, param.end );
|
||||
} else {
|
||||
let start = param.start, end = param.end; // TODO https://gitlab.com/Rich-Harris/buble/issues/8
|
||||
|
||||
while ( /\s/.test( code.original[ start - 1 ] ) ) start -= 1;
|
||||
while ( /\s/.test( code.original[ end ] ) ) end += 1;
|
||||
|
||||
code.remove( start, end );
|
||||
}
|
||||
|
||||
const name = param.argument.name;
|
||||
const len = this.scope.createIdentifier( 'len' );
|
||||
const count = params.length - 1;
|
||||
|
||||
if ( count ) {
|
||||
code.insertLeft( start, `${prefix}var ${name} = [], ${len} = arguments.length - ${count};\n${indentation}while ( ${len}-- > 0 ) ${name}[ ${len} ] = arguments[ ${len} + ${count} ];${suffix}` );
|
||||
} else {
|
||||
code.insertLeft( start, `${prefix}var ${name} = [], ${len} = arguments.length;\n${indentation}while ( ${len}-- ) ${name}[ ${len} ] = arguments[ ${len} ];${suffix}` );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
else if ( param.type !== 'Identifier' ) {
|
||||
if ( transforms.parameterDestructuring ) {
|
||||
const ref = this.scope.createIdentifier( 'ref' );
|
||||
destructure( code, this.scope, param, ref, introStatementGenerators );
|
||||
code.insertLeft( param.start, ref );
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
transpileBlockScopedIdentifiers ( code ) {
|
||||
Object.keys( this.scope.blockScopedDeclarations ).forEach( name => {
|
||||
const declarations = this.scope.blockScopedDeclarations[ name ];
|
||||
|
||||
for ( let declaration of declarations ) {
|
||||
let cont = false; // TODO implement proper continue...
|
||||
|
||||
if ( declaration.kind === 'for.let' ) {
|
||||
// special case
|
||||
const forStatement = declaration.node.findNearest( 'ForStatement' );
|
||||
|
||||
if ( forStatement.shouldRewriteAsFunction ) {
|
||||
const outerAlias = this.scope.createIdentifier( name );
|
||||
const innerAlias = forStatement.reassigned[ name ] ?
|
||||
this.scope.createIdentifier( name ) :
|
||||
name;
|
||||
|
||||
declaration.name = outerAlias;
|
||||
code.overwrite( declaration.node.start, declaration.node.end, outerAlias, true );
|
||||
|
||||
forStatement.aliases[ name ] = {
|
||||
outer: outerAlias,
|
||||
inner: innerAlias
|
||||
};
|
||||
|
||||
for ( const identifier of declaration.instances ) {
|
||||
const alias = forStatement.body.contains( identifier ) ?
|
||||
innerAlias :
|
||||
outerAlias;
|
||||
|
||||
if ( name !== alias ) {
|
||||
code.overwrite( identifier.start, identifier.end, alias, true );
|
||||
}
|
||||
}
|
||||
|
||||
cont = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !cont ) {
|
||||
const alias = this.scope.createIdentifier( name );
|
||||
|
||||
if ( name !== alias ) {
|
||||
declaration.name = alias;
|
||||
code.overwrite( declaration.node.start, declaration.node.end, alias, true );
|
||||
|
||||
for ( const identifier of declaration.instances ) {
|
||||
identifier.rewritten = true;
|
||||
code.overwrite( identifier.start, identifier.end, alias, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
108
node_modules/bubleify/node_modules/buble/src/program/Node.js
generated
vendored
Normal file
108
node_modules/bubleify/node_modules/buble/src/program/Node.js
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
import wrap from './wrap.js';
|
||||
import keys from './keys.js';
|
||||
|
||||
// used for debugging, without the noise created by
|
||||
// circular references
|
||||
function toJSON ( node ) {
|
||||
var obj = {};
|
||||
|
||||
Object.keys( node ).forEach( key => {
|
||||
if ( key === 'parent' || key === 'program' || key === 'keys' || key === '__wrapped' ) return;
|
||||
|
||||
if ( Array.isArray( node[ key ] ) ) {
|
||||
obj[ key ] = node[ key ].map( toJSON );
|
||||
} else if ( node[ key ] && node[ key ].toJSON ) {
|
||||
obj[ key ] = node[ key ].toJSON();
|
||||
} else {
|
||||
obj[ key ] = node[ key ];
|
||||
}
|
||||
});
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
export default class Node {
|
||||
constructor ( raw, parent ) {
|
||||
raw.parent = parent;
|
||||
raw.program = parent.program || parent;
|
||||
raw.depth = parent.depth + 1;
|
||||
raw.keys = keys[ raw.type ];
|
||||
raw.indentation = undefined;
|
||||
|
||||
for ( const key of keys[ raw.type ] ) {
|
||||
wrap( raw[ key ], raw );
|
||||
}
|
||||
|
||||
raw.program.magicString.addSourcemapLocation( raw.start );
|
||||
raw.program.magicString.addSourcemapLocation( raw.end );
|
||||
}
|
||||
|
||||
ancestor ( level ) {
|
||||
let node = this;
|
||||
while ( level-- ) {
|
||||
node = node.parent;
|
||||
if ( !node ) return null;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
contains ( node ) {
|
||||
while ( node ) {
|
||||
if ( node === this ) return true;
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
findLexicalBoundary () {
|
||||
return this.parent.findLexicalBoundary();
|
||||
}
|
||||
|
||||
findNearest ( type ) {
|
||||
if ( typeof type === 'string' ) type = new RegExp( `^${type}$` );
|
||||
if ( type.test( this.type ) ) return this;
|
||||
return this.parent.findNearest( type );
|
||||
}
|
||||
|
||||
findScope ( functionScope ) {
|
||||
return this.parent.findScope( functionScope );
|
||||
}
|
||||
|
||||
getIndentation () {
|
||||
return this.parent.getIndentation();
|
||||
}
|
||||
|
||||
initialise ( transforms ) {
|
||||
for ( var key of this.keys ) {
|
||||
const value = this[ key ];
|
||||
|
||||
if ( Array.isArray( value ) ) {
|
||||
value.forEach( node => node && node.initialise( transforms ) );
|
||||
} else if ( value && typeof value === 'object' ) {
|
||||
value.initialise( transforms );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
toJSON () {
|
||||
return toJSON( this );
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.program.magicString.original.slice( this.start, this.end );
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
for ( const key of this.keys ) {
|
||||
const value = this[ key ];
|
||||
|
||||
if ( Array.isArray( value ) ) {
|
||||
value.forEach( node => node && node.transpile( code, transforms ) );
|
||||
} else if ( value && typeof value === 'object' ) {
|
||||
value.transpile( code, transforms );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
53
node_modules/bubleify/node_modules/buble/src/program/Program.js
generated
vendored
Normal file
53
node_modules/bubleify/node_modules/buble/src/program/Program.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
import MagicString from 'magic-string';
|
||||
import BlockStatement from './BlockStatement.js';
|
||||
import wrap from './wrap.js';
|
||||
|
||||
export default function Program ( source, ast, transforms, options ) {
|
||||
this.type = 'Root';
|
||||
|
||||
// options
|
||||
this.jsx = options.jsx || 'React.createElement';
|
||||
this.objectAssign = options.objectAssign || 'Object.assign';
|
||||
|
||||
this.source = source;
|
||||
this.magicString = new MagicString( source );
|
||||
|
||||
this.ast = ast;
|
||||
this.depth = 0;
|
||||
|
||||
wrap( this.body = ast, this );
|
||||
this.body.__proto__ = BlockStatement.prototype;
|
||||
|
||||
this.templateElements = [];
|
||||
this.body.initialise( transforms );
|
||||
|
||||
this.indentExclusions = {};
|
||||
for ( const node of this.templateElements ) {
|
||||
for ( let i = node.start; i < node.end; i += 1 ) {
|
||||
this.indentExclusions[ node.start + i ] = true;
|
||||
}
|
||||
}
|
||||
|
||||
this.body.transpile( this.magicString, transforms );
|
||||
}
|
||||
|
||||
Program.prototype = {
|
||||
export ( options = {} ) {
|
||||
return {
|
||||
code: this.magicString.toString(),
|
||||
map: this.magicString.generateMap({
|
||||
file: options.file,
|
||||
source: options.source,
|
||||
includeContent: options.includeContent !== false
|
||||
})
|
||||
};
|
||||
},
|
||||
|
||||
findNearest () {
|
||||
return null;
|
||||
},
|
||||
|
||||
findScope () {
|
||||
return null;
|
||||
}
|
||||
};
|
98
node_modules/bubleify/node_modules/buble/src/program/Scope.js
generated
vendored
Normal file
98
node_modules/bubleify/node_modules/buble/src/program/Scope.js
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
import extractNames from './extractNames.js';
|
||||
import reserved from '../utils/reserved.js';
|
||||
import CompileError from '../utils/CompileError.js';
|
||||
|
||||
const letConst = /^(?:let|const)$/;
|
||||
|
||||
export default function Scope ( options ) {
|
||||
options = options || {};
|
||||
|
||||
this.parent = options.parent;
|
||||
this.isBlockScope = !!options.block;
|
||||
|
||||
let scope = this;
|
||||
while ( scope.isBlockScope ) scope = scope.parent;
|
||||
this.functionScope = scope;
|
||||
|
||||
this.identifiers = [];
|
||||
this.declarations = Object.create( null );
|
||||
this.references = Object.create( null );
|
||||
this.blockScopedDeclarations = this.isBlockScope ? null : Object.create( null );
|
||||
this.aliases = this.isBlockScope ? null : Object.create( null );
|
||||
}
|
||||
|
||||
Scope.prototype = {
|
||||
addDeclaration ( node, kind ) {
|
||||
for ( const identifier of extractNames( node ) ) {
|
||||
const name = identifier.name;
|
||||
const existingDeclaration = this.declarations[ name ];
|
||||
if ( existingDeclaration && ( letConst.test( kind ) || letConst.test( existingDeclaration.kind ) ) ) {
|
||||
// TODO warn about double var declarations?
|
||||
throw new CompileError( identifier, `${name} is already declared` );
|
||||
}
|
||||
|
||||
const declaration = { name, node: identifier, kind, instances: [] };
|
||||
this.declarations[ name ] = declaration;
|
||||
|
||||
if ( this.isBlockScope ) {
|
||||
if ( !this.functionScope.blockScopedDeclarations[ name ] ) this.functionScope.blockScopedDeclarations[ name ] = [];
|
||||
this.functionScope.blockScopedDeclarations[ name ].push( declaration );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
addReference ( identifier ) {
|
||||
if ( this.consolidated ) {
|
||||
this.consolidateReference( identifier );
|
||||
} else {
|
||||
this.identifiers.push( identifier );
|
||||
}
|
||||
},
|
||||
|
||||
consolidate () {
|
||||
for ( let i = 0; i < this.identifiers.length; i += 1 ) { // we might push to the array during consolidation, so don't cache length
|
||||
const identifier = this.identifiers[i];
|
||||
this.consolidateReference( identifier );
|
||||
}
|
||||
|
||||
this.consolidated = true; // TODO understand why this is necessary... seems bad
|
||||
},
|
||||
|
||||
consolidateReference ( identifier ) {
|
||||
const declaration = this.declarations[ identifier.name ];
|
||||
if ( declaration ) {
|
||||
declaration.instances.push( identifier );
|
||||
} else {
|
||||
this.references[ identifier.name ] = true;
|
||||
if ( this.parent ) this.parent.addReference( identifier );
|
||||
}
|
||||
},
|
||||
|
||||
contains ( name ) {
|
||||
return this.declarations[ name ] ||
|
||||
( this.parent ? this.parent.contains( name ) : false );
|
||||
},
|
||||
|
||||
createIdentifier ( base ) {
|
||||
base = base
|
||||
.replace( /\s/g, '' )
|
||||
.replace( /\[([^\]]+)\]/g, '_$1' )
|
||||
.replace( /[^a-zA-Z0-9_$]/g, '_' )
|
||||
.replace( /_{2,}/, '_' );
|
||||
|
||||
let name = base;
|
||||
let counter = 1;
|
||||
|
||||
while ( this.declarations[ name ] || this.references[ name ] || this.aliases[ name ] || name in reserved ) {
|
||||
name = `${base}$${counter++}`;
|
||||
}
|
||||
|
||||
this.aliases[ name ] = true;
|
||||
return name;
|
||||
},
|
||||
|
||||
findDeclaration ( name ) {
|
||||
return this.declarations[ name ] ||
|
||||
( this.parent && this.parent.findDeclaration( name ) );
|
||||
}
|
||||
};
|
31
node_modules/bubleify/node_modules/buble/src/program/extractNames.js
generated
vendored
Normal file
31
node_modules/bubleify/node_modules/buble/src/program/extractNames.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
export default function extractNames ( node ) {
|
||||
const names = [];
|
||||
extractors[ node.type ]( names, node );
|
||||
return names;
|
||||
}
|
||||
|
||||
const extractors = {
|
||||
Identifier ( names, node ) {
|
||||
names.push( node );
|
||||
},
|
||||
|
||||
ObjectPattern ( names, node ) {
|
||||
for ( const prop of node.properties ) {
|
||||
extractors[ prop.value.type ]( names, prop.value );
|
||||
}
|
||||
},
|
||||
|
||||
ArrayPattern ( names, node ) {
|
||||
for ( const element of node.elements ) {
|
||||
if ( element ) extractors[ element.type ]( names, element );
|
||||
}
|
||||
},
|
||||
|
||||
RestElement ( names, node ) {
|
||||
extractors[ node.argument.type ]( names, node.argument );
|
||||
},
|
||||
|
||||
AssignmentPattern ( names, node ) {
|
||||
extractors[ node.left.type ]( names, node.left );
|
||||
}
|
||||
};
|
4
node_modules/bubleify/node_modules/buble/src/program/keys.js
generated
vendored
Normal file
4
node_modules/bubleify/node_modules/buble/src/program/keys.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
export default {
|
||||
Program: [ 'body' ],
|
||||
Literal: []
|
||||
};
|
48
node_modules/bubleify/node_modules/buble/src/program/types/ArrayExpression.js
generated
vendored
Normal file
48
node_modules/bubleify/node_modules/buble/src/program/types/ArrayExpression.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
import Node from '../Node.js';
|
||||
import spread, { isArguments } from '../../utils/spread.js';
|
||||
|
||||
export default class ArrayExpression extends Node {
|
||||
initialise ( transforms ) {
|
||||
if ( transforms.spreadRest && this.elements.length ) {
|
||||
const lexicalBoundary = this.findLexicalBoundary();
|
||||
|
||||
let i = this.elements.length;
|
||||
while ( i-- ) {
|
||||
const element = this.elements[i];
|
||||
if ( element && element.type === 'SpreadElement' && isArguments( element.argument ) ) {
|
||||
this.argumentsArrayAlias = lexicalBoundary.getArgumentsArrayAlias();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.initialise( transforms );
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( transforms.spreadRest ) {
|
||||
if ( this.elements.length === 1 ) {
|
||||
const element = this.elements[0];
|
||||
|
||||
if ( element && element.type === 'SpreadElement' ) {
|
||||
// special case – [ ...arguments ]
|
||||
if ( isArguments( element.argument ) ) {
|
||||
code.overwrite( this.start, this.end, `[].concat( ${this.argumentsArrayAlias} )` ); // TODO if this is the only use of argsArray, don't bother concating
|
||||
} else {
|
||||
code.overwrite( this.start, element.argument.start, '[].concat( ' );
|
||||
code.overwrite( element.end, this.end, ' )' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
const hasSpreadElements = spread( code, this.elements, this.start, this.argumentsArrayAlias );
|
||||
|
||||
if ( hasSpreadElements ) {
|
||||
code.overwrite( this.end - 1, this.end, ')' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
30
node_modules/bubleify/node_modules/buble/src/program/types/ArrowFunctionExpression.js
generated
vendored
Normal file
30
node_modules/bubleify/node_modules/buble/src/program/types/ArrowFunctionExpression.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
export default class ArrowFunctionExpression extends Node {
|
||||
initialise ( transforms ) {
|
||||
this.body.createScope();
|
||||
super.initialise( transforms );
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( transforms.arrow ) {
|
||||
// remove arrow
|
||||
let charIndex = this.body.start;
|
||||
while ( code.original[ charIndex ] !== '=' ) {
|
||||
charIndex -= 1;
|
||||
}
|
||||
code.remove( charIndex, this.body.start );
|
||||
|
||||
// wrap naked parameter
|
||||
if ( this.params.length === 1 && this.start === this.params[0].start ) {
|
||||
code.insertRight( this.params[0].start, '(' );
|
||||
code.insertLeft( this.params[0].end, ')' );
|
||||
}
|
||||
|
||||
// add function
|
||||
code.insertRight( this.start, 'function ' );
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
134
node_modules/bubleify/node_modules/buble/src/program/types/AssignmentExpression.js
generated
vendored
Normal file
134
node_modules/bubleify/node_modules/buble/src/program/types/AssignmentExpression.js
generated
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
import Node from '../Node.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
|
||||
export default class AssignmentExpression extends Node {
|
||||
initialise ( transforms ) {
|
||||
if ( this.left.type === 'Identifier' ) {
|
||||
const declaration = this.findScope( false ).findDeclaration( this.left.name );
|
||||
if ( declaration && declaration.kind === 'const' ) {
|
||||
throw new CompileError( this.left, `${this.left.name} is read-only` );
|
||||
}
|
||||
|
||||
// special case – https://gitlab.com/Rich-Harris/buble/issues/11
|
||||
const statement = declaration && declaration.node.ancestor( 3 );
|
||||
if ( statement && statement.type === 'ForStatement' && statement.body.contains( this ) ) {
|
||||
statement.reassigned[ this.left.name ] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( /Pattern/.test( this.left.type ) ) {
|
||||
throw new CompileError( this.left, 'Destructuring assignments are not currently supported. Coming soon!' );
|
||||
}
|
||||
|
||||
super.initialise( transforms );
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( this.operator === '**=' && transforms.exponentiation ) {
|
||||
const scope = this.findScope( false );
|
||||
const getAlias = name => {
|
||||
const declaration = scope.findDeclaration( name );
|
||||
return declaration ? declaration.name : name;
|
||||
};
|
||||
|
||||
// first, the easy part – `**=` -> `=`
|
||||
let charIndex = this.left.end;
|
||||
while ( code.original[ charIndex ] !== '*' ) charIndex += 1;
|
||||
code.remove( charIndex, charIndex + 2 );
|
||||
|
||||
// how we do the next part depends on a number of factors – whether
|
||||
// this is a top-level statement, and whether we're updating a
|
||||
// simple or complex reference
|
||||
let base;
|
||||
|
||||
let left = this.left;
|
||||
while ( left.type === 'ParenthesizedExpression' ) left = left.expression;
|
||||
|
||||
if ( left.type === 'Identifier' ) {
|
||||
base = getAlias( left.name );
|
||||
} else if ( left.type === 'MemberExpression' ) {
|
||||
let object;
|
||||
let needsObjectVar = false;
|
||||
let property;
|
||||
let needsPropertyVar = false;
|
||||
|
||||
const statement = this.findNearest( /(?:Statement|Declaration)$/ );
|
||||
const i0 = statement.getIndentation();
|
||||
|
||||
if ( left.property.type === 'Identifier' ) {
|
||||
property = left.computed ? getAlias( left.property.name ) : left.property.name;
|
||||
} else {
|
||||
property = scope.createIdentifier( 'property' );
|
||||
needsPropertyVar = true;
|
||||
}
|
||||
|
||||
if ( left.object.type === 'Identifier' ) {
|
||||
object = getAlias( left.object.name );
|
||||
} else {
|
||||
object = scope.createIdentifier( 'object' );
|
||||
needsObjectVar = true;
|
||||
}
|
||||
|
||||
if ( left.start === statement.start ) {
|
||||
if ( needsObjectVar && needsPropertyVar ) {
|
||||
code.insertRight( statement.start, `var ${object} = ` );
|
||||
code.overwrite( left.object.end, left.property.start, `;\n${i0}var ${property} = ` );
|
||||
code.overwrite( left.property.end, left.end, `;\n${i0}${object}[${property}]` );
|
||||
}
|
||||
|
||||
else if ( needsObjectVar ) {
|
||||
code.insertRight( statement.start, `var ${object} = ` );
|
||||
code.insertLeft( left.object.end, `;\n${i0}` );
|
||||
code.insertLeft( left.object.end, object );
|
||||
}
|
||||
|
||||
else if ( needsPropertyVar ) {
|
||||
code.insertRight( left.property.start, `var ${property} = ` );
|
||||
code.insertLeft( left.property.end, `;\n${i0}` );
|
||||
code.move( left.property.start, left.property.end, this.start );
|
||||
|
||||
code.insertLeft( left.object.end, `[${property}]` );
|
||||
code.remove( left.object.end, left.property.start );
|
||||
code.remove( left.property.end, left.end );
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
let declarators = [];
|
||||
if ( needsObjectVar ) declarators.push( object );
|
||||
if ( needsPropertyVar ) declarators.push( property );
|
||||
code.insertRight( statement.start, `var ${declarators.join( ', ' )};\n${i0}` );
|
||||
|
||||
if ( needsObjectVar && needsPropertyVar ) {
|
||||
code.insertRight( left.start, `( ${object} = ` );
|
||||
code.overwrite( left.object.end, left.property.start, `, ${property} = ` );
|
||||
code.overwrite( left.property.end, left.end, `, ${object}[${property}]` );
|
||||
}
|
||||
|
||||
else if ( needsObjectVar ) {
|
||||
code.insertRight( left.start, `( ${object} = ` );
|
||||
code.insertLeft( left.object.end, `, ${object}` );
|
||||
}
|
||||
|
||||
else if ( needsPropertyVar ) {
|
||||
code.insertRight( left.property.start, `( ${property} = ` );
|
||||
code.insertLeft( left.property.end, `, ` );
|
||||
code.move( left.property.start, left.property.end, left.start );
|
||||
|
||||
code.overwrite( left.object.end, left.property.start, `[${property}]` );
|
||||
code.remove( left.property.end, left.end );
|
||||
}
|
||||
|
||||
code.insertLeft( this.end, ` )` );
|
||||
}
|
||||
|
||||
base = object + ( left.computed || needsPropertyVar ? `[${property}]` : `.${property}` );
|
||||
}
|
||||
|
||||
code.insertRight( this.right.start, `Math.pow( ${base}, ` );
|
||||
code.insertLeft( this.right.end, ` )` );
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
12
node_modules/bubleify/node_modules/buble/src/program/types/BinaryExpression.js
generated
vendored
Normal file
12
node_modules/bubleify/node_modules/buble/src/program/types/BinaryExpression.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
export default class BinaryExpression extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
if ( this.operator === '**' && transforms.exponentiation ) {
|
||||
code.insertRight( this.start, `Math.pow( ` );
|
||||
code.overwrite( this.left.end, this.right.start, `, ` );
|
||||
code.insertLeft( this.end, ` )` );
|
||||
}
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
21
node_modules/bubleify/node_modules/buble/src/program/types/BreakStatement.js
generated
vendored
Normal file
21
node_modules/bubleify/node_modules/buble/src/program/types/BreakStatement.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
import Node from '../Node.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
|
||||
export default class BreakStatement extends Node {
|
||||
initialise ( transforms ) {
|
||||
const loop = this.findNearest( /(?:For(?:In)?|While)Statement/ );
|
||||
const switchCase = this.findNearest( 'SwitchCase' );
|
||||
|
||||
if ( loop && ( !switchCase || loop.depth > switchCase.depth ) ) {
|
||||
loop.canBreak = true;
|
||||
this.loop = loop;
|
||||
}
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( this.loop && this.loop.shouldRewriteAsFunction ) {
|
||||
if ( this.label ) throw new CompileError( this, 'Labels are not currently supported in a loop with locally-scoped variables' );
|
||||
code.overwrite( this.start, this.start + 5, `return 'break'` );
|
||||
}
|
||||
}
|
||||
}
|
86
node_modules/bubleify/node_modules/buble/src/program/types/CallExpression.js
generated
vendored
Normal file
86
node_modules/bubleify/node_modules/buble/src/program/types/CallExpression.js
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
import Node from '../Node.js';
|
||||
import spread, { isArguments } from '../../utils/spread.js';
|
||||
|
||||
export default class CallExpression extends Node {
|
||||
initialise ( transforms ) {
|
||||
if ( transforms.spreadRest && this.arguments.length > 1 ) {
|
||||
const lexicalBoundary = this.findLexicalBoundary();
|
||||
|
||||
let i = this.arguments.length;
|
||||
while ( i-- ) {
|
||||
const arg = this.arguments[i];
|
||||
if ( arg.type === 'SpreadElement' && isArguments( arg.argument ) ) {
|
||||
this.argumentsArrayAlias = lexicalBoundary.getArgumentsArrayAlias();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.initialise( transforms );
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( transforms.spreadRest && this.arguments.length ) {
|
||||
let hasSpreadElements = false;
|
||||
let context;
|
||||
|
||||
const firstArgument = this.arguments[0];
|
||||
|
||||
if ( this.arguments.length === 1 ) {
|
||||
if ( firstArgument.type === 'SpreadElement' ) {
|
||||
code.remove( firstArgument.start, firstArgument.argument.start );
|
||||
hasSpreadElements = true;
|
||||
}
|
||||
} else {
|
||||
hasSpreadElements = spread( code, this.arguments, firstArgument.start, this.argumentsArrayAlias );
|
||||
}
|
||||
|
||||
if ( hasSpreadElements ) {
|
||||
if ( this.callee.type === 'MemberExpression' ) {
|
||||
if ( this.callee.object.type === 'Identifier' ) {
|
||||
context = this.callee.object.name;
|
||||
} else {
|
||||
const statement = this.callee.object;
|
||||
const i0 = statement.getIndentation();
|
||||
context = this.findScope( true ).createIdentifier( 'ref' );
|
||||
code.insertRight( statement.start, `var ${context} = ` );
|
||||
code.insertLeft( statement.end, `;\n${i0}${context}` );
|
||||
}
|
||||
} else {
|
||||
context = 'void 0';
|
||||
}
|
||||
|
||||
code.insertLeft( this.callee.end, '.apply' );
|
||||
|
||||
// we need to handle `super()` different, because `SuperClass.call.apply`
|
||||
// isn't very helpful
|
||||
const isSuper = this.callee.type === 'Super';
|
||||
|
||||
if ( isSuper ) {
|
||||
this.callee.noCall = true; // bit hacky...
|
||||
|
||||
if ( this.arguments.length > 1 ) {
|
||||
if ( firstArgument.type !== 'SpreadElement' ) {
|
||||
code.insertRight( firstArgument.start, `[ ` );
|
||||
}
|
||||
|
||||
code.insertLeft( this.arguments[ this.arguments.length - 1 ].end, ' )' );
|
||||
}
|
||||
}
|
||||
|
||||
else if ( this.arguments.length === 1 ) {
|
||||
code.insertRight( firstArgument.start, `${context}, ` );
|
||||
} else {
|
||||
if ( firstArgument.type === 'SpreadElement' ) {
|
||||
code.insertRight( firstArgument.start, `${context}, ` );
|
||||
} else {
|
||||
code.insertRight( firstArgument.start, `${context}, [ ` );
|
||||
}
|
||||
|
||||
code.insertLeft( this.arguments[ this.arguments.length - 1 ].end, ' )' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
164
node_modules/bubleify/node_modules/buble/src/program/types/ClassBody.js
generated
vendored
Normal file
164
node_modules/bubleify/node_modules/buble/src/program/types/ClassBody.js
generated
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
import Node from '../Node.js';
|
||||
import { findIndex } from '../../utils/array.js';
|
||||
import reserved from '../../utils/reserved.js';
|
||||
|
||||
// TODO this code is pretty wild, tidy it up
|
||||
export default class ClassBody extends Node {
|
||||
transpile ( code, transforms, inFunctionExpression, superName ) {
|
||||
if ( transforms.classes ) {
|
||||
const name = this.parent.name;
|
||||
|
||||
const indentStr = code.getIndentString();
|
||||
const i0 = this.getIndentation() + ( inFunctionExpression ? indentStr : '' );
|
||||
const i1 = i0 + indentStr;
|
||||
|
||||
const constructorIndex = findIndex( this.body, node => node.kind === 'constructor' );
|
||||
const constructor = this.body[ constructorIndex ];
|
||||
|
||||
let introBlock = '';
|
||||
let outroBlock = '';
|
||||
|
||||
if ( this.body.length ) {
|
||||
code.remove( this.start, this.body[0].start );
|
||||
code.remove( this.body[ this.body.length - 1 ].end, this.end );
|
||||
} else {
|
||||
code.remove( this.start, this.end );
|
||||
}
|
||||
|
||||
if ( constructor ) {
|
||||
constructor.value.body.isConstructorBody = true;
|
||||
|
||||
const previousMethod = this.body[ constructorIndex - 1 ];
|
||||
const nextMethod = this.body[ constructorIndex + 1 ];
|
||||
|
||||
// ensure constructor is first
|
||||
if ( constructorIndex > 0 ) {
|
||||
code.remove( previousMethod.end, constructor.start );
|
||||
code.move( constructor.start, nextMethod ? nextMethod.start : this.end - 1, this.body[0].start );
|
||||
}
|
||||
|
||||
if ( !inFunctionExpression ) code.insertLeft( constructor.end, ';' );
|
||||
}
|
||||
|
||||
if ( this.parent.superClass ) {
|
||||
let inheritanceBlock = `if ( ${superName} ) ${name}.__proto__ = ${superName};\n${i0}${name}.prototype = Object.create( ${superName} && ${superName}.prototype );\n${i0}${name}.prototype.constructor = ${name};`;
|
||||
|
||||
if ( constructor ) {
|
||||
introBlock += `\n\n${i0}` + inheritanceBlock;
|
||||
} else {
|
||||
const fn = `function ${name} () {` + ( superName ?
|
||||
`\n${i1}${superName}.apply(this, arguments);\n${i0}}` :
|
||||
`}` ) + ( inFunctionExpression ? '' : ';' ) + ( this.body.length ? `\n\n${i0}` : '' );
|
||||
|
||||
inheritanceBlock = fn + inheritanceBlock;
|
||||
introBlock += inheritanceBlock + `\n\n${i0}`;
|
||||
}
|
||||
} else if ( !constructor ) {
|
||||
let fn = `function ${name} () {}`;
|
||||
if ( this.parent.type === 'ClassDeclaration' ) fn += ';';
|
||||
if ( this.body.length ) fn += `\n\n${i0}`;
|
||||
|
||||
introBlock += fn;
|
||||
}
|
||||
|
||||
const scope = this.findScope( false );
|
||||
|
||||
let prototypeGettersAndSetters = [];
|
||||
let staticGettersAndSetters = [];
|
||||
let prototypeAccessors;
|
||||
let staticAccessors;
|
||||
|
||||
this.body.forEach( ( method, i ) => {
|
||||
if ( method.kind === 'constructor' ) {
|
||||
code.overwrite( method.key.start, method.key.end, `function ${name}` );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( method.static ) code.remove( method.start, method.start + 7 );
|
||||
|
||||
const isAccessor = method.kind !== 'method';
|
||||
let lhs;
|
||||
|
||||
let methodName = method.key.name;
|
||||
if ( scope.contains( methodName ) || reserved[ methodName ] ) methodName = scope.createIdentifier( methodName );
|
||||
|
||||
if ( isAccessor ) {
|
||||
if ( method.computed ) {
|
||||
throw new Error( 'Computed accessor properties are not currently supported' );
|
||||
}
|
||||
|
||||
code.remove( method.start, method.key.start );
|
||||
|
||||
if ( method.static ) {
|
||||
if ( !~staticGettersAndSetters.indexOf( method.key.name ) ) staticGettersAndSetters.push( method.key.name );
|
||||
if ( !staticAccessors ) staticAccessors = scope.createIdentifier( 'staticAccessors' );
|
||||
|
||||
lhs = `${staticAccessors}`;
|
||||
} else {
|
||||
if ( !~prototypeGettersAndSetters.indexOf( method.key.name ) ) prototypeGettersAndSetters.push( method.key.name );
|
||||
if ( !prototypeAccessors ) prototypeAccessors = scope.createIdentifier( 'prototypeAccessors' );
|
||||
|
||||
lhs = `${prototypeAccessors}`;
|
||||
}
|
||||
} else {
|
||||
lhs = method.static ?
|
||||
`${name}` :
|
||||
`${name}.prototype`;
|
||||
}
|
||||
|
||||
if ( !method.computed ) lhs += '.';
|
||||
|
||||
const insertNewlines = ( constructorIndex > 0 && i === constructorIndex + 1 ) ||
|
||||
( i === 0 && constructorIndex === this.body.length - 1 );
|
||||
|
||||
if ( insertNewlines ) lhs = `\n\n${i0}${lhs}`;
|
||||
|
||||
let c = method.key.end;
|
||||
if ( method.computed ) {
|
||||
while ( code.original[c] !== ']' ) c += 1;
|
||||
c += 1;
|
||||
}
|
||||
|
||||
code.insertRight( method.start, lhs );
|
||||
|
||||
const rhs = ( isAccessor ? `.${method.kind}` : '' ) + ` = function` + ( method.value.generator ? '* ' : ' ' ) + ( method.computed || isAccessor ? '' : `${methodName} ` );
|
||||
code.remove( c, method.value.start );
|
||||
code.insertRight( method.value.start, rhs );
|
||||
code.insertLeft( method.end, ';' );
|
||||
|
||||
if ( method.value.generator ) code.remove( method.start, method.key.start );
|
||||
});
|
||||
|
||||
if ( prototypeGettersAndSetters.length || staticGettersAndSetters.length ) {
|
||||
let intro = [];
|
||||
let outro = [];
|
||||
|
||||
if ( prototypeGettersAndSetters.length ) {
|
||||
intro.push( `var ${prototypeAccessors} = { ${prototypeGettersAndSetters.map( name => `${name}: {}` ).join( ',' )} };` );
|
||||
outro.push( `Object.defineProperties( ${name}.prototype, ${prototypeAccessors} );` );
|
||||
}
|
||||
|
||||
if ( staticGettersAndSetters.length ) {
|
||||
intro.push( `var ${staticAccessors} = { ${staticGettersAndSetters.map( name => `${name}: {}` ).join( ',' )} };` );
|
||||
outro.push( `Object.defineProperties( ${name}, ${staticAccessors} );` );
|
||||
}
|
||||
|
||||
if ( constructor ) introBlock += `\n\n${i0}`;
|
||||
introBlock += intro.join( `\n${i0}` );
|
||||
if ( !constructor ) introBlock += `\n\n${i0}`;
|
||||
|
||||
outroBlock += `\n\n${i0}` + outro.join( `\n${i0}` );
|
||||
}
|
||||
|
||||
if ( constructor ) {
|
||||
code.insertLeft( constructor.end, introBlock );
|
||||
} else {
|
||||
code.insertRight( this.start, introBlock );
|
||||
}
|
||||
|
||||
code.insertLeft( this.end, outroBlock );
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
62
node_modules/bubleify/node_modules/buble/src/program/types/ClassDeclaration.js
generated
vendored
Normal file
62
node_modules/bubleify/node_modules/buble/src/program/types/ClassDeclaration.js
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
import Node from '../Node.js';
|
||||
import deindent from '../../utils/deindent.js';
|
||||
|
||||
export default class ClassDeclaration extends Node {
|
||||
initialise ( transforms ) {
|
||||
this.name = this.id.name;
|
||||
this.findScope( true ).addDeclaration( this.id, 'class' );
|
||||
|
||||
super.initialise( transforms );
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( transforms.classes ) {
|
||||
if ( !this.superClass ) deindent( this.body, code );
|
||||
|
||||
const superName = this.superClass && ( this.superClass.name || 'superclass' );
|
||||
|
||||
const i0 = this.getIndentation();
|
||||
const i1 = i0 + code.getIndentString();
|
||||
|
||||
// if this is an export default statement, we have to move the export to
|
||||
// after the declaration, because `export default var Foo = ...` is illegal
|
||||
const syntheticDefaultExport = this.parent.type === 'ExportDefaultDeclaration' ?
|
||||
`\n\n${i0}export default ${this.id.name};` :
|
||||
'';
|
||||
|
||||
if ( syntheticDefaultExport ) code.remove( this.parent.start, this.start );
|
||||
|
||||
code.overwrite( this.start, this.id.start, 'var ' );
|
||||
|
||||
if ( this.superClass ) {
|
||||
if ( this.superClass.end === this.body.start ) {
|
||||
code.remove( this.id.end, this.superClass.start );
|
||||
code.insertLeft( this.id.end, ` = (function (${superName}) {\n${i1}` );
|
||||
} else {
|
||||
code.overwrite( this.id.end, this.superClass.start, ' = ' );
|
||||
code.overwrite( this.superClass.end, this.body.start, `(function (${superName}) {\n${i1}` );
|
||||
}
|
||||
} else {
|
||||
if ( this.id.end === this.body.start ) {
|
||||
code.insertLeft( this.id.end, ' = ' );
|
||||
} else {
|
||||
code.overwrite( this.id.end, this.body.start, ' = ' );
|
||||
}
|
||||
}
|
||||
|
||||
this.body.transpile( code, transforms, !!this.superClass, superName );
|
||||
|
||||
if ( this.superClass ) {
|
||||
code.insertLeft( this.end, `\n\n${i1}return ${this.name};\n${i0}}(` );
|
||||
code.move( this.superClass.start, this.superClass.end, this.end );
|
||||
code.insertRight( this.end, `));${syntheticDefaultExport}` );
|
||||
} else if ( syntheticDefaultExport ) {
|
||||
code.insertRight( this.end, syntheticDefaultExport );
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
this.body.transpile( code, transforms, false, null );
|
||||
}
|
||||
}
|
||||
}
|
45
node_modules/bubleify/node_modules/buble/src/program/types/ClassExpression.js
generated
vendored
Normal file
45
node_modules/bubleify/node_modules/buble/src/program/types/ClassExpression.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
export default class ClassExpression extends Node {
|
||||
initialise ( transforms ) {
|
||||
this.name = this.id ? this.id.name :
|
||||
this.parent.type === 'VariableDeclarator' ? this.parent.id.name :
|
||||
this.parent.type === 'AssignmentExpression' ? this.parent.left.name :
|
||||
this.findScope( true ).createIdentifier( 'anonymous' );
|
||||
|
||||
super.initialise( transforms );
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( transforms.classes ) {
|
||||
const superName = this.superClass && ( this.superClass.name || 'superclass' );
|
||||
|
||||
const i0 = this.getIndentation();
|
||||
const i1 = i0 + code.getIndentString();
|
||||
|
||||
if ( this.superClass ) {
|
||||
code.remove( this.start, this.superClass.start );
|
||||
code.remove( this.superClass.end, this.body.start );
|
||||
code.insertLeft( this.start, `(function (${superName}) {\n${i1}` );
|
||||
} else {
|
||||
code.overwrite( this.start, this.body.start, `(function () {\n${i1}` );
|
||||
}
|
||||
|
||||
this.body.transpile( code, transforms, true, superName );
|
||||
|
||||
const outro = `\n\n${i1}return ${this.name};\n${i0}}(`;
|
||||
|
||||
if ( this.superClass ) {
|
||||
code.insertLeft( this.end, outro );
|
||||
code.move( this.superClass.start, this.superClass.end, this.end );
|
||||
code.insertRight( this.end, '))' );
|
||||
} else {
|
||||
code.insertLeft( this.end, `\n\n${i1}return ${this.name};\n${i0}}())` );
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
this.body.transpile( code, transforms, false );
|
||||
}
|
||||
}
|
||||
}
|
12
node_modules/bubleify/node_modules/buble/src/program/types/ContinueStatement.js
generated
vendored
Normal file
12
node_modules/bubleify/node_modules/buble/src/program/types/ContinueStatement.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import Node from '../Node.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
|
||||
export default class ContinueStatement extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
const loop = this.findNearest( /(?:For(?:In|Of)?|While)Statement/ );
|
||||
if ( loop.shouldRewriteAsFunction ) {
|
||||
if ( this.label ) throw new CompileError( this, 'Labels are not currently supported in a loop with locally-scoped variables' );
|
||||
code.overwrite( this.start, this.start + 8, 'return' );
|
||||
}
|
||||
}
|
||||
}
|
9
node_modules/bubleify/node_modules/buble/src/program/types/ExportDefaultDeclaration.js
generated
vendored
Normal file
9
node_modules/bubleify/node_modules/buble/src/program/types/ExportDefaultDeclaration.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import Node from '../Node.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
|
||||
export default class ExportDefaultDeclaration extends Node {
|
||||
initialise ( transforms ) {
|
||||
if ( transforms.moduleExport ) throw new CompileError( this, 'export is not supported' );
|
||||
super.initialise( transforms );
|
||||
}
|
||||
}
|
9
node_modules/bubleify/node_modules/buble/src/program/types/ExportNamedDeclaration.js
generated
vendored
Normal file
9
node_modules/bubleify/node_modules/buble/src/program/types/ExportNamedDeclaration.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import Node from '../Node.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
|
||||
export default class ExportNamedDeclaration extends Node {
|
||||
initialise ( transforms ) {
|
||||
if ( transforms.moduleExport ) throw new CompileError( this, 'export is not supported' );
|
||||
super.initialise( transforms );
|
||||
}
|
||||
}
|
22
node_modules/bubleify/node_modules/buble/src/program/types/ForInStatement.js
generated
vendored
Normal file
22
node_modules/bubleify/node_modules/buble/src/program/types/ForInStatement.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
import LoopStatement from './shared/LoopStatement.js';
|
||||
import extractNames from '../extractNames.js';
|
||||
|
||||
export default class ForInStatement extends LoopStatement {
|
||||
findScope ( functionScope ) {
|
||||
return functionScope || !this.createdScope ? this.parent.findScope( functionScope ) : this.body.scope;
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( this.shouldRewriteAsFunction ) {
|
||||
// which variables are declared in the init statement?
|
||||
const names = this.left.type === 'VariableDeclaration' ?
|
||||
[].concat.apply( [], this.left.declarations.map( declarator => extractNames( declarator.id ) ) ) :
|
||||
[];
|
||||
|
||||
this.args = names.map( name => name in this.aliases ? this.aliases[ name ].outer : name );
|
||||
this.params = names.map( name => name in this.aliases ? this.aliases[ name ].inner : name );
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
52
node_modules/bubleify/node_modules/buble/src/program/types/ForOfStatement.js
generated
vendored
Normal file
52
node_modules/bubleify/node_modules/buble/src/program/types/ForOfStatement.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
import LoopStatement from './shared/LoopStatement.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
|
||||
export default class ForOfStatement extends LoopStatement {
|
||||
initialise ( transforms ) {
|
||||
if ( transforms.forOf && !transforms.dangerousForOf ) throw new CompileError( this, 'for...of statements are not supported. Use `transforms: { forOf: false }` to skip transformation and disable this error, or `transforms: { dangerousForOf: true }` if you know what you\'re doing' );
|
||||
super.initialise( transforms );
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( !transforms.dangerousForOf ) {
|
||||
super.transpile( code, transforms );
|
||||
return;
|
||||
}
|
||||
|
||||
// edge case (#80)
|
||||
if ( !this.body.body[0] ) {
|
||||
if ( this.left.type === 'VariableDeclaration' && this.left.kind === 'var' ) {
|
||||
code.remove( this.start, this.left.start );
|
||||
code.insertLeft( this.left.end, ';' );
|
||||
code.remove( this.left.end, this.end );
|
||||
} else {
|
||||
code.remove( this.start, this.end );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const scope = this.findScope( true );
|
||||
const i0 = this.getIndentation();
|
||||
const i1 = i0 + code.getIndentString();
|
||||
|
||||
const key = scope.createIdentifier( 'i' );
|
||||
const list = scope.createIdentifier( 'list' );
|
||||
|
||||
if ( this.body.synthetic ) {
|
||||
code.insertRight( this.left.start, `{\n${i1}` );
|
||||
code.insertLeft( this.body.body[0].end, `\n${i0}}` );
|
||||
}
|
||||
|
||||
const bodyStart = this.body.body[0].start;
|
||||
|
||||
code.remove( this.left.end, this.right.start );
|
||||
code.move( this.left.start, this.left.end, bodyStart );
|
||||
code.insertLeft( this.left.end, ` = ${list}[${key}];\n\n${i1}` );
|
||||
|
||||
code.insertRight( this.right.start, `var ${key} = 0, ${list} = ` );
|
||||
code.insertLeft( this.right.end, `; ${key} < ${list}.length; ${key} += 1` );
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
38
node_modules/bubleify/node_modules/buble/src/program/types/ForStatement.js
generated
vendored
Normal file
38
node_modules/bubleify/node_modules/buble/src/program/types/ForStatement.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
import LoopStatement from './shared/LoopStatement.js';
|
||||
import extractNames from '../extractNames.js';
|
||||
|
||||
export default class ForStatement extends LoopStatement {
|
||||
findScope ( functionScope ) {
|
||||
return functionScope || !this.createdScope ? this.parent.findScope( functionScope ) : this.body.scope;
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
const i1 = this.getIndentation() + code.getIndentString();
|
||||
|
||||
if ( this.shouldRewriteAsFunction ) {
|
||||
// which variables are declared in the init statement?
|
||||
const names = this.init.type === 'VariableDeclaration' ?
|
||||
[].concat.apply( [], this.init.declarations.map( declarator => extractNames( declarator.id ) ) ) :
|
||||
[];
|
||||
|
||||
const aliases = this.aliases;
|
||||
|
||||
this.args = names.map( name => name in this.aliases ? this.aliases[ name ].outer : name );
|
||||
this.params = names.map( name => name in this.aliases ? this.aliases[ name ].inner : name );
|
||||
|
||||
const updates = Object.keys( this.reassigned )
|
||||
.map( name => `${aliases[ name ].outer} = ${aliases[ name ].inner};` );
|
||||
|
||||
if ( updates.length ) {
|
||||
if ( this.body.synthetic ) {
|
||||
code.insertLeft( this.body.body[0].end, `; ${updates.join(` `)}` );
|
||||
} else {
|
||||
const lastStatement = this.body.body[ this.body.body.length - 1 ];
|
||||
code.insertLeft( lastStatement.end, `\n\n${i1}${updates.join(`\n${i1}`)}` );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
15
node_modules/bubleify/node_modules/buble/src/program/types/FunctionDeclaration.js
generated
vendored
Normal file
15
node_modules/bubleify/node_modules/buble/src/program/types/FunctionDeclaration.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import Node from '../Node.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
|
||||
export default class FunctionDeclaration extends Node {
|
||||
initialise ( transforms ) {
|
||||
if ( this.generator && transforms.generator ) {
|
||||
throw new CompileError( this, 'Generators are not supported' );
|
||||
}
|
||||
|
||||
this.body.createScope();
|
||||
|
||||
this.findScope( true ).addDeclaration( this.id, 'function' );
|
||||
super.initialise( transforms );
|
||||
}
|
||||
}
|
19
node_modules/bubleify/node_modules/buble/src/program/types/FunctionExpression.js
generated
vendored
Normal file
19
node_modules/bubleify/node_modules/buble/src/program/types/FunctionExpression.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
import Node from '../Node.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
|
||||
export default class FunctionExpression extends Node {
|
||||
initialise ( transforms ) {
|
||||
if ( this.generator && transforms.generator ) {
|
||||
throw new CompileError( this, 'Generators are not supported' );
|
||||
}
|
||||
|
||||
this.body.createScope();
|
||||
|
||||
if ( this.id ) {
|
||||
// function expression IDs belong to the child scope...
|
||||
this.body.scope.addDeclaration( this.id, 'function' );
|
||||
}
|
||||
|
||||
super.initialise( transforms );
|
||||
}
|
||||
}
|
42
node_modules/bubleify/node_modules/buble/src/program/types/Identifier.js
generated
vendored
Normal file
42
node_modules/bubleify/node_modules/buble/src/program/types/Identifier.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
import Node from '../Node.js';
|
||||
import isReference from '../../utils/isReference.js';
|
||||
|
||||
export default class Identifier extends Node {
|
||||
findScope ( functionScope ) {
|
||||
if ( this.parent.params && ~this.parent.params.indexOf( this ) ) {
|
||||
return this.parent.body.scope;
|
||||
}
|
||||
|
||||
if ( this.parent.type === 'FunctionExpression' && this === this.parent.id ) {
|
||||
return this.parent.body.scope;
|
||||
}
|
||||
|
||||
return this.parent.findScope( functionScope );
|
||||
}
|
||||
|
||||
initialise ( transforms ) {
|
||||
if ( transforms.arrow && isReference( this, this.parent ) ) {
|
||||
if ( this.name === 'arguments' && !this.findScope( false ).contains( this.name ) ) {
|
||||
const lexicalBoundary = this.findLexicalBoundary();
|
||||
const arrowFunction = this.findNearest( 'ArrowFunctionExpression' );
|
||||
const loop = this.findNearest( /(?:For(?:In|Of)?|While)Statement/ );
|
||||
|
||||
if ( arrowFunction && arrowFunction.depth > lexicalBoundary.depth ) {
|
||||
this.alias = lexicalBoundary.getArgumentsAlias();
|
||||
}
|
||||
|
||||
if ( loop && loop.body.contains( this ) && loop.depth > lexicalBoundary.depth ) {
|
||||
this.alias = lexicalBoundary.getArgumentsAlias();
|
||||
}
|
||||
}
|
||||
|
||||
this.findScope( false ).addReference( this );
|
||||
}
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( this.alias ) {
|
||||
code.overwrite( this.start, this.end, this.alias, true );
|
||||
}
|
||||
}
|
||||
}
|
9
node_modules/bubleify/node_modules/buble/src/program/types/ImportDeclaration.js
generated
vendored
Normal file
9
node_modules/bubleify/node_modules/buble/src/program/types/ImportDeclaration.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import Node from '../Node.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
|
||||
export default class ImportDeclaration extends Node {
|
||||
initialise ( transforms ) {
|
||||
if ( transforms.moduleImport ) throw new CompileError( this, 'import is not supported' );
|
||||
super.initialise( transforms );
|
||||
}
|
||||
}
|
8
node_modules/bubleify/node_modules/buble/src/program/types/ImportDefaultSpecifier.js
generated
vendored
Normal file
8
node_modules/bubleify/node_modules/buble/src/program/types/ImportDefaultSpecifier.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
export default class ImportDefaultSpecifier extends Node {
|
||||
initialise ( transforms ) {
|
||||
this.findScope( true ).addDeclaration( this.local, 'import' );
|
||||
super.initialise( transforms );
|
||||
}
|
||||
}
|
8
node_modules/bubleify/node_modules/buble/src/program/types/ImportSpecifier.js
generated
vendored
Normal file
8
node_modules/bubleify/node_modules/buble/src/program/types/ImportSpecifier.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
export default class ImportSpecifier extends Node {
|
||||
initialise ( transforms ) {
|
||||
this.findScope( true ).addDeclaration( this.local, 'import' );
|
||||
super.initialise( transforms );
|
||||
}
|
||||
}
|
20
node_modules/bubleify/node_modules/buble/src/program/types/JSXAttribute.js
generated
vendored
Normal file
20
node_modules/bubleify/node_modules/buble/src/program/types/JSXAttribute.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
const IS_DATA_ATTRIBUTE = /-/;
|
||||
|
||||
export default class JSXAttribute extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
if ( this.value ) {
|
||||
code.overwrite( this.name.end, this.value.start, ': ' );
|
||||
} else {
|
||||
// tag without value
|
||||
code.overwrite( this.name.start, this.name.end, `${this.name.name}: true`)
|
||||
}
|
||||
|
||||
if ( IS_DATA_ATTRIBUTE.test( this.name.name ) ) {
|
||||
code.overwrite( this.name.start, this.name.end, `'${this.name.name}'` );
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
22
node_modules/bubleify/node_modules/buble/src/program/types/JSXClosingElement.js
generated
vendored
Normal file
22
node_modules/bubleify/node_modules/buble/src/program/types/JSXClosingElement.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
function containsNewLine ( node ) {
|
||||
return node.type === 'Literal' && !/\S/.test( node.value ) && /\n/.test( node.value );
|
||||
}
|
||||
|
||||
export default class JSXClosingElement extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
let spaceBeforeParen = true;
|
||||
|
||||
const lastChild = this.parent.children[ this.parent.children.length - 1 ];
|
||||
|
||||
// omit space before closing paren if
|
||||
// a) this is on a separate line, or
|
||||
// b) there are no children but there are attributes
|
||||
if ( ( lastChild && containsNewLine( lastChild ) ) || ( this.parent.openingElement.attributes.length ) ) {
|
||||
spaceBeforeParen = false;
|
||||
}
|
||||
|
||||
code.overwrite( this.start, this.end, spaceBeforeParen ? ' )' : ')' );
|
||||
}
|
||||
}
|
46
node_modules/bubleify/node_modules/buble/src/program/types/JSXElement.js
generated
vendored
Normal file
46
node_modules/bubleify/node_modules/buble/src/program/types/JSXElement.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
function normalise ( str, removeTrailingWhitespace ) {
|
||||
if ( removeTrailingWhitespace && /\n/.test( str ) ) {
|
||||
str = str.replace( /\s+$/, '' );
|
||||
}
|
||||
|
||||
str = str
|
||||
.replace( /^\n\r?\s+/, '' ) // remove leading newline + space
|
||||
.replace( /\s*\n\r?\s*/gm, ' ' ); // replace newlines with spaces
|
||||
|
||||
// TODO prefer single quotes?
|
||||
return JSON.stringify( str );
|
||||
}
|
||||
|
||||
export default class JSXElement extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
super.transpile( code, transforms );
|
||||
|
||||
const children = this.children.filter( child => {
|
||||
if ( child.type !== 'Literal' ) return true;
|
||||
|
||||
// remove whitespace-only literals, unless on a single line
|
||||
return /\S/.test( child.value ) || !/\n/.test( child.value );
|
||||
});
|
||||
|
||||
if ( children.length ) {
|
||||
let c = this.openingElement.end;
|
||||
|
||||
let i;
|
||||
for ( i = 0; i < children.length; i += 1 ) {
|
||||
const child = children[i];
|
||||
|
||||
const tail = code.original[ c ] === '\n' && child.type !== 'Literal' ? '' : ' ';
|
||||
code.insertLeft( c, `,${tail}` );
|
||||
|
||||
if ( child.type === 'Literal' ) {
|
||||
const str = normalise( child.value, i === children.length - 1 );
|
||||
code.overwrite( child.start, child.end, str );
|
||||
}
|
||||
|
||||
c = child.end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
10
node_modules/bubleify/node_modules/buble/src/program/types/JSXExpressionContainer.js
generated
vendored
Normal file
10
node_modules/bubleify/node_modules/buble/src/program/types/JSXExpressionContainer.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
export default class JSXExpressionContainer extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
code.remove( this.start, this.expression.start );
|
||||
code.remove( this.expression.end, this.end );
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
81
node_modules/bubleify/node_modules/buble/src/program/types/JSXOpeningElement.js
generated
vendored
Normal file
81
node_modules/bubleify/node_modules/buble/src/program/types/JSXOpeningElement.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
export default class JSXOpeningElement extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
code.overwrite( this.start, this.name.start, `${this.program.jsx}( ` );
|
||||
|
||||
const html = this.name.type === 'JSXIdentifier' && this.name.name[0] === this.name.name[0].toLowerCase();
|
||||
if ( html ) code.insertRight( this.name.start, `'` );
|
||||
|
||||
const len = this.attributes.length;
|
||||
let c = this.name.end;
|
||||
|
||||
if ( len ) {
|
||||
let i;
|
||||
|
||||
let hasSpread = false;
|
||||
for ( i = 0; i < len; i += 1 ) {
|
||||
if ( this.attributes[i].type === 'JSXSpreadAttribute' ) {
|
||||
hasSpread = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
c = this.attributes[0].end;
|
||||
|
||||
for ( i = 0; i < len; i += 1 ) {
|
||||
const attr = this.attributes[i];
|
||||
|
||||
if ( i > 0 ) {
|
||||
code.overwrite( c, attr.start, ', ' );
|
||||
}
|
||||
|
||||
if ( hasSpread && attr.type !== 'JSXSpreadAttribute' ) {
|
||||
const lastAttr = this.attributes[ i - 1 ];
|
||||
const nextAttr = this.attributes[ i + 1 ];
|
||||
|
||||
if ( !lastAttr || lastAttr.type === 'JSXSpreadAttribute' ) {
|
||||
code.insertRight( attr.start, '{ ' );
|
||||
}
|
||||
|
||||
if ( !nextAttr || nextAttr.type === 'JSXSpreadAttribute' ) {
|
||||
code.insertLeft( attr.end, ' }' );
|
||||
}
|
||||
}
|
||||
|
||||
c = attr.end;
|
||||
}
|
||||
|
||||
let after;
|
||||
let before;
|
||||
if ( hasSpread ) {
|
||||
if ( len === 1 ) {
|
||||
before = html ? `',` : ',';
|
||||
} else {
|
||||
before = html ? `', ${this.program.objectAssign}({},` : `, ${this.program.objectAssign}({},`;
|
||||
after = ')';
|
||||
}
|
||||
} else {
|
||||
before = html ? `', {` : ', {';
|
||||
after = ' }';
|
||||
}
|
||||
|
||||
code.insertRight( this.name.end, before );
|
||||
|
||||
if ( after ) {
|
||||
code.insertLeft( this.attributes[ len - 1 ].end, after );
|
||||
}
|
||||
} else {
|
||||
code.insertLeft( this.name.end, html ? `', null` : `, null` );
|
||||
c = this.name.end;
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
|
||||
if ( this.selfClosing ) {
|
||||
code.overwrite( c, this.end, this.attributes.length ? `)` : ` )` );
|
||||
} else {
|
||||
code.remove( c, this.end );
|
||||
}
|
||||
}
|
||||
}
|
10
node_modules/bubleify/node_modules/buble/src/program/types/JSXSpreadAttribute.js
generated
vendored
Normal file
10
node_modules/bubleify/node_modules/buble/src/program/types/JSXSpreadAttribute.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
export default class JSXSpreadAttribute extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
code.remove( this.start, this.argument.start );
|
||||
code.remove( this.argument.end, this.end );
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
23
node_modules/bubleify/node_modules/buble/src/program/types/Literal.js
generated
vendored
Normal file
23
node_modules/bubleify/node_modules/buble/src/program/types/Literal.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
import Node from '../Node.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
import rewritePattern from 'regexpu-core';
|
||||
|
||||
export default class Literal extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
if ( transforms.numericLiteral ) {
|
||||
const leading = this.raw.slice( 0, 2 );
|
||||
if ( leading === '0b' || leading === '0o' ) {
|
||||
code.overwrite( this.start, this.end, String( this.value ), true );
|
||||
}
|
||||
}
|
||||
|
||||
if ( this.regex ) {
|
||||
const { pattern, flags } = this.regex;
|
||||
|
||||
if ( transforms.stickyRegExp && /y/.test( flags ) ) throw new CompileError( this, 'Regular expression sticky flag is not supported' );
|
||||
if ( transforms.unicodeRegExp && /u/.test( flags ) ) {
|
||||
code.overwrite( this.start, this.end, `/${rewritePattern( pattern, flags )}/${flags.replace( 'u', '' )}` );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
13
node_modules/bubleify/node_modules/buble/src/program/types/MemberExpression.js
generated
vendored
Normal file
13
node_modules/bubleify/node_modules/buble/src/program/types/MemberExpression.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import Node from '../Node.js';
|
||||
import reserved from '../../utils/reserved.js';
|
||||
|
||||
export default class MemberExpression extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
if ( transforms.reservedProperties && reserved[ this.property.name ] ) {
|
||||
code.overwrite( this.object.end, this.property.start, `['` );
|
||||
code.insertLeft( this.property.end, `']` );
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
121
node_modules/bubleify/node_modules/buble/src/program/types/ObjectExpression.js
generated
vendored
Normal file
121
node_modules/bubleify/node_modules/buble/src/program/types/ObjectExpression.js
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
import Node from '../Node.js';
|
||||
import deindent from '../../utils/deindent.js';
|
||||
|
||||
export default class ObjectExpression extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
super.transpile( code, transforms );
|
||||
|
||||
let spreadPropertyCount = 0;
|
||||
let computedPropertyCount = 0;
|
||||
|
||||
for ( let prop of this.properties ) {
|
||||
if ( prop.type === 'SpreadProperty' ) spreadPropertyCount += 1;
|
||||
if ( prop.computed ) computedPropertyCount += 1;
|
||||
}
|
||||
|
||||
if ( spreadPropertyCount ) {
|
||||
// enclose run of non-spread properties in curlies
|
||||
let i = this.properties.length;
|
||||
while ( i-- ) {
|
||||
const prop = this.properties[i];
|
||||
|
||||
if ( prop.type === 'Property' ) {
|
||||
const lastProp = this.properties[ i - 1 ];
|
||||
const nextProp = this.properties[ i + 1 ];
|
||||
|
||||
if ( !lastProp || lastProp.type !== 'Property' ) {
|
||||
code.insertRight( prop.start, '{' );
|
||||
}
|
||||
|
||||
if ( !nextProp || nextProp.type !== 'Property' ) {
|
||||
code.insertLeft( prop.end, '}' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// wrap the whole thing in Object.assign
|
||||
code.overwrite( this.start, this.properties[0].start, `${this.program.objectAssign}({}, `);
|
||||
code.overwrite( this.properties[ this.properties.length - 1 ].end, this.end, ')' );
|
||||
}
|
||||
|
||||
if ( computedPropertyCount && transforms.computedProperty ) {
|
||||
const i0 = this.getIndentation();
|
||||
|
||||
let isSimpleAssignment;
|
||||
let name;
|
||||
|
||||
let start;
|
||||
let end;
|
||||
|
||||
if ( this.parent.type === 'VariableDeclarator' && this.parent.parent.declarations.length === 1 ) {
|
||||
isSimpleAssignment = true;
|
||||
name = this.parent.id.alias || this.parent.id.name; // TODO is this right?
|
||||
} else if ( this.parent.type === 'AssignmentExpression' && this.parent.parent.type === 'ExpressionStatement' && this.parent.left.type === 'Identifier' ) {
|
||||
isSimpleAssignment = true;
|
||||
name = this.parent.left.alias || this.parent.left.name; // TODO is this right?
|
||||
}
|
||||
|
||||
// handle block scoping
|
||||
const declaration = this.findScope( false ).findDeclaration( name );
|
||||
if ( declaration ) name = declaration.name;
|
||||
|
||||
start = this.start + 1;
|
||||
end = this.end;
|
||||
|
||||
if ( isSimpleAssignment ) {
|
||||
// ???
|
||||
} else {
|
||||
name = this.findScope( true ).createIdentifier( 'obj' );
|
||||
|
||||
const statement = this.findNearest( /(?:Statement|Declaration)$/ );
|
||||
code.insertRight( statement.start, `var ${name};\n${i0}` );
|
||||
|
||||
code.insertRight( this.start, `( ${name} = ` );
|
||||
}
|
||||
|
||||
const len = this.properties.length;
|
||||
let lastComputedProp;
|
||||
|
||||
for ( let i = 0; i < len; i += 1 ) {
|
||||
const prop = this.properties[i];
|
||||
|
||||
if ( prop.computed ) {
|
||||
lastComputedProp = prop;
|
||||
let moveStart = i > 0 ? this.properties[ i - 1 ].end : start;
|
||||
|
||||
code.overwrite( moveStart, prop.start, isSimpleAssignment ? `;\n${i0}${name}` : `, ${name}` );
|
||||
let c = prop.key.end;
|
||||
while ( code.original[c] !== ']' ) c += 1;
|
||||
c += 1;
|
||||
|
||||
if ( prop.value.start > c ) code.remove( c, prop.value.start );
|
||||
code.insertLeft( c, ' = ' );
|
||||
code.move( moveStart, prop.end, end );
|
||||
|
||||
if ( i === 0 && len > 1 ) {
|
||||
// remove trailing comma
|
||||
c = prop.end;
|
||||
while ( code.original[c] !== ',' ) c += 1;
|
||||
|
||||
code.remove( prop.end, c + 1 );
|
||||
}
|
||||
|
||||
if ( prop.method && transforms.conciseMethodProperty ) {
|
||||
code.insertRight( prop.value.start, 'function ' );
|
||||
}
|
||||
|
||||
deindent( prop.value, code );
|
||||
}
|
||||
}
|
||||
|
||||
// special case
|
||||
if ( computedPropertyCount === len ) {
|
||||
code.remove( this.properties[ len - 1 ].end, this.end - 1 );
|
||||
}
|
||||
|
||||
if ( !isSimpleAssignment ) {
|
||||
code.insertLeft( lastComputedProp.end, `, ${name} )` );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
23
node_modules/bubleify/node_modules/buble/src/program/types/Property.js
generated
vendored
Normal file
23
node_modules/bubleify/node_modules/buble/src/program/types/Property.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
import Node from '../Node.js';
|
||||
import reserved from '../../utils/reserved.js';
|
||||
|
||||
export default class Property extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
if ( transforms.conciseMethodProperty && !this.computed && this.parent.type !== 'ObjectPattern' ) {
|
||||
if ( this.shorthand ) {
|
||||
code.insertRight( this.start, `${this.key.name}: ` );
|
||||
} else if ( this.method ) {
|
||||
const name = this.findScope( true ).createIdentifier( this.key.type === 'Identifier' ? this.key.name : this.key.value );
|
||||
if ( this.value.generator ) code.remove( this.start, this.key.start );
|
||||
code.insertLeft( this.key.end, `: function${this.value.generator ? '*' : ''} ${name}` );
|
||||
}
|
||||
}
|
||||
|
||||
if ( transforms.reservedProperties && reserved[ this.key.name ] ) {
|
||||
code.insertRight( this.key.start, `'` );
|
||||
code.insertLeft( this.key.end, `'` );
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
27
node_modules/bubleify/node_modules/buble/src/program/types/ReturnStatement.js
generated
vendored
Normal file
27
node_modules/bubleify/node_modules/buble/src/program/types/ReturnStatement.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
export default class ReturnStatement extends Node {
|
||||
initialise ( transforms ) {
|
||||
this.loop = this.findNearest( /(?:For(?:In)?|While)Statement/ );
|
||||
this.nearestFunction = this.findNearest( /Function/ );
|
||||
|
||||
if ( this.loop && ( !this.nearestFunction || this.loop.depth > this.nearestFunction.depth ) ) {
|
||||
this.loop.canReturn = true;
|
||||
this.shouldWrap = true;
|
||||
}
|
||||
|
||||
if ( this.argument ) this.argument.initialise( transforms );
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( this.argument ) {
|
||||
const shouldWrap = this.shouldWrap && this.loop && this.loop.shouldRewriteAsFunction;
|
||||
|
||||
if ( shouldWrap ) code.insertRight( this.argument.start, `{ v: ` );
|
||||
|
||||
if ( this.argument ) this.argument.transpile( code, transforms );
|
||||
|
||||
if ( shouldWrap ) code.insertLeft( this.argument.end, ` }` );
|
||||
}
|
||||
}
|
||||
}
|
11
node_modules/bubleify/node_modules/buble/src/program/types/SpreadProperty.js
generated
vendored
Normal file
11
node_modules/bubleify/node_modules/buble/src/program/types/SpreadProperty.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
import Node from '../Node.js';
|
||||
import reserved from '../../utils/reserved.js';
|
||||
|
||||
export default class SpreadProperty extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
code.remove( this.start, this.argument.start );
|
||||
code.remove( this.argument.end, this.end );
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
68
node_modules/bubleify/node_modules/buble/src/program/types/Super.js
generated
vendored
Normal file
68
node_modules/bubleify/node_modules/buble/src/program/types/Super.js
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
import Node from '../Node.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
|
||||
export default class Super extends Node {
|
||||
initialise ( transforms ) {
|
||||
if ( transforms.classes ) {
|
||||
this.method = this.findNearest( 'MethodDefinition' );
|
||||
if ( !this.method ) throw new CompileError( this, 'use of super outside class method' );
|
||||
|
||||
const parentClass = this.findNearest( 'ClassBody' ).parent;
|
||||
this.superClassName = parentClass.superClass && (parentClass.superClass.name || 'superclass');
|
||||
|
||||
if ( !this.superClassName ) throw new CompileError( this, 'super used in base class' );
|
||||
|
||||
this.isCalled = this.parent.type === 'CallExpression' && this === this.parent.callee;
|
||||
|
||||
if ( this.method.kind !== 'constructor' && this.isCalled ) {
|
||||
throw new CompileError( this, 'super() not allowed outside class constructor' );
|
||||
}
|
||||
|
||||
this.isMember = this.parent.type === 'MemberExpression';
|
||||
|
||||
if ( !this.isCalled && !this.isMember ) {
|
||||
throw new CompileError( this, 'Unexpected use of `super` (expected `super(...)` or `super.*`)' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( transforms.arrow ) {
|
||||
const lexicalBoundary = this.findLexicalBoundary();
|
||||
const arrowFunction = this.findNearest( 'ArrowFunctionExpression' );
|
||||
const loop = this.findNearest( /(?:For(?:In|Of)?|While)Statement/ );
|
||||
|
||||
if ( arrowFunction && arrowFunction.depth > lexicalBoundary.depth ) {
|
||||
this.thisAlias = lexicalBoundary.getThisAlias();
|
||||
}
|
||||
|
||||
if ( loop && loop.body.contains( this ) && loop.depth > lexicalBoundary.depth ) {
|
||||
this.thisAlias = lexicalBoundary.getThisAlias();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( transforms.classes ) {
|
||||
const expression = ( this.isCalled || this.method.static ) ?
|
||||
this.superClassName :
|
||||
`${this.superClassName}.prototype`;
|
||||
|
||||
code.overwrite( this.start, this.end, expression, true );
|
||||
|
||||
const callExpression = this.isCalled ? this.parent : this.parent.parent;
|
||||
|
||||
if ( callExpression && callExpression.type === 'CallExpression' ) {
|
||||
if ( !this.noCall ) { // special case – `super( ...args )`
|
||||
code.insertLeft( callExpression.callee.end, '.call' );
|
||||
}
|
||||
|
||||
const thisAlias = this.thisAlias || 'this';
|
||||
|
||||
if ( callExpression.arguments.length ) {
|
||||
code.insertLeft( callExpression.arguments[0].start, `${thisAlias}, ` );
|
||||
} else {
|
||||
code.insertLeft( callExpression.end - 1, `${thisAlias}` );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
node_modules/bubleify/node_modules/buble/src/program/types/TaggedTemplateExpression.js
generated
vendored
Normal file
37
node_modules/bubleify/node_modules/buble/src/program/types/TaggedTemplateExpression.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
import Node from '../Node.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
|
||||
export default class TaggedTemplateExpression extends Node {
|
||||
initialise ( transforms ) {
|
||||
if ( transforms.templateString && !transforms.dangerousTaggedTemplateString ) {
|
||||
throw new CompileError( this, 'Tagged template strings are not supported. Use `transforms: { templateString: false }` to skip transformation and disable this error, or `transforms: { dangerousTaggedTemplateString: true }` if you know what you\'re doing' );
|
||||
}
|
||||
|
||||
super.initialise( transforms );
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( transforms.templateString && transforms.dangerousTaggedTemplateString ) {
|
||||
const ordered = this.quasi.expressions.concat( this.quasi.quasis ).sort( ( a, b ) => a.start - b.start );
|
||||
|
||||
// insert strings at start
|
||||
const templateStrings = this.quasi.quasis.map( quasi => JSON.stringify( quasi.value.cooked ) );
|
||||
code.overwrite( this.tag.end, ordered[0].start, `([${templateStrings.join(', ')}]` );
|
||||
|
||||
let lastIndex = ordered[0].start;
|
||||
ordered.forEach( node => {
|
||||
if ( node.type === 'TemplateElement' ) {
|
||||
code.remove( lastIndex, node.end );
|
||||
} else {
|
||||
code.overwrite( lastIndex, node.start, ', ' );
|
||||
}
|
||||
|
||||
lastIndex = node.end;
|
||||
});
|
||||
|
||||
code.overwrite( lastIndex, this.end, ')' );
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
7
node_modules/bubleify/node_modules/buble/src/program/types/TemplateElement.js
generated
vendored
Normal file
7
node_modules/bubleify/node_modules/buble/src/program/types/TemplateElement.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
export default class TemplateElement extends Node {
|
||||
initialise ( transforms ) {
|
||||
this.program.templateElements.push( this );
|
||||
}
|
||||
}
|
69
node_modules/bubleify/node_modules/buble/src/program/types/TemplateLiteral.js
generated
vendored
Normal file
69
node_modules/bubleify/node_modules/buble/src/program/types/TemplateLiteral.js
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
export default class TemplateLiteral extends Node {
|
||||
transpile ( code, transforms ) {
|
||||
if ( transforms.templateString && this.parent.type !== 'TaggedTemplateExpression' ) {
|
||||
let ordered = this.expressions.concat( this.quasis )
|
||||
.sort( ( a, b ) => a.start - b.start || a.end - b.end )
|
||||
.filter( ( node, i ) => {
|
||||
// include all expressions
|
||||
if ( node.type !== 'TemplateElement' ) return true;
|
||||
|
||||
// include all non-empty strings
|
||||
if ( node.value.raw ) return true;
|
||||
|
||||
// exclude all empty strings not at the head
|
||||
return !i;
|
||||
});
|
||||
|
||||
// special case – we may be able to skip the first element,
|
||||
// if it's the empty string, but only if the second and
|
||||
// third elements aren't both expressions (since they maybe
|
||||
// be numeric, and `1 + 2 + '3' === '33'`)
|
||||
if ( ordered.length >= 3 ) {
|
||||
const [ first, , third ] = ordered;
|
||||
if ( first.type === 'TemplateElement' && first.value.raw === '' && third.type === 'TemplateElement' ) {
|
||||
ordered.shift();
|
||||
}
|
||||
}
|
||||
|
||||
const parenthesise = ( this.quasis.length !== 1 || this.expressions.length !== 0 ) &&
|
||||
this.parent.type !== 'AssignmentExpression' &&
|
||||
this.parent.type !== 'VariableDeclarator' &&
|
||||
( this.parent.type !== 'BinaryExpression' || this.parent.operator !== '+' );
|
||||
|
||||
if ( parenthesise ) code.insertRight( this.start, '(' );
|
||||
|
||||
let lastIndex = this.start;
|
||||
|
||||
ordered.forEach( ( node, i ) => {
|
||||
if ( node.type === 'TemplateElement' ) {
|
||||
let replacement = '';
|
||||
if ( i ) replacement += ' + ';
|
||||
replacement += JSON.stringify( node.value.cooked );
|
||||
|
||||
code.overwrite( lastIndex, node.end, replacement );
|
||||
} else {
|
||||
const parenthesise = node.type !== 'Identifier'; // TODO other cases where it's safe
|
||||
|
||||
let replacement = '';
|
||||
if ( i ) replacement += ' + ';
|
||||
if ( parenthesise ) replacement += '(';
|
||||
|
||||
code.overwrite( lastIndex, node.start, replacement );
|
||||
|
||||
if ( parenthesise ) code.insertLeft( node.end, ')' );
|
||||
}
|
||||
|
||||
lastIndex = node.end;
|
||||
});
|
||||
|
||||
let close = '';
|
||||
if ( parenthesise ) close += ')';
|
||||
|
||||
code.overwrite( lastIndex, this.end, close );
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
25
node_modules/bubleify/node_modules/buble/src/program/types/ThisExpression.js
generated
vendored
Normal file
25
node_modules/bubleify/node_modules/buble/src/program/types/ThisExpression.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
import Node from '../Node.js';
|
||||
|
||||
export default class ThisExpression extends Node {
|
||||
initialise ( transforms ) {
|
||||
if ( transforms.arrow ) {
|
||||
const lexicalBoundary = this.findLexicalBoundary();
|
||||
const arrowFunction = this.findNearest( 'ArrowFunctionExpression' );
|
||||
const loop = this.findNearest( /(?:For(?:In|Of)?|While)Statement/ );
|
||||
|
||||
if ( arrowFunction && arrowFunction.depth > lexicalBoundary.depth ) {
|
||||
this.alias = lexicalBoundary.getThisAlias();
|
||||
}
|
||||
|
||||
if ( loop && loop.body.contains( this ) && loop.depth > lexicalBoundary.depth ) {
|
||||
this.alias = lexicalBoundary.getThisAlias();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( this.alias ) {
|
||||
code.overwrite( this.start, this.end, this.alias, true );
|
||||
}
|
||||
}
|
||||
}
|
15
node_modules/bubleify/node_modules/buble/src/program/types/UpdateExpression.js
generated
vendored
Normal file
15
node_modules/bubleify/node_modules/buble/src/program/types/UpdateExpression.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import Node from '../Node.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
|
||||
export default class UpdateExpression extends Node {
|
||||
initialise ( transforms ) {
|
||||
if ( this.argument.type === 'Identifier' ) {
|
||||
const declaration = this.findScope( false ).findDeclaration( this.argument.name );
|
||||
if ( declaration && declaration.kind === 'const' ) {
|
||||
throw new CompileError( this, `${this.argument.name} is read-only` );
|
||||
}
|
||||
}
|
||||
|
||||
super.initialise( transforms );
|
||||
}
|
||||
}
|
85
node_modules/bubleify/node_modules/buble/src/program/types/VariableDeclaration.js
generated
vendored
Normal file
85
node_modules/bubleify/node_modules/buble/src/program/types/VariableDeclaration.js
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
import Node from '../Node.js';
|
||||
import destructure from '../../utils/destructure.js';
|
||||
|
||||
export default class VariableDeclaration extends Node {
|
||||
initialise ( transforms ) {
|
||||
this.scope = this.findScope( this.kind === 'var' );
|
||||
this.declarations.forEach( declarator => declarator.initialise( transforms ) );
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
const i0 = this.getIndentation();
|
||||
let kind = this.kind;
|
||||
|
||||
if ( transforms.letConst && kind !== 'var' ) {
|
||||
kind = 'var';
|
||||
code.overwrite( this.start, this.start + this.kind.length, kind, true );
|
||||
}
|
||||
|
||||
if ( transforms.destructuring ) {
|
||||
let c = this.start;
|
||||
let lastDeclaratorIsPattern;
|
||||
|
||||
this.declarations.forEach( ( declarator, i ) => {
|
||||
if ( declarator.id.type === 'Identifier' ) {
|
||||
if ( i > 0 && this.declarations[ i - 1 ].id.type !== 'Identifier' ) {
|
||||
code.overwrite( c, declarator.id.start, `var ` );
|
||||
}
|
||||
} else {
|
||||
if ( i === 0 ) {
|
||||
code.remove( c, declarator.id.start );
|
||||
} else {
|
||||
code.overwrite( c, declarator.id.start, `;\n${i0}` );
|
||||
}
|
||||
|
||||
const simple = declarator.init.type === 'Identifier' && !declarator.init.rewritten;
|
||||
|
||||
const name = simple ? declarator.init.name : declarator.findScope( true ).createIdentifier( 'ref' );
|
||||
|
||||
let c = declarator.start;
|
||||
|
||||
let statementGenerators = [];
|
||||
|
||||
if ( simple ) {
|
||||
code.remove( declarator.id.end, declarator.end );
|
||||
} else {
|
||||
statementGenerators.push( ( start, prefix, suffix ) => {
|
||||
code.insertRight( declarator.id.end, `var ${name}` );
|
||||
code.insertLeft( declarator.init.end, `;${suffix}` );
|
||||
code.move( declarator.id.end, declarator.end, start );
|
||||
});
|
||||
}
|
||||
|
||||
destructure( code, declarator.findScope( false ), declarator.id, name, statementGenerators );
|
||||
|
||||
let suffix = `\n${i0}`;
|
||||
statementGenerators.forEach( ( fn, j ) => {
|
||||
if ( i === this.declarations.length - 1 && j === statementGenerators.length - 1 ) {
|
||||
suffix = '';
|
||||
}
|
||||
|
||||
fn( declarator.start, '', suffix );
|
||||
});
|
||||
}
|
||||
|
||||
if ( declarator.init ) {
|
||||
declarator.init.transpile( code, transforms );
|
||||
}
|
||||
|
||||
c = declarator.end;
|
||||
lastDeclaratorIsPattern = declarator.id.type !== 'Identifier';
|
||||
});
|
||||
|
||||
if ( lastDeclaratorIsPattern ) {
|
||||
code.remove( c, this.end );
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
this.declarations.forEach( declarator => {
|
||||
if ( declarator.init ) declarator.init.transpile( code, transforms );
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
14
node_modules/bubleify/node_modules/buble/src/program/types/VariableDeclarator.js
generated
vendored
Normal file
14
node_modules/bubleify/node_modules/buble/src/program/types/VariableDeclarator.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
import Node from '../Node.js';
|
||||
import CompileError from '../../utils/CompileError.js';
|
||||
|
||||
export default class VariableDeclarator extends Node {
|
||||
initialise ( transforms ) {
|
||||
let kind = this.parent.kind;
|
||||
if ( kind === 'let' && this.parent.parent.type === 'ForStatement' ) {
|
||||
kind = 'for.let'; // special case...
|
||||
}
|
||||
|
||||
this.parent.scope.addDeclaration( this.id, kind );
|
||||
super.initialise( transforms );
|
||||
}
|
||||
}
|
88
node_modules/bubleify/node_modules/buble/src/program/types/index.js
generated
vendored
Normal file
88
node_modules/bubleify/node_modules/buble/src/program/types/index.js
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
import ArrayExpression from './ArrayExpression.js';
|
||||
import ArrowFunctionExpression from './ArrowFunctionExpression.js';
|
||||
import AssignmentExpression from './AssignmentExpression.js';
|
||||
import BinaryExpression from './BinaryExpression.js';
|
||||
import BreakStatement from './BreakStatement.js';
|
||||
import CallExpression from './CallExpression.js';
|
||||
import ClassBody from './ClassBody.js';
|
||||
import ClassDeclaration from './ClassDeclaration.js';
|
||||
import ClassExpression from './ClassExpression.js';
|
||||
import ContinueStatement from './ContinueStatement.js';
|
||||
import ExportDefaultDeclaration from './ExportDefaultDeclaration.js';
|
||||
import ExportNamedDeclaration from './ExportNamedDeclaration.js';
|
||||
import ForStatement from './ForStatement.js';
|
||||
import ForInStatement from './ForInStatement.js';
|
||||
import ForOfStatement from './ForOfStatement.js';
|
||||
import FunctionDeclaration from './FunctionDeclaration.js';
|
||||
import FunctionExpression from './FunctionExpression.js';
|
||||
import Identifier from './Identifier.js';
|
||||
import ImportDeclaration from './ImportDeclaration.js';
|
||||
import ImportDefaultSpecifier from './ImportDefaultSpecifier.js';
|
||||
import ImportSpecifier from './ImportSpecifier.js';
|
||||
import JSXAttribute from './JSXAttribute.js';
|
||||
import JSXClosingElement from './JSXClosingElement.js';
|
||||
import JSXElement from './JSXElement.js';
|
||||
import JSXExpressionContainer from './JSXExpressionContainer.js';
|
||||
import JSXOpeningElement from './JSXOpeningElement.js';
|
||||
import JSXSpreadAttribute from './JSXSpreadAttribute.js';
|
||||
import Literal from './Literal.js';
|
||||
import LoopStatement from './shared/LoopStatement.js';
|
||||
import MemberExpression from './MemberExpression.js';
|
||||
import ObjectExpression from './ObjectExpression.js';
|
||||
import Property from './Property.js';
|
||||
import ReturnStatement from './ReturnStatement.js';
|
||||
import SpreadProperty from './SpreadProperty.js';
|
||||
import Super from './Super.js';
|
||||
import TaggedTemplateExpression from './TaggedTemplateExpression.js';
|
||||
import TemplateElement from './TemplateElement.js';
|
||||
import TemplateLiteral from './TemplateLiteral.js';
|
||||
import ThisExpression from './ThisExpression.js';
|
||||
import UpdateExpression from './UpdateExpression.js';
|
||||
import VariableDeclaration from './VariableDeclaration.js';
|
||||
import VariableDeclarator from './VariableDeclarator.js';
|
||||
|
||||
export default {
|
||||
ArrayExpression,
|
||||
ArrowFunctionExpression,
|
||||
AssignmentExpression,
|
||||
BinaryExpression,
|
||||
BreakStatement,
|
||||
CallExpression,
|
||||
ClassBody,
|
||||
ClassDeclaration,
|
||||
ClassExpression,
|
||||
ContinueStatement,
|
||||
DoWhileStatement: LoopStatement,
|
||||
ExportNamedDeclaration,
|
||||
ExportDefaultDeclaration,
|
||||
ForStatement,
|
||||
ForInStatement,
|
||||
ForOfStatement,
|
||||
FunctionDeclaration,
|
||||
FunctionExpression,
|
||||
Identifier,
|
||||
ImportDeclaration,
|
||||
ImportDefaultSpecifier,
|
||||
ImportSpecifier,
|
||||
JSXAttribute,
|
||||
JSXClosingElement,
|
||||
JSXElement,
|
||||
JSXExpressionContainer,
|
||||
JSXOpeningElement,
|
||||
JSXSpreadAttribute,
|
||||
Literal,
|
||||
MemberExpression,
|
||||
ObjectExpression,
|
||||
Property,
|
||||
ReturnStatement,
|
||||
SpreadProperty,
|
||||
Super,
|
||||
TaggedTemplateExpression,
|
||||
TemplateElement,
|
||||
TemplateLiteral,
|
||||
ThisExpression,
|
||||
UpdateExpression,
|
||||
VariableDeclaration,
|
||||
VariableDeclarator,
|
||||
WhileStatement: LoopStatement
|
||||
};
|
85
node_modules/bubleify/node_modules/buble/src/program/types/shared/LoopStatement.js
generated
vendored
Normal file
85
node_modules/bubleify/node_modules/buble/src/program/types/shared/LoopStatement.js
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
import Node from '../../Node.js';
|
||||
import extractNames from '../../extractNames.js';
|
||||
|
||||
export default class LoopStatement extends Node {
|
||||
findScope ( functionScope ) {
|
||||
return functionScope || !this.createdScope ? this.parent.findScope( functionScope ) : this.body.scope;
|
||||
}
|
||||
|
||||
initialise ( transforms ) {
|
||||
this.body.createScope();
|
||||
this.createdScope = true;
|
||||
|
||||
// this is populated as and when reassignments occur
|
||||
this.reassigned = Object.create( null );
|
||||
this.aliases = Object.create( null );
|
||||
|
||||
super.initialise( transforms );
|
||||
|
||||
if ( transforms.letConst ) {
|
||||
// see if any block-scoped declarations are referenced
|
||||
// inside function expressions
|
||||
const names = Object.keys( this.body.scope.declarations );
|
||||
|
||||
let i = names.length;
|
||||
while ( i-- ) {
|
||||
const name = names[i];
|
||||
const declaration = this.body.scope.declarations[ name ];
|
||||
|
||||
let j = declaration.instances.length;
|
||||
while ( j-- ) {
|
||||
const instance = declaration.instances[j];
|
||||
const nearestFunctionExpression = instance.findNearest( /Function/ );
|
||||
|
||||
if ( nearestFunctionExpression && nearestFunctionExpression.depth > this.depth ) {
|
||||
this.shouldRewriteAsFunction = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( this.shouldRewriteAsFunction ) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
transpile ( code, transforms ) {
|
||||
if ( this.shouldRewriteAsFunction ) {
|
||||
const i0 = this.getIndentation();
|
||||
const i1 = i0 + code.getIndentString();
|
||||
|
||||
const argString = this.args ? ` ${this.args.join( ', ' )} ` : '';
|
||||
const paramString = this.params ? ` ${this.params.join( ', ' )} ` : '';
|
||||
|
||||
const functionScope = this.findScope( true );
|
||||
const loop = functionScope.createIdentifier( 'loop' );
|
||||
|
||||
const before = `var ${loop} = function (${paramString}) ` + ( this.body.synthetic ? `{\n${i0}${code.getIndentString()}` : '' );
|
||||
const after = ( this.body.synthetic ? `\n${i0}}` : '' ) + `;\n\n${i0}`;
|
||||
|
||||
code.insertRight( this.body.start, before );
|
||||
code.insertLeft( this.body.end, after );
|
||||
code.move( this.start, this.body.start, this.body.end );
|
||||
|
||||
if ( this.canBreak || this.canReturn ) {
|
||||
const returned = functionScope.createIdentifier( 'returned' );
|
||||
|
||||
let insert = `{\n${i1}var ${returned} = ${loop}(${argString});\n`;
|
||||
if ( this.canBreak ) insert += `\n${i1}if ( ${returned} === 'break' ) break;`;
|
||||
if ( this.canReturn ) insert += `\n${i1}if ( ${returned} ) return returned.v;`;
|
||||
insert += `\n${i0}}`;
|
||||
|
||||
code.insertRight( this.body.end, insert );
|
||||
} else {
|
||||
const callExpression = `${loop}(${argString});`;
|
||||
|
||||
if ( this.type === 'DoWhileStatement' ) {
|
||||
code.overwrite( this.start, this.body.start, `do {\n${i1}${callExpression}\n${i0}}` );
|
||||
} else {
|
||||
code.insertRight( this.body.end, callExpression );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.transpile( code, transforms );
|
||||
}
|
||||
}
|
9
node_modules/bubleify/node_modules/buble/src/program/types/shared/ModuleDeclaration.js
generated
vendored
Normal file
9
node_modules/bubleify/node_modules/buble/src/program/types/shared/ModuleDeclaration.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import Node from '../../Node.js';
|
||||
import CompileError from '../../../utils/CompileError.js';
|
||||
|
||||
export default class ModuleDeclaration extends Node {
|
||||
initialise ( transforms ) {
|
||||
if ( transforms.moduleImport ) throw new CompileError( this, 'Modules are not supported' );
|
||||
super.initialise( transforms );
|
||||
}
|
||||
}
|
54
node_modules/bubleify/node_modules/buble/src/program/wrap.js
generated
vendored
Normal file
54
node_modules/bubleify/node_modules/buble/src/program/wrap.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
import types from './types/index.js';
|
||||
import BlockStatement from './BlockStatement.js';
|
||||
import Node from './Node.js';
|
||||
import keys from './keys.js';
|
||||
|
||||
const statementsWithBlocks = {
|
||||
IfStatement: 'consequent',
|
||||
ForStatement: 'body',
|
||||
ForInStatement: 'body',
|
||||
ForOfStatement: 'body',
|
||||
WhileStatement: 'body',
|
||||
DoWhileStatement: 'body',
|
||||
ArrowFunctionExpression: 'body'
|
||||
};
|
||||
|
||||
export default function wrap ( raw, parent ) {
|
||||
if ( !raw ) return;
|
||||
|
||||
if ( 'length' in raw ) {
|
||||
let i = raw.length;
|
||||
while ( i-- ) wrap( raw[i], parent );
|
||||
return;
|
||||
}
|
||||
|
||||
// with e.g. shorthand properties, key and value are
|
||||
// the same node. We don't want to wrap an object twice
|
||||
if ( raw.__wrapped ) return;
|
||||
raw.__wrapped = true;
|
||||
|
||||
if ( !keys[ raw.type ] ) {
|
||||
keys[ raw.type ] = Object.keys( raw ).filter( key => typeof raw[ key ] === 'object' );
|
||||
}
|
||||
|
||||
// special case – body-less if/for/while statements. TODO others?
|
||||
const bodyType = statementsWithBlocks[ raw.type ];
|
||||
if ( bodyType && raw[ bodyType ].type !== 'BlockStatement' ) {
|
||||
const expression = raw[ bodyType ];
|
||||
|
||||
// create a synthetic block statement, otherwise all hell
|
||||
// breaks loose when it comes to block scoping
|
||||
raw[ bodyType ] = {
|
||||
start: expression.start,
|
||||
end: expression.end,
|
||||
type: 'BlockStatement',
|
||||
body: [ expression ],
|
||||
synthetic: true
|
||||
};
|
||||
}
|
||||
|
||||
Node( raw, parent );
|
||||
|
||||
const type = ( raw.type === 'BlockStatement' ? BlockStatement : types[ raw.type ] ) || Node;
|
||||
raw.__proto__ = type.prototype;
|
||||
}
|
72
node_modules/bubleify/node_modules/buble/src/support.js
generated
vendored
Normal file
72
node_modules/bubleify/node_modules/buble/src/support.js
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
export const matrix = {
|
||||
chrome: {
|
||||
48: 0b1001111011111100111110101111101,
|
||||
49: 0b1001111111111100111111111111111,
|
||||
50: 0b1011111111111100111111111111111
|
||||
},
|
||||
firefox: {
|
||||
43: 0b1000111111101100000110111011101,
|
||||
44: 0b1000111111101100000110111011101,
|
||||
45: 0b1000111111101100000110111011101
|
||||
},
|
||||
safari: {
|
||||
8: 0b1000000000000000000000000000000,
|
||||
9: 0b1001111001101100000011101011110
|
||||
},
|
||||
ie: {
|
||||
8: 0b0000000000000000000000000000000,
|
||||
9: 0b1000000000000000000000000000000,
|
||||
10: 0b1000000000000000000000000000000,
|
||||
11: 0b1000000000000000111000001100000
|
||||
},
|
||||
edge: {
|
||||
12: 0b1011110110111100011010001011101,
|
||||
13: 0b1011111110111100011111001011111
|
||||
},
|
||||
node: {
|
||||
'0.10': 0b1000000000101000000000001000000,
|
||||
'0.12': 0b1000001000101000000010001000100,
|
||||
4: 0b1001111000111100111111001111111,
|
||||
5: 0b1001111000111100111111001111111,
|
||||
6: 0b1011111111111100111111111111111
|
||||
}
|
||||
};
|
||||
|
||||
export const features = [
|
||||
'arrow',
|
||||
'classes',
|
||||
'collections',
|
||||
'computedProperty',
|
||||
'conciseMethodProperty',
|
||||
'constLoop',
|
||||
'constRedef',
|
||||
'defaultParameter',
|
||||
'destructuring',
|
||||
'extendNatives',
|
||||
'forOf',
|
||||
'generator',
|
||||
'letConst',
|
||||
'letLoop',
|
||||
'letLoopScope',
|
||||
'moduleExport',
|
||||
'moduleImport',
|
||||
'numericLiteral',
|
||||
'objectProto',
|
||||
'objectSuper',
|
||||
'oldOctalLiteral',
|
||||
'parameterDestructuring',
|
||||
'spreadRest',
|
||||
'stickyRegExp',
|
||||
'symbol',
|
||||
'templateString',
|
||||
'unicodeEscape',
|
||||
'unicodeIdentifier',
|
||||
'unicodeRegExp',
|
||||
|
||||
// ES2016
|
||||
'exponentiation',
|
||||
|
||||
// additional transforms, not from
|
||||
// https://featuretests.io
|
||||
'reservedProperties'
|
||||
];
|
23
node_modules/bubleify/node_modules/buble/src/utils/CompileError.js
generated
vendored
Normal file
23
node_modules/bubleify/node_modules/buble/src/utils/CompileError.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
import locate from './locate.js';
|
||||
import getSnippet from './getSnippet.js';
|
||||
|
||||
export default class CompileError extends Error {
|
||||
constructor ( node, message ) {
|
||||
super();
|
||||
|
||||
const source = node.program.magicString.original;
|
||||
const loc = locate( source, node.start );
|
||||
|
||||
this.name = 'CompileError';
|
||||
this.message = message + ` (${loc.line}:${loc.column})`;
|
||||
|
||||
this.stack = new Error().stack.replace( new RegExp( `.+new ${this.name}.+\\n`, 'm' ), '' );
|
||||
|
||||
this.loc = loc;
|
||||
this.snippet = getSnippet( source, loc, node.end - node.start );
|
||||
}
|
||||
|
||||
toString () {
|
||||
return `${this.name}: ${this.message}\n${this.snippet}`;
|
||||
}
|
||||
}
|
11
node_modules/bubleify/node_modules/buble/src/utils/array.js
generated
vendored
Normal file
11
node_modules/bubleify/node_modules/buble/src/utils/array.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
export function findIndex ( array, fn ) {
|
||||
for ( let i = 0; i < array.length; i += 1 ) {
|
||||
if ( fn( array[i], i ) ) return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
export function find ( array, fn ) {
|
||||
return array[ findIndex( array, fn ) ];
|
||||
}
|
21
node_modules/bubleify/node_modules/buble/src/utils/deindent.js
generated
vendored
Normal file
21
node_modules/bubleify/node_modules/buble/src/utils/deindent.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// TODO this function is slightly flawed – it works on the original string,
|
||||
// not its current edited state.
|
||||
// That's not a problem for the way that it's currently used, but it could
|
||||
// be in future...
|
||||
export default function deindent ( node, code ) {
|
||||
const start = node.start;
|
||||
const end = node.end;
|
||||
|
||||
const indentStr = code.getIndentString();
|
||||
const pattern = new RegExp( indentStr + '\\S', 'g' );
|
||||
|
||||
if ( code.original.slice( start - indentStr.length, start ) === indentStr ) {
|
||||
code.remove( start - indentStr.length, start );
|
||||
}
|
||||
|
||||
const slice = code.original.slice( start, end );
|
||||
let match;
|
||||
while ( match = pattern.exec( slice ) ) {
|
||||
if ( !node.program.indentExclusions[ match.index ] ) code.remove( start + match.index, start + match.index + indentStr.length );
|
||||
}
|
||||
}
|
170
node_modules/bubleify/node_modules/buble/src/utils/destructure.js
generated
vendored
Normal file
170
node_modules/bubleify/node_modules/buble/src/utils/destructure.js
generated
vendored
Normal file
@ -0,0 +1,170 @@
|
||||
import { findIndex } from './array.js';
|
||||
|
||||
const handlers = {
|
||||
ArrayPattern: destructureArrayPattern,
|
||||
ObjectPattern: destructureObjectPattern,
|
||||
AssignmentPattern: destructureAssignmentPattern,
|
||||
Identifier: destructureIdentifier
|
||||
};
|
||||
|
||||
export default function destructure ( code, scope, node, ref, statementGenerators ) {
|
||||
_destructure( code, scope, node, ref, ref, statementGenerators );
|
||||
}
|
||||
|
||||
function _destructure ( code, scope, node, ref, expr, statementGenerators ) {
|
||||
const handler = handlers[ node.type ];
|
||||
if ( !handler ) throw new Error( `not implemented: ${node.type}` );
|
||||
|
||||
handler( code, scope, node, ref, expr, statementGenerators );
|
||||
}
|
||||
|
||||
function destructureIdentifier ( code, scope, node, ref, expr, statementGenerators ) {
|
||||
statementGenerators.push( ( start, prefix, suffix ) => {
|
||||
code.insertRight( node.start, `${prefix}var ` );
|
||||
code.insertLeft( node.end, ` = ${expr};${suffix}` );
|
||||
code.move( node.start, node.end, start );
|
||||
});
|
||||
}
|
||||
|
||||
function handleProperty ( code, scope, c, node, value, statementGenerators ) {
|
||||
switch ( node.type ) {
|
||||
case 'Identifier':
|
||||
code.remove( c, node.start );
|
||||
statementGenerators.push( ( start, prefix, suffix ) => {
|
||||
code.insertRight( node.start, `${prefix}var ` );
|
||||
code.insertLeft( node.end, ` = ${value};${suffix}` );
|
||||
code.move( node.start, node.end, start );
|
||||
});
|
||||
break;
|
||||
|
||||
case 'AssignmentPattern':
|
||||
let name;
|
||||
|
||||
const isIdentifier = node.left.type === 'Identifier';
|
||||
|
||||
if ( isIdentifier ) {
|
||||
name = node.left.name;
|
||||
const declaration = scope.findDeclaration( name );
|
||||
if ( declaration ) name = declaration.name;
|
||||
} else {
|
||||
name = scope.createIdentifier( value );
|
||||
}
|
||||
|
||||
statementGenerators.push( ( start, prefix, suffix ) => {
|
||||
code.insertRight( node.right.start, `${prefix}var ${name} = ${value}; if ( ${name} === void 0 ) ${name} = ` );
|
||||
code.move( node.right.start, node.right.end, start );
|
||||
code.insertLeft( node.right.end, `;${suffix}` );
|
||||
});
|
||||
|
||||
if ( isIdentifier ) {
|
||||
code.remove( c, node.right.start );
|
||||
} else {
|
||||
code.remove( c, node.left.start );
|
||||
code.remove( node.left.end, node.right.start );
|
||||
handleProperty( code, scope, c, node.left, name, statementGenerators );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'ObjectPattern':
|
||||
code.remove( c, c = node.start );
|
||||
|
||||
if ( node.properties.length > 1 ) {
|
||||
const ref = scope.createIdentifier( value );
|
||||
|
||||
statementGenerators.push( ( start, prefix, suffix ) => {
|
||||
// this feels a tiny bit hacky, but we can't do a
|
||||
// straightforward insertLeft and keep correct order...
|
||||
code.insertRight( node.start, `${prefix}var ${ref} = ` );
|
||||
code.overwrite( node.start, c = node.start + 1, value );
|
||||
code.insertLeft( c, `;${suffix}` );
|
||||
|
||||
code.move( node.start, c, start );
|
||||
});
|
||||
|
||||
node.properties.forEach( prop => {
|
||||
handleProperty( code, scope, c, prop.value, `${ref}.${prop.key.name}`, statementGenerators );
|
||||
c = prop.end;
|
||||
});
|
||||
} else {
|
||||
const prop = node.properties[0];
|
||||
handleProperty( code, scope, c, prop.value, `${value}.${prop.key.name}`, statementGenerators );
|
||||
c = prop.end;
|
||||
}
|
||||
|
||||
code.remove( c, node.end );
|
||||
break;
|
||||
|
||||
case 'ArrayPattern':
|
||||
code.remove( c, c = node.start );
|
||||
|
||||
if ( node.elements.filter( Boolean ).length > 1 ) {
|
||||
const ref = scope.createIdentifier( value );
|
||||
|
||||
statementGenerators.push( ( start, prefix, suffix ) => {
|
||||
code.insertRight( node.start, `${prefix}var ${ref} = ` );
|
||||
code.overwrite( node.start, c = node.start + 1, value );
|
||||
code.insertLeft( c, `;${suffix}` );
|
||||
|
||||
code.move( node.start, c, start );
|
||||
});
|
||||
|
||||
node.elements.forEach( ( element, i ) => {
|
||||
if ( !element ) return;
|
||||
|
||||
handleProperty( code, scope, c, element, `${ref}[${i}]`, statementGenerators );
|
||||
c = element.end;
|
||||
});
|
||||
} else {
|
||||
const index = findIndex( node.elements, Boolean );
|
||||
const element = node.elements[ index ];
|
||||
handleProperty( code, scope, c, element, `${value}[${index}]`, statementGenerators );
|
||||
c = element.end;
|
||||
}
|
||||
|
||||
code.remove( c, node.end );
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error( `Unexpected node type in destructuring (${node.type})` );
|
||||
}
|
||||
}
|
||||
|
||||
function destructureArrayPattern ( code, scope, node, ref, expr, statementGenerators ) {
|
||||
let c = node.start;
|
||||
|
||||
node.elements.forEach( ( element, i ) => {
|
||||
if ( !element ) return;
|
||||
|
||||
handleProperty( code, scope, c, element, `${ref}[${i}]`, statementGenerators );
|
||||
c = element.end;
|
||||
});
|
||||
|
||||
code.remove( c, node.end );
|
||||
}
|
||||
|
||||
function destructureObjectPattern ( code, scope, node, ref, expr, statementGenerators ) {
|
||||
let c = node.start;
|
||||
|
||||
node.properties.forEach( prop => {
|
||||
handleProperty( code, scope, c, prop.value, `${ref}.${prop.key.name}`, statementGenerators );
|
||||
c = prop.end;
|
||||
});
|
||||
|
||||
code.remove( c, node.end );
|
||||
}
|
||||
|
||||
function destructureAssignmentPattern ( code, scope, node, ref, expr, statementGenerators ) {
|
||||
const isIdentifier = node.left.type === 'Identifier';
|
||||
const name = isIdentifier ? node.left.name : ref;
|
||||
|
||||
statementGenerators.push( ( start, prefix, suffix ) => {
|
||||
code.insertRight( node.left.end, `${prefix}if ( ${name} === void 0 ) ${name}` );
|
||||
code.move( node.left.end, node.right.end, start );
|
||||
code.insertLeft( node.right.end, `;${suffix}` );
|
||||
});
|
||||
|
||||
if ( !isIdentifier ) {
|
||||
_destructure( code, scope, node.left, ref, expr, statementGenerators );
|
||||
}
|
||||
}
|
30
node_modules/bubleify/node_modules/buble/src/utils/getSnippet.js
generated
vendored
Normal file
30
node_modules/bubleify/node_modules/buble/src/utils/getSnippet.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
function pad ( num, len ) {
|
||||
let result = String( num );
|
||||
return result + repeat( ' ', len - result.length );
|
||||
}
|
||||
|
||||
function repeat ( str, times ) {
|
||||
let result = '';
|
||||
while ( times-- ) result += str;
|
||||
return result;
|
||||
}
|
||||
|
||||
export default function getSnippet ( source, loc, length = 1 ) {
|
||||
const first = Math.max( loc.line - 5, 0 );
|
||||
const last = loc.line;
|
||||
|
||||
const numDigits = String( last ).length;
|
||||
|
||||
const lines = source.split( '\n' ).slice( first, last );
|
||||
|
||||
const lastLine = lines[ lines.length - 1 ];
|
||||
const offset = lastLine.slice( 0, loc.column ).replace( /\t/g, ' ' ).length;
|
||||
|
||||
let snippet = lines
|
||||
.map( ( line, i ) => `${pad( i + first + 1, numDigits )} : ${line.replace( /\t/g, ' ')}` )
|
||||
.join( '\n' );
|
||||
|
||||
snippet += '\n' + repeat( ' ', numDigits + 3 + offset ) + repeat( '^', length );
|
||||
|
||||
return snippet;
|
||||
}
|
37
node_modules/bubleify/node_modules/buble/src/utils/isReference.js
generated
vendored
Normal file
37
node_modules/bubleify/node_modules/buble/src/utils/isReference.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
export default function isReference ( node, parent ) {
|
||||
if ( node.type === 'MemberExpression' ) {
|
||||
return !node.computed && isReference( node.object, node );
|
||||
}
|
||||
|
||||
if ( node.type === 'Identifier' ) {
|
||||
// the only time we could have an identifier node without a parent is
|
||||
// if it's the entire body of a function without a block statement –
|
||||
// i.e. an arrow function expression like `a => a`
|
||||
if ( !parent ) return true;
|
||||
|
||||
if ( /(Function|Class)Expression/.test( parent.type ) ) return false;
|
||||
|
||||
if ( parent.type === 'VariableDeclarator' ) return node === parent.init;
|
||||
|
||||
// TODO is this right?
|
||||
if ( parent.type === 'MemberExpression' || parent.type === 'MethodDefinition' ) {
|
||||
return parent.computed || node === parent.object;
|
||||
}
|
||||
|
||||
if ( parent.type === 'ArrayPattern' ) return false;
|
||||
|
||||
// disregard the `bar` in `{ bar: foo }`, but keep it in `{ [bar]: foo }`
|
||||
if ( parent.type === 'Property' ) {
|
||||
if ( parent.parent.type === 'ObjectPattern' ) return false;
|
||||
return parent.computed || node === parent.value;
|
||||
}
|
||||
|
||||
// disregard the `bar` in `class Foo { bar () {...} }`
|
||||
if ( parent.type === 'MethodDefinition' ) return false;
|
||||
|
||||
// disregard the `bar` in `export { foo as bar }`
|
||||
if ( parent.type === 'ExportSpecifier' && node !== parent.local ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
20
node_modules/bubleify/node_modules/buble/src/utils/locate.js
generated
vendored
Normal file
20
node_modules/bubleify/node_modules/buble/src/utils/locate.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
export default function locate ( source, index ) {
|
||||
var lines = source.split( '\n' );
|
||||
var len = lines.length;
|
||||
|
||||
var lineStart = 0;
|
||||
var i;
|
||||
|
||||
for ( i = 0; i < len; i += 1 ) {
|
||||
var line = lines[i];
|
||||
var lineEnd = lineStart + line.length + 1; // +1 for newline
|
||||
|
||||
if ( lineEnd > index ) {
|
||||
return { line: i + 1, column: index - lineStart, char: i };
|
||||
}
|
||||
|
||||
lineStart = lineEnd;
|
||||
}
|
||||
|
||||
throw new Error( 'Could not determine location of character' );
|
||||
}
|
5
node_modules/bubleify/node_modules/buble/src/utils/reserved.js
generated
vendored
Normal file
5
node_modules/bubleify/node_modules/buble/src/utils/reserved.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
let reserved = Object.create( null );
|
||||
'do if in for let new try var case else enum eval null this true void with await break catch class const false super throw while yield delete export import public return static switch typeof default extends finally package private continue debugger function arguments interface protected implements instanceof'.split( ' ' )
|
||||
.forEach( word => reserved[ word ] = true );
|
||||
|
||||
export default reserved;
|
46
node_modules/bubleify/node_modules/buble/src/utils/spread.js
generated
vendored
Normal file
46
node_modules/bubleify/node_modules/buble/src/utils/spread.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
export function isArguments ( node ) {
|
||||
return node.type === 'Identifier' && node.name === 'arguments';
|
||||
}
|
||||
|
||||
export default function spread ( code, elements, start, argumentsArrayAlias ) {
|
||||
let i = elements.length;
|
||||
let firstSpreadIndex = -1;
|
||||
|
||||
while ( i-- ) {
|
||||
const element = elements[i];
|
||||
if ( element && element.type === 'SpreadElement' ) {
|
||||
if ( isArguments( element.argument ) ) {
|
||||
code.overwrite( element.argument.start, element.argument.end, argumentsArrayAlias );
|
||||
}
|
||||
|
||||
firstSpreadIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if ( firstSpreadIndex === -1 ) return false; // false indicates no spread elements
|
||||
|
||||
let element = elements[ firstSpreadIndex ];
|
||||
const previousElement = elements[ firstSpreadIndex - 1 ];
|
||||
|
||||
if ( !previousElement ) {
|
||||
code.remove( start, element.start );
|
||||
code.overwrite( element.end, elements[1].start, '.concat( ' );
|
||||
} else {
|
||||
code.overwrite( previousElement.end, element.start, ' ].concat( ' );
|
||||
}
|
||||
|
||||
for ( i = firstSpreadIndex; i < elements.length; i += 1 ) {
|
||||
element = elements[i];
|
||||
|
||||
if ( element ) {
|
||||
if ( element.type === 'SpreadElement' ) {
|
||||
code.remove( element.start, element.argument.start );
|
||||
} else {
|
||||
code.insertRight( element.start, '[' );
|
||||
code.insertLeft( element.end, ']' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true; // true indicates some spread elements
|
||||
}
|
116
node_modules/bubleify/node_modules/chalk/index.js
generated
vendored
Normal file
116
node_modules/bubleify/node_modules/chalk/index.js
generated
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
'use strict';
|
||||
var escapeStringRegexp = require('escape-string-regexp');
|
||||
var ansiStyles = require('ansi-styles');
|
||||
var stripAnsi = require('strip-ansi');
|
||||
var hasAnsi = require('has-ansi');
|
||||
var supportsColor = require('supports-color');
|
||||
var defineProps = Object.defineProperties;
|
||||
var isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(process.env.TERM);
|
||||
|
||||
function Chalk(options) {
|
||||
// detect mode if not set manually
|
||||
this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled;
|
||||
}
|
||||
|
||||
// use bright blue on Windows as the normal blue color is illegible
|
||||
if (isSimpleWindowsTerm) {
|
||||
ansiStyles.blue.open = '\u001b[94m';
|
||||
}
|
||||
|
||||
var styles = (function () {
|
||||
var ret = {};
|
||||
|
||||
Object.keys(ansiStyles).forEach(function (key) {
|
||||
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
||||
|
||||
ret[key] = {
|
||||
get: function () {
|
||||
return build.call(this, this._styles.concat(key));
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
return ret;
|
||||
})();
|
||||
|
||||
var proto = defineProps(function chalk() {}, styles);
|
||||
|
||||
function build(_styles) {
|
||||
var builder = function () {
|
||||
return applyStyle.apply(builder, arguments);
|
||||
};
|
||||
|
||||
builder._styles = _styles;
|
||||
builder.enabled = this.enabled;
|
||||
// __proto__ is used because we must return a function, but there is
|
||||
// no way to create a function with a different prototype.
|
||||
/* eslint-disable no-proto */
|
||||
builder.__proto__ = proto;
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
function applyStyle() {
|
||||
// support varags, but simply cast to string in case there's only one arg
|
||||
var args = arguments;
|
||||
var argsLen = args.length;
|
||||
var str = argsLen !== 0 && String(arguments[0]);
|
||||
|
||||
if (argsLen > 1) {
|
||||
// don't slice `arguments`, it prevents v8 optimizations
|
||||
for (var a = 1; a < argsLen; a++) {
|
||||
str += ' ' + args[a];
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.enabled || !str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
var nestedStyles = this._styles;
|
||||
var i = nestedStyles.length;
|
||||
|
||||
// Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
|
||||
// see https://github.com/chalk/chalk/issues/58
|
||||
// If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
|
||||
var originalDim = ansiStyles.dim.open;
|
||||
if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) {
|
||||
ansiStyles.dim.open = '';
|
||||
}
|
||||
|
||||
while (i--) {
|
||||
var code = ansiStyles[nestedStyles[i]];
|
||||
|
||||
// Replace any instances already present with a re-opening code
|
||||
// otherwise only the part of the string until said closing code
|
||||
// will be colored, and the rest will simply be 'plain'.
|
||||
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
||||
}
|
||||
|
||||
// Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue.
|
||||
ansiStyles.dim.open = originalDim;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function init() {
|
||||
var ret = {};
|
||||
|
||||
Object.keys(styles).forEach(function (name) {
|
||||
ret[name] = {
|
||||
get: function () {
|
||||
return build.call(this, [name]);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
defineProps(Chalk.prototype, init());
|
||||
|
||||
module.exports = new Chalk();
|
||||
module.exports.styles = ansiStyles;
|
||||
module.exports.hasColor = hasAnsi;
|
||||
module.exports.stripColor = stripAnsi;
|
||||
module.exports.supportsColor = supportsColor;
|
21
node_modules/bubleify/node_modules/chalk/license
generated
vendored
Normal file
21
node_modules/bubleify/node_modules/chalk/license
generated
vendored
Normal 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.
|
140
node_modules/bubleify/node_modules/chalk/package.json
generated
vendored
Normal file
140
node_modules/bubleify/node_modules/chalk/package.json
generated
vendored
Normal file
@ -0,0 +1,140 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "chalk@^1.1.3",
|
||||
"scope": null,
|
||||
"escapedName": "chalk",
|
||||
"name": "chalk",
|
||||
"rawSpec": "^1.1.3",
|
||||
"spec": ">=1.1.3 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\bubleify\\node_modules\\buble"
|
||||
]
|
||||
],
|
||||
"_from": "chalk@>=1.1.3 <2.0.0",
|
||||
"_id": "chalk@1.1.3",
|
||||
"_inCache": true,
|
||||
"_location": "/bubleify/chalk",
|
||||
"_nodeVersion": "0.10.32",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/chalk-1.1.3.tgz_1459210604109_0.3892582862172276"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "qix",
|
||||
"email": "i.am.qix@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.14.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "chalk@^1.1.3",
|
||||
"scope": null,
|
||||
"escapedName": "chalk",
|
||||
"name": "chalk",
|
||||
"rawSpec": "^1.1.3",
|
||||
"spec": ">=1.1.3 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/bubleify/buble"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
||||
"_shasum": "a8115c55e4a702fe4d150abd3872822a7e09fc98",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "chalk@^1.1.3",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\bubleify\\node_modules\\buble",
|
||||
"bugs": {
|
||||
"url": "https://github.com/chalk/chalk/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-styles": "^2.2.1",
|
||||
"escape-string-regexp": "^1.0.2",
|
||||
"has-ansi": "^2.0.0",
|
||||
"strip-ansi": "^3.0.0",
|
||||
"supports-color": "^2.0.0"
|
||||
},
|
||||
"description": "Terminal string styling done right. Much color.",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.2",
|
||||
"matcha": "^0.6.0",
|
||||
"mocha": "*",
|
||||
"nyc": "^3.0.0",
|
||||
"require-uncached": "^1.0.2",
|
||||
"resolve-from": "^1.0.0",
|
||||
"semver": "^4.3.3",
|
||||
"xo": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "a8115c55e4a702fe4d150abd3872822a7e09fc98",
|
||||
"tarball": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "0d8d8c204eb87a4038219131ad4d8369c9f59d24",
|
||||
"homepage": "https://github.com/chalk/chalk#readme",
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"str",
|
||||
"ansi",
|
||||
"style",
|
||||
"styles",
|
||||
"tty",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "qix",
|
||||
"email": "i.am.qix@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "unicorn",
|
||||
"email": "sindresorhus+unicorn@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "chalk",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/chalk/chalk.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "matcha benchmark.js",
|
||||
"coverage": "nyc npm test && nyc report",
|
||||
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
|
||||
"test": "xo && mocha"
|
||||
},
|
||||
"version": "1.1.3",
|
||||
"xo": {
|
||||
"envs": [
|
||||
"node",
|
||||
"mocha"
|
||||
]
|
||||
}
|
||||
}
|
213
node_modules/bubleify/node_modules/chalk/readme.md
generated
vendored
Normal file
213
node_modules/bubleify/node_modules/chalk/readme.md
generated
vendored
Normal file
@ -0,0 +1,213 @@
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img width="360" src="https://cdn.rawgit.com/chalk/chalk/19935d6484811c5e468817f846b7b3d417d7bf4a/logo.svg" alt="chalk">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
> Terminal string styling done right
|
||||
|
||||
[](https://travis-ci.org/chalk/chalk)
|
||||
[](https://coveralls.io/r/chalk/chalk?branch=master)
|
||||
[](https://www.youtube.com/watch?v=9auOCbH5Ns4)
|
||||
|
||||
|
||||
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough.
|
||||
|
||||
**Chalk is a clean and focused alternative.**
|
||||
|
||||

|
||||
|
||||
|
||||
## Why
|
||||
|
||||
- Highly performant
|
||||
- Doesn't extend `String.prototype`
|
||||
- Expressive API
|
||||
- Ability to nest styles
|
||||
- Clean and focused
|
||||
- Auto-detects color support
|
||||
- Actively maintained
|
||||
- [Used by ~4500 modules](https://www.npmjs.com/browse/depended/chalk) as of July 15, 2015
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save chalk
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
|
||||
// style a string
|
||||
chalk.blue('Hello world!');
|
||||
|
||||
// combine styled and normal strings
|
||||
chalk.blue('Hello') + 'World' + chalk.red('!');
|
||||
|
||||
// compose multiple styles using the chainable API
|
||||
chalk.blue.bgRed.bold('Hello world!');
|
||||
|
||||
// pass in multiple arguments
|
||||
chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz');
|
||||
|
||||
// nest styles
|
||||
chalk.red('Hello', chalk.underline.bgBlue('world') + '!');
|
||||
|
||||
// nest styles of the same type even (color, underline, background)
|
||||
chalk.green(
|
||||
'I am a green line ' +
|
||||
chalk.blue.underline.bold('with a blue substring') +
|
||||
' that becomes green again!'
|
||||
);
|
||||
```
|
||||
|
||||
Easily define your own themes.
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
var error = chalk.bold.red;
|
||||
console.log(error('Error!'));
|
||||
```
|
||||
|
||||
Take advantage of console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data).
|
||||
|
||||
```js
|
||||
var name = 'Sindre';
|
||||
console.log(chalk.green('Hello %s'), name);
|
||||
//=> Hello Sindre
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### chalk.`<style>[.<style>...](string, [string...])`
|
||||
|
||||
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||
|
||||
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `Chalk.red.yellow.green` is equivalent to `Chalk.green`.
|
||||
|
||||
Multiple arguments will be separated by space.
|
||||
|
||||
### chalk.enabled
|
||||
|
||||
Color support is automatically detected, but you can override it by setting the `enabled` property. You should however only do this in your own code as it applies globally to all chalk consumers.
|
||||
|
||||
If you need to change this in a reusable module create a new instance:
|
||||
|
||||
```js
|
||||
var ctx = new chalk.constructor({enabled: false});
|
||||
```
|
||||
|
||||
### chalk.supportsColor
|
||||
|
||||
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`.
|
||||
|
||||
### chalk.styles
|
||||
|
||||
Exposes the styles as [ANSI escape codes](https://github.com/chalk/ansi-styles).
|
||||
|
||||
Generally not useful, but you might need just the `.open` or `.close` escape code if you're mixing externally styled strings with your own.
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
|
||||
console.log(chalk.styles.red);
|
||||
//=> {open: '\u001b[31m', close: '\u001b[39m'}
|
||||
|
||||
console.log(chalk.styles.red.open + 'Hello' + chalk.styles.red.close);
|
||||
```
|
||||
|
||||
### chalk.hasColor(string)
|
||||
|
||||
Check whether a string [has color](https://github.com/chalk/has-ansi).
|
||||
|
||||
### chalk.stripColor(string)
|
||||
|
||||
[Strip color](https://github.com/chalk/strip-ansi) from a string.
|
||||
|
||||
Can be useful in combination with `.supportsColor` to strip color on externally styled text when it's not supported.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
var styledString = getText();
|
||||
|
||||
if (!chalk.supportsColor) {
|
||||
styledString = chalk.stripColor(styledString);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(not widely supported)*
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue` *(on Windows the bright version is used as normal blue is illegible)*
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `gray`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
|
||||
|
||||
## 256-colors
|
||||
|
||||
Chalk does not support anything other than the base eight colors, which guarantees it will work on all terminals and systems. Some terminals, specifically `xterm` compliant ones, will support the full range of 8-bit colors. For this the lower level [ansi-256-colors](https://github.com/jbnicolai/ansi-256-colors) package can be used.
|
||||
|
||||
|
||||
## Windows
|
||||
|
||||
If you're on Windows, do yourself a favor and use [`cmder`](http://bliker.github.io/cmder/) instead of `cmd.exe`.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles/) - ANSI escape codes for styling strings in the terminal
|
||||
- [supports-color](https://github.com/chalk/supports-color/) - Detect whether a terminal supports color
|
||||
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user