forked from enviPath/enviPy
Current Dev State
This commit is contained in:
22
static/js/ketcher2/node_modules/babelify/LICENSE
generated
vendored
Normal file
22
static/js/ketcher2/node_modules/babelify/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Copyright (c) 2015 Sebastian McKenzie
|
||||
|
||||
MIT License
|
||||
|
||||
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.
|
||||
217
static/js/ketcher2/node_modules/babelify/README.md
generated
vendored
Normal file
217
static/js/ketcher2/node_modules/babelify/README.md
generated
vendored
Normal file
@ -0,0 +1,217 @@
|
||||
# babelify [](https://travis-ci.org/babel/babelify)
|
||||
|
||||
[Babel](https://github.com/babel/babel) [browserify](https://github.com/substack/node-browserify) transform.
|
||||
|
||||
As of [Babel 6.0.0](http://babeljs.io/blog/2015/10/29/6.0.0/) there are **no plugins included by default**. For babelify to be useful, you must also include some [presets](http://babeljs.io/docs/plugins/#presets) and/or [plugins](http://babeljs.io/docs/plugins/#transform).
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install --save-dev babelify
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### CLI
|
||||
|
||||
```sh
|
||||
$ browserify script.js -o bundle.js -t [ babelify --presets [ es2015 react ] ]
|
||||
```
|
||||
|
||||
### Node
|
||||
|
||||
```javascript
|
||||
var fs = require("fs");
|
||||
var browserify = require("browserify");
|
||||
browserify("./script.js")
|
||||
.transform("babelify", {presets: ["es2015", "react"]})
|
||||
.bundle()
|
||||
.pipe(fs.createWriteStream("bundle.js"));
|
||||
```
|
||||
|
||||
**NOTE:** [Presets and plugins](http://babeljs.io/docs/plugins/) need to be installed as separate modules. For the above examples to work, you'd need to also install [`babel-preset-es2015`](https://www.npmjs.com/package/babel-preset-es2015) and [`babel-preset-react`](https://www.npmjs.com/package/babel-preset-react):
|
||||
|
||||
```sh
|
||||
$ npm install --save-dev babel-preset-es2015 babel-preset-react
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
Selected options are discussed below. See the [babel](http://babeljs.io/) docs for the complete list of [options](http://babeljs.io/docs/usage/options/).
|
||||
|
||||
Options may be passed in via standard [browserify](https://github.com/substack/node-browserify#btransformtr-opts) ways:
|
||||
|
||||
```sh
|
||||
$ browserify -t [ babelify --presets [ es2015 react ] ]
|
||||
```
|
||||
|
||||
```js
|
||||
browserify().transform("babelify", {presets: ["es2015", "react"]});
|
||||
```
|
||||
|
||||
```js
|
||||
var babelify = require("babelify");
|
||||
browserify().transform(babelify, {presets: ["es2015", "react"]});
|
||||
```
|
||||
|
||||
Or, with the `configure` method:
|
||||
|
||||
```js
|
||||
browserify().transform(babelify.configure({
|
||||
presets: ["es2015", "react"]
|
||||
}));
|
||||
```
|
||||
|
||||
#### Customizing extensions
|
||||
|
||||
By default, all files with the extensions `.js`, `.es`, `.es6` and `.jsx` are compiled. You can change this by passing an array of extensions.
|
||||
|
||||
**NOTE:** This will override the default ones so if you want to use any of them
|
||||
you have to add them back.
|
||||
|
||||
```js
|
||||
browserify().transform("babelify", {extensions: [".babel"]});
|
||||
```
|
||||
|
||||
```sh
|
||||
$ browserify -t [ babelify --extensions .babel ]
|
||||
```
|
||||
|
||||
Now you can use:
|
||||
|
||||
```js
|
||||
import NavBar from "nav-bar.babel";
|
||||
var Panels = require("panels.babel");
|
||||
```
|
||||
|
||||
**NOTE:** By default, Browserify will only lookup `.js` and `.json` files when the extension is ommited (like node's `require`). To lookup additional extensions, use browserify's [`extensions` option](https://github.com/substack/node-browserify#browserifyfiles--opts).
|
||||
|
||||
```js
|
||||
browserify({
|
||||
extensions: [".babel"]
|
||||
}).transform("babelify", {
|
||||
extensions: [".babel"]
|
||||
});
|
||||
```
|
||||
|
||||
```sh
|
||||
$ browserify --extensions=.babel -t [ babelify --extensions .babel ]
|
||||
```
|
||||
|
||||
Now you can omit the extension and compile `.babel` files:
|
||||
|
||||
```js
|
||||
import NavBar from "nav-bar";
|
||||
var Panels = require("panels");
|
||||
```
|
||||
|
||||
#### Source maps
|
||||
|
||||
By default, browserify sets the source map sources paths relative to the basedir (or to `process.cwd()` if not set). To make the sources paths absolute, set the `sourceMapsAbsolute` option on babelify:
|
||||
|
||||
```js
|
||||
browserify().transform("babelify", {
|
||||
sourceMapsAbsolute: true
|
||||
});
|
||||
```
|
||||
|
||||
```sh
|
||||
$ browserify -t [ babelify --sourceMapsAbsolute ]
|
||||
```
|
||||
|
||||
#### Additional options
|
||||
|
||||
```javascript
|
||||
browserify().transform(babelify.configure({
|
||||
// Optional ignore regex - if any filenames **do** match this regex then
|
||||
// they aren't compiled
|
||||
ignore: /regex/,
|
||||
|
||||
// Optional only regex - if any filenames **don't** match this regex
|
||||
// then they aren't compiled
|
||||
only: /my_es6_folder/
|
||||
}))
|
||||
```
|
||||
|
||||
```sh
|
||||
$ browserify -t [ babelify --ignore regex --only my_es6_folder ]
|
||||
```
|
||||
|
||||
#### Babel result (metadata and others)
|
||||
|
||||
Babelify emits a `babelify` event with Babel's full result object as the first
|
||||
argument, and the filename as the second. Browserify doesn't pass-through the
|
||||
events emitted by a transform, so it's necessary to get a reference to the
|
||||
transform instance before you can attach a listener for the event:
|
||||
|
||||
```js
|
||||
var b = browserify().transform(babelify);
|
||||
|
||||
b.on("transform", function(tr) {
|
||||
if (tr instanceof babelify) {
|
||||
tr.once("babelify", function(result, filename) {
|
||||
result; // => { code, map, ast, metadata }
|
||||
});
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why aren't files in `node_modules` being transformed?
|
||||
|
||||
This is the default browserify behavior.
|
||||
|
||||
A possible solution is to add:
|
||||
|
||||
```json
|
||||
{
|
||||
"browserify": {
|
||||
"transform": ["babelify"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
to the root of all your modules `package.json` that you want to be transformed. If you'd like to
|
||||
specify options then you can use:
|
||||
|
||||
```json
|
||||
{
|
||||
"browserify": {
|
||||
"transform": [["babelify", { "presets": ["es2015"] }]]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Another solution (proceed with caution!) is to run babelify as a [global](https://github.com/substack/node-browserify#btransformtr-opts) transform. Use the babel [`ignore` option](http://babeljs.io/docs/usage/options/) to narrow the number of files transformed:
|
||||
|
||||
```js
|
||||
browserify().transform(babelify, {
|
||||
global: true,
|
||||
ignore: /\/node_modules\/(?!app\/)/
|
||||
});
|
||||
```
|
||||
|
||||
The above example will transform all files except those in the `node_modules` directory that are not in `node_modules/app`.
|
||||
|
||||
### Why am I not getting source maps?
|
||||
|
||||
To use source maps, enable them in browserify with the [`debug`](https://github.com/substack/node-browserify#browserifyfiles--opts) option:
|
||||
|
||||
```js
|
||||
browserify({debug: true}).transform("babelify");
|
||||
```
|
||||
|
||||
```sh
|
||||
$ browserify -d -t [ babelify ]
|
||||
```
|
||||
|
||||
If you want the source maps to be of the post-transpiled code, then leave `debug` on, but turn off babelify's `sourceMaps`:
|
||||
|
||||
```js
|
||||
browserify({debug: true}).transform("babelify", {sourceMaps: false});
|
||||
```
|
||||
|
||||
```sh
|
||||
$ browserify -d -t [ babelify --no-sourceMaps ]
|
||||
```
|
||||
76
static/js/ketcher2/node_modules/babelify/index.js
generated
vendored
Normal file
76
static/js/ketcher2/node_modules/babelify/index.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
var assign = require("object-assign");
|
||||
var stream = require("stream");
|
||||
var babel = require("babel-core");
|
||||
var util = require("util");
|
||||
|
||||
module.exports = Babelify;
|
||||
util.inherits(Babelify, stream.Transform);
|
||||
|
||||
function Babelify(filename, opts) {
|
||||
if (!(this instanceof Babelify)) {
|
||||
return Babelify.configure(opts)(filename);
|
||||
}
|
||||
|
||||
stream.Transform.call(this);
|
||||
this._data = "";
|
||||
this._filename = filename;
|
||||
this._opts = assign({filename: filename}, opts);
|
||||
}
|
||||
|
||||
Babelify.prototype._transform = function (buf, enc, callback) {
|
||||
this._data += buf;
|
||||
callback();
|
||||
};
|
||||
|
||||
Babelify.prototype._flush = function (callback) {
|
||||
try {
|
||||
var result = babel.transform(this._data, this._opts);
|
||||
this.emit("babelify", result, this._filename);
|
||||
var code = result.code;
|
||||
this.push(code);
|
||||
} catch(err) {
|
||||
this.emit("error", err);
|
||||
return;
|
||||
}
|
||||
callback();
|
||||
};
|
||||
|
||||
Babelify.configure = function (opts) {
|
||||
opts = assign({}, opts);
|
||||
var extensions = opts.extensions ? babel.util.arrayify(opts.extensions) : null;
|
||||
var sourceMapsAbsolute = opts.sourceMapsAbsolute;
|
||||
if (opts.sourceMaps !== false) opts.sourceMaps = "inline";
|
||||
|
||||
// babelify specific options
|
||||
delete opts.sourceMapsAbsolute;
|
||||
delete opts.extensions;
|
||||
delete opts.filename;
|
||||
|
||||
// babelify backwards-compat
|
||||
delete opts.sourceMapRelative;
|
||||
|
||||
// browserify specific options
|
||||
delete opts._flags;
|
||||
delete opts.basedir;
|
||||
delete opts.global;
|
||||
|
||||
// browserify cli options
|
||||
delete opts._;
|
||||
// "--opt [ a b ]" and "--opt a --opt b" are allowed:
|
||||
if (opts.ignore && opts.ignore._) opts.ignore = opts.ignore._;
|
||||
if (opts.only && opts.only._) opts.only = opts.only._;
|
||||
if (opts.plugins && opts.plugins._) opts.plugins = opts.plugins._;
|
||||
if (opts.presets && opts.presets._) opts.presets = opts.presets._;
|
||||
|
||||
return function (filename) {
|
||||
if (!babel.util.canCompile(filename, extensions)) {
|
||||
return stream.PassThrough();
|
||||
}
|
||||
|
||||
var _opts = sourceMapsAbsolute
|
||||
? assign({sourceFileName: filename}, opts)
|
||||
: opts;
|
||||
|
||||
return new Babelify(filename, _opts);
|
||||
};
|
||||
};
|
||||
63
static/js/ketcher2/node_modules/babelify/package.json
generated
vendored
Normal file
63
static/js/ketcher2/node_modules/babelify/package.json
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "babelify@7.3.0",
|
||||
"_id": "babelify@7.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-qlau3nBn/XvVSWZu4W3ChQh+iOU=",
|
||||
"_location": "/babelify",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "babelify@7.3.0",
|
||||
"name": "babelify",
|
||||
"escapedName": "babelify",
|
||||
"rawSpec": "7.3.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.3.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/babelify/-/babelify-7.3.0.tgz",
|
||||
"_shasum": "aa56aede7067fd7bd549666ee16dc285087e88e5",
|
||||
"_spec": "babelify@7.3.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher",
|
||||
"author": {
|
||||
"name": "Sebastian McKenzie",
|
||||
"email": "sebmck@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babelify/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"babel-core": "^6.0.14",
|
||||
"object-assign": "^4.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Babel browserify transform",
|
||||
"devDependencies": {
|
||||
"babel-plugin-transform-es3-property-literals": "^6.0.14",
|
||||
"babel-plugin-transform-node-env-inline": "^6.0.14",
|
||||
"babel-plugin-transform-react-display-name": "^6.0.14",
|
||||
"babel-plugin-undeclared-variables-check": "^6.0.14",
|
||||
"babel-preset-es2015": "^6.0.14",
|
||||
"babel-preset-react": "^6.0.14",
|
||||
"browserify": "^13.0.0",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"lodash.zipobject": "^4.1.3",
|
||||
"path-is-absolute": "^1.0.0",
|
||||
"tap": "^5.7.1"
|
||||
},
|
||||
"homepage": "https://github.com/babel/babelify",
|
||||
"license": "MIT",
|
||||
"name": "babelify",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/babel/babelify.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "7.3.0"
|
||||
}
|
||||
Reference in New Issue
Block a user