Gregory Rudolph
4 years ago
5262 changed files with 0 additions and 293920 deletions
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../atob/bin/atob.js |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../babel-cli/bin/babel.js |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../babel-cli/bin/babel-doctor.js |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../babel-cli/bin/babel-external-helpers.js |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../babel-cli/bin/babel-node.js |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../babylon/bin/babylon.js |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../browserslist/cli.js |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../jsesc/bin/jsesc |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../json5/lib/cli.js |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../loose-envify/cli.js |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../mkdirp/bin/cmd.js |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../regjsparser/bin/parser |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../semver/bin/semver |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
../user-home/cli.js |
@ -1,4 +0,0 @@
@@ -1,4 +0,0 @@
|
||||
'use strict'; |
||||
module.exports = function () { |
||||
return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; |
||||
}; |
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
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. |
@ -1,109 +0,0 @@
@@ -1,109 +0,0 @@
|
||||
{ |
||||
"_from": "ansi-regex@^2.0.0", |
||||
"_id": "ansi-regex@2.1.1", |
||||
"_inBundle": false, |
||||
"_integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", |
||||
"_location": "/ansi-regex", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "range", |
||||
"registry": true, |
||||
"raw": "ansi-regex@^2.0.0", |
||||
"name": "ansi-regex", |
||||
"escapedName": "ansi-regex", |
||||
"rawSpec": "^2.0.0", |
||||
"saveSpec": null, |
||||
"fetchSpec": "^2.0.0" |
||||
}, |
||||
"_requiredBy": [ |
||||
"/has-ansi", |
||||
"/strip-ansi" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", |
||||
"_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df", |
||||
"_spec": "ansi-regex@^2.0.0", |
||||
"_where": "/home/rudi/Personal/disgord-Thanos/node_modules/has-ansi", |
||||
"author": { |
||||
"name": "Sindre Sorhus", |
||||
"email": "sindresorhus@gmail.com", |
||||
"url": "sindresorhus.com" |
||||
}, |
||||
"bugs": { |
||||
"url": "https://github.com/chalk/ansi-regex/issues" |
||||
}, |
||||
"bundleDependencies": false, |
||||
"deprecated": false, |
||||
"description": "Regular expression for matching ANSI escape codes", |
||||
"devDependencies": { |
||||
"ava": "0.17.0", |
||||
"xo": "0.16.0" |
||||
}, |
||||
"engines": { |
||||
"node": ">=0.10.0" |
||||
}, |
||||
"files": [ |
||||
"index.js" |
||||
], |
||||
"homepage": "https://github.com/chalk/ansi-regex#readme", |
||||
"keywords": [ |
||||
"ansi", |
||||
"styles", |
||||
"color", |
||||
"colour", |
||||
"colors", |
||||
"terminal", |
||||
"console", |
||||
"cli", |
||||
"string", |
||||
"tty", |
||||
"escape", |
||||
"formatting", |
||||
"rgb", |
||||
"256", |
||||
"shell", |
||||
"xterm", |
||||
"command-line", |
||||
"text", |
||||
"regex", |
||||
"regexp", |
||||
"re", |
||||
"match", |
||||
"test", |
||||
"find", |
||||
"pattern" |
||||
], |
||||
"license": "MIT", |
||||
"maintainers": [ |
||||
{ |
||||
"name": "Sindre Sorhus", |
||||
"email": "sindresorhus@gmail.com", |
||||
"url": "sindresorhus.com" |
||||
}, |
||||
{ |
||||
"name": "Joshua Appelman", |
||||
"email": "jappelman@xebia.com", |
||||
"url": "jbnicolai.com" |
||||
}, |
||||
{ |
||||
"name": "JD Ballard", |
||||
"email": "i.am.qix@gmail.com", |
||||
"url": "github.com/qix-" |
||||
} |
||||
], |
||||
"name": "ansi-regex", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/chalk/ansi-regex.git" |
||||
}, |
||||
"scripts": { |
||||
"test": "xo && ava --verbose", |
||||
"view-supported": "node fixtures/view-codes.js" |
||||
}, |
||||
"version": "2.1.1", |
||||
"xo": { |
||||
"rules": { |
||||
"guard-for-in": 0, |
||||
"no-loop-func": 0 |
||||
} |
||||
} |
||||
} |
@ -1,39 +0,0 @@
@@ -1,39 +0,0 @@
|
||||
# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) |
||||
|
||||
> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) |
||||
|
||||
|
||||
## Install |
||||
|
||||
``` |
||||
$ npm install --save ansi-regex |
||||
``` |
||||
|
||||
|
||||
## Usage |
||||
|
||||
```js |
||||
const ansiRegex = require('ansi-regex'); |
||||
|
||||
ansiRegex().test('\u001b[4mcake\u001b[0m'); |
||||
//=> true |
||||
|
||||
ansiRegex().test('cake'); |
||||
//=> false |
||||
|
||||
'\u001b[4mcake\u001b[0m'.match(ansiRegex()); |
||||
//=> ['\u001b[4m', '\u001b[0m'] |
||||
``` |
||||
|
||||
## FAQ |
||||
|
||||
### Why do you test for codes not in the ECMA 48 standard? |
||||
|
||||
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. |
||||
|
||||
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. |
||||
|
||||
|
||||
## License |
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com) |
@ -1,65 +0,0 @@
@@ -1,65 +0,0 @@
|
||||
'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 |
||||
}); |
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
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. |
@ -1,90 +0,0 @@
@@ -1,90 +0,0 @@
|
||||
{ |
||||
"_from": "ansi-styles@^2.2.1", |
||||
"_id": "ansi-styles@2.2.1", |
||||
"_inBundle": false, |
||||
"_integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", |
||||
"_location": "/ansi-styles", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "range", |
||||
"registry": true, |
||||
"raw": "ansi-styles@^2.2.1", |
||||
"name": "ansi-styles", |
||||
"escapedName": "ansi-styles", |
||||
"rawSpec": "^2.2.1", |
||||
"saveSpec": null, |
||||
"fetchSpec": "^2.2.1" |
||||
}, |
||||
"_requiredBy": [ |
||||
"/chalk" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", |
||||
"_shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe", |
||||
"_spec": "ansi-styles@^2.2.1", |
||||
"_where": "/home/rudi/Personal/disgord-Thanos/node_modules/chalk", |
||||
"author": { |
||||
"name": "Sindre Sorhus", |
||||
"email": "sindresorhus@gmail.com", |
||||
"url": "sindresorhus.com" |
||||
}, |
||||
"bugs": { |
||||
"url": "https://github.com/chalk/ansi-styles/issues" |
||||
}, |
||||
"bundleDependencies": false, |
||||
"deprecated": false, |
||||
"description": "ANSI escape codes for styling strings in the terminal", |
||||
"devDependencies": { |
||||
"mocha": "*" |
||||
}, |
||||
"engines": { |
||||
"node": ">=0.10.0" |
||||
}, |
||||
"files": [ |
||||
"index.js" |
||||
], |
||||
"homepage": "https://github.com/chalk/ansi-styles#readme", |
||||
"keywords": [ |
||||
"ansi", |
||||
"styles", |
||||
"color", |
||||
"colour", |
||||
"colors", |
||||
"terminal", |
||||
"console", |
||||
"cli", |
||||
"string", |
||||
"tty", |
||||
"escape", |
||||
"formatting", |
||||
"rgb", |
||||
"256", |
||||
"shell", |
||||
"xterm", |
||||
"log", |
||||
"logging", |
||||
"command-line", |
||||
"text" |
||||
], |
||||
"license": "MIT", |
||||
"maintainers": [ |
||||
{ |
||||
"name": "Sindre Sorhus", |
||||
"email": "sindresorhus@gmail.com", |
||||
"url": "sindresorhus.com" |
||||
}, |
||||
{ |
||||
"name": "Joshua Appelman", |
||||
"email": "jappelman@xebia.com", |
||||
"url": "jbnicolai.com" |
||||
} |
||||
], |
||||
"name": "ansi-styles", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/chalk/ansi-styles.git" |
||||
}, |
||||
"scripts": { |
||||
"test": "mocha" |
||||
}, |
||||
"version": "2.2.1" |
||||
} |
@ -1,86 +0,0 @@
@@ -1,86 +0,0 @@
|
||||
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles) |
||||
|
||||
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal |
||||
|
||||
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. |
||||
|
||||
![](screenshot.png) |
||||
|
||||
|
||||
## Install |
||||
|
||||
``` |
||||
$ npm install --save ansi-styles |
||||
``` |
||||
|
||||
|
||||
## Usage |
||||
|
||||
```js |
||||
var ansi = require('ansi-styles'); |
||||
|
||||
console.log(ansi.green.open + 'Hello world!' + ansi.green.close); |
||||
``` |
||||
|
||||
|
||||
## API |
||||
|
||||
Each style has an `open` and `close` property. |
||||
|
||||
|
||||
## Styles |
||||
|
||||
### Modifiers |
||||
|
||||
- `reset` |
||||
- `bold` |
||||
- `dim` |
||||
- `italic` *(not widely supported)* |
||||
- `underline` |
||||
- `inverse` |
||||
- `hidden` |
||||
- `strikethrough` *(not widely supported)* |
||||
|
||||
### Colors |
||||
|
||||
- `black` |
||||
- `red` |
||||
- `green` |
||||
- `yellow` |
||||
- `blue` |
||||
- `magenta` |
||||
- `cyan` |
||||
- `white` |
||||
- `gray` |
||||
|
||||
### Background colors |
||||
|
||||
- `bgBlack` |
||||
- `bgRed` |
||||
- `bgGreen` |
||||
- `bgYellow` |
||||
- `bgBlue` |
||||
- `bgMagenta` |
||||
- `bgCyan` |
||||
- `bgWhite` |
||||
|
||||
|
||||
## Advanced usage |
||||
|
||||
By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. |
||||
|
||||
- `ansi.modifiers` |
||||
- `ansi.colors` |
||||
- `ansi.bgColors` |
||||
|
||||
|
||||
###### Example |
||||
|
||||
```js |
||||
console.log(ansi.colors.green.open); |
||||
``` |
||||
|
||||
|
||||
## License |
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com) |
@ -1,15 +0,0 @@
@@ -1,15 +0,0 @@
|
||||
The ISC License |
||||
|
||||
Copyright (c) 2014 Elan Shanker |
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any |
||||
purpose with or without fee is hereby granted, provided that the above |
||||
copyright notice and this permission notice appear in all copies. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR |
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
@ -1,98 +0,0 @@
@@ -1,98 +0,0 @@
|
||||
anymatch [![Build Status](https://travis-ci.org/es128/anymatch.svg?branch=master)](https://travis-ci.org/es128/anymatch) [![Coverage Status](https://img.shields.io/coveralls/es128/anymatch.svg?branch=master)](https://coveralls.io/r/es128/anymatch?branch=master) |
||||
====== |
||||
Javascript module to match a string against a regular expression, glob, string, |
||||
or function that takes the string as an argument and returns a truthy or falsy |
||||
value. The matcher can also be an array of any or all of these. Useful for |
||||
allowing a very flexible user-defined config to define things like file paths. |
||||
|
||||
[![NPM](https://nodei.co/npm/anymatch.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/anymatch/) |
||||
[![NPM](https://nodei.co/npm-dl/anymatch.png?height=3&months=9)](https://nodei.co/npm-dl/anymatch/) |
||||
|
||||
Usage |
||||
----- |
||||
```sh |
||||
npm install anymatch --save |
||||
``` |
||||
|
||||
#### anymatch (matchers, testString, [returnIndex], [startIndex], [endIndex]) |
||||
* __matchers__: (_Array|String|RegExp|Function_) |
||||
String to be directly matched, string with glob patterns, regular expression |
||||
test, function that takes the testString as an argument and returns a truthy |
||||
value if it should be matched, or an array of any number and mix of these types. |
||||
* __testString__: (_String|Array_) The string to test against the matchers. If |
||||
passed as an array, the first element of the array will be used as the |
||||
`testString` for non-function matchers, while the entire array will be applied |
||||
as the arguments for function matchers. |
||||
* __returnIndex__: (_Boolean [optional]_) If true, return the array index of |
||||
the first matcher that that testString matched, or -1 if no match, instead of a |
||||
boolean result. |
||||
* __startIndex, endIndex__: (_Integer [optional]_) Can be used to define a |
||||
subset out of the array of provided matchers to test against. Can be useful |
||||
with bound matcher functions (see below). When used with `returnIndex = true` |
||||
preserves original indexing. Behaves the same as `Array.prototype.slice` (i.e. |
||||
includes array members up to, but not including endIndex). |
||||
|
||||
```js |
||||
var anymatch = require('anymatch'); |
||||
|
||||
var matchers = [ |
||||
'path/to/file.js', |
||||
'path/anyjs/**/*.js', |
||||
/foo\.js$/, |
||||
function (string) { |
||||
return string.indexOf('bar') !== -1 && string.length > 10 |
||||
} |
||||
]; |
||||
|
||||
anymatch(matchers, 'path/to/file.js'); // true |
||||
anymatch(matchers, 'path/anyjs/baz.js'); // true |
||||
anymatch(matchers, 'path/to/foo.js'); // true |
||||
anymatch(matchers, 'path/to/bar.js'); // true |
||||
anymatch(matchers, 'bar.js'); // false |
||||
|
||||
// returnIndex = true |
||||
anymatch(matchers, 'foo.js', true); // 2 |
||||
anymatch(matchers, 'path/anyjs/foo.js', true); // 1 |
||||
|
||||
// skip matchers |
||||
anymatch(matchers, 'path/to/file.js', false, 1); // false |
||||
anymatch(matchers, 'path/anyjs/foo.js', true, 2, 3); // 2 |
||||
anymatch(matchers, 'path/to/bar.js', true, 0, 3); // -1 |
||||
|
||||
// using globs to match directories and their children |
||||
anymatch('node_modules', 'node_modules'); // true |
||||
anymatch('node_modules', 'node_modules/somelib/index.js'); // false |
||||
anymatch('node_modules/**', 'node_modules/somelib/index.js'); // true |
||||
anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false |
||||
anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true |
||||
``` |
||||
|
||||
#### anymatch (matchers) |
||||
You can also pass in only your matcher(s) to get a curried function that has |
||||
already been bound to the provided matching criteria. This can be used as an |
||||
`Array.prototype.filter` callback. |
||||
|
||||
```js |
||||
var matcher = anymatch(matchers); |
||||
|
||||
matcher('path/to/file.js'); // true |
||||
matcher('path/anyjs/baz.js', true); // 1 |
||||
matcher('path/anyjs/baz.js', true, 2); // -1 |
||||
|
||||
['foo.js', 'bar.js'].filter(matcher); // ['foo.js'] |
||||
``` |
||||
|
||||
Change Log |
||||
---------- |
||||
[See release notes page on GitHub](https://github.com/es128/anymatch/releases) |
||||
|
||||
NOTE: As of v1.2.0, anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch) |
||||
for glob pattern matching. The glob matching behavior should be functionally |
||||
equivalent to the commonly used [minimatch](https://github.com/isaacs/minimatch) |
||||
library (aside from some fixed bugs and greater performance), so a major |
||||
version bump wasn't merited. Issues with glob pattern matching should be |
||||
reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues). |
||||
|
||||
License |
||||
------- |
||||
[ISC](https://raw.github.com/es128/anymatch/master/LICENSE) |
@ -1,67 +0,0 @@
@@ -1,67 +0,0 @@
|
||||
'use strict'; |
||||
|
||||
var micromatch = require('micromatch'); |
||||
var normalize = require('normalize-path'); |
||||
var path = require('path'); // required for tests.
|
||||
var arrify = function(a) { return a == null ? [] : (Array.isArray(a) ? a : [a]); }; |
||||
|
||||
var anymatch = function(criteria, value, returnIndex, startIndex, endIndex) { |
||||
criteria = arrify(criteria); |
||||
value = arrify(value); |
||||
if (arguments.length === 1) { |
||||
return anymatch.bind(null, criteria.map(function(criterion) { |
||||
return typeof criterion === 'string' && criterion[0] !== '!' ? |
||||
micromatch.matcher(criterion) : criterion; |
||||
})); |
||||
} |
||||
startIndex = startIndex || 0; |
||||
var string = value[0]; |
||||
var altString, altValue; |
||||
var matched = false; |
||||
var matchIndex = -1; |
||||
function testCriteria(criterion, index) { |
||||
var result; |
||||
switch (Object.prototype.toString.call(criterion)) { |
||||
case '[object String]': |
||||
result = string === criterion || altString && altString === criterion; |
||||
result = result || micromatch.isMatch(string, criterion); |
||||
break; |
||||
case '[object RegExp]': |
||||
result = criterion.test(string) || altString && criterion.test(altString); |
||||
break; |
||||
case '[object Function]': |
||||
result = criterion.apply(null, value); |
||||
result = result || altValue && criterion.apply(null, altValue); |
||||
break; |
||||
default: |
||||
result = false; |
||||
} |
||||
if (result) { |
||||
matchIndex = index + startIndex; |
||||
} |
||||
return result; |
||||
} |
||||
var crit = criteria; |
||||
var negGlobs = crit.reduce(function(arr, criterion, index) { |
||||
if (typeof criterion === 'string' && criterion[0] === '!') { |
||||
if (crit === criteria) { |
||||
// make a copy before modifying
|
||||
crit = crit.slice(); |
||||
} |
||||
crit[index] = null; |
||||
arr.push(criterion.substr(1)); |
||||
} |
||||
return arr; |
||||
}, []); |
||||
if (!negGlobs.length || !micromatch.any(string, negGlobs)) { |
||||
if (path.sep === '\\' && typeof string === 'string') { |
||||
altString = normalize(string); |
||||
altString = altString === string ? null : altString; |
||||
if (altString) altValue = [altString].concat(value.slice(1)); |
||||
} |
||||
matched = crit.slice(startIndex, endIndex).some(testCriteria); |
||||
} |
||||
return returnIndex === true ? matchIndex : matched; |
||||
}; |
||||
|
||||
module.exports = anymatch; |
@ -1,72 +0,0 @@
@@ -1,72 +0,0 @@
|
||||
{ |
||||
"_from": "anymatch@^1.3.0", |
||||
"_id": "anymatch@1.3.2", |
||||
"_inBundle": false, |
||||
"_integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", |
||||
"_location": "/anymatch", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "range", |
||||
"registry": true, |
||||
"raw": "anymatch@^1.3.0", |
||||
"name": "anymatch", |
||||
"escapedName": "anymatch", |
||||
"rawSpec": "^1.3.0", |
||||
"saveSpec": null, |
||||
"fetchSpec": "^1.3.0" |
||||
}, |
||||
"_requiredBy": [ |
||||
"/chokidar" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", |
||||
"_shasum": "553dcb8f91e3c889845dfdba34c77721b90b9d7a", |
||||
"_spec": "anymatch@^1.3.0", |
||||
"_where": "/home/rudi/Personal/disgord-Thanos/node_modules/chokidar", |
||||
"author": { |
||||
"name": "Elan Shanker", |
||||
"url": "http://github.com/es128" |
||||
}, |
||||
"bugs": { |
||||
"url": "https://github.com/es128/anymatch/issues" |
||||
}, |
||||
"bundleDependencies": false, |
||||
"dependencies": { |
||||
"micromatch": "^2.1.5", |
||||
"normalize-path": "^2.0.0" |
||||
}, |
||||
"deprecated": false, |
||||
"description": "Matches strings against configurable strings, globs, regular expressions, and/or functions", |
||||
"devDependencies": { |
||||
"coveralls": "^2.11.2", |
||||
"istanbul": "^0.3.13", |
||||
"mocha": "^2.2.4" |
||||
}, |
||||
"files": [ |
||||
"index.js" |
||||
], |
||||
"homepage": "https://github.com/es128/anymatch", |
||||
"keywords": [ |
||||
"match", |
||||
"any", |
||||
"string", |
||||
"file", |
||||
"fs", |
||||
"list", |
||||
"glob", |
||||
"regex", |
||||
"regexp", |
||||
"regular", |
||||
"expression", |
||||
"function" |
||||
], |
||||
"license": "ISC", |
||||
"name": "anymatch", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/es128/anymatch.git" |
||||
}, |
||||
"scripts": { |
||||
"test": "istanbul cover _mocha && cat ./coverage/lcov.info | coveralls" |
||||
}, |
||||
"version": "1.3.2" |
||||
} |
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) 2014-2015, Jon Schlinkert. |
||||
|
||||
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. |
@ -1,74 +0,0 @@
@@ -1,74 +0,0 @@
|
||||
# arr-diff [![NPM version](https://img.shields.io/npm/v/arr-diff.svg)](https://www.npmjs.com/package/arr-diff) [![Build Status](https://img.shields.io/travis/jonschlinkert/base.svg)](https://travis-ci.org/jonschlinkert/base) |
||||
|
||||
> Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons. |
||||
|
||||
## Install |
||||
|
||||
Install with [npm](https://www.npmjs.com/) |
||||
|
||||
```sh |
||||
$ npm i arr-diff --save |
||||
``` |
||||
Install with [bower](http://bower.io/) |
||||
|
||||
```sh |
||||
$ bower install arr-diff --save |
||||
``` |
||||
|
||||
## API |
||||
|
||||
### [diff](index.js#L33) |
||||
|
||||
Return the difference between the first array and additional arrays. |
||||
|
||||
**Params** |
||||
|
||||
* `a` **{Array}** |
||||
* `b` **{Array}** |
||||
* `returns` **{Array}** |
||||
|
||||
**Example** |
||||
|
||||
```js |
||||
var diff = require('arr-diff'); |
||||
|
||||
var a = ['a', 'b', 'c', 'd']; |
||||
var b = ['b', 'c']; |
||||
|
||||
console.log(diff(a, b)) |
||||
//=> ['a', 'd'] |
||||
``` |
||||
|
||||
## Related projects |
||||
|
||||
* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten) |
||||
* [array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter) |
||||
* [array-intersection](https://www.npmjs.com/package/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality… [more](https://www.npmjs.com/package/array-intersection) | [homepage](https://github.com/jonschlinkert/array-intersection) |
||||
|
||||
## Running tests |
||||
|
||||
Install dev dependencies: |
||||
|
||||
```sh |
||||
$ npm i -d && npm test |
||||
``` |
||||
|
||||
## Contributing |
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/arr-diff/issues/new). |
||||
|
||||
## Author |
||||
|
||||
**Jon Schlinkert** |
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert) |
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) |
||||
|
||||
## License |
||||
|
||||
Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert) |
||||
Released under the MIT license. |
||||
|
||||
*** |
||||
|
||||
_This file was generated by [verb](https://github.com/verbose/verb) on Sat Dec 05 2015 23:24:53 GMT-0500 (EST)._ |
@ -1,58 +0,0 @@
@@ -1,58 +0,0 @@
|
||||
/*! |
||||
* arr-diff <https://github.com/jonschlinkert/arr-diff>
|
||||
* |
||||
* Copyright (c) 2014 Jon Schlinkert, contributors. |
||||
* Licensed under the MIT License |
||||
*/ |
||||
|
||||
'use strict'; |
||||
|
||||
var flatten = require('arr-flatten'); |
||||
var slice = [].slice; |
||||
|
||||
/** |
||||
* Return the difference between the first array and |
||||
* additional arrays. |
||||
* |
||||
* ```js
|
||||
* var diff = require('{%= name %}'); |
||||
* |
||||
* var a = ['a', 'b', 'c', 'd']; |
||||
* var b = ['b', 'c']; |
||||
* |
||||
* console.log(diff(a, b)) |
||||
* //=> ['a', 'd']
|
||||
* ``` |
||||
* |
||||
* @param {Array} `a` |
||||
* @param {Array} `b` |
||||
* @return {Array} |
||||
* @api public |
||||
*/ |
||||
|
||||
function diff(arr, arrays) { |
||||
var argsLen = arguments.length; |
||||
var len = arr.length, i = -1; |
||||
var res = [], arrays; |
||||
|
||||
if (argsLen === 1) { |
||||
return arr; |
||||
} |
||||
|
||||
if (argsLen > 2) { |
||||
arrays = flatten(slice.call(arguments, 1)); |
||||
} |
||||
|
||||
while (++i < len) { |
||||
if (!~arrays.indexOf(arr[i])) { |
||||
res.push(arr[i]); |
||||
} |
||||
} |
||||
return res; |
||||
} |
||||
|
||||
/** |
||||
* Expose `diff` |
||||
*/ |
||||
|
||||
module.exports = diff; |
@ -1,80 +0,0 @@
@@ -1,80 +0,0 @@
|
||||
{ |
||||
"_from": "arr-diff@^2.0.0", |
||||
"_id": "arr-diff@2.0.0", |
||||
"_inBundle": false, |
||||
"_integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", |
||||
"_location": "/arr-diff", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "range", |
||||
"registry": true, |
||||
"raw": "arr-diff@^2.0.0", |
||||
"name": "arr-diff", |
||||
"escapedName": "arr-diff", |
||||
"rawSpec": "^2.0.0", |
||||
"saveSpec": null, |
||||
"fetchSpec": "^2.0.0" |
||||
}, |
||||
"_requiredBy": [ |
||||
"/micromatch" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", |
||||
"_shasum": "8f3b827f955a8bd669697e4a4256ac3ceae356cf", |
||||
"_spec": "arr-diff@^2.0.0", |
||||
"_where": "/home/rudi/Personal/disgord-Thanos/node_modules/micromatch", |
||||
"author": { |
||||
"name": "Jon Schlinkert", |
||||
"url": "https://github.com/jonschlinkert" |
||||
}, |
||||
"bugs": { |
||||
"url": "https://github.com/jonschlinkert/arr-diff/issues" |
||||
}, |
||||
"bundleDependencies": false, |
||||
"dependencies": { |
||||
"arr-flatten": "^1.0.1" |
||||
}, |
||||
"deprecated": false, |
||||
"description": "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.", |
||||
"devDependencies": { |
||||
"array-differ": "^1.0.0", |
||||
"array-slice": "^0.2.3", |
||||
"benchmarked": "^0.1.4", |
||||
"chalk": "^1.1.1", |
||||
"mocha": "*", |
||||
"should": "*" |
||||
}, |
||||
"engines": { |
||||
"node": ">=0.10.0" |
||||
}, |
||||
"files": [ |
||||
"index.js" |
||||
], |
||||
"homepage": "https://github.com/jonschlinkert/arr-diff", |
||||
"keywords": [ |
||||
"arr", |
||||
"array", |
||||
"diff", |
||||
"differ", |
||||
"difference" |
||||
], |
||||
"license": "MIT", |
||||
"main": "index.js", |
||||
"name": "arr-diff", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/jonschlinkert/arr-diff.git" |
||||
}, |
||||
"scripts": { |
||||
"test": "mocha" |
||||
}, |
||||
"verb": { |
||||
"related": { |
||||
"list": [ |
||||
"arr-flatten", |
||||
"array-filter", |
||||
"array-intersection" |
||||
] |
||||
} |
||||
}, |
||||
"version": "2.0.0" |
||||
} |
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) 2014-2017, Jon Schlinkert. |
||||
|
||||
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. |
@ -1,86 +0,0 @@
@@ -1,86 +0,0 @@
|
||||
# arr-flatten [![NPM version](https://img.shields.io/npm/v/arr-flatten.svg?style=flat)](https://www.npmjs.com/package/arr-flatten) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![NPM total downloads](https://img.shields.io/npm/dt/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-flatten.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/arr-flatten) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/arr-flatten.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/arr-flatten) |
||||
|
||||
> Recursively flatten an array or arrays. |
||||
|
||||
## Install |
||||
|
||||
Install with [npm](https://www.npmjs.com/): |
||||
|
||||
```sh |
||||
$ npm install --save arr-flatten |
||||
``` |
||||
|
||||
## Install |
||||
|
||||
Install with [bower](https://bower.io/) |
||||
|
||||
```sh |
||||
$ bower install arr-flatten --save |
||||
``` |
||||
|
||||
## Usage |
||||
|
||||
```js |
||||
var flatten = require('arr-flatten'); |
||||
|
||||
flatten(['a', ['b', ['c']], 'd', ['e']]); |
||||
//=> ['a', 'b', 'c', 'd', 'e'] |
||||
``` |
||||
|
||||
## Why another flatten utility? |
||||
|
||||
I wanted the fastest implementation I could find, with implementation choices that should work for 95% of use cases, but no cruft to cover the other 5%. |
||||
|
||||
## About |
||||
|
||||
### Related projects |
||||
|
||||
* [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter "Faster alternative to javascript's native filter method.") |
||||
* [arr-union](https://www.npmjs.com/package/arr-union): Combines a list of arrays, returning a single array with unique values, using strict equality… [more](https://github.com/jonschlinkert/arr-union) | [homepage](https://github.com/jonschlinkert/arr-union "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.") |
||||
* [array-each](https://www.npmjs.com/package/array-each): Loop over each item in an array and call the given function on every element. | [homepage](https://github.com/jonschlinkert/array-each "Loop over each item in an array and call the given function on every element.") |
||||
* [array-unique](https://www.npmjs.com/package/array-unique): Remove duplicate values from an array. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique "Remove duplicate values from an array. Fastest ES5 implementation.") |
||||
|
||||
### Contributing |
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). |
||||
|
||||
### Contributors |
||||
|
||||
| **Commits** | **Contributor** | |
||||
| --- | --- | |
||||
| 20 | [jonschlinkert](https://github.com/jonschlinkert) | |
||||
| 1 | [lukeed](https://github.com/lukeed) | |
||||
|
||||
### Building docs |
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ |
||||
|
||||
To generate the readme, run the following command: |
||||
|
||||
```sh |
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb |
||||
``` |
||||
|
||||
### Running tests |
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: |
||||
|
||||
```sh |
||||
$ npm install && npm test |
||||
``` |
||||
|
||||
### Author |
||||
|
||||
**Jon Schlinkert** |
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert) |
||||
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) |
||||
|
||||
### License |
||||
|
||||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). |
||||
Released under the [MIT License](LICENSE). |
||||
|
||||
*** |
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 05, 2017._ |
@ -1,22 +0,0 @@
@@ -1,22 +0,0 @@
|
||||
/*! |
||||
* arr-flatten <https://github.com/jonschlinkert/arr-flatten>
|
||||
* |
||||
* Copyright (c) 2014-2017, Jon Schlinkert. |
||||
* Released under the MIT License. |
||||
*/ |
||||
|
||||
'use strict'; |
||||
|
||||
module.exports = function (arr) { |
||||
return flat(arr, []); |
||||
}; |
||||
|
||||
function flat(arr, res) { |
||||
var i = 0, cur; |
||||
var len = arr.length; |
||||
for (; i < len; i++) { |
||||
cur = arr[i]; |
||||
Array.isArray(cur) ? flat(cur, res) : res.push(cur); |
||||
} |
||||
return res; |
||||
} |
@ -1,114 +0,0 @@
@@ -1,114 +0,0 @@
|
||||
{ |
||||
"_from": "arr-flatten@^1.0.1", |
||||
"_id": "arr-flatten@1.1.0", |
||||
"_inBundle": false, |
||||
"_integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", |
||||
"_location": "/arr-flatten", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "range", |
||||
"registry": true, |
||||
"raw": "arr-flatten@^1.0.1", |
||||
"name": "arr-flatten", |
||||
"escapedName": "arr-flatten", |
||||
"rawSpec": "^1.0.1", |
||||
"saveSpec": null, |
||||
"fetchSpec": "^1.0.1" |
||||
}, |
||||
"_requiredBy": [ |
||||
"/arr-diff", |
||||
"/readdirp/braces" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", |
||||
"_shasum": "36048bbff4e7b47e136644316c99669ea5ae91f1", |
||||
"_spec": "arr-flatten@^1.0.1", |
||||
"_where": "/home/rudi/Personal/disgord-Thanos/node_modules/arr-diff", |
||||
"author": { |
||||
"name": "Jon Schlinkert", |
||||
"url": "https://github.com/jonschlinkert" |
||||
}, |
||||
"bugs": { |
||||
"url": "https://github.com/jonschlinkert/arr-flatten/issues" |
||||
}, |
||||
"bundleDependencies": false, |
||||
"contributors": [ |
||||
{ |
||||
"name": "Jon Schlinkert", |
||||
"url": "http://twitter.com/jonschlinkert" |
||||
}, |
||||
{ |
||||
"name": "Luke Edwards", |
||||
"url": "https://lukeed.com" |
||||
} |
||||
], |
||||
"deprecated": false, |
||||
"description": "Recursively flatten an array or arrays.", |
||||
"devDependencies": { |
||||
"ansi-bold": "^0.1.1", |
||||
"array-flatten": "^2.1.1", |
||||
"array-slice": "^1.0.0", |
||||
"benchmarked": "^1.0.0", |
||||
"compute-flatten": "^1.0.0", |
||||
"flatit": "^1.1.1", |
||||
"flatten": "^1.0.2", |
||||
"flatten-array": "^1.0.0", |
||||
"glob": "^7.1.1", |
||||
"gulp-format-md": "^0.1.12", |
||||
"just-flatten-it": "^1.1.23", |
||||
"lodash.flattendeep": "^4.4.0", |
||||
"m_flattened": "^1.0.1", |
||||
"mocha": "^3.2.0", |
||||
"utils-flatten": "^1.0.0", |
||||
"write": "^0.3.3" |
||||
}, |
||||
"engines": { |
||||
"node": ">=0.10.0" |
||||
}, |
||||
"files": [ |
||||
"index.js" |
||||
], |
||||
"homepage": "https://github.com/jonschlinkert/arr-flatten", |
||||
"keywords": [ |
||||
"arr", |
||||
"array", |
||||
"elements", |
||||
"flat", |
||||
"flatten", |
||||
"nested", |
||||
"recurse", |
||||
"recursive", |
||||
"recursively" |
||||
], |
||||
"license": "MIT", |
||||
"main": "index.js", |
||||
"name": "arr-flatten", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/jonschlinkert/arr-flatten.git" |
||||
}, |
||||
"scripts": { |
||||
"test": "mocha" |
||||
}, |
||||
"verb": { |
||||
"toc": false, |
||||
"layout": "default", |
||||
"tasks": [ |
||||
"readme" |
||||
], |
||||
"plugins": [ |
||||
"gulp-format-md" |
||||
], |
||||
"related": { |
||||
"list": [ |
||||
"arr-filter", |
||||
"arr-union", |
||||
"array-each", |
||||
"array-unique" |
||||
] |
||||
}, |
||||
"lint": { |
||||
"reflinks": true |
||||
} |
||||
}, |
||||
"version": "1.1.0" |
||||
} |
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) 2014-2016, Jon Schlinkert. |
||||
|
||||
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. |
@ -1,99 +0,0 @@
@@ -1,99 +0,0 @@
|
||||
# arr-union [![NPM version](https://img.shields.io/npm/v/arr-union.svg)](https://www.npmjs.com/package/arr-union) [![Build Status](https://img.shields.io/travis/jonschlinkert/arr-union.svg)](https://travis-ci.org/jonschlinkert/arr-union) |
||||
|
||||
> Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons. |
||||
|
||||
## Install |
||||
|
||||
Install with [npm](https://www.npmjs.com/): |
||||
|
||||
```sh |
||||
$ npm i arr-union --save |
||||
``` |
||||
|
||||
## Benchmarks |
||||
|
||||
This library is **10-20 times faster** and more performant than [array-union](https://github.com/sindresorhus/array-union). |
||||
|
||||
See the [benchmarks](./benchmark). |
||||
|
||||
```sh |
||||
#1: five-arrays |
||||
array-union x 511,121 ops/sec ±0.80% (96 runs sampled) |
||||
arr-union x 5,716,039 ops/sec ±0.86% (93 runs sampled) |
||||
|
||||
#2: ten-arrays |
||||
array-union x 245,196 ops/sec ±0.69% (94 runs sampled) |
||||
arr-union x 1,850,786 ops/sec ±0.84% (97 runs sampled) |
||||
|
||||
#3: two-arrays |
||||
array-union x 563,869 ops/sec ±0.97% (94 runs sampled) |
||||
arr-union x 9,602,852 ops/sec ±0.87% (92 runs sampled) |
||||
``` |
||||
|
||||
## Usage |
||||
|
||||
```js |
||||
var union = require('arr-union'); |
||||
|
||||
union(['a'], ['b', 'c'], ['d', 'e', 'f']); |
||||
//=> ['a', 'b', 'c', 'd', 'e', 'f'] |
||||
``` |
||||
|
||||
Returns only unique elements: |
||||
|
||||
```js |
||||
union(['a', 'a'], ['b', 'c']); |
||||
//=> ['a', 'b', 'c'] |
||||
``` |
||||
|
||||
## Related projects |
||||
|
||||
* [arr-diff](https://www.npmjs.com/package/arr-diff): Returns an array with only the unique values from the first array, by excluding all… [more](https://www.npmjs.com/package/arr-diff) | [homepage](https://github.com/jonschlinkert/arr-diff) |
||||
* [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter) |
||||
* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten) |
||||
* [arr-map](https://www.npmjs.com/package/arr-map): Faster, node.js focused alternative to JavaScript's native array map. | [homepage](https://github.com/jonschlinkert/arr-map) |
||||
* [arr-pluck](https://www.npmjs.com/package/arr-pluck): Retrieves the value of a specified property from all elements in the collection. | [homepage](https://github.com/jonschlinkert/arr-pluck) |
||||
* [arr-reduce](https://www.npmjs.com/package/arr-reduce): Fast array reduce that also loops over sparse elements. | [homepage](https://github.com/jonschlinkert/arr-reduce) |
||||
* [array-unique](https://www.npmjs.com/package/array-unique): Return an array free of duplicate values. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique) |
||||
|
||||
## Contributing |
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/arr-union/issues/new). |
||||
|
||||
## Building docs |
||||
|
||||
Generate readme and API documentation with [verb](https://github.com/verbose/verb): |
||||
|
||||
```sh |
||||
$ npm i verb && npm run docs |
||||
``` |
||||
|
||||
Or, if [verb](https://github.com/verbose/verb) is installed globally: |
||||
|
||||
```sh |
||||
$ verb |
||||
``` |
||||
|
||||
## Running tests |
||||
|
||||
Install dev dependencies: |
||||
|
||||
```sh |
||||
$ npm i -d && npm test |
||||
``` |
||||
|
||||
## Author |
||||
|
||||
**Jon Schlinkert** |
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert) |
||||
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) |
||||
|
||||
## License |
||||
|
||||
Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert) |
||||
Released under the [MIT license](https://github.com/jonschlinkert/arr-union/blob/master/LICENSE). |
||||
|
||||
*** |
||||
|
||||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on February 23, 2016._ |
@ -1,29 +0,0 @@
@@ -1,29 +0,0 @@
|
||||
'use strict'; |
||||
|
||||
module.exports = function union(init) { |
||||
if (!Array.isArray(init)) { |
||||
throw new TypeError('arr-union expects the first argument to be an array.'); |
||||
} |
||||
|
||||
var len = arguments.length; |
||||
var i = 0; |
||||
|
||||
while (++i < len) { |
||||
var arg = arguments[i]; |
||||
if (!arg) continue; |
||||
|
||||
if (!Array.isArray(arg)) { |
||||
arg = [arg]; |
||||
} |
||||
|
||||
for (var j = 0; j < arg.length; j++) { |
||||
var ele = arg[j]; |
||||
|
||||
if (init.indexOf(ele) >= 0) { |
||||
continue; |
||||
} |
||||
init.push(ele); |
||||
} |
||||
} |
||||
return init; |
||||
}; |
@ -1,108 +0,0 @@
@@ -1,108 +0,0 @@
|
||||
{ |
||||
"_from": "arr-union@^3.1.0", |
||||
"_id": "arr-union@3.1.0", |
||||
"_inBundle": false, |
||||
"_integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", |
||||
"_location": "/arr-union", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "range", |
||||
"registry": true, |
||||
"raw": "arr-union@^3.1.0", |
||||
"name": "arr-union", |
||||
"escapedName": "arr-union", |
||||
"rawSpec": "^3.1.0", |
||||
"saveSpec": null, |
||||
"fetchSpec": "^3.1.0" |
||||
}, |
||||
"_requiredBy": [ |
||||
"/class-utils", |
||||
"/union-value" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", |
||||
"_shasum": "e39b09aea9def866a8f206e288af63919bae39c4", |
||||
"_spec": "arr-union@^3.1.0", |
||||
"_where": "/home/rudi/Personal/disgord-Thanos/node_modules/union-value", |
||||
"author": { |
||||
"name": "Jon Schlinkert", |
||||
"url": "https://github.com/jonschlinkert" |
||||
}, |
||||
"bugs": { |
||||
"url": "https://github.com/jonschlinkert/arr-union/issues" |
||||
}, |
||||
"bundleDependencies": false, |
||||
"deprecated": false, |
||||
"description": "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.", |
||||
"devDependencies": { |
||||
"ansi-bold": "^0.1.1", |
||||
"array-union": "^1.0.1", |
||||
"array-unique": "^0.2.1", |
||||
"benchmarked": "^0.1.4", |
||||
"gulp-format-md": "^0.1.7", |
||||
"minimist": "^1.1.1", |
||||
"mocha": "*", |
||||
"should": "*" |
||||
}, |
||||
"engines": { |
||||
"node": ">=0.10.0" |
||||
}, |
||||
"files": [ |
||||
"index.js" |
||||
], |
||||
"homepage": "https://github.com/jonschlinkert/arr-union", |
||||
"keywords": [ |
||||
"add", |
||||
"append", |
||||
"array", |
||||
"arrays", |
||||
"combine", |
||||
"concat", |
||||
"extend", |
||||
"union", |
||||
"uniq", |
||||
"unique", |
||||
"util", |
||||
"utility", |
||||
"utils" |
||||
], |
||||
"license": "MIT", |
||||
"main": "index.js", |
||||
"name": "arr-union", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/jonschlinkert/arr-union.git" |
||||
}, |
||||
"scripts": { |
||||
"test": "mocha" |
||||
}, |
||||
"verb": { |
||||
"run": true, |
||||
"toc": false, |
||||
"layout": "default", |
||||
"tasks": [ |
||||
"readme" |
||||
], |
||||
"plugins": [ |
||||
"gulp-format-md" |
||||
], |
||||
"related": { |
||||
"list": [ |
||||
"arr-diff", |
||||
"arr-flatten", |
||||
"arr-filter", |
||||
"arr-map", |
||||
"arr-pluck", |
||||
"arr-reduce", |
||||
"array-unique" |
||||
] |
||||
}, |
||||
"reflinks": [ |
||||
"verb", |
||||
"array-union" |
||||
], |
||||
"lint": { |
||||
"reflinks": true |
||||
} |
||||
}, |
||||
"version": "3.1.0" |
||||
} |
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) 2014-2015, Jon Schlinkert. |
||||
|
||||
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. |
@ -1,51 +0,0 @@
@@ -1,51 +0,0 @@
|
||||
# array-unique [![NPM version](https://badge.fury.io/js/array-unique.svg)](http://badge.fury.io/js/array-unique) [![Build Status](https://travis-ci.org/jonschlinkert/array-unique.svg)](https://travis-ci.org/jonschlinkert/array-unique) |
||||
|
||||
> Return an array free of duplicate values. Fastest ES5 implementation. |
||||
|
||||
## Install with [npm](npmjs.org) |
||||
|
||||
```bash |
||||
npm i array-unique --save |
||||
``` |
||||
|
||||
## Usage |
||||
|
||||
```js |
||||
var unique = require('array-unique'); |
||||
|
||||
unique(['a', 'b', 'c', 'c']); |
||||
//=> ['a', 'b', 'c'] |
||||
``` |
||||
|
||||
## Related |
||||
* [arr-diff](https://github.com/jonschlinkert/arr-diff): Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons. |
||||
* [arr-union](https://github.com/jonschlinkert/arr-union): Returns an array of unique values using strict equality for comparisons. |
||||
* [arr-flatten](https://github.com/jonschlinkert/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. |
||||
* [arr-reduce](https://github.com/jonschlinkert/arr-reduce): Fast array reduce that also loops over sparse elements. |
||||
* [arr-map](https://github.com/jonschlinkert/arr-map): Faster, node.js focused alternative to JavaScript's native array map. |
||||
* [arr-pluck](https://github.com/jonschlinkert/arr-pluck): Retrieves the value of a specified property from all elements in the collection. |
||||
|
||||
## Run tests |
||||
Install dev dependencies. |
||||
|
||||
```bash |
||||
npm i -d && npm test |
||||
``` |
||||
|
||||
## Contributing |
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/array-unique/issues) |
||||
|
||||
## Author |
||||
|
||||
**Jon Schlinkert** |
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert) |
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) |
||||
|
||||
## License |
||||
Copyright (c) 2015 Jon Schlinkert |
||||
Released under the MIT license |
||||
|
||||
*** |
||||
|
||||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 24, 2015._ |
@ -1,28 +0,0 @@
@@ -1,28 +0,0 @@
|
||||
/*! |
||||
* array-unique <https://github.com/jonschlinkert/array-unique>
|
||||
* |
||||
* Copyright (c) 2014-2015, Jon Schlinkert. |
||||
* Licensed under the MIT License. |
||||
*/ |
||||
|
||||
'use strict'; |
||||
|
||||
module.exports = function unique(arr) { |
||||
if (!Array.isArray(arr)) { |
||||
throw new TypeError('array-unique expects an array.'); |
||||
} |
||||
|
||||
var len = arr.length; |
||||
var i = -1; |
||||
|
||||
while (i++ < len) { |
||||
var j = i + 1; |
||||
|
||||
for (; j < arr.length; ++j) { |
||||
if (arr[i] === arr[j]) { |
||||
arr.splice(j--, 1); |
||||
} |
||||
} |
||||
} |
||||
return arr; |
||||
}; |
@ -1,62 +0,0 @@
@@ -1,62 +0,0 @@
|
||||
{ |
||||
"_from": "array-unique@^0.2.1", |
||||
"_id": "array-unique@0.2.1", |
||||
"_inBundle": false, |
||||
"_integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", |
||||
"_location": "/array-unique", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "range", |
||||
"registry": true, |
||||
"raw": "array-unique@^0.2.1", |
||||
"name": "array-unique", |
||||
"escapedName": "array-unique", |
||||
"rawSpec": "^0.2.1", |
||||
"saveSpec": null, |
||||
"fetchSpec": "^0.2.1" |
||||
}, |
||||
"_requiredBy": [ |
||||
"/micromatch" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", |
||||
"_shasum": "a1d97ccafcbc2625cc70fadceb36a50c58b01a53", |
||||
"_spec": "array-unique@^0.2.1", |
||||
"_where": "/home/rudi/Personal/disgord-Thanos/node_modules/micromatch", |
||||
"author": { |
||||
"name": "Jon Schlinkert", |
||||
"url": "https://github.com/jonschlinkert" |
||||
}, |
||||
"bugs": { |
||||
"url": "https://github.com/jonschlinkert/array-unique/issues" |
||||
}, |
||||
"bundleDependencies": false, |
||||
"deprecated": false, |
||||
"description": "Return an array free of duplicate values. Fastest ES5 implementation.", |
||||
"devDependencies": { |
||||
"array-uniq": "^1.0.2", |
||||
"benchmarked": "^0.1.3", |
||||
"mocha": "*", |
||||
"should": "*" |
||||
}, |
||||
"engines": { |
||||
"node": ">=0.10.0" |
||||
}, |
||||
"files": [ |
||||
"index.js" |
||||
], |
||||
"homepage": "https://github.com/jonschlinkert/array-unique", |
||||
"license": { |
||||
"type": "MIT", |
||||
"url": "https://github.com/jonschlinkert/array-unique/blob/master/LICENSE" |
||||
}, |
||||
"main": "index.js", |
||||
"name": "array-unique", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git://github.com/jonschlinkert/array-unique.git" |
||||
}, |
||||
"scripts": { |
||||
"test": "mocha" |
||||
}, |
||||
"version": "0.2.1" |
||||
} |
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) 2015, Jon Schlinkert. |
||||
|
||||
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. |
@ -1,73 +0,0 @@
@@ -1,73 +0,0 @@
|
||||
# assign-symbols [![NPM version](https://badge.fury.io/js/assign-symbols.svg)](http://badge.fury.io/js/assign-symbols) |
||||
|
||||
> Assign the enumerable es6 Symbol properties from an object (or objects) to the first object passed on the arguments. Can be used as a supplement to other extend, assign or merge methods as a polyfill for the Symbols part of the es6 Object.assign method. |
||||
|
||||
From the [Mozilla Developer docs for Symbol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol): |
||||
|
||||
> A symbol is a unique and immutable data type and may be used as an identifier for object properties. The symbol object is an implicit object wrapper for the symbol primitive data type. |
||||
|
||||
## Install |
||||
|
||||
Install with [npm](https://www.npmjs.com/) |
||||
|
||||
```sh |
||||
$ npm i assign-symbols --save |
||||
``` |
||||
|
||||
## Usage |
||||
|
||||
```js |
||||
var assignSymbols = require('assign-symbols'); |
||||
var obj = {}; |
||||
|
||||
var one = {}; |
||||
var symbolOne = Symbol('aaa'); |
||||
one[symbolOne] = 'bbb'; |
||||
|
||||
var two = {}; |
||||
var symbolTwo = Symbol('ccc'); |
||||
two[symbolTwo] = 'ddd'; |
||||
|
||||
assignSymbols(obj, one, two); |
||||
|
||||
console.log(obj[symbolOne]); |
||||
//=> 'bbb' |
||||
console.log(obj[symbolTwo]); |
||||
//=> 'ddd' |
||||
``` |
||||
|
||||
## Similar projects |
||||
|
||||
* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties of source objects to a destination object. | [homepage](https://github.com/jonschlinkert/assign-deep) |
||||
* [clone-deep](https://www.npmjs.com/package/clone-deep): Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives. | [homepage](https://github.com/jonschlinkert/clone-deep) |
||||
* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow) |
||||
* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep) |
||||
* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep) |
||||
|
||||
## Running tests |
||||
|
||||
Install dev dependencies: |
||||
|
||||
```sh |
||||
$ npm i -d && npm test |
||||
``` |
||||
|
||||
## Contributing |
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/assign-symbols/issues/new). |
||||
|
||||
## Author |
||||
|
||||
**Jon Schlinkert** |
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert) |
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) |
||||
|
||||
## License |
||||
|
||||
Copyright © 2015 Jon Schlinkert |
||||
Released under the MIT license. |
||||
|
||||
*** |
||||
|
||||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 06, 2015._ |
@ -1,40 +0,0 @@
@@ -1,40 +0,0 @@
|
||||
/*! |
||||
* assign-symbols <https://github.com/jonschlinkert/assign-symbols>
|
||||
* |
||||
* Copyright (c) 2015, Jon Schlinkert. |
||||
* Licensed under the MIT License. |
||||
*/ |
||||
|
||||
'use strict'; |
||||
|
||||
module.exports = function(receiver, objects) { |
||||
if (receiver === null || typeof receiver === 'undefined') { |
||||
throw new TypeError('expected first argument to be an object.'); |
||||
} |
||||
|
||||
if (typeof objects === 'undefined' || typeof Symbol === 'undefined') { |
||||
return receiver; |
||||
} |
||||
|
||||
if (typeof Object.getOwnPropertySymbols !== 'function') { |
||||
return receiver; |
||||
} |
||||
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable; |
||||
var target = Object(receiver); |
||||
var len = arguments.length, i = 0; |
||||
|
||||
while (++i < len) { |
||||
var provider = Object(arguments[i]); |
||||
var names = Object.getOwnPropertySymbols(provider); |
||||
|
||||
for (var j = 0; j < names.length; j++) { |
||||
var key = names[j]; |
||||
|
||||
if (isEnumerable.call(provider, key)) { |
||||
target[key] = provider[key]; |
||||
} |
||||
} |
||||
} |
||||
return target; |
||||
}; |
@ -1,71 +0,0 @@
@@ -1,71 +0,0 @@
|
||||
{ |
||||
"_from": "assign-symbols@^1.0.0", |
||||
"_id": "assign-symbols@1.0.0", |
||||
"_inBundle": false, |
||||
"_integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", |
||||
"_location": "/assign-symbols", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "range", |
||||
"registry": true, |
||||
"raw": "assign-symbols@^1.0.0", |
||||
"name": "assign-symbols", |
||||
"escapedName": "assign-symbols", |
||||
"rawSpec": "^1.0.0", |
||||
"saveSpec": null, |
||||
"fetchSpec": "^1.0.0" |
||||
}, |
||||
"_requiredBy": [ |
||||
"/extend-shallow" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", |
||||
"_shasum": "59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367", |
||||
"_spec": "assign-symbols@^1.0.0", |
||||
"_where": "/home/rudi/Personal/disgord-Thanos/node_modules/extend-shallow", |
||||
"author": { |
||||
"name": "Jon Schlinkert", |
||||
"url": "https://github.com/jonschlinkert" |
||||
}, |
||||
"bugs": { |
||||
"url": "https://github.com/jonschlinkert/assign-symbols/issues" |
||||
}, |
||||
"bundleDependencies": false, |
||||
"deprecated": false, |
||||
"description": "Assign the enumerable es6 Symbol properties from an object (or objects) to the first object passed on the arguments. Can be used as a supplement to other extend, assign or merge methods as a polyfill for the Symbols part of the es6 Object.assign method.", |
||||
"devDependencies": { |
||||
"mocha": "^3.0.0" |
||||
}, |
||||
"engines": { |
||||
"node": ">=0.10.0" |
||||
}, |
||||
"files": [ |
||||
"index.js" |
||||
], |
||||
"homepage": "https://github.com/jonschlinkert/assign-symbols", |
||||
"keywords": [ |
||||
"assign", |
||||
"symbols" |
||||
], |
||||
"license": "MIT", |
||||
"main": "index.js", |
||||
"name": "assign-symbols", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/jonschlinkert/assign-symbols.git" |
||||
}, |
||||
"scripts": { |
||||
"test": "mocha" |
||||
}, |
||||
"verb": { |
||||
"related": { |
||||
"list": [ |
||||
"assign-deep", |
||||
"mixin-deep", |
||||
"merge-deep", |
||||
"extend-shallow", |
||||
"clone-deep" |
||||
] |
||||
} |
||||
}, |
||||
"version": "1.0.0" |
||||
} |
@ -1,52 +0,0 @@
@@ -1,52 +0,0 @@
|
||||
# async-each |
||||
|
||||
No-bullshit, ultra-simple, 35-lines-of-code async parallel forEach function for JavaScript. |
||||
|
||||
We don't need junky 30K async libs. Really. |
||||
|
||||
For browsers and node.js. |
||||
|
||||
## Installation |
||||
* Just include async-each before your scripts. |
||||
* `npm install async-each` if you’re using node.js. |
||||
|
||||
## Usage |
||||
|
||||
* `each(array, iterator, callback);` — `Array`, `Function`, `(optional) Function` |
||||
* `iterator(item, next)` receives current item and a callback that will mark the item as done. `next` callback receives optional `error, transformedItem` arguments. |
||||
* `callback(error, transformedArray)` optionally receives first error and transformed result `Array`. |
||||
|
||||
```javascript |
||||
var each = require('async-each'); |
||||
each(['a.js', 'b.js', 'c.js'], fs.readFile, function(error, contents) { |
||||
if (error) console.error(error); |
||||
console.log('Contents for a, b and c:', contents); |
||||
}); |
||||
|
||||
// Alternatively in browser: |
||||
asyncEach(list, fn, callback); |
||||
``` |
||||
|
||||
## License |
||||
|
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) 2016 Paul Miller [(paulmillr.com)](http://paulmillr.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. |
@ -1,38 +0,0 @@
@@ -1,38 +0,0 @@
|
||||
// async-each MIT license (by Paul Miller from https://paulmillr.com).
|
||||
(function(globals) { |
||||
'use strict'; |
||||
var each = function(items, next, callback) { |
||||
if (!Array.isArray(items)) throw new TypeError('each() expects array as first argument'); |
||||
if (typeof next !== 'function') throw new TypeError('each() expects function as second argument'); |
||||
if (typeof callback !== 'function') callback = Function.prototype; // no-op
|
||||
|
||||
if (items.length === 0) return callback(undefined, items); |
||||
|
||||
var transformed = new Array(items.length); |
||||
var count = 0; |
||||
var returned = false; |
||||
|
||||
items.forEach(function(item, index) { |
||||
next(item, function(error, transformedItem) { |
||||
if (returned) return; |
||||
if (error) { |
||||
returned = true; |
||||
return callback(error); |
||||
} |
||||
transformed[index] = transformedItem; |
||||
count += 1; |
||||
if (count === items.length) return callback(undefined, transformed); |
||||
}); |
||||
}); |
||||
}; |
||||
|
||||
if (typeof define !== 'undefined' && define.amd) { |
||||
define([], function() { |
||||
return each; |
||||
}); // RequireJS
|
||||
} else if (typeof module !== 'undefined' && module.exports) { |
||||
module.exports = each; // CommonJS
|
||||
} else { |
||||
globals.asyncEach = each; // <script>
|
||||
} |
||||
})(this); |
@ -1,63 +0,0 @@
@@ -1,63 +0,0 @@
|
||||
{ |
||||
"_from": "async-each@^1.0.0", |
||||
"_id": "async-each@1.0.3", |
||||
"_inBundle": false, |
||||
"_integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", |
||||
"_location": "/async-each", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "range", |
||||
"registry": true, |
||||
"raw": "async-each@^1.0.0", |
||||
"name": "async-each", |
||||
"escapedName": "async-each", |
||||
"rawSpec": "^1.0.0", |
||||
"saveSpec": null, |
||||
"fetchSpec": "^1.0.0" |
||||
}, |
||||
"_requiredBy": [ |
||||
"/chokidar" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", |
||||
"_shasum": "b727dbf87d7651602f06f4d4ac387f47d91b0cbf", |
||||
"_spec": "async-each@^1.0.0", |
||||
"_where": "/home/rudi/Personal/disgord-Thanos/node_modules/chokidar", |
||||
"author": { |
||||
"name": "Paul Miller", |
||||
"url": "https://paulmillr.com/" |
||||
}, |
||||
"bugs": { |
||||
"url": "https://github.com/paulmillr/async-each/issues" |
||||
}, |
||||
"bundleDependencies": false, |
||||
"dependencies": {}, |
||||
"deprecated": false, |
||||
"description": "No-bullshit, ultra-simple, 35-lines-of-code async parallel forEach / map function for JavaScript.", |
||||
"files": [ |
||||
"index.js" |
||||
], |
||||
"homepage": "https://github.com/paulmillr/async-each/", |
||||
"keywords": [ |
||||
"async", |
||||
"forEach", |
||||
"each", |
||||
"map", |
||||
"asynchronous", |
||||
"iteration", |
||||
"iterate", |
||||
"loop", |
||||
"parallel", |
||||
"concurrent", |
||||
"array", |
||||
"flow", |
||||
"control flow" |
||||
], |
||||
"license": "MIT", |
||||
"main": "index.js", |
||||
"name": "async-each", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git://github.com/paulmillr/async-each.git" |
||||
}, |
||||
"version": "1.0.3" |
||||
} |
@ -1,230 +0,0 @@
@@ -1,230 +0,0 @@
|
||||
At your option you may choose either of the following licenses: |
||||
|
||||
* The MIT License (MIT) |
||||
* The Apache License 2.0 (Apache-2.0) |
||||
|
||||
|
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) 2015 AJ ONeal |
||||
|
||||
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. |
||||
|
||||
|
||||
Apache License |
||||
Version 2.0, January 2004 |
||||
http://www.apache.org/licenses/ |
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
||||
|
||||
1. Definitions. |
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, |
||||
and distribution as defined by Sections 1 through 9 of this document. |
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by |
||||
the copyright owner that is granting the License. |
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all |
||||
other entities that control, are controlled by, or are under common |
||||
control with that entity. For the purposes of this definition, |
||||
"control" means (i) the power, direct or indirect, to cause the |
||||
direction or management of such entity, whether by contract or |
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the |
||||
outstanding shares, or (iii) beneficial ownership of such entity. |
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity |
||||
exercising permissions granted by this License. |
||||
|
||||
"Source" form shall mean the preferred form for making modifications, |
||||
including but not limited to software source code, documentation |
||||
source, and configuration files. |
||||
|
||||
"Object" form shall mean any form resulting from mechanical |
||||
transformation or translation of a Source form, including but |
||||
not limited to compiled object code, generated documentation, |
||||
and conversions to other media types. |
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or |
||||
Object form, made available under the License, as indicated by a |
||||
copyright notice that is included in or attached to the work |
||||
(an example is provided in the Appendix below). |
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object |
||||
form, that is based on (or derived from) the Work and for which the |
||||
editorial revisions, annotations, elaborations, or other modifications |
||||
represent, as a whole, an original work of authorship. For the purposes |
||||
of this License, Derivative Works shall not include works that remain |
||||
separable from, or merely link (or bind by name) to the interfaces of, |
||||
the Work and Derivative Works thereof. |
||||
|
||||
"Contribution" shall mean any work of authorship, including |
||||
the original version of the Work and any modifications or additions |
||||
to that Work or Derivative Works thereof, that is intentionally |
||||
submitted to Licensor for inclusion in the Work by the copyright owner |
||||
or by an individual or Legal Entity authorized to submit on behalf of |
||||
the copyright owner. For the purposes of this definition, "submitted" |
||||
means any form of electronic, verbal, or written communication sent |
||||
to the Licensor or its representatives, including but not limited to |
||||
communication on electronic mailing lists, source code control systems, |
||||
and issue tracking systems that are managed by, or on behalf of, the |
||||
Licensor for the purpose of discussing and improving the Work, but |
||||
excluding communication that is conspicuously marked or otherwise |
||||
designated in writing by the copyright owner as "Not a Contribution." |
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity |
||||
on behalf of whom a Contribution has been received by Licensor and |
||||
subsequently incorporated within the Work. |
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of |
||||
this License, each Contributor hereby grants to You a perpetual, |
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
||||
copyright license to reproduce, prepare Derivative Works of, |
||||
publicly display, publicly perform, sublicense, and distribute the |
||||
Work and such Derivative Works in Source or Object form. |
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of |
||||
this License, each Contributor hereby grants to You a perpetual, |
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
||||
(except as stated in this section) patent license to make, have made, |
||||
use, offer to sell, sell, import, and otherwise transfer the Work, |
||||
where such license applies only to those patent claims licensable |
||||
by such Contributor that are necessarily infringed by their |
||||
Contribution(s) alone or by combination of their Contribution(s) |
||||
with the Work to which such Contribution(s) was submitted. If You |
||||
institute patent litigation against any entity (including a |
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work |
||||
or a Contribution incorporated within the Work constitutes direct |
||||
or contributory patent infringement, then any patent licenses |
||||
granted to You under this License for that Work shall terminate |
||||
as of the date such litigation is filed. |
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the |
||||
Work or Derivative Works thereof in any medium, with or without |
||||
modifications, and in Source or Object form, provided that You |
||||
meet the following conditions: |
||||
|
||||
(a) You must give any other recipients of the Work or |
||||
Derivative Works a copy of this License; and |
||||
|
||||
(b) You must cause any modified files to carry prominent notices |
||||
stating that You changed the files; and |
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works |
||||
that You distribute, all copyright, patent, trademark, and |
||||
attribution notices from the Source form of the Work, |
||||
excluding those notices that do not pertain to any part of |
||||
the Derivative Works; and |
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its |
||||
distribution, then any Derivative Works that You distribute must |
||||
include a readable copy of the attribution notices contained |
||||
within such NOTICE file, excluding those notices that do not |
||||
pertain to any part of the Derivative Works, in at least one |
||||
of the following places: within a NOTICE text file distributed |
||||
as part of the Derivative Works; within the Source form or |
||||
documentation, if provided along with the Derivative Works; or, |
||||
within a display generated by the Derivative Works, if and |
||||
wherever such third-party notices normally appear. The contents |
||||
of the NOTICE file are for informational purposes only and |
||||
do not modify the License. You may add Your own attribution |
||||
notices within Derivative Works that You distribute, alongside |
||||
or as an addendum to the NOTICE text from the Work, provided |
||||
that such additional attribution notices cannot be construed |
||||
as modifying the License. |
||||
|
||||
You may add Your own copyright statement to Your modifications and |
||||
may provide additional or different license terms and conditions |
||||
for use, reproduction, or distribution of Your modifications, or |
||||
for any such Derivative Works as a whole, provided Your use, |
||||
reproduction, and distribution of the Work otherwise complies with |
||||
the conditions stated in this License. |
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, |
||||
any Contribution intentionally submitted for inclusion in the Work |
||||
by You to the Licensor shall be under the terms and conditions of |
||||
this License, without any additional terms or conditions. |
||||
Notwithstanding the above, nothing herein shall supersede or modify |
||||
the terms of any separate license agreement you may have executed |
||||
with Licensor regarding such Contributions. |
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade |
||||
names, trademarks, service marks, or product names of the Licensor, |
||||
except as required for reasonable and customary use in describing the |
||||
origin of the Work and reproducing the content of the NOTICE file. |
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or |
||||
agreed to in writing, Licensor provides the Work (and each |
||||
Contributor provides its Contributions) on an "AS IS" BASIS, |
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
||||
implied, including, without limitation, any warranties or conditions |
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A |
||||
PARTICULAR PURPOSE. You are solely responsible for determining the |
||||
appropriateness of using or redistributing the Work and assume any |
||||
risks associated with Your exercise of permissions under this License. |
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, |
||||
whether in tort (including negligence), contract, or otherwise, |
||||
unless required by applicable law (such as deliberate and grossly |
||||
negligent acts) or agreed to in writing, shall any Contributor be |
||||
liable to You for damages, including any direct, indirect, special, |
||||
incidental, or consequential damages of any character arising as a |
||||
result of this License or out of the use or inability to use the |
||||
Work (including but not limited to damages for loss of goodwill, |
||||
work stoppage, computer failure or malfunction, or any and all |
||||
other commercial damages or losses), even if such Contributor |
||||
has been advised of the possibility of such damages. |
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing |
||||
the Work or Derivative Works thereof, You may choose to offer, |
||||
and charge a fee for, acceptance of support, warranty, indemnity, |
||||
or other liability obligations and/or rights consistent with this |
||||
License. However, in accepting such obligations, You may act only |
||||
on Your own behalf and on Your sole responsibility, not on behalf |
||||
of any other Contributor, and only if You agree to indemnify, |
||||
defend, and hold each Contributor harmless for any liability |
||||
incurred by, or claims asserted against, such Contributor by reason |
||||
of your accepting any such warranty or additional liability. |
||||
|
||||
END OF TERMS AND CONDITIONS |
||||
|
||||
APPENDIX: How to apply the Apache License to your work. |
||||
|
||||
To apply the Apache License to your work, attach the following |
||||
boilerplate notice, with the fields enclosed by brackets "{}" |
||||
replaced with your own identifying information. (Don't include |
||||
the brackets!) The text should be enclosed in the appropriate |
||||
comment syntax for the file format. We also recommend that a |
||||
file or class name and description of purpose be included on the |
||||
same "printed page" as the copyright notice for easier |
||||
identification within third-party archives. |
||||
|
||||
Copyright 2015 AJ ONeal |
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); |
||||
you may not use this file except in compliance with the License. |
||||
You may obtain a copy of the License at |
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
||||
Unless required by applicable law or agreed to in writing, software |
||||
distributed under the License is distributed on an "AS IS" BASIS, |
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
See the License for the specific language governing permissions and |
||||
limitations under the License. |
@ -1,319 +0,0 @@
@@ -1,319 +0,0 @@
|
||||
Creative Commons Legal Code |
||||
|
||||
Attribution 3.0 Unported |
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE |
||||
LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN |
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS |
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES |
||||
REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR |
||||
DAMAGES RESULTING FROM ITS USE. |
||||
|
||||
License |
||||
|
||||
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE |
||||
COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY |
||||
COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS |
||||
AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. |
||||
|
||||
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE |
||||
TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY |
||||
BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS |
||||
CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND |
||||
CONDITIONS. |
||||
|
||||
1. Definitions |
||||
|
||||
a. "Adaptation" means a work based upon the Work, or upon the Work and |
||||
other pre-existing works, such as a translation, adaptation, |
||||
derivative work, arrangement of music or other alterations of a |
||||
literary or artistic work, or phonogram or performance and includes |
||||
cinematographic adaptations or any other form in which the Work may be |
||||
recast, transformed, or adapted including in any form recognizably |
||||
derived from the original, except that a work that constitutes a |
||||
Collection will not be considered an Adaptation for the purpose of |
||||
this License. For the avoidance of doubt, where the Work is a musical |
||||
work, performance or phonogram, the synchronization of the Work in |
||||
timed-relation with a moving image ("synching") will be considered an |
||||
Adaptation for the purpose of this License. |
||||
b. "Collection" means a collection of literary or artistic works, such as |
||||
encyclopedias and anthologies, or performances, phonograms or |
||||
broadcasts, or other works or subject matter other than works listed |
||||
in Section 1(f) below, which, by reason of the selection and |
||||
arrangement of their contents, constitute intellectual creations, in |
||||
which the Work is included in its entirety in unmodified form along |
||||
with one or more other contributions, each constituting separate and |
||||
independent works in themselves, which together are assembled into a |
||||
collective whole. A work that constitutes a Collection will not be |
||||
considered an Adaptation (as defined above) for the purposes of this |
||||
License. |
||||
c. "Distribute" means to make available to the public the original and |
||||
copies of the Work or Adaptation, as appropriate, through sale or |
||||
other transfer of ownership. |
||||
d. "Licensor" means the individual, individuals, entity or entities that |
||||
offer(s) the Work under the terms of this License. |
||||
e. "Original Author" means, in the case of a literary or artistic work, |
||||
the individual, individuals, entity or entities who created the Work |
||||
or if no individual or entity can be identified, the publisher; and in |
||||
addition (i) in the case of a performance the actors, singers, |
||||
musicians, dancers, and other persons who act, sing, deliver, declaim, |
||||
play in, interpret or otherwise perform literary or artistic works or |
||||
expressions of folklore; (ii) in the case of a phonogram the producer |
||||
being the person or legal entity who first fixes the sounds of a |
||||
performance or other sounds; and, (iii) in the case of broadcasts, the |
||||
organization that transmits the broadcast. |
||||
f. "Work" means the literary and/or artistic work offered under the terms |
||||
of this License including without limitation any production in the |
||||
literary, scientific and artistic domain, whatever may be the mode or |
||||
form of its expression including digital form, such as a book, |
||||
pamphlet and other writing; a lecture, address, sermon or other work |
||||
of the same nature; a dramatic or dramatico-musical work; a |
||||
choreographic work or entertainment in dumb show; a musical |
||||
composition with or without words; a cinematographic work to which are |
||||
assimilated works expressed by a process analogous to cinematography; |
||||
a work of drawing, painting, architecture, sculpture, engraving or |
||||
lithography; a photographic work to which are assimilated works |
||||
expressed by a process analogous to photography; a work of applied |
||||
art; an illustration, map, plan, sketch or three-dimensional work |
||||
relative to geography, topography, architecture or science; a |
||||
performance; a broadcast; a phonogram; a compilation of data to the |
||||
extent it is protected as a copyrightable work; or a work performed by |
||||
a variety or circus performer to the extent it is not otherwise |
||||
considered a literary or artistic work. |
||||
g. "You" means an individual or entity exercising rights under this |
||||
License who has not previously violated the terms of this License with |
||||
respect to the Work, or who has received express permission from the |
||||
Licensor to exercise rights under this License despite a previous |
||||
violation. |
||||
h. "Publicly Perform" means to perform public recitations of the Work and |
||||
to communicate to the public those public recitations, by any means or |
||||
process, including by wire or wireless means or public digital |
||||
performances; to make available to the public Works in such a way that |
||||
members of the public may access these Works from a place and at a |
||||
place individually chosen by them; to perform the Work to the public |
||||
by any means or process and the communication to the public of the |
||||
performances of the Work, including by public digital performance; to |
||||
broadcast and rebroadcast the Work by any means including signs, |
||||
sounds or images. |
||||
i. "Reproduce" means to make copies of the Work by any means including |
||||
without limitation by sound or visual recordings and the right of |
||||
fixation and reproducing fixations of the Work, including storage of a |
||||
protected performance or phonogram in digital form or other electronic |
||||
medium. |
||||
|
||||
2. Fair Dealing Rights. Nothing in this License is intended to reduce, |
||||
limit, or restrict any uses free from copyright or rights arising from |
||||
limitations or exceptions that are provided for in connection with the |
||||
copyright protection under copyright law or other applicable laws. |
||||
|
||||
3. License Grant. Subject to the terms and conditions of this License, |
||||
Licensor hereby grants You a worldwide, royalty-free, non-exclusive, |
||||
perpetual (for the duration of the applicable copyright) license to |
||||
exercise the rights in the Work as stated below: |
||||
|
||||
a. to Reproduce the Work, to incorporate the Work into one or more |
||||
Collections, and to Reproduce the Work as incorporated in the |
||||
Collections; |
||||
b. to create and Reproduce Adaptations provided that any such Adaptation, |
||||
including any translation in any medium, takes reasonable steps to |
||||
clearly label, demarcate or otherwise identify that changes were made |
||||
to the original Work. For example, a translation could be marked "The |
||||
original work was translated from English to Spanish," or a |
||||
modification could indicate "The original work has been modified."; |
||||
c. to Distribute and Publicly Perform the Work including as incorporated |
||||
in Collections; and, |
||||
d. to Distribute and Publicly Perform Adaptations. |
||||
e. For the avoidance of doubt: |
||||
|
||||
i. Non-waivable Compulsory License Schemes. In those jurisdictions in |
||||
which the right to collect royalties through any statutory or |
||||
compulsory licensing scheme cannot be waived, the Licensor |
||||
reserves the exclusive right to collect such royalties for any |
||||
exercise by You of the rights granted under this License; |
||||
ii. Waivable Compulsory License Schemes. In those jurisdictions in |
||||
which the right to collect royalties through any statutory or |
||||
compulsory licensing scheme can be waived, the Licensor waives the |
||||
exclusive right to collect such royalties for any exercise by You |
||||
of the rights granted under this License; and, |
||||
iii. Voluntary License Schemes. The Licensor waives the right to |
||||
collect royalties, whether individually or, in the event that the |
||||
Licensor is a member of a collecting society that administers |
||||
voluntary licensing schemes, via that society, from any exercise |
||||
by You of the rights granted under this License. |
||||
|
||||
The above rights may be exercised in all media and formats whether now |
||||
known or hereafter devised. The above rights include the right to make |
||||
such modifications as are technically necessary to exercise the rights in |
||||
other media and formats. Subject to Section 8(f), all rights not expressly |
||||
granted by Licensor are hereby reserved. |
||||
|
||||
4. Restrictions. The license granted in Section 3 above is expressly made |
||||
subject to and limited by the following restrictions: |
||||
|
||||
a. You may Distribute or Publicly Perform the Work only under the terms |
||||
of this License. You must include a copy of, or the Uniform Resource |
||||
Identifier (URI) for, this License with every copy of the Work You |
||||
Distribute or Publicly Perform. You may not offer or impose any terms |
||||
on the Work that restrict the terms of this License or the ability of |
||||
the recipient of the Work to exercise the rights granted to that |
||||
recipient under the terms of the License. You may not sublicense the |
||||
Work. You must keep intact all notices that refer to this License and |
||||
to the disclaimer of warranties with every copy of the Work You |
||||
Distribute or Publicly Perform. When You Distribute or Publicly |
||||
Perform the Work, You may not impose any effective technological |
||||
measures on the Work that restrict the ability of a recipient of the |
||||
Work from You to exercise the rights granted to that recipient under |
||||
the terms of the License. This Section 4(a) applies to the Work as |
||||
incorporated in a Collection, but this does not require the Collection |
||||
apart from the Work itself to be made subject to the terms of this |
||||
License. If You create a Collection, upon notice from any Licensor You |
||||
must, to the extent practicable, remove from the Collection any credit |
||||
as required by Section 4(b), as requested. If You create an |
||||
Adaptation, upon notice from any Licensor You must, to the extent |
||||
practicable, remove from the Adaptation any credit as required by |
||||
Section 4(b), as requested. |
||||
b. If You Distribute, or Publicly Perform the Work or any Adaptations or |
||||
Collections, You must, unless a request has been made pursuant to |
||||
Section 4(a), keep intact all copyright notices for the Work and |
||||
provide, reasonable to the medium or means You are utilizing: (i) the |
||||
name of the Original Author (or pseudonym, if applicable) if supplied, |
||||
and/or if the Original Author and/or Licensor designate another party |
||||
or parties (e.g., a sponsor institute, publishing entity, journal) for |
||||
attribution ("Attribution Parties") in Licensor's copyright notice, |
||||
terms of service or by other reasonable means, the name of such party |
||||
or parties; (ii) the title of the Work if supplied; (iii) to the |
||||
extent reasonably practicable, the URI, if any, that Licensor |
||||
specifies to be associated with the Work, unless such URI does not |
||||
refer to the copyright notice or licensing information for the Work; |
||||
and (iv) , consistent with Section 3(b), in the case of an Adaptation, |
||||
a credit identifying the use of the Work in the Adaptation (e.g., |
||||
"French translation of the Work by Original Author," or "Screenplay |
||||
based on original Work by Original Author"). The credit required by |
||||
this Section 4 (b) may be implemented in any reasonable manner; |
||||
provided, however, that in the case of a Adaptation or Collection, at |
||||
a minimum such credit will appear, if a credit for all contributing |
||||
authors of the Adaptation or Collection appears, then as part of these |
||||
credits and in a manner at least as prominent as the credits for the |
||||
other contributing authors. For the avoidance of doubt, You may only |
||||
use the credit required by this Section for the purpose of attribution |
||||
in the manner set out above and, by exercising Your rights under this |
||||
License, You may not implicitly or explicitly assert or imply any |
||||
connection with, sponsorship or endorsement by the Original Author, |
||||
Licensor and/or Attribution Parties, as appropriate, of You or Your |
||||
use of the Work, without the separate, express prior written |
||||
permission of the Original Author, Licensor and/or Attribution |
||||
Parties. |
||||
c. Except as otherwise agreed in writing by the Licensor or as may be |
||||
otherwise permitted by applicable law, if You Reproduce, Distribute or |
||||
Publicly Perform the Work either by itself or as part of any |
||||
Adaptations or Collections, You must not distort, mutilate, modify or |
||||
take other derogatory action in relation to the Work which would be |
||||
prejudicial to the Original Author's honor or reputation. Licensor |
||||
agrees that in those jurisdictions (e.g. Japan), in which any exercise |
||||
of the right granted in Section 3(b) of this License (the right to |
||||
make Adaptations) would be deemed to be a distortion, mutilation, |
||||
modification or other derogatory action prejudicial to the Original |
||||
Author's honor and reputation, the Licensor will waive or not assert, |
||||
as appropriate, this Section, to the fullest extent permitted by the |
||||
applicable national law, to enable You to reasonably exercise Your |
||||
right under Section 3(b) of this License (right to make Adaptations) |
||||
but not otherwise. |
||||
|
||||
5. Representations, Warranties and Disclaimer |
||||
|
||||
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR |
||||
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY |
||||
KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, |
||||
INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF |
||||
LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, |
||||
WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION |
||||
OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. |
||||
|
||||
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE |
||||
LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR |
||||
ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES |
||||
ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS |
||||
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
||||
|
||||
7. Termination |
||||
|
||||
a. This License and the rights granted hereunder will terminate |
||||
automatically upon any breach by You of the terms of this License. |
||||
Individuals or entities who have received Adaptations or Collections |
||||
from You under this License, however, will not have their licenses |
||||
terminated provided such individuals or entities remain in full |
||||
compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will |
||||
survive any termination of this License. |
||||
b. Subject to the above terms and conditions, the license granted here is |
||||
perpetual (for the duration of the applicable copyright in the Work). |
||||
Notwithstanding the above, Licensor reserves the right to release the |
||||
Work under different license terms or to stop distributing the Work at |
||||
any time; provided, however that any such election will not serve to |
||||
withdraw this License (or any other license that has been, or is |
||||
required to be, granted under the terms of this License), and this |
||||
License will continue in full force and effect unless terminated as |
||||
stated above. |
||||
|
||||
8. Miscellaneous |
||||
|
||||
a. Each time You Distribute or Publicly Perform the Work or a Collection, |
||||
the Licensor offers to the recipient a license to the Work on the same |
||||
terms and conditions as the license granted to You under this License. |
||||
b. Each time You Distribute or Publicly Perform an Adaptation, Licensor |
||||
offers to the recipient a license to the original Work on the same |
||||
terms and conditions as the license granted to You under this License. |
||||
c. If any provision of this License is invalid or unenforceable under |
||||
applicable law, it shall not affect the validity or enforceability of |
||||
the remainder of the terms of this License, and without further action |
||||
by the parties to this agreement, such provision shall be reformed to |
||||
the minimum extent necessary to make such provision valid and |
||||
enforceable. |
||||
d. No term or provision of this License shall be deemed waived and no |
||||
breach consented to unless such waiver or consent shall be in writing |
||||
and signed by the party to be charged with such waiver or consent. |
||||
e. This License constitutes the entire agreement between the parties with |
||||
respect to the Work licensed here. There are no understandings, |
||||
agreements or representations with respect to the Work not specified |
||||
here. Licensor shall not be bound by any additional provisions that |
||||
may appear in any communication from You. This License may not be |
||||
modified without the mutual written agreement of the Licensor and You. |
||||
f. The rights granted under, and the subject matter referenced, in this |
||||
License were drafted utilizing the terminology of the Berne Convention |
||||
for the Protection of Literary and Artistic Works (as amended on |
||||
September 28, 1979), the Rome Convention of 1961, the WIPO Copyright |
||||
Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 |
||||
and the Universal Copyright Convention (as revised on July 24, 1971). |
||||
These rights and subject matter take effect in the relevant |
||||
jurisdiction in which the License terms are sought to be enforced |
||||
according to the corresponding provisions of the implementation of |
||||
those treaty provisions in the applicable national law. If the |
||||
standard suite of rights granted under applicable copyright law |
||||
includes additional rights not granted under this License, such |
||||
additional rights are deemed to be included in the License; this |
||||
License is not intended to restrict the license of any rights under |
||||
applicable law. |
||||
|
||||
|
||||
Creative Commons Notice |
||||
|
||||
Creative Commons is not a party to this License, and makes no warranty |
||||
whatsoever in connection with the Work. Creative Commons will not be |
||||
liable to You or any party on any legal theory for any damages |
||||
whatsoever, including without limitation any general, special, |
||||
incidental or consequential damages arising in connection to this |
||||
license. Notwithstanding the foregoing two (2) sentences, if Creative |
||||
Commons has expressly identified itself as the Licensor hereunder, it |
||||
shall have all rights and obligations of Licensor. |
||||
|
||||
Except for the limited purpose of indicating to the public that the |
||||
Work is licensed under the CCPL, Creative Commons does not authorize |
||||
the use by either party of the trademark "Creative Commons" or any |
||||
related trademark or logo of Creative Commons without the prior |
||||
written consent of Creative Commons. Any permitted use will be in |
||||
compliance with Creative Commons' then-current trademark usage |
||||
guidelines, as may be published on its website or otherwise made |
||||
available upon request from time to time. For the avoidance of doubt, |
||||
this trademark restriction does not form part of this License. |
||||
|
||||
Creative Commons may be contacted at http://creativecommons.org/. |
@ -1,49 +0,0 @@
@@ -1,49 +0,0 @@
|
||||
atob |
||||
=== |
||||
|
||||
| **atob** |
||||
| [btoa](https://git.coolaj86.com/coolaj86/btoa.js) |
||||
| [unibabel.js](https://git.coolaj86.com/coolaj86/unibabel.js) |
||||
| Sponsored by [ppl](https://ppl.family) |
||||
|
||||
Uses `Buffer` to emulate the exact functionality of the browser's atob. |
||||
|
||||
Note: Unicode may be handled incorrectly (like the browser). |
||||
|
||||
It turns base64-encoded <strong>a</strong>scii data back **to** <strong>b</strong>inary. |
||||
|
||||
```javascript |
||||
(function () { |
||||
"use strict"; |
||||
|
||||
var atob = require('atob'); |
||||
var b64 = "SGVsbG8sIFdvcmxkIQ=="; |
||||
var bin = atob(b64); |
||||
|
||||
console.log(bin); // "Hello, World!" |
||||
}()); |
||||
``` |
||||
|
||||
### Need Unicode and Binary Support in the Browser? |
||||
|
||||
Check out [unibabel.js](https://git.coolaj86.com/coolaj86/unibabel.js) |
||||
|
||||
Changelog |
||||
======= |
||||
|
||||
* v2.1.0 address a few issues and PRs, update URLs |
||||
* v2.0.0 provide browser version for ios web workers |
||||
* v1.2.0 provide (empty) browser version |
||||
* v1.1.3 add MIT license |
||||
* v1.1.2 node only |
||||
|
||||
LICENSE |
||||
======= |
||||
|
||||
Code copyright 2012-2018 AJ ONeal |
||||
|
||||
Dual-licensed MIT and Apache-2.0 |
||||
|
||||
Docs copyright 2012-2018 AJ ONeal |
||||
|
||||
Docs released under [Creative Commons](https://git.coolaj86.com/coolaj86/atob.js/blob/master/LICENSE.DOCS). |
@ -1,6 +0,0 @@
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict'; |
||||
|
||||
var atob = require('../node-atob'); |
||||
var str = process.argv[2]; |
||||
console.log(atob(str)); |
@ -1,24 +0,0 @@
@@ -1,24 +0,0 @@
|
||||
{ |
||||
"name": "atob", |
||||
"description": "atob for isomorphic environments", |
||||
"main": "browser-atob.js", |
||||
"authors": [ |
||||
"AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com)" |
||||
], |
||||
"license": "(MIT OR Apache-2.0)", |
||||
"keywords": [ |
||||
"atob", |
||||
"browser" |
||||
], |
||||
"homepage": "https://github.com/node-browser-compat/atob", |
||||
"moduleType": [ |
||||
"globals" |
||||
], |
||||
"ignore": [ |
||||
"**/.*", |
||||
"node_modules", |
||||
"bower_components", |
||||
"test", |
||||
"tests" |
||||
] |
||||
} |
@ -1,44 +0,0 @@
@@ -1,44 +0,0 @@
|
||||
(function (w) { |
||||
"use strict"; |
||||
|
||||
function findBest(atobNative) { |
||||
// normal window
|
||||
if ('function' === typeof atobNative) { return atobNative; } |
||||
|
||||
|
||||
// browserify (web worker)
|
||||
if ('function' === typeof Buffer) { |
||||
return function atobBrowserify(a) { |
||||
//!! Deliberately using an API that's deprecated in node.js because
|
||||
//!! this file is for browsers and we expect them to cope with it.
|
||||
//!! Discussion: github.com/node-browser-compat/atob/pull/9
|
||||
return new Buffer(a, 'base64').toString('binary'); |
||||
}; |
||||
} |
||||
|
||||
// ios web worker with base64js
|
||||
if ('object' === typeof w.base64js) { |
||||
// bufferToBinaryString
|
||||
// https://git.coolaj86.com/coolaj86/unibabel.js/blob/master/index.js#L50
|
||||
return function atobWebWorker_iOS(a) { |
||||
var buf = w.base64js.b64ToByteArray(a); |
||||
return Array.prototype.map.call(buf, function (ch) { |
||||
return String.fromCharCode(ch); |
||||
}).join(''); |
||||
}; |
||||
} |
||||
|
||||
return function () { |
||||
// ios web worker without base64js
|
||||
throw new Error("You're probably in an old browser or an iOS webworker." + |
||||
" It might help to include beatgammit's base64-js."); |
||||
}; |
||||
} |
||||
|
||||
var atobBest = findBest(w.atob); |
||||
w.atob = atobBest; |
||||
|
||||
if ((typeof module === 'object') && module && module.exports) { |
||||
module.exports = atobBest; |
||||
} |
||||
}(window)); |
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
function atob(str) { |
||||
return Buffer.from(str, 'base64').toString('binary'); |
||||
} |
||||
|
||||
module.exports = atob.atob = atob; |
@ -1,53 +0,0 @@
@@ -1,53 +0,0 @@
|
||||
{ |
||||
"_from": "atob@^2.1.2", |
||||
"_id": "atob@2.1.2", |
||||
"_inBundle": false, |
||||
"_integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", |
||||
"_location": "/atob", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "range", |
||||
"registry": true, |
||||
"raw": "atob@^2.1.2", |
||||
"name": "atob", |
||||
"escapedName": "atob", |
||||
"rawSpec": "^2.1.2", |
||||
"saveSpec": null, |
||||
"fetchSpec": "^2.1.2" |
||||
}, |
||||
"_requiredBy": [ |
||||
"/source-map-resolve" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", |
||||
"_shasum": "6d9517eb9e030d2436666651e86bd9f6f13533c9", |
||||
"_spec": "atob@^2.1.2", |
||||
"_where": "/home/rudi/Personal/disgord-Thanos/node_modules/source-map-resolve", |
||||
"author": { |
||||
"name": "AJ ONeal", |
||||
"email": "coolaj86@gmail.com", |
||||
"url": "https://coolaj86.com" |
||||
}, |
||||
"bin": { |
||||
"atob": "bin/atob.js" |
||||
}, |
||||
"browser": "browser-atob.js", |
||||
"bundleDependencies": false, |
||||
"deprecated": false, |
||||
"description": "atob for Node.JS and Linux / Mac / Windows CLI (it's a one-liner)", |
||||
"engines": { |
||||
"node": ">= 4.5.0" |
||||
}, |
||||
"homepage": "https://git.coolaj86.com/coolaj86/atob.js.git", |
||||
"keywords": [ |
||||
"atob", |
||||
"browser" |
||||
], |
||||
"license": "(MIT OR Apache-2.0)", |
||||
"main": "node-atob.js", |
||||
"name": "atob", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git://git.coolaj86.com/coolaj86/atob.js.git" |
||||
}, |
||||
"version": "2.1.2" |
||||
} |
@ -1,18 +0,0 @@
@@ -1,18 +0,0 @@
|
||||
(function () { |
||||
"use strict"; |
||||
|
||||
var atob = require('.'); |
||||
var encoded = "SGVsbG8sIFdvcmxkIQ==" |
||||
var unencoded = "Hello, World!"; |
||||
/* |
||||
, encoded = "SGVsbG8sIBZM" |
||||
, unencoded = "Hello, 世界" |
||||
*/ |
||||
|
||||
if (unencoded !== atob(encoded)) { |
||||
console.log('[FAIL]', unencoded, atob(encoded)); |
||||
return; |
||||
} |
||||
|
||||
console.log('[PASS] all tests pass'); |
||||
}()); |
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
src |
||||
test |
||||
node_modules |
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
# babel-cli |
||||
|
||||
> Babel command line. |
||||
|
||||
In addition, various entry point scripts live in the top-level package at `babel-cli/bin`. |
||||
|
||||
There are some shell-executable utility scripts, `babel-external-helpers.js` and `babel-node.js`, and the main Babel cli script, `babel.js`. |
||||
|
||||
## Install |
||||
|
||||
```sh |
||||
npm install --save-dev babel-cli |
||||
``` |
||||
|
||||
## Usage |
||||
|
||||
```sh |
||||
babel script.js |
||||
``` |
||||
|
||||
For more in depth documentation see: http://babeljs.io/docs/usage/cli/ |
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
throw new Error("babel-doctor has been removed."); |
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require("../lib/babel-external-helpers"); |
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require("../lib/babel-node"); |
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require("../lib/babel"); |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
throw new Error("Use the `babel-core` package not `babel`."); |
@ -1,185 +0,0 @@
@@ -1,185 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
var _pathIsAbsolute = require("path-is-absolute"); |
||||
|
||||
var _pathIsAbsolute2 = _interopRequireDefault(_pathIsAbsolute); |
||||
|
||||
var _commander = require("commander"); |
||||
|
||||
var _commander2 = _interopRequireDefault(_commander); |
||||
|
||||
var _module2 = require("module"); |
||||
|
||||
var _module3 = _interopRequireDefault(_module2); |
||||
|
||||
var _util = require("util"); |
||||
|
||||
var _path = require("path"); |
||||
|
||||
var _path2 = _interopRequireDefault(_path); |
||||
|
||||
var _repl = require("repl"); |
||||
|
||||
var _repl2 = _interopRequireDefault(_repl); |
||||
|
||||
var _babelCore = require("babel-core"); |
||||
|
||||
var babel = _interopRequireWildcard(_babelCore); |
||||
|
||||
var _vm = require("vm"); |
||||
|
||||
var _vm2 = _interopRequireDefault(_vm); |
||||
|
||||
require("babel-polyfill"); |
||||
|
||||
var _babelRegister = require("babel-register"); |
||||
|
||||
var _babelRegister2 = _interopRequireDefault(_babelRegister); |
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
var program = new _commander2.default.Command("babel-node"); |
||||
|
||||
program.option("-e, --eval [script]", "Evaluate script"); |
||||
program.option("-p, --print [code]", "Evaluate script and print result"); |
||||
program.option("-o, --only [globs]", ""); |
||||
program.option("-i, --ignore [globs]", ""); |
||||
program.option("-x, --extensions [extensions]", "List of extensions to hook into [.es6,.js,.es,.jsx]"); |
||||
program.option("-w, --plugins [string]", "", _babelCore.util.list); |
||||
program.option("-b, --presets [string]", "", _babelCore.util.list); |
||||
|
||||
var pkg = require("../package.json"); |
||||
program.version(pkg.version); |
||||
program.usage("[options] [ -e script | script.js ] [arguments]"); |
||||
program.parse(process.argv); |
||||
|
||||
(0, _babelRegister2.default)({ |
||||
extensions: program.extensions, |
||||
ignore: program.ignore, |
||||
only: program.only, |
||||
plugins: program.plugins, |
||||
presets: program.presets |
||||
}); |
||||
|
||||
var replPlugin = function replPlugin(_ref) { |
||||
var t = _ref.types; |
||||
return { |
||||
visitor: { |
||||
ModuleDeclaration: function ModuleDeclaration(path) { |
||||
throw path.buildCodeFrameError("Modules aren't supported in the REPL"); |
||||
}, |
||||
VariableDeclaration: function VariableDeclaration(path) { |
||||
if (path.node.kind !== "var") { |
||||
throw path.buildCodeFrameError("Only `var` variables are supported in the REPL"); |
||||
} |
||||
}, |
||||
Program: function Program(path) { |
||||
if (path.get("body").some(function (child) { |
||||
return child.isExpressionStatement(); |
||||
})) return; |
||||
|
||||
path.pushContainer("body", t.expressionStatement(t.identifier("undefined"))); |
||||
} |
||||
} |
||||
}; |
||||
}; |
||||
|
||||
var _eval = function _eval(code, filename) { |
||||
code = code.trim(); |
||||
if (!code) return undefined; |
||||
|
||||
code = babel.transform(code, { |
||||
filename: filename, |
||||
presets: program.presets, |
||||
plugins: (program.plugins || []).concat([replPlugin]) |
||||
}).code; |
||||
|
||||
return _vm2.default.runInThisContext(code, { |
||||
filename: filename |
||||
}); |
||||
}; |
||||
|
||||
if (program.eval || program.print) { |
||||
var code = program.eval; |
||||
if (!code || code === true) code = program.print; |
||||
|
||||
global.__filename = "[eval]"; |
||||
global.__dirname = process.cwd(); |
||||
|
||||
var _module = new _module3.default(global.__filename); |
||||
_module.filename = global.__filename; |
||||
_module.paths = _module3.default._nodeModulePaths(global.__dirname); |
||||
|
||||
global.exports = _module.exports; |
||||
global.module = _module; |
||||
global.require = _module.require.bind(_module); |
||||
|
||||
var result = _eval(code, global.__filename); |
||||
if (program.print) { |
||||
var output = typeof result === "string" ? result : (0, _util.inspect)(result); |
||||
process.stdout.write(output + "\n"); |
||||
} |
||||
} else { |
||||
if (program.args.length) { |
||||
var args = process.argv.slice(2); |
||||
|
||||
var i = 0; |
||||
var ignoreNext = false; |
||||
args.some(function (arg, i2) { |
||||
if (ignoreNext) { |
||||
ignoreNext = false; |
||||
return; |
||||
} |
||||
|
||||
if (arg[0] === "-") { |
||||
var parsedArg = program[arg.slice(2)]; |
||||
if (parsedArg && parsedArg !== true) { |
||||
ignoreNext = true; |
||||
} |
||||
} else { |
||||
i = i2; |
||||
return true; |
||||
} |
||||
}); |
||||
args = args.slice(i); |
||||
|
||||
var filename = args[0]; |
||||
if (!(0, _pathIsAbsolute2.default)(filename)) args[0] = _path2.default.join(process.cwd(), filename); |
||||
|
||||
process.argv = ["node"].concat(args); |
||||
process.execArgv.unshift(__filename); |
||||
|
||||
_module3.default.runMain(); |
||||
} else { |
||||
replStart(); |
||||
} |
||||
} |
||||
|
||||
function replStart() { |
||||
_repl2.default.start({ |
||||
prompt: "> ", |
||||
input: process.stdin, |
||||
output: process.stdout, |
||||
eval: replEval, |
||||
useGlobal: true |
||||
}); |
||||
} |
||||
|
||||
function replEval(code, context, filename, callback) { |
||||
var err = void 0; |
||||
var result = void 0; |
||||
|
||||
try { |
||||
if (code[0] === "(" && code[code.length - 1] === ")") { |
||||
code = code.slice(1, -1); |
||||
} |
||||
|
||||
result = _eval(code, filename); |
||||
} catch (e) { |
||||
err = e; |
||||
} |
||||
|
||||
callback(err, result); |
||||
} |
@ -1,17 +0,0 @@
@@ -1,17 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
var _commander = require("commander"); |
||||
|
||||
var _commander2 = _interopRequireDefault(_commander); |
||||
|
||||
var _babelCore = require("babel-core"); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
_commander2.default.option("-l, --whitelist [whitelist]", "Whitelist of helpers to ONLY include", _babelCore.util.list); |
||||
_commander2.default.option("-t, --output-type [type]", "Type of output (global|umd|var)", "global"); |
||||
|
||||
_commander2.default.usage("[options]"); |
||||
_commander2.default.parse(process.argv); |
||||
|
||||
console.log((0, _babelCore.buildExternalHelpers)(_commander2.default.whitelist, _commander2.default.outputType)); |
@ -1,84 +0,0 @@
@@ -1,84 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
var getV8Flags = require("v8flags"); |
||||
var path = require("path"); |
||||
|
||||
var args = [path.join(__dirname, "_babel-node")]; |
||||
|
||||
var babelArgs = process.argv.slice(2); |
||||
var userArgs = void 0; |
||||
|
||||
var argSeparator = babelArgs.indexOf("--"); |
||||
if (argSeparator > -1) { |
||||
userArgs = babelArgs.slice(argSeparator); |
||||
babelArgs = babelArgs.slice(0, argSeparator); |
||||
} |
||||
|
||||
function getNormalizedV8Flag(arg) { |
||||
var matches = arg.match(/--(.+)/); |
||||
|
||||
if (matches) { |
||||
return "--" + matches[1].replace(/-/g, "_"); |
||||
} |
||||
|
||||
return arg; |
||||
} |
||||
|
||||
getV8Flags(function (err, v8Flags) { |
||||
babelArgs.forEach(function (arg) { |
||||
var flag = arg.split("=")[0]; |
||||
|
||||
switch (flag) { |
||||
case "-d": |
||||
args.unshift("--debug"); |
||||
break; |
||||
|
||||
case "debug": |
||||
case "--debug": |
||||
case "--debug-brk": |
||||
case "--inspect": |
||||
case "--inspect-brk": |
||||
args.unshift(arg); |
||||
break; |
||||
|
||||
case "-gc": |
||||
args.unshift("--expose-gc"); |
||||
break; |
||||
|
||||
case "--nolazy": |
||||
args.unshift(flag); |
||||
break; |
||||
|
||||
default: |
||||
if (v8Flags.indexOf(getNormalizedV8Flag(flag)) >= 0 || arg.indexOf("--trace") === 0) { |
||||
args.unshift(arg); |
||||
} else { |
||||
args.push(arg); |
||||
} |
||||
break; |
||||
} |
||||
}); |
||||
|
||||
if (argSeparator > -1) { |
||||
args = args.concat(userArgs); |
||||
} |
||||
|
||||
try { |
||||
var kexec = require("kexec"); |
||||
kexec(process.argv[0], args); |
||||
} catch (err) { |
||||
if (err.code !== "MODULE_NOT_FOUND") throw err; |
||||
|
||||
var child_process = require("child_process"); |
||||
var proc = child_process.spawn(process.argv[0], args, { stdio: "inherit" }); |
||||
proc.on("exit", function (code, signal) { |
||||
process.on("exit", function () { |
||||
if (signal) { |
||||
process.kill(process.pid, signal); |
||||
} else { |
||||
process.exit(code); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
}); |
@ -1,97 +0,0 @@
@@ -1,97 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
var _stringify = require("babel-runtime/core-js/json/stringify"); |
||||
|
||||
var _stringify2 = _interopRequireDefault(_stringify); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
var outputFileSync = require("output-file-sync"); |
||||
var slash = require("slash"); |
||||
var path = require("path"); |
||||
var util = require("./util"); |
||||
var fs = require("fs"); |
||||
|
||||
module.exports = function (commander, filenames) { |
||||
function write(src, relative) { |
||||
relative = relative.replace(/\.(\w*?)$/, "") + ".js"; |
||||
|
||||
var dest = path.join(commander.outDir, relative); |
||||
|
||||
var data = util.compile(src, { |
||||
sourceFileName: slash(path.relative(dest + "/..", src)), |
||||
sourceMapTarget: path.basename(relative) |
||||
}); |
||||
if (!commander.copyFiles && data.ignored) return; |
||||
|
||||
if (data.map && commander.sourceMaps && commander.sourceMaps !== "inline") { |
||||
var mapLoc = dest + ".map"; |
||||
data.code = util.addSourceMappingUrl(data.code, mapLoc); |
||||
outputFileSync(mapLoc, (0, _stringify2.default)(data.map)); |
||||
} |
||||
|
||||
outputFileSync(dest, data.code); |
||||
util.chmod(src, dest); |
||||
|
||||
util.log(src + " -> " + dest); |
||||
} |
||||
|
||||
function handleFile(src, filename) { |
||||
if (util.shouldIgnore(src)) return; |
||||
|
||||
if (util.canCompile(filename, commander.extensions)) { |
||||
write(src, filename); |
||||
} else if (commander.copyFiles) { |
||||
var dest = path.join(commander.outDir, filename); |
||||
outputFileSync(dest, fs.readFileSync(src)); |
||||
util.chmod(src, dest); |
||||
} |
||||
} |
||||
|
||||
function handle(filename) { |
||||
if (!fs.existsSync(filename)) return; |
||||
|
||||
var stat = fs.statSync(filename); |
||||
|
||||
if (stat.isDirectory(filename)) { |
||||
var dirname = filename; |
||||
|
||||
util.readdir(dirname).forEach(function (filename) { |
||||
var src = path.join(dirname, filename); |
||||
handleFile(src, filename); |
||||
}); |
||||
} else { |
||||
write(filename, filename); |
||||
} |
||||
} |
||||
|
||||
if (!commander.skipInitialBuild) { |
||||
filenames.forEach(handle); |
||||
} |
||||
|
||||
if (commander.watch) { |
||||
var chokidar = util.requireChokidar(); |
||||
|
||||
filenames.forEach(function (dirname) { |
||||
var watcher = chokidar.watch(dirname, { |
||||
persistent: true, |
||||
ignoreInitial: true, |
||||
awaitWriteFinish: { |
||||
stabilityThreshold: 50, |
||||
pollInterval: 10 |
||||
} |
||||
}); |
||||
|
||||
["add", "change"].forEach(function (type) { |
||||
watcher.on(type, function (filename) { |
||||
var relative = path.relative(dirname, filename) || filename; |
||||
try { |
||||
handleFile(filename, relative); |
||||
} catch (err) { |
||||
console.error(err.stack); |
||||
} |
||||
}); |
||||
}); |
||||
}); |
||||
} |
||||
}; |
@ -1,188 +0,0 @@
@@ -1,188 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
var _stringify = require("babel-runtime/core-js/json/stringify"); |
||||
|
||||
var _stringify2 = _interopRequireDefault(_stringify); |
||||
|
||||
var _set = require("babel-runtime/core-js/set"); |
||||
|
||||
var _set2 = _interopRequireDefault(_set); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
var convertSourceMap = require("convert-source-map"); |
||||
var sourceMap = require("source-map"); |
||||
var slash = require("slash"); |
||||
var path = require("path"); |
||||
var util = require("./util"); |
||||
var fs = require("fs"); |
||||
|
||||
module.exports = function (commander, filenames, opts) { |
||||
if (commander.sourceMaps === "inline") { |
||||
opts.sourceMaps = true; |
||||
} |
||||
|
||||
var results = []; |
||||
|
||||
var buildResult = function buildResult() { |
||||
var map = new sourceMap.SourceMapGenerator({ |
||||
file: path.basename(commander.outFile || "") || "stdout", |
||||
sourceRoot: opts.sourceRoot |
||||
}); |
||||
|
||||
var code = ""; |
||||
var offset = 0; |
||||
|
||||
results.forEach(function (result) { |
||||
code += result.code + "\n"; |
||||
|
||||
if (result.map) { |
||||
var consumer = new sourceMap.SourceMapConsumer(result.map); |
||||
var sources = new _set2.default(); |
||||
|
||||
consumer.eachMapping(function (mapping) { |
||||
if (mapping.source != null) sources.add(mapping.source); |
||||
|
||||
map.addMapping({ |
||||
generated: { |
||||
line: mapping.generatedLine + offset, |
||||
column: mapping.generatedColumn |
||||
}, |
||||
source: mapping.source, |
||||
original: mapping.source == null ? null : { |
||||
line: mapping.originalLine, |
||||
column: mapping.originalColumn |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
sources.forEach(function (source) { |
||||
var content = consumer.sourceContentFor(source, true); |
||||
if (content !== null) { |
||||
map.setSourceContent(source, content); |
||||
} |
||||
}); |
||||
|
||||
offset = code.split("\n").length - 1; |
||||
} |
||||
}); |
||||
|
||||
if (commander.sourceMaps === "inline" || !commander.outFile && commander.sourceMaps) { |
||||
code += "\n" + convertSourceMap.fromObject(map).toComment(); |
||||
} |
||||
|
||||
return { |
||||
map: map, |
||||
code: code |
||||
}; |
||||
}; |
||||
|
||||
var output = function output() { |
||||
var result = buildResult(); |
||||
|
||||
if (commander.outFile) { |
||||
if (commander.sourceMaps && commander.sourceMaps !== "inline") { |
||||
var mapLoc = commander.outFile + ".map"; |
||||
result.code = util.addSourceMappingUrl(result.code, mapLoc); |
||||
fs.writeFileSync(mapLoc, (0, _stringify2.default)(result.map)); |
||||
} |
||||
|
||||
fs.writeFileSync(commander.outFile, result.code); |
||||
} else { |
||||
process.stdout.write(result.code + "\n"); |
||||
} |
||||
}; |
||||
|
||||
var stdin = function stdin() { |
||||
var code = ""; |
||||
|
||||
process.stdin.setEncoding("utf8"); |
||||
|
||||
process.stdin.on("readable", function () { |
||||
var chunk = process.stdin.read(); |
||||
if (chunk !== null) code += chunk; |
||||
}); |
||||
|
||||
process.stdin.on("end", function () { |
||||
results.push(util.transform(commander.filename, code, { |
||||
sourceFileName: "stdin" |
||||
})); |
||||
output(); |
||||
}); |
||||
}; |
||||
|
||||
var walk = function walk() { |
||||
var _filenames = []; |
||||
results = []; |
||||
|
||||
filenames.forEach(function (filename) { |
||||
if (!fs.existsSync(filename)) return; |
||||
|
||||
var stat = fs.statSync(filename); |
||||
if (stat.isDirectory()) { |
||||
var dirname = filename; |
||||
|
||||
util.readdirFilter(filename).forEach(function (filename) { |
||||
_filenames.push(path.join(dirname, filename)); |
||||
}); |
||||
} else { |
||||
_filenames.push(filename); |
||||
} |
||||
}); |
||||
|
||||
_filenames.forEach(function (filename) { |
||||
if (util.shouldIgnore(filename)) return; |
||||
|
||||
var sourceFilename = filename; |
||||
if (commander.outFile) { |
||||
sourceFilename = path.relative(path.dirname(commander.outFile), sourceFilename); |
||||
} |
||||
sourceFilename = slash(sourceFilename); |
||||
|
||||
var data = util.compile(filename, { |
||||
sourceFileName: sourceFilename |
||||
}); |
||||
|
||||
if (data.ignored) return; |
||||
results.push(data); |
||||
}); |
||||
|
||||
output(); |
||||
}; |
||||
|
||||
var files = function files() { |
||||
|
||||
if (!commander.skipInitialBuild) { |
||||
walk(); |
||||
} |
||||
|
||||
if (commander.watch) { |
||||
var chokidar = util.requireChokidar(); |
||||
chokidar.watch(filenames, { |
||||
persistent: true, |
||||
ignoreInitial: true, |
||||
awaitWriteFinish: { |
||||
stabilityThreshold: 50, |
||||
pollInterval: 10 |
||||
} |
||||
}).on("all", function (type, filename) { |
||||
if (util.shouldIgnore(filename) || !util.canCompile(filename, commander.extensions)) return; |
||||
|
||||
if (type === "add" || type === "change") { |
||||
util.log(type + " " + filename); |
||||
try { |
||||
walk(); |
||||
} catch (err) { |
||||
console.error(err.stack); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
}; |
||||
|
||||
if (filenames.length) { |
||||
files(); |
||||
} else { |
||||
stdin(); |
||||
} |
||||
}; |
@ -1,129 +0,0 @@
@@ -1,129 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict"; |
||||
|
||||
var _keys = require("babel-runtime/core-js/object/keys"); |
||||
|
||||
var _keys2 = _interopRequireDefault(_keys); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
var fs = require("fs"); |
||||
var commander = require("commander"); |
||||
var kebabCase = require("lodash/kebabCase"); |
||||
var options = require("babel-core").options; |
||||
var util = require("babel-core").util; |
||||
var uniq = require("lodash/uniq"); |
||||
var glob = require("glob"); |
||||
|
||||
(0, _keys2.default)(options).forEach(function (key) { |
||||
var option = options[key]; |
||||
if (option.hidden) return; |
||||
|
||||
var arg = kebabCase(key); |
||||
|
||||
if (option.type !== "boolean") { |
||||
arg += " [" + (option.type || "string") + "]"; |
||||
} |
||||
|
||||
if (option.type === "boolean" && option.default === true) { |
||||
arg = "no-" + arg; |
||||
} |
||||
|
||||
arg = "--" + arg; |
||||
|
||||
if (option.shorthand) { |
||||
arg = "-" + option.shorthand + ", " + arg; |
||||
} |
||||
|
||||
var desc = []; |
||||
if (option.deprecated) desc.push("[DEPRECATED] " + option.deprecated); |
||||
if (option.description) desc.push(option.description); |
||||
|
||||
commander.option(arg, desc.join(" ")); |
||||
}); |
||||
|
||||
commander.option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx]"); |
||||
commander.option("-w, --watch", "Recompile files on changes"); |
||||
commander.option("--skip-initial-build", "Do not compile files before watching"); |
||||
commander.option("-o, --out-file [out]", "Compile all input files into a single file"); |
||||
commander.option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory"); |
||||
commander.option("-D, --copy-files", "When compiling a directory copy over non-compilable files"); |
||||
commander.option("-q, --quiet", "Don't log anything"); |
||||
|
||||
|
||||
var pkg = require("../../package.json"); |
||||
commander.version(pkg.version + " (babel-core " + require("babel-core").version + ")"); |
||||
commander.usage("[options] <files ...>"); |
||||
commander.parse(process.argv); |
||||
|
||||
if (commander.extensions) { |
||||
commander.extensions = util.arrayify(commander.extensions); |
||||
} |
||||
|
||||
var errors = []; |
||||
|
||||
var filenames = commander.args.reduce(function (globbed, input) { |
||||
var files = glob.sync(input); |
||||
if (!files.length) files = [input]; |
||||
return globbed.concat(files); |
||||
}, []); |
||||
|
||||
filenames = uniq(filenames); |
||||
|
||||
filenames.forEach(function (filename) { |
||||
if (!fs.existsSync(filename)) { |
||||
errors.push(filename + " doesn't exist"); |
||||
} |
||||
}); |
||||
|
||||
if (commander.outDir && !filenames.length) { |
||||
errors.push("filenames required for --out-dir"); |
||||
} |
||||
|
||||
if (commander.outFile && commander.outDir) { |
||||
errors.push("cannot have --out-file and --out-dir"); |
||||
} |
||||
|
||||
if (commander.watch) { |
||||
if (!commander.outFile && !commander.outDir) { |
||||
errors.push("--watch requires --out-file or --out-dir"); |
||||
} |
||||
|
||||
if (!filenames.length) { |
||||
errors.push("--watch requires filenames"); |
||||
} |
||||
} |
||||
|
||||
if (commander.skipInitialBuild && !commander.watch) { |
||||
errors.push("--skip-initial-build requires --watch"); |
||||
} |
||||
|
||||
if (errors.length) { |
||||
console.error(errors.join(". ")); |
||||
process.exit(2); |
||||
} |
||||
|
||||
var opts = exports.opts = {}; |
||||
|
||||
(0, _keys2.default)(options).forEach(function (key) { |
||||
var opt = options[key]; |
||||
if (commander[key] !== undefined && commander[key] !== opt.default) { |
||||
opts[key] = commander[key]; |
||||
} |
||||
}); |
||||
|
||||
opts.ignore = util.arrayify(opts.ignore, util.regexify); |
||||
|
||||
if (opts.only) { |
||||
opts.only = util.arrayify(opts.only, util.regexify); |
||||
} |
||||
|
||||
var fn = void 0; |
||||
|
||||
if (commander.outDir) { |
||||
fn = require("./dir"); |
||||
} else { |
||||
fn = require("./file"); |
||||
} |
||||
|
||||
fn(commander, filenames, exports.opts); |
@ -1,90 +0,0 @@
@@ -1,90 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
exports.chmod = chmod; |
||||
exports.readdirFilter = readdirFilter; |
||||
exports.shouldIgnore = shouldIgnore; |
||||
exports.addSourceMappingUrl = addSourceMappingUrl; |
||||
exports.log = log; |
||||
exports.transform = transform; |
||||
exports.compile = compile; |
||||
exports.requireChokidar = requireChokidar; |
||||
var commander = require("commander"); |
||||
var defaults = require("lodash/defaults"); |
||||
var readdir = require("fs-readdir-recursive"); |
||||
var index = require("./index"); |
||||
var babel = require("babel-core"); |
||||
var util = require("babel-core").util; |
||||
var path = require("path"); |
||||
var fs = require("fs"); |
||||
|
||||
function chmod(src, dest) { |
||||
fs.chmodSync(dest, fs.statSync(src).mode); |
||||
} |
||||
|
||||
function readdirFilter(filename) { |
||||
return readdir(filename).filter(function (filename) { |
||||
return util.canCompile(filename); |
||||
}); |
||||
} |
||||
|
||||
exports.readdir = readdir; |
||||
var canCompile = exports.canCompile = util.canCompile; |
||||
|
||||
function shouldIgnore(loc) { |
||||
return util.shouldIgnore(loc, index.opts.ignore, index.opts.only); |
||||
} |
||||
|
||||
function addSourceMappingUrl(code, loc) { |
||||
return code + "\n//# sourceMappingURL=" + path.basename(loc); |
||||
} |
||||
|
||||
function log(msg) { |
||||
if (!commander.quiet) console.log(msg); |
||||
} |
||||
|
||||
function transform(filename, code, opts) { |
||||
opts = defaults(opts || {}, index.opts); |
||||
opts.filename = filename; |
||||
|
||||
var result = babel.transform(code, opts); |
||||
result.filename = filename; |
||||
result.actual = code; |
||||
return result; |
||||
} |
||||
|
||||
function compile(filename, opts) { |
||||
try { |
||||
var code = fs.readFileSync(filename, "utf8"); |
||||
return transform(filename, code, opts); |
||||
} catch (err) { |
||||
if (commander.watch) { |
||||
console.error(toErrorStack(err)); |
||||
return { ignored: true }; |
||||
} else { |
||||
throw err; |
||||
} |
||||
} |
||||
} |
||||
|
||||
function toErrorStack(err) { |
||||
if (err._babel && err instanceof SyntaxError) { |
||||
return err.name + ": " + err.message + "\n" + err.codeFrame; |
||||
} else { |
||||
return err.stack; |
||||
} |
||||
} |
||||
|
||||
process.on("uncaughtException", function (err) { |
||||
console.error(toErrorStack(err)); |
||||
process.exit(1); |
||||
}); |
||||
|
||||
function requireChokidar() { |
||||
try { |
||||
return require("chokidar"); |
||||
} catch (err) { |
||||
console.error("The optional dependency chokidar failed to install and is required for " + "--watch. Chokidar is likely not supported on your platform."); |
||||
throw err; |
||||
} |
||||
} |
@ -1,161 +0,0 @@
@@ -1,161 +0,0 @@
|
||||
{ |
||||
"name": "babel-cli", |
||||
"version": "6.24.1", |
||||
"lockfileVersion": 1, |
||||
"requires": true, |
||||
"dependencies": { |
||||
"balanced-match": { |
||||
"version": "1.0.0", |
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", |
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" |
||||
}, |
||||
"brace-expansion": { |
||||
"version": "1.1.8", |
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", |
||||
"integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", |
||||
"requires": { |
||||
"balanced-match": "1.0.0", |
||||
"concat-map": "0.0.1" |
||||
} |
||||
}, |
||||
"commander": { |
||||
"version": "2.11.0", |
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", |
||||
"integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==" |
||||
}, |
||||
"concat-map": { |
||||
"version": "0.0.1", |
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", |
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" |
||||
}, |
||||
"convert-source-map": { |
||||
"version": "1.5.0", |
||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", |
||||
"integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=" |
||||
}, |
||||
"fs-readdir-recursive": { |
||||
"version": "1.0.0", |
||||
"resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.0.0.tgz", |
||||
"integrity": "sha1-jNF0XItPiinIyuw5JHaSG6GV9WA=" |
||||
}, |
||||
"fs.realpath": { |
||||
"version": "1.0.0", |
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", |
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" |
||||
}, |
||||
"glob": { |
||||
"version": "7.1.2", |
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", |
||||
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", |
||||
"requires": { |
||||
"fs.realpath": "1.0.0", |
||||
"inflight": "1.0.6", |
||||
"inherits": "2.0.3", |
||||
"minimatch": "3.0.4", |
||||
"once": "1.4.0", |
||||
"path-is-absolute": "1.0.1" |
||||
} |
||||
}, |
||||
"graceful-fs": { |
||||
"version": "4.1.11", |
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", |
||||
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" |
||||
}, |
||||
"inflight": { |
||||
"version": "1.0.6", |
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", |
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", |
||||
"requires": { |
||||
"once": "1.4.0", |
||||
"wrappy": "1.0.2" |
||||
} |
||||
}, |
||||
"inherits": { |
||||
"version": "2.0.3", |
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", |
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" |
||||
}, |
||||
"lodash": { |
||||
"version": "4.17.4", |
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", |
||||
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" |
||||
}, |
||||
"minimatch": { |
||||
"version": "3.0.4", |
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", |
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", |
||||
"requires": { |
||||
"brace-expansion": "1.1.8" |
||||
} |
||||
}, |
||||
"minimist": { |
||||
"version": "0.0.8", |
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", |
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" |
||||
}, |
||||
"mkdirp": { |
||||
"version": "0.5.1", |
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", |
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", |
||||
"requires": { |
||||
"minimist": "0.0.8" |
||||
} |
||||
}, |
||||
"object-assign": { |
||||
"version": "4.1.1", |
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", |
||||
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" |
||||
}, |
||||
"once": { |
||||
"version": "1.4.0", |
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", |
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", |
||||
"requires": { |
||||
"wrappy": "1.0.2" |
||||
} |
||||
}, |
||||
"output-file-sync": { |
||||
"version": "1.1.2", |
||||
"resolved": "https://registry.npmjs.org/output-file-sync/-/output-file-sync-1.1.2.tgz", |
||||
"integrity": "sha1-0KM+7+YaIF+suQCS6CZZjVJFznY=", |
||||
"requires": { |
||||
"graceful-fs": "4.1.11", |
||||
"mkdirp": "0.5.1", |
||||
"object-assign": "4.1.1" |
||||
} |
||||
}, |
||||
"path-is-absolute": { |
||||
"version": "1.0.1", |
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", |
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" |
||||
}, |
||||
"slash": { |
||||
"version": "1.0.0", |
||||
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", |
||||
"integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=" |
||||
}, |
||||
"source-map": { |
||||
"version": "0.5.6", |
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", |
||||
"integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=" |
||||
}, |
||||
"user-home": { |
||||
"version": "1.1.1", |
||||
"resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", |
||||
"integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=" |
||||
}, |
||||
"v8flags": { |
||||
"version": "2.1.1", |
||||
"resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.1.1.tgz", |
||||
"integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", |
||||
"requires": { |
||||
"user-home": "1.1.1" |
||||
} |
||||
}, |
||||
"wrappy": { |
||||
"version": "1.0.2", |
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", |
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" |
||||
} |
||||
} |
||||
} |
@ -1,79 +0,0 @@
@@ -1,79 +0,0 @@
|
||||
{ |
||||
"_from": "babel-cli@6", |
||||
"_id": "babel-cli@6.26.0", |
||||
"_inBundle": false, |
||||
"_integrity": "sha1-UCq1SHTX24itALiHoGODzgPQAvE=", |
||||
"_location": "/babel-cli", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "range", |
||||
"registry": true, |
||||
"raw": "babel-cli@6", |
||||
"name": "babel-cli", |
||||
"escapedName": "babel-cli", |
||||
"rawSpec": "6", |
||||
"saveSpec": null, |
||||
"fetchSpec": "6" |
||||
}, |
||||
"_requiredBy": [ |
||||
"#USER", |
||||
"/" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/babel-cli/-/babel-cli-6.26.0.tgz", |
||||
"_shasum": "502ab54874d7db88ad00b887a06383ce03d002f1", |
||||
"_spec": "babel-cli@6", |
||||
"_where": "/home/rudi/Personal/disgord-Thanos", |
||||
"author": { |
||||
"name": "Sebastian McKenzie", |
||||
"email": "sebmck@gmail.com" |
||||
}, |
||||
"bin": { |
||||
"babel-doctor": "bin/babel-doctor.js", |
||||
"babel": "bin/babel.js", |
||||
"babel-node": "bin/babel-node.js", |
||||
"babel-external-helpers": "bin/babel-external-helpers.js" |
||||
}, |
||||
"bundleDependencies": false, |
||||
"dependencies": { |
||||
"babel-core": "^6.26.0", |
||||
"babel-polyfill": "^6.26.0", |
||||
"babel-register": "^6.26.0", |
||||
"babel-runtime": "^6.26.0", |
||||
"chokidar": "^1.6.1", |
||||
"commander": "^2.11.0", |
||||
"convert-source-map": "^1.5.0", |
||||
"fs-readdir-recursive": "^1.0.0", |
||||
"glob": "^7.1.2", |
||||
"lodash": "^4.17.4", |
||||
"output-file-sync": "^1.1.2", |
||||
"path-is-absolute": "^1.0.1", |
||||
"slash": "^1.0.0", |
||||
"source-map": "^0.5.6", |
||||
"v8flags": "^2.1.1" |
||||
}, |
||||
"deprecated": false, |
||||
"description": "Babel command line.", |
||||
"devDependencies": { |
||||
"babel-helper-fixtures": "^6.26.0" |
||||
}, |
||||
"homepage": "https://babeljs.io/", |
||||
"keywords": [ |
||||
"6to5", |
||||
"babel", |
||||
"es6", |
||||
"transpile", |
||||
"transpiler", |
||||
"babel-cli", |
||||
"compiler" |
||||
], |
||||
"license": "MIT", |
||||
"name": "babel-cli", |
||||
"optionalDependencies": { |
||||
"chokidar": "^1.6.1" |
||||
}, |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-cli" |
||||
}, |
||||
"version": "6.26.0" |
||||
} |
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh |
||||
set -e |
||||
npm link babel-core |
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
src |
||||
test |
||||
node_modules |
@ -1,60 +0,0 @@
@@ -1,60 +0,0 @@
|
||||
# babel-code-frame |
||||
|
||||
> Generate errors that contain a code frame that point to source locations. |
||||
|
||||
## Install |
||||
|
||||
```sh |
||||
npm install --save-dev babel-code-frame |
||||
``` |
||||
|
||||
## Usage |
||||
|
||||
```js |
||||
import codeFrame from 'babel-code-frame'; |
||||
|
||||
const rawLines = `class Foo { |
||||
constructor() |
||||
}`; |
||||
const lineNumber = 2; |
||||
const colNumber = 16; |
||||
|
||||
const result = codeFrame(rawLines, lineNumber, colNumber, { /* options */ }); |
||||
|
||||
console.log(result); |
||||
``` |
||||
|
||||
```sh |
||||
1 | class Foo { |
||||
> 2 | constructor() |
||||
| ^ |
||||
3 | } |
||||
``` |
||||
|
||||
If the column number is not known, you may pass `null` instead. |
||||
|
||||
## Options |
||||
|
||||
### `highlightCode` |
||||
|
||||
`boolean`, defaults to `false`. |
||||
|
||||
Toggles syntax highlighting the code as JavaScript for terminals. |
||||
|
||||
### `linesAbove` |
||||
|
||||
`number`, defaults to `2`. |
||||
|
||||
Adjust the number of lines to show above the error. |
||||
|
||||
### `linesBelow` |
||||
|
||||
`number`, defaults to `3`. |
||||
|
||||
Adjust the number of lines to show below the error. |
||||
|
||||
### `forceColor` |
||||
|
||||
`boolean`, defaults to `false`. |
||||
|
||||
Enable this to forcibly syntax highlight the code as JavaScript (for non-terminals); overrides `highlightCode`. |
@ -1,141 +0,0 @@
@@ -1,141 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
|
||||
exports.default = function (rawLines, lineNumber, colNumber) { |
||||
var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; |
||||
|
||||
colNumber = Math.max(colNumber, 0); |
||||
|
||||
var highlighted = opts.highlightCode && _chalk2.default.supportsColor || opts.forceColor; |
||||
var chalk = _chalk2.default; |
||||
if (opts.forceColor) { |
||||
chalk = new _chalk2.default.constructor({ enabled: true }); |
||||
} |
||||
var maybeHighlight = function maybeHighlight(chalkFn, string) { |
||||
return highlighted ? chalkFn(string) : string; |
||||
}; |
||||
var defs = getDefs(chalk); |
||||
if (highlighted) rawLines = highlight(defs, rawLines); |
||||
|
||||
var linesAbove = opts.linesAbove || 2; |
||||
var linesBelow = opts.linesBelow || 3; |
||||
|
||||
var lines = rawLines.split(NEWLINE); |
||||
var start = Math.max(lineNumber - (linesAbove + 1), 0); |
||||
var end = Math.min(lines.length, lineNumber + linesBelow); |
||||
|
||||
if (!lineNumber && !colNumber) { |
||||
start = 0; |
||||
end = lines.length; |
||||
} |
||||
|
||||
var numberMaxWidth = String(end).length; |
||||
|
||||
var frame = lines.slice(start, end).map(function (line, index) { |
||||
var number = start + 1 + index; |
||||
var paddedNumber = (" " + number).slice(-numberMaxWidth); |
||||
var gutter = " " + paddedNumber + " | "; |
||||
if (number === lineNumber) { |
||||
var markerLine = ""; |
||||
if (colNumber) { |
||||
var markerSpacing = line.slice(0, colNumber - 1).replace(/[^\t]/g, " "); |
||||
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^")].join(""); |
||||
} |
||||
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join(""); |
||||
} else { |
||||
return " " + maybeHighlight(defs.gutter, gutter) + line; |
||||
} |
||||
}).join("\n"); |
||||
|
||||
if (highlighted) { |
||||
return chalk.reset(frame); |
||||
} else { |
||||
return frame; |
||||
} |
||||
}; |
||||
|
||||
var _jsTokens = require("js-tokens"); |
||||
|
||||
var _jsTokens2 = _interopRequireDefault(_jsTokens); |
||||
|
||||
var _esutils = require("esutils"); |
||||
|
||||
var _esutils2 = _interopRequireDefault(_esutils); |
||||
|
||||
var _chalk = require("chalk"); |
||||
|
||||
var _chalk2 = _interopRequireDefault(_chalk); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
function getDefs(chalk) { |
||||
return { |
||||
keyword: chalk.cyan, |
||||
capitalized: chalk.yellow, |
||||
jsx_tag: chalk.yellow, |
||||
punctuator: chalk.yellow, |
||||
|
||||
number: chalk.magenta, |
||||
string: chalk.green, |
||||
regex: chalk.magenta, |
||||
comment: chalk.grey, |
||||
invalid: chalk.white.bgRed.bold, |
||||
gutter: chalk.grey, |
||||
marker: chalk.red.bold |
||||
}; |
||||
} |
||||
|
||||
var NEWLINE = /\r\n|[\n\r\u2028\u2029]/; |
||||
|
||||
var JSX_TAG = /^[a-z][\w-]*$/i; |
||||
|
||||
var BRACKET = /^[()\[\]{}]$/; |
||||
|
||||
function getTokenType(match) { |
||||
var _match$slice = match.slice(-2), |
||||
offset = _match$slice[0], |
||||
text = _match$slice[1]; |
||||
|
||||
var token = (0, _jsTokens.matchToToken)(match); |
||||
|
||||
if (token.type === "name") { |
||||
if (_esutils2.default.keyword.isReservedWordES6(token.value)) { |
||||
return "keyword"; |
||||
} |
||||
|
||||
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) { |
||||
return "jsx_tag"; |
||||
} |
||||
|
||||
if (token.value[0] !== token.value[0].toLowerCase()) { |
||||
return "capitalized"; |
||||
} |
||||
} |
||||
|
||||
if (token.type === "punctuator" && BRACKET.test(token.value)) { |
||||
return "bracket"; |
||||
} |
||||
|
||||
return token.type; |
||||
} |
||||
|
||||
function highlight(defs, text) { |
||||
return text.replace(_jsTokens2.default, function () { |
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { |
||||
args[_key] = arguments[_key]; |
||||
} |
||||
|
||||
var type = getTokenType(args); |
||||
var colorize = defs[type]; |
||||
if (colorize) { |
||||
return args[0].split(NEWLINE).map(function (str) { |
||||
return colorize(str); |
||||
}).join("\n"); |
||||
} else { |
||||
return args[0]; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
module.exports = exports["default"]; |
@ -1,66 +0,0 @@
@@ -1,66 +0,0 @@
|
||||
{ |
||||
"name": "babel-code-frame", |
||||
"version": "6.22.0", |
||||
"lockfileVersion": 1, |
||||
"requires": true, |
||||
"dependencies": { |
||||
"ansi-regex": { |
||||
"version": "2.1.1", |
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", |
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" |
||||
}, |
||||
"ansi-styles": { |
||||
"version": "2.2.1", |
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", |
||||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" |
||||
}, |
||||
"chalk": { |
||||
"version": "1.1.3", |
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", |
||||
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", |
||||
"requires": { |
||||
"ansi-styles": "2.2.1", |
||||
"escape-string-regexp": "1.0.5", |
||||
"has-ansi": "2.0.0", |
||||
"strip-ansi": "3.0.1", |
||||
"supports-color": "2.0.0" |
||||
} |
||||
}, |
||||
"escape-string-regexp": { |
||||
"version": "1.0.5", |
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", |
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" |
||||
}, |
||||
"esutils": { |
||||
"version": "2.0.2", |
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", |
||||
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" |
||||
}, |
||||
"has-ansi": { |
||||
"version": "2.0.0", |
||||
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", |
||||
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", |
||||
"requires": { |
||||
"ansi-regex": "2.1.1" |
||||
} |
||||
}, |
||||
"js-tokens": { |
||||
"version": "3.0.2", |
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", |
||||
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" |
||||
}, |
||||
"strip-ansi": { |
||||
"version": "3.0.1", |
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", |
||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", |
||||
"requires": { |
||||
"ansi-regex": "2.1.1" |
||||
} |
||||
}, |
||||
"supports-color": { |
||||
"version": "2.0.0", |
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", |
||||
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" |
||||
} |
||||
} |
||||
} |
@ -1,47 +0,0 @@
@@ -1,47 +0,0 @@
|
||||
{ |
||||
"_from": "babel-code-frame@^6.26.0", |
||||
"_id": "babel-code-frame@6.26.0", |
||||
"_inBundle": false, |
||||
"_integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", |
||||
"_location": "/babel-code-frame", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "range", |
||||
"registry": true, |
||||
"raw": "babel-code-frame@^6.26.0", |
||||
"name": "babel-code-frame", |
||||
"escapedName": "babel-code-frame", |
||||
"rawSpec": "^6.26.0", |
||||
"saveSpec": null, |
||||
"fetchSpec": "^6.26.0" |
||||
}, |
||||
"_requiredBy": [ |
||||
"/babel-core", |
||||
"/babel-traverse" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", |
||||
"_shasum": "63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b", |
||||
"_spec": "babel-code-frame@^6.26.0", |
||||
"_where": "/home/rudi/Personal/disgord-Thanos/node_modules/babel-core", |
||||
"author": { |
||||
"name": "Sebastian McKenzie", |
||||
"email": "sebmck@gmail.com" |
||||
}, |
||||
"bundleDependencies": false, |
||||
"dependencies": { |
||||
"chalk": "^1.1.3", |
||||
"esutils": "^2.0.2", |
||||
"js-tokens": "^3.0.2" |
||||
}, |
||||
"deprecated": false, |
||||
"description": "Generate errors that contain a code frame that point to source locations.", |
||||
"homepage": "https://babeljs.io/", |
||||
"license": "MIT", |
||||
"main": "lib/index.js", |
||||
"name": "babel-code-frame", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-code-frame" |
||||
}, |
||||
"version": "6.26.0" |
||||
} |
@ -1,117 +0,0 @@
@@ -1,117 +0,0 @@
|
||||
# babel-core |
||||
|
||||
> Babel compiler core. |
||||
|
||||
|
||||
```javascript |
||||
var babel = require("babel-core"); |
||||
import { transform } from 'babel-core'; |
||||
import * as babel from 'babel-core'; |
||||
``` |
||||
|
||||
All transformations will use your local configuration files (.babelrc or in package.json). See [options](#options) to disable it. |
||||
|
||||
## babel.transform(code: string, [options?](#options): Object) |
||||
|
||||
Transforms the passed in `code`. Returning an object with the generated code, |
||||
source map, and AST. |
||||
|
||||
```js |
||||
babel.transform(code, options) // => { code, map, ast } |
||||
``` |
||||
|
||||
**Example** |
||||
|
||||
```js |
||||
var result = babel.transform("code();", options); |
||||
result.code; |
||||
result.map; |
||||
result.ast; |
||||
``` |
||||
|
||||
## babel.transformFile(filename: string, [options?](#options): Object, callback: Function) |
||||
|
||||
Asynchronously transforms the entire contents of a file. |
||||
|
||||
```js |
||||
babel.transformFile(filename, options, callback) |
||||
``` |
||||
|
||||
**Example** |
||||
|
||||
```js |
||||
babel.transformFile("filename.js", options, function (err, result) { |
||||
result; // => { code, map, ast } |
||||
}); |
||||
``` |
||||
|
||||
## babel.transformFileSync(filename: string, [options?](#options): Object) |
||||
|
||||
Synchronous version of `babel.transformFile`. Returns the transformed contents of |
||||
the `filename`. |
||||
|
||||
```js |
||||
babel.transformFileSync(filename, options) // => { code, map, ast } |
||||
``` |
||||
|
||||
**Example** |
||||
|
||||
```js |
||||
babel.transformFileSync("filename.js", options).code; |
||||
``` |
||||
|
||||
## babel.transformFromAst(ast: Object, code?: string, [options?](#options): Object) |
||||
|
||||
Given, an [AST](https://astexplorer.net/), transform it. |
||||
|
||||
```js |
||||
const code = "if (true) return;"; |
||||
const ast = babylon.parse(code, { allowReturnOutsideFunction: true }); |
||||
const { code, map, ast } = babel.transformFromAst(ast, code, options); |
||||
``` |
||||
|
||||
## Options |
||||
|
||||
> #### Babel CLI |
||||
> |
||||
> You can pass these options from the Babel CLI like so: |
||||
> |
||||
> `babel --name=value` |
||||
|
||||
Following is a table of the options you can use: |
||||
|
||||
| Option | Default | Description | |
||||
| ------------------------ | -------------------- | ------------------------------- | |
||||
| `ast` | `true` | Include the AST in the returned object | |
||||
| `auxiliaryCommentAfter` | `null` | Attach a comment after all non-user injected code. | |
||||
| `auxiliaryCommentBefore` | `null` | Attach a comment before all non-user injected code. | |
||||
| `babelrc` | `true` | Specify whether or not to use .babelrc and .babelignore files. Not available when using the CLI, [use `--no-babelrc` instead](https://babeljs.io/docs/en/babel-cli#ignoring-babelrc). | |
||||
| `code` | `true` | Enable code generation | |
||||
| `comments` | `true` | Output comments in generated output. | |
||||
| `compact` | `"auto"` | Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB. | |
||||
| `env` | `{}` | This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { /* specific options */ } } }` which will use those options when the environment variable `BABEL_ENV` is set to `"production"`. If `BABEL_ENV` isn't set then `NODE_ENV` will be used, if it's not set then it defaults to `"development"` | |
||||
| `extends` | `null` | A path to an `.babelrc` file to extend | |
||||
| `filename` | `"unknown"` | Filename for use in errors etc. | |
||||
| `filenameRelative` | `(filename)` | Filename relative to `sourceRoot`. | |
||||
| `generatorOpts` | `{}` | An object containing the options to be passed down to the babel code generator, babel-generator | |
||||
| `getModuleId` | `null` | Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used. | |
||||
| `highlightCode` | `true` | ANSI highlight syntax error code frames | |
||||
| `ignore` | `null` | Opposite to the `only` option. `ignore` is disregarded if `only` is specified. | |
||||
| `inputSourceMap` | `null` | A source map object that the output source map will be based on. | |
||||
| `minified` | `false` | Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe) | |
||||
| `moduleId` | `null` | Specify a custom name for module ids. | |
||||
| `moduleIds` | `false` | If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules) | |
||||
| `moduleRoot` | `(sourceRoot)` | Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. | |
||||
| `only` | `null` | A [glob](https://github.com/isaacs/minimatch), regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile a non-matching file it's returned verbatim. | |
||||
| `parserOpts` | `{}` | An object containing the options to be passed down to the babel parser, babylon | |
||||
| `plugins` | `[]` | List of [plugins](https://babeljs.io/docs/en/plugins) to load and use. | |
||||
| `presets` | `[]` | List of [presets](https://babeljs.io/docs/en/plugins#presets) (a set of plugins) to load and use. | |
||||
| `retainLines` | `false` | Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE:** This will not retain the columns) | |
||||
| `resolveModuleSource` | `null` | Resolve a module source ie. `import "SOURCE";` to a custom value. Called as `resolveModuleSource(source, filename)`. | |
||||
| `shouldPrintComment` | `null` | An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE:** This overrides the `comment` option when used. | |
||||
| `sourceFileName` | `(filenameRelative)` | Set `sources[0]` on returned source map. | |
||||
| `sourceMaps` | `false` | If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** To have sourcemaps emitted using the CLI, you must pass it the `--source-maps` option. | |
||||
| `sourceMapTarget` | `(filenameRelative)` | Set `file` on returned source map. | |
||||
| `sourceRoot` | `(moduleRoot)` | The root from which all sources are relative. | |
||||
| `sourceType` | `"module"` | Indicate the mode the code should be parsed in. Can be either "script" or "module". | |
||||
| `wrapPluginVisitorMethod`| `null` | An optional callback that can be used to wrap visitor methods. **NOTE:** This is useful for things like introspection, and not really needed for implementing anything. Called as `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`. |
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
module.exports = require("./lib/api/node.js"); |
@ -1,190 +0,0 @@
@@ -1,190 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
exports.transformFileSync = exports.transformFile = exports.transformFromAst = exports.transform = exports.analyse = exports.Pipeline = exports.Plugin = exports.OptionManager = exports.traverse = exports.types = exports.messages = exports.util = exports.version = exports.template = exports.buildExternalHelpers = exports.options = exports.File = undefined; |
||||
|
||||
var _node = require("./node"); |
||||
|
||||
Object.defineProperty(exports, "File", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.File; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "options", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.options; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "buildExternalHelpers", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.buildExternalHelpers; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "template", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.template; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "version", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.version; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "util", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.util; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "messages", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.messages; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "types", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.types; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "traverse", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.traverse; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "OptionManager", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.OptionManager; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "Plugin", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.Plugin; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "Pipeline", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.Pipeline; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "analyse", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.analyse; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "transform", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.transform; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "transformFromAst", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.transformFromAst; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "transformFile", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.transformFile; |
||||
} |
||||
}); |
||||
Object.defineProperty(exports, "transformFileSync", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _node.transformFileSync; |
||||
} |
||||
}); |
||||
exports.run = run; |
||||
exports.load = load; |
||||
function run(code) { |
||||
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
||||
|
||||
return new Function((0, _node.transform)(code, opts).code)(); |
||||
} |
||||
|
||||
function load(url, callback) { |
||||
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
||||
var hold = arguments[3]; |
||||
|
||||
opts.filename = opts.filename || url; |
||||
|
||||
var xhr = global.ActiveXObject ? new global.ActiveXObject("Microsoft.XMLHTTP") : new global.XMLHttpRequest(); |
||||
xhr.open("GET", url, true); |
||||
if ("overrideMimeType" in xhr) xhr.overrideMimeType("text/plain"); |
||||
|
||||
xhr.onreadystatechange = function () { |
||||
if (xhr.readyState !== 4) return; |
||||
|
||||
var status = xhr.status; |
||||
if (status === 0 || status === 200) { |
||||
var param = [xhr.responseText, opts]; |
||||
if (!hold) run(param); |
||||
if (callback) callback(param); |
||||
} else { |
||||
throw new Error("Could not load " + url); |
||||
} |
||||
}; |
||||
|
||||
xhr.send(null); |
||||
} |
||||
|
||||
function runScripts() { |
||||
var scripts = []; |
||||
var types = ["text/ecmascript-6", "text/6to5", "text/babel", "module"]; |
||||
var index = 0; |
||||
|
||||
function exec() { |
||||
var param = scripts[index]; |
||||
if (param instanceof Array) { |
||||
run(param, index); |
||||
index++; |
||||
exec(); |
||||
} |
||||
} |
||||
|
||||
function run(script, i) { |
||||
var opts = {}; |
||||
|
||||
if (script.src) { |
||||
load(script.src, function (param) { |
||||
scripts[i] = param; |
||||
exec(); |
||||
}, opts, true); |
||||
} else { |
||||
opts.filename = "embedded"; |
||||
scripts[i] = [script.innerHTML, opts]; |
||||
} |
||||
} |
||||
|
||||
var _scripts = global.document.getElementsByTagName("script"); |
||||
|
||||
for (var i = 0; i < _scripts.length; ++i) { |
||||
var _script = _scripts[i]; |
||||
if (types.indexOf(_script.type) >= 0) scripts.push(_script); |
||||
} |
||||
|
||||
for (var _i = 0; _i < scripts.length; _i++) { |
||||
run(scripts[_i], _i); |
||||
} |
||||
|
||||
exec(); |
||||
} |
||||
|
||||
if (global.addEventListener) { |
||||
global.addEventListener("DOMContentLoaded", runScripts, false); |
||||
} else if (global.attachEvent) { |
||||
global.attachEvent("onload", runScripts); |
||||
} |
@ -1,153 +0,0 @@
@@ -1,153 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
exports.transformFromAst = exports.transform = exports.analyse = exports.Pipeline = exports.OptionManager = exports.traverse = exports.types = exports.messages = exports.util = exports.version = exports.resolvePreset = exports.resolvePlugin = exports.template = exports.buildExternalHelpers = exports.options = exports.File = undefined; |
||||
|
||||
var _file = require("../transformation/file"); |
||||
|
||||
Object.defineProperty(exports, "File", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _interopRequireDefault(_file).default; |
||||
} |
||||
}); |
||||
|
||||
var _config = require("../transformation/file/options/config"); |
||||
|
||||
Object.defineProperty(exports, "options", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _interopRequireDefault(_config).default; |
||||
} |
||||
}); |
||||
|
||||
var _buildExternalHelpers = require("../tools/build-external-helpers"); |
||||
|
||||
Object.defineProperty(exports, "buildExternalHelpers", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _interopRequireDefault(_buildExternalHelpers).default; |
||||
} |
||||
}); |
||||
|
||||
var _babelTemplate = require("babel-template"); |
||||
|
||||
Object.defineProperty(exports, "template", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _interopRequireDefault(_babelTemplate).default; |
||||
} |
||||
}); |
||||
|
||||
var _resolvePlugin = require("../helpers/resolve-plugin"); |
||||
|
||||
Object.defineProperty(exports, "resolvePlugin", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _interopRequireDefault(_resolvePlugin).default; |
||||
} |
||||
}); |
||||
|
||||
var _resolvePreset = require("../helpers/resolve-preset"); |
||||
|
||||
Object.defineProperty(exports, "resolvePreset", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _interopRequireDefault(_resolvePreset).default; |
||||
} |
||||
}); |
||||
|
||||
var _package = require("../../package"); |
||||
|
||||
Object.defineProperty(exports, "version", { |
||||
enumerable: true, |
||||
get: function get() { |
||||
return _package.version; |
||||
} |
||||
}); |
||||
exports.Plugin = Plugin; |
||||
exports.transformFile = transformFile; |
||||
exports.transformFileSync = transformFileSync; |
||||
|
||||
var _fs = require("fs"); |
||||
|
||||
var _fs2 = _interopRequireDefault(_fs); |
||||
|
||||
var _util = require("../util"); |
||||
|
||||
var util = _interopRequireWildcard(_util); |
||||
|
||||
var _babelMessages = require("babel-messages"); |
||||
|
||||
var messages = _interopRequireWildcard(_babelMessages); |
||||
|
||||
var _babelTypes = require("babel-types"); |
||||
|
||||
var t = _interopRequireWildcard(_babelTypes); |
||||
|
||||
var _babelTraverse = require("babel-traverse"); |
||||
|
||||
var _babelTraverse2 = _interopRequireDefault(_babelTraverse); |
||||
|
||||
var _optionManager = require("../transformation/file/options/option-manager"); |
||||
|
||||
var _optionManager2 = _interopRequireDefault(_optionManager); |
||||
|
||||
var _pipeline = require("../transformation/pipeline"); |
||||
|
||||
var _pipeline2 = _interopRequireDefault(_pipeline); |
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
exports.util = util; |
||||
exports.messages = messages; |
||||
exports.types = t; |
||||
exports.traverse = _babelTraverse2.default; |
||||
exports.OptionManager = _optionManager2.default; |
||||
function Plugin(alias) { |
||||
throw new Error("The (" + alias + ") Babel 5 plugin is being run with Babel 6."); |
||||
} |
||||
|
||||
exports.Pipeline = _pipeline2.default; |
||||
|
||||
|
||||
var pipeline = new _pipeline2.default(); |
||||
var analyse = exports.analyse = pipeline.analyse.bind(pipeline); |
||||
var transform = exports.transform = pipeline.transform.bind(pipeline); |
||||
var transformFromAst = exports.transformFromAst = pipeline.transformFromAst.bind(pipeline); |
||||
|
||||
function transformFile(filename, opts, callback) { |
||||
if (typeof opts === "function") { |
||||
callback = opts; |
||||
opts = {}; |
||||
} |
||||
|
||||
opts.filename = filename; |
||||
|
||||
_fs2.default.readFile(filename, function (err, code) { |
||||
var result = void 0; |
||||
|
||||
if (!err) { |
||||
try { |
||||
result = transform(code, opts); |
||||
} catch (_err) { |
||||
err = _err; |
||||
} |
||||
} |
||||
|
||||
if (err) { |
||||
callback(err); |
||||
} else { |
||||
callback(null, result); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
function transformFileSync(filename) { |
||||
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
||||
|
||||
opts.filename = filename; |
||||
return transform(_fs2.default.readFileSync(filename, "utf8"), opts); |
||||
} |
@ -1,8 +0,0 @@
@@ -1,8 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
exports.default = getPossiblePluginNames; |
||||
function getPossiblePluginNames(pluginName) { |
||||
return ["babel-plugin-" + pluginName, pluginName]; |
||||
} |
||||
module.exports = exports["default"]; |
@ -1,18 +0,0 @@
@@ -1,18 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
exports.default = getPossiblePresetNames; |
||||
function getPossiblePresetNames(presetName) { |
||||
var possibleNames = ["babel-preset-" + presetName, presetName]; |
||||
|
||||
var matches = presetName.match(/^(@[^/]+)\/(.+)$/); |
||||
if (matches) { |
||||
var orgName = matches[1], |
||||
presetPath = matches[2]; |
||||
|
||||
possibleNames.push(orgName + "/babel-preset-" + presetPath); |
||||
} |
||||
|
||||
return possibleNames; |
||||
} |
||||
module.exports = exports["default"]; |
@ -1,46 +0,0 @@
@@ -1,46 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
|
||||
var _getIterator2 = require("babel-runtime/core-js/get-iterator"); |
||||
|
||||
var _getIterator3 = _interopRequireDefault(_getIterator2); |
||||
|
||||
exports.default = function (dest, src) { |
||||
if (!dest || !src) return; |
||||
|
||||
return (0, _mergeWith2.default)(dest, src, function (a, b) { |
||||
if (b && Array.isArray(a)) { |
||||
var newArray = b.slice(0); |
||||
|
||||
for (var _iterator = a, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { |
||||
var _ref; |
||||
|
||||
if (_isArray) { |
||||
if (_i >= _iterator.length) break; |
||||
_ref = _iterator[_i++]; |
||||
} else { |
||||
_i = _iterator.next(); |
||||
if (_i.done) break; |
||||
_ref = _i.value; |
||||
} |
||||
|
||||
var item = _ref; |
||||
|
||||
if (newArray.indexOf(item) < 0) { |
||||
newArray.push(item); |
||||
} |
||||
} |
||||
|
||||
return newArray; |
||||
} |
||||
}); |
||||
}; |
||||
|
||||
var _mergeWith = require("lodash/mergeWith"); |
||||
|
||||
var _mergeWith2 = _interopRequireDefault(_mergeWith); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
module.exports = exports["default"]; |
@ -1,23 +0,0 @@
@@ -1,23 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
|
||||
exports.default = function (ast, comments, tokens) { |
||||
if (ast) { |
||||
if (ast.type === "Program") { |
||||
return t.file(ast, comments || [], tokens || []); |
||||
} else if (ast.type === "File") { |
||||
return ast; |
||||
} |
||||
} |
||||
|
||||
throw new Error("Not a valid ast?"); |
||||
}; |
||||
|
||||
var _babelTypes = require("babel-types"); |
||||
|
||||
var t = _interopRequireWildcard(_babelTypes); |
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } |
||||
|
||||
module.exports = exports["default"]; |
@ -1,17 +0,0 @@
@@ -1,17 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
exports.default = resolveFromPossibleNames; |
||||
|
||||
var _resolve = require("./resolve"); |
||||
|
||||
var _resolve2 = _interopRequireDefault(_resolve); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
function resolveFromPossibleNames(possibleNames, dirname) { |
||||
return possibleNames.reduce(function (accum, curr) { |
||||
return accum || (0, _resolve2.default)(curr, dirname); |
||||
}, null); |
||||
} |
||||
module.exports = exports["default"]; |
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
exports.default = resolvePlugin; |
||||
|
||||
var _resolveFromPossibleNames = require("./resolve-from-possible-names"); |
||||
|
||||
var _resolveFromPossibleNames2 = _interopRequireDefault(_resolveFromPossibleNames); |
||||
|
||||
var _getPossiblePluginNames = require("./get-possible-plugin-names"); |
||||
|
||||
var _getPossiblePluginNames2 = _interopRequireDefault(_getPossiblePluginNames); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
function resolvePlugin(pluginName) { |
||||
var dirname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd(); |
||||
|
||||
return (0, _resolveFromPossibleNames2.default)((0, _getPossiblePluginNames2.default)(pluginName), dirname); |
||||
} |
||||
module.exports = exports["default"]; |
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
exports.default = resolvePreset; |
||||
|
||||
var _resolveFromPossibleNames = require("./resolve-from-possible-names"); |
||||
|
||||
var _resolveFromPossibleNames2 = _interopRequireDefault(_resolveFromPossibleNames); |
||||
|
||||
var _getPossiblePresetNames = require("./get-possible-preset-names"); |
||||
|
||||
var _getPossiblePresetNames2 = _interopRequireDefault(_getPossiblePresetNames); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
function resolvePreset(presetName) { |
||||
var dirname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd(); |
||||
|
||||
return (0, _resolveFromPossibleNames2.default)((0, _getPossiblePresetNames2.default)(presetName), dirname); |
||||
} |
||||
module.exports = exports["default"]; |
@ -1,46 +0,0 @@
@@ -1,46 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
|
||||
var _typeof2 = require("babel-runtime/helpers/typeof"); |
||||
|
||||
var _typeof3 = _interopRequireDefault(_typeof2); |
||||
|
||||
exports.default = function (loc) { |
||||
var relative = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd(); |
||||
|
||||
if ((typeof _module2.default === "undefined" ? "undefined" : (0, _typeof3.default)(_module2.default)) === "object") return null; |
||||
|
||||
var relativeMod = relativeModules[relative]; |
||||
|
||||
if (!relativeMod) { |
||||
relativeMod = new _module2.default(); |
||||
|
||||
var filename = _path2.default.join(relative, ".babelrc"); |
||||
relativeMod.id = filename; |
||||
relativeMod.filename = filename; |
||||
|
||||
relativeMod.paths = _module2.default._nodeModulePaths(relative); |
||||
relativeModules[relative] = relativeMod; |
||||
} |
||||
|
||||
try { |
||||
return _module2.default._resolveFilename(loc, relativeMod); |
||||
} catch (err) { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
var _module = require("module"); |
||||
|
||||
var _module2 = _interopRequireDefault(_module); |
||||
|
||||
var _path = require("path"); |
||||
|
||||
var _path2 = _interopRequireDefault(_path); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
var relativeModules = {}; |
||||
|
||||
module.exports = exports["default"]; |
@ -1,55 +0,0 @@
@@ -1,55 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
|
||||
var _map = require("babel-runtime/core-js/map"); |
||||
|
||||
var _map2 = _interopRequireDefault(_map); |
||||
|
||||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); |
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); |
||||
|
||||
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn"); |
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); |
||||
|
||||
var _inherits2 = require("babel-runtime/helpers/inherits"); |
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
var Store = function (_Map) { |
||||
(0, _inherits3.default)(Store, _Map); |
||||
|
||||
function Store() { |
||||
(0, _classCallCheck3.default)(this, Store); |
||||
|
||||
var _this = (0, _possibleConstructorReturn3.default)(this, _Map.call(this)); |
||||
|
||||
_this.dynamicData = {}; |
||||
return _this; |
||||
} |
||||
|
||||
Store.prototype.setDynamic = function setDynamic(key, fn) { |
||||
this.dynamicData[key] = fn; |
||||
}; |
||||
|
||||
Store.prototype.get = function get(key) { |
||||
if (this.has(key)) { |
||||
return _Map.prototype.get.call(this, key); |
||||
} else { |
||||
if (Object.prototype.hasOwnProperty.call(this.dynamicData, key)) { |
||||
var val = this.dynamicData[key](); |
||||
this.set(key, val); |
||||
return val; |
||||
} |
||||
} |
||||
}; |
||||
|
||||
return Store; |
||||
}(_map2.default); |
||||
|
||||
exports.default = Store; |
||||
module.exports = exports["default"]; |
@ -1,101 +0,0 @@
@@ -1,101 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
|
||||
exports.default = function (whitelist) { |
||||
var outputType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "global"; |
||||
|
||||
var namespace = t.identifier("babelHelpers"); |
||||
|
||||
var builder = function builder(body) { |
||||
return buildHelpers(body, namespace, whitelist); |
||||
}; |
||||
|
||||
var tree = void 0; |
||||
|
||||
var build = { |
||||
global: buildGlobal, |
||||
umd: buildUmd, |
||||
var: buildVar |
||||
}[outputType]; |
||||
|
||||
if (build) { |
||||
tree = build(namespace, builder); |
||||
} else { |
||||
throw new Error(messages.get("unsupportedOutputType", outputType)); |
||||
} |
||||
|
||||
return (0, _babelGenerator2.default)(tree).code; |
||||
}; |
||||
|
||||
var _babelHelpers = require("babel-helpers"); |
||||
|
||||
var helpers = _interopRequireWildcard(_babelHelpers); |
||||
|
||||
var _babelGenerator = require("babel-generator"); |
||||
|
||||
var _babelGenerator2 = _interopRequireDefault(_babelGenerator); |
||||
|
||||
var _babelMessages = require("babel-messages"); |
||||
|
||||
var messages = _interopRequireWildcard(_babelMessages); |
||||
|
||||
var _babelTemplate = require("babel-template"); |
||||
|
||||
var _babelTemplate2 = _interopRequireDefault(_babelTemplate); |
||||
|
||||
var _babelTypes = require("babel-types"); |
||||
|
||||
var t = _interopRequireWildcard(_babelTypes); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } |
||||
|
||||
var buildUmdWrapper = (0, _babelTemplate2.default)("\n (function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === \"object\") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n"); |
||||
|
||||
function buildGlobal(namespace, builder) { |
||||
var body = []; |
||||
var container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body)); |
||||
var tree = t.program([t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]); |
||||
|
||||
body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.assignmentExpression("=", t.memberExpression(t.identifier("global"), namespace), t.objectExpression([])))])); |
||||
|
||||
builder(body); |
||||
|
||||
return tree; |
||||
} |
||||
|
||||
function buildUmd(namespace, builder) { |
||||
var body = []; |
||||
body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.identifier("global"))])); |
||||
|
||||
builder(body); |
||||
|
||||
return t.program([buildUmdWrapper({ |
||||
FACTORY_PARAMETERS: t.identifier("global"), |
||||
BROWSER_ARGUMENTS: t.assignmentExpression("=", t.memberExpression(t.identifier("root"), namespace), t.objectExpression([])), |
||||
COMMON_ARGUMENTS: t.identifier("exports"), |
||||
AMD_ARGUMENTS: t.arrayExpression([t.stringLiteral("exports")]), |
||||
FACTORY_BODY: body, |
||||
UMD_ROOT: t.identifier("this") |
||||
})]); |
||||
} |
||||
|
||||
function buildVar(namespace, builder) { |
||||
var body = []; |
||||
body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.objectExpression([]))])); |
||||
builder(body); |
||||
body.push(t.expressionStatement(namespace)); |
||||
return t.program(body); |
||||
} |
||||
|
||||
function buildHelpers(body, namespace, whitelist) { |
||||
helpers.list.forEach(function (name) { |
||||
if (whitelist && whitelist.indexOf(name) < 0) return; |
||||
|
||||
var key = t.identifier(name); |
||||
body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(namespace, key), helpers.get(name)))); |
||||
}); |
||||
} |
||||
module.exports = exports["default"]; |
@ -1,705 +0,0 @@
@@ -1,705 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
exports.File = undefined; |
||||
|
||||
var _getIterator2 = require("babel-runtime/core-js/get-iterator"); |
||||
|
||||
var _getIterator3 = _interopRequireDefault(_getIterator2); |
||||
|
||||
var _create = require("babel-runtime/core-js/object/create"); |
||||
|
||||
var _create2 = _interopRequireDefault(_create); |
||||
|
||||
var _assign = require("babel-runtime/core-js/object/assign"); |
||||
|
||||
var _assign2 = _interopRequireDefault(_assign); |
||||
|
||||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); |
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); |
||||
|
||||
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn"); |
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); |
||||
|
||||
var _inherits2 = require("babel-runtime/helpers/inherits"); |
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2); |
||||
|
||||
var _babelHelpers = require("babel-helpers"); |
||||
|
||||
var _babelHelpers2 = _interopRequireDefault(_babelHelpers); |
||||
|
||||
var _metadata = require("./metadata"); |
||||
|
||||
var metadataVisitor = _interopRequireWildcard(_metadata); |
||||
|
||||
var _convertSourceMap = require("convert-source-map"); |
||||
|
||||
var _convertSourceMap2 = _interopRequireDefault(_convertSourceMap); |
||||
|
||||
var _optionManager = require("./options/option-manager"); |
||||
|
||||
var _optionManager2 = _interopRequireDefault(_optionManager); |
||||
|
||||
var _pluginPass = require("../plugin-pass"); |
||||
|
||||
var _pluginPass2 = _interopRequireDefault(_pluginPass); |
||||
|
||||
var _babelTraverse = require("babel-traverse"); |
||||
|
||||
var _babelTraverse2 = _interopRequireDefault(_babelTraverse); |
||||
|
||||
var _babelGenerator = require("babel-generator"); |
||||
|
||||
var _babelGenerator2 = _interopRequireDefault(_babelGenerator); |
||||
|
||||
var _babelCodeFrame = require("babel-code-frame"); |
||||
|
||||
var _babelCodeFrame2 = _interopRequireDefault(_babelCodeFrame); |
||||
|
||||
var _defaults = require("lodash/defaults"); |
||||
|
||||
var _defaults2 = _interopRequireDefault(_defaults); |
||||
|
||||
var _logger = require("./logger"); |
||||
|
||||
var _logger2 = _interopRequireDefault(_logger); |
||||
|
||||
var _store = require("../../store"); |
||||
|
||||
var _store2 = _interopRequireDefault(_store); |
||||
|
||||
var _babylon = require("babylon"); |
||||
|
||||
var _util = require("../../util"); |
||||
|
||||
var util = _interopRequireWildcard(_util); |
||||
|
||||
var _path = require("path"); |
||||
|
||||
var _path2 = _interopRequireDefault(_path); |
||||
|
||||
var _babelTypes = require("babel-types"); |
||||
|
||||
var t = _interopRequireWildcard(_babelTypes); |
||||
|
||||
var _mergeMap = require("./merge-map"); |
||||
|
||||
var _mergeMap2 = _interopRequireDefault(_mergeMap); |
||||
|
||||
var _resolve = require("../../helpers/resolve"); |
||||
|
||||
var _resolve2 = _interopRequireDefault(_resolve); |
||||
|
||||
var _blockHoist = require("../internal-plugins/block-hoist"); |
||||
|
||||
var _blockHoist2 = _interopRequireDefault(_blockHoist); |
||||
|
||||
var _shadowFunctions = require("../internal-plugins/shadow-functions"); |
||||
|
||||
var _shadowFunctions2 = _interopRequireDefault(_shadowFunctions); |
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
var shebangRegex = /^#!.*/; |
||||
|
||||
var INTERNAL_PLUGINS = [[_blockHoist2.default], [_shadowFunctions2.default]]; |
||||
|
||||
var errorVisitor = { |
||||
enter: function enter(path, state) { |
||||
var loc = path.node.loc; |
||||
if (loc) { |
||||
state.loc = loc; |
||||
path.stop(); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
var File = function (_Store) { |
||||
(0, _inherits3.default)(File, _Store); |
||||
|
||||
function File() { |
||||
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
||||
var pipeline = arguments[1]; |
||||
(0, _classCallCheck3.default)(this, File); |
||||
|
||||
var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this)); |
||||
|
||||
_this.pipeline = pipeline; |
||||
|
||||
_this.log = new _logger2.default(_this, opts.filename || "unknown"); |
||||
_this.opts = _this.initOptions(opts); |
||||
|
||||
_this.parserOpts = { |
||||
sourceType: _this.opts.sourceType, |
||||
sourceFileName: _this.opts.filename, |
||||
plugins: [] |
||||
}; |
||||
|
||||
_this.pluginVisitors = []; |
||||
_this.pluginPasses = []; |
||||
|
||||
_this.buildPluginsForOptions(_this.opts); |
||||
|
||||
if (_this.opts.passPerPreset) { |
||||
_this.perPresetOpts = []; |
||||
_this.opts.presets.forEach(function (presetOpts) { |
||||
var perPresetOpts = (0, _assign2.default)((0, _create2.default)(_this.opts), presetOpts); |
||||
_this.perPresetOpts.push(perPresetOpts); |
||||
_this.buildPluginsForOptions(perPresetOpts); |
||||
}); |
||||
} |
||||
|
||||
_this.metadata = { |
||||
usedHelpers: [], |
||||
marked: [], |
||||
modules: { |
||||
imports: [], |
||||
exports: { |
||||
exported: [], |
||||
specifiers: [] |
||||
} |
||||
} |
||||
}; |
||||
|
||||
_this.dynamicImportTypes = {}; |
||||
_this.dynamicImportIds = {}; |
||||
_this.dynamicImports = []; |
||||
_this.declarations = {}; |
||||
_this.usedHelpers = {}; |
||||
|
||||
_this.path = null; |
||||
_this.ast = {}; |
||||
|
||||
_this.code = ""; |
||||
_this.shebang = ""; |
||||
|
||||
_this.hub = new _babelTraverse.Hub(_this); |
||||
return _this; |
||||
} |
||||
|
||||
File.prototype.getMetadata = function getMetadata() { |
||||
var has = false; |
||||
for (var _iterator = this.ast.program.body, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { |
||||
var _ref; |
||||
|
||||
if (_isArray) { |
||||
if (_i >= _iterator.length) break; |
||||
_ref = _iterator[_i++]; |
||||
} else { |
||||
_i = _iterator.next(); |
||||
if (_i.done) break; |
||||
_ref = _i.value; |
||||
} |
||||
|
||||
var node = _ref; |
||||
|
||||
if (t.isModuleDeclaration(node)) { |
||||
has = true; |
||||
break; |
||||
} |
||||
} |
||||
if (has) { |
||||
this.path.traverse(metadataVisitor, this); |
||||
} |
||||
}; |
||||
|
||||
File.prototype.initOptions = function initOptions(opts) { |
||||
opts = new _optionManager2.default(this.log, this.pipeline).init(opts); |
||||
|
||||
if (opts.inputSourceMap) { |
||||
opts.sourceMaps = true; |
||||
} |
||||
|
||||
if (opts.moduleId) { |
||||
opts.moduleIds = true; |
||||
} |
||||
|
||||
opts.basename = _path2.default.basename(opts.filename, _path2.default.extname(opts.filename)); |
||||
|
||||
opts.ignore = util.arrayify(opts.ignore, util.regexify); |
||||
|
||||
if (opts.only) opts.only = util.arrayify(opts.only, util.regexify); |
||||
|
||||
(0, _defaults2.default)(opts, { |
||||
moduleRoot: opts.sourceRoot |
||||
}); |
||||
|
||||
(0, _defaults2.default)(opts, { |
||||
sourceRoot: opts.moduleRoot |
||||
}); |
||||
|
||||
(0, _defaults2.default)(opts, { |
||||
filenameRelative: opts.filename |
||||
}); |
||||
|
||||
var basenameRelative = _path2.default.basename(opts.filenameRelative); |
||||
|
||||
(0, _defaults2.default)(opts, { |
||||
sourceFileName: basenameRelative, |
||||
sourceMapTarget: basenameRelative |
||||
}); |
||||
|
||||
return opts; |
||||
}; |
||||
|
||||
File.prototype.buildPluginsForOptions = function buildPluginsForOptions(opts) { |
||||
if (!Array.isArray(opts.plugins)) { |
||||
return; |
||||
} |
||||
|
||||
var plugins = opts.plugins.concat(INTERNAL_PLUGINS); |
||||
var currentPluginVisitors = []; |
||||
var currentPluginPasses = []; |
||||
|
||||
for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { |
||||
var _ref2; |
||||
|
||||
if (_isArray2) { |
||||
if (_i2 >= _iterator2.length) break; |
||||
_ref2 = _iterator2[_i2++]; |
||||
} else { |
||||
_i2 = _iterator2.next(); |
||||
if (_i2.done) break; |
||||
_ref2 = _i2.value; |
||||
} |
||||
|
||||
var ref = _ref2; |
||||
var plugin = ref[0], |
||||
pluginOpts = ref[1]; |
||||
|
||||
|
||||
currentPluginVisitors.push(plugin.visitor); |
||||
currentPluginPasses.push(new _pluginPass2.default(this, plugin, pluginOpts)); |
||||
|
||||
if (plugin.manipulateOptions) { |
||||
plugin.manipulateOptions(opts, this.parserOpts, this); |
||||
} |
||||
} |
||||
|
||||
this.pluginVisitors.push(currentPluginVisitors); |
||||
this.pluginPasses.push(currentPluginPasses); |
||||
}; |
||||
|
||||
File.prototype.getModuleName = function getModuleName() { |
||||
var opts = this.opts; |
||||
if (!opts.moduleIds) { |
||||
return null; |
||||
} |
||||
|
||||
if (opts.moduleId != null && !opts.getModuleId) { |
||||
return opts.moduleId; |
||||
} |
||||
|
||||
var filenameRelative = opts.filenameRelative; |
||||
var moduleName = ""; |
||||
|
||||
if (opts.moduleRoot != null) { |
||||
moduleName = opts.moduleRoot + "/"; |
||||
} |
||||
|
||||
if (!opts.filenameRelative) { |
||||
return moduleName + opts.filename.replace(/^\//, ""); |
||||
} |
||||
|
||||
if (opts.sourceRoot != null) { |
||||
var sourceRootRegEx = new RegExp("^" + opts.sourceRoot + "\/?"); |
||||
filenameRelative = filenameRelative.replace(sourceRootRegEx, ""); |
||||
} |
||||
|
||||
filenameRelative = filenameRelative.replace(/\.(\w*?)$/, ""); |
||||
|
||||
moduleName += filenameRelative; |
||||
|
||||
moduleName = moduleName.replace(/\\/g, "/"); |
||||
|
||||
if (opts.getModuleId) { |
||||
return opts.getModuleId(moduleName) || moduleName; |
||||
} else { |
||||
return moduleName; |
||||
} |
||||
}; |
||||
|
||||
File.prototype.resolveModuleSource = function resolveModuleSource(source) { |
||||
var resolveModuleSource = this.opts.resolveModuleSource; |
||||
if (resolveModuleSource) source = resolveModuleSource(source, this.opts.filename); |
||||
return source; |
||||
}; |
||||
|
||||
File.prototype.addImport = function addImport(source, imported) { |
||||
var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : imported; |
||||
|
||||
var alias = source + ":" + imported; |
||||
var id = this.dynamicImportIds[alias]; |
||||
|
||||
if (!id) { |
||||
source = this.resolveModuleSource(source); |
||||
id = this.dynamicImportIds[alias] = this.scope.generateUidIdentifier(name); |
||||
|
||||
var specifiers = []; |
||||
|
||||
if (imported === "*") { |
||||
specifiers.push(t.importNamespaceSpecifier(id)); |
||||
} else if (imported === "default") { |
||||
specifiers.push(t.importDefaultSpecifier(id)); |
||||
} else { |
||||
specifiers.push(t.importSpecifier(id, t.identifier(imported))); |
||||
} |
||||
|
||||
var declar = t.importDeclaration(specifiers, t.stringLiteral(source)); |
||||
declar._blockHoist = 3; |
||||
|
||||
this.path.unshiftContainer("body", declar); |
||||
} |
||||
|
||||
return id; |
||||
}; |
||||
|
||||
File.prototype.addHelper = function addHelper(name) { |
||||
var declar = this.declarations[name]; |
||||
if (declar) return declar; |
||||
|
||||
if (!this.usedHelpers[name]) { |
||||
this.metadata.usedHelpers.push(name); |
||||
this.usedHelpers[name] = true; |
||||
} |
||||
|
||||
var generator = this.get("helperGenerator"); |
||||
var runtime = this.get("helpersNamespace"); |
||||
if (generator) { |
||||
var res = generator(name); |
||||
if (res) return res; |
||||
} else if (runtime) { |
||||
return t.memberExpression(runtime, t.identifier(name)); |
||||
} |
||||
|
||||
var ref = (0, _babelHelpers2.default)(name); |
||||
var uid = this.declarations[name] = this.scope.generateUidIdentifier(name); |
||||
|
||||
if (t.isFunctionExpression(ref) && !ref.id) { |
||||
ref.body._compact = true; |
||||
ref._generated = true; |
||||
ref.id = uid; |
||||
ref.type = "FunctionDeclaration"; |
||||
this.path.unshiftContainer("body", ref); |
||||
} else { |
||||
ref._compact = true; |
||||
this.scope.push({ |
||||
id: uid, |
||||
init: ref, |
||||
unique: true |
||||
}); |
||||
} |
||||
|
||||
return uid; |
||||
}; |
||||
|
||||
File.prototype.addTemplateObject = function addTemplateObject(helperName, strings, raw) { |
||||
var stringIds = raw.elements.map(function (string) { |
||||
return string.value; |
||||
}); |
||||
var name = helperName + "_" + raw.elements.length + "_" + stringIds.join(","); |
||||
|
||||
var declar = this.declarations[name]; |
||||
if (declar) return declar; |
||||
|
||||
var uid = this.declarations[name] = this.scope.generateUidIdentifier("templateObject"); |
||||
|
||||
var helperId = this.addHelper(helperName); |
||||
var init = t.callExpression(helperId, [strings, raw]); |
||||
init._compact = true; |
||||
this.scope.push({ |
||||
id: uid, |
||||
init: init, |
||||
_blockHoist: 1.9 }); |
||||
return uid; |
||||
}; |
||||
|
||||
File.prototype.buildCodeFrameError = function buildCodeFrameError(node, msg) { |
||||
var Error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : SyntaxError; |
||||
|
||||
var loc = node && (node.loc || node._loc); |
||||
|
||||
var err = new Error(msg); |
||||
|
||||
if (loc) { |
||||
err.loc = loc.start; |
||||
} else { |
||||
(0, _babelTraverse2.default)(node, errorVisitor, this.scope, err); |
||||
|
||||
err.message += " (This is an error on an internal node. Probably an internal error"; |
||||
|
||||
if (err.loc) { |
||||
err.message += ". Location has been estimated."; |
||||
} |
||||
|
||||
err.message += ")"; |
||||
} |
||||
|
||||
return err; |
||||
}; |
||||
|
||||
File.prototype.mergeSourceMap = function mergeSourceMap(map) { |
||||
var inputMap = this.opts.inputSourceMap; |
||||
|
||||
if (inputMap && map) { |
||||
return (0, _mergeMap2.default)(inputMap, map); |
||||
} else { |
||||
return map; |
||||
} |
||||
}; |
||||
|
||||
File.prototype.parse = function parse(code) { |
||||
var parseCode = _babylon.parse; |
||||
var parserOpts = this.opts.parserOpts; |
||||
|
||||
if (parserOpts) { |
||||
parserOpts = (0, _assign2.default)({}, this.parserOpts, parserOpts); |
||||
|
||||
if (parserOpts.parser) { |
||||
if (typeof parserOpts.parser === "string") { |
||||
var dirname = _path2.default.dirname(this.opts.filename) || process.cwd(); |
||||
var parser = (0, _resolve2.default)(parserOpts.parser, dirname); |
||||
if (parser) { |
||||
parseCode = require(parser).parse; |
||||
} else { |
||||
throw new Error("Couldn't find parser " + parserOpts.parser + " with \"parse\" method " + ("relative to directory " + dirname)); |
||||
} |
||||
} else { |
||||
parseCode = parserOpts.parser; |
||||
} |
||||
|
||||
parserOpts.parser = { |
||||
parse: function parse(source) { |
||||
return (0, _babylon.parse)(source, parserOpts); |
||||
} |
||||
}; |
||||
} |
||||
} |
||||
|
||||
this.log.debug("Parse start"); |
||||
var ast = parseCode(code, parserOpts || this.parserOpts); |
||||
this.log.debug("Parse stop"); |
||||
return ast; |
||||
}; |
||||
|
||||
File.prototype._addAst = function _addAst(ast) { |
||||
this.path = _babelTraverse.NodePath.get({ |
||||
hub: this.hub, |
||||
parentPath: null, |
||||
parent: ast, |
||||
container: ast, |
||||
key: "program" |
||||
}).setContext(); |
||||
this.scope = this.path.scope; |
||||
this.ast = ast; |
||||
this.getMetadata(); |
||||
}; |
||||
|
||||
File.prototype.addAst = function addAst(ast) { |
||||
this.log.debug("Start set AST"); |
||||
this._addAst(ast); |
||||
this.log.debug("End set AST"); |
||||
}; |
||||
|
||||
File.prototype.transform = function transform() { |
||||
for (var i = 0; i < this.pluginPasses.length; i++) { |
||||
var pluginPasses = this.pluginPasses[i]; |
||||
this.call("pre", pluginPasses); |
||||
this.log.debug("Start transform traverse"); |
||||
|
||||
var visitor = _babelTraverse2.default.visitors.merge(this.pluginVisitors[i], pluginPasses, this.opts.wrapPluginVisitorMethod); |
||||
(0, _babelTraverse2.default)(this.ast, visitor, this.scope); |
||||
|
||||
this.log.debug("End transform traverse"); |
||||
this.call("post", pluginPasses); |
||||
} |
||||
|
||||
return this.generate(); |
||||
}; |
||||
|
||||
File.prototype.wrap = function wrap(code, callback) { |
||||
code = code + ""; |
||||
|
||||
try { |
||||
if (this.shouldIgnore()) { |
||||
return this.makeResult({ code: code, ignored: true }); |
||||
} else { |
||||
return callback(); |
||||
} |
||||
} catch (err) { |
||||
if (err._babel) { |
||||
throw err; |
||||
} else { |
||||
err._babel = true; |
||||
} |
||||
|
||||
var message = err.message = this.opts.filename + ": " + err.message; |
||||
|
||||
var loc = err.loc; |
||||
if (loc) { |
||||
err.codeFrame = (0, _babelCodeFrame2.default)(code, loc.line, loc.column + 1, this.opts); |
||||
message += "\n" + err.codeFrame; |
||||
} |
||||
|
||||
if (process.browser) { |
||||
err.message = message; |
||||
} |
||||
|
||||
if (err.stack) { |
||||
var newStack = err.stack.replace(err.message, message); |
||||
err.stack = newStack; |
||||
} |
||||
|
||||
throw err; |
||||
} |
||||
}; |
||||
|
||||
File.prototype.addCode = function addCode(code) { |
||||
code = (code || "") + ""; |
||||
code = this.parseInputSourceMap(code); |
||||
this.code = code; |
||||
}; |
||||
|
||||
File.prototype.parseCode = function parseCode() { |
||||
this.parseShebang(); |
||||
var ast = this.parse(this.code); |
||||
this.addAst(ast); |
||||
}; |
||||
|
||||
File.prototype.shouldIgnore = function shouldIgnore() { |
||||
var opts = this.opts; |
||||
return util.shouldIgnore(opts.filename, opts.ignore, opts.only); |
||||
}; |
||||
|
||||
File.prototype.call = function call(key, pluginPasses) { |
||||
for (var _iterator3 = pluginPasses, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { |
||||
var _ref3; |
||||
|
||||
if (_isArray3) { |
||||
if (_i3 >= _iterator3.length) break; |
||||
_ref3 = _iterator3[_i3++]; |
||||
} else { |
||||
_i3 = _iterator3.next(); |
||||
if (_i3.done) break; |
||||
_ref3 = _i3.value; |
||||
} |
||||
|
||||
var pass = _ref3; |
||||
|
||||
var plugin = pass.plugin; |
||||
var fn = plugin[key]; |
||||
if (fn) fn.call(pass, this); |
||||
} |
||||
}; |
||||
|
||||
File.prototype.parseInputSourceMap = function parseInputSourceMap(code) { |
||||
var opts = this.opts; |
||||
|
||||
if (opts.inputSourceMap !== false) { |
||||
var inputMap = _convertSourceMap2.default.fromSource(code); |
||||
if (inputMap) { |
||||
opts.inputSourceMap = inputMap.toObject(); |
||||
code = _convertSourceMap2.default.removeComments(code); |
||||
} |
||||
} |
||||
|
||||
return code; |
||||
}; |
||||
|
||||
File.prototype.parseShebang = function parseShebang() { |
||||
var shebangMatch = shebangRegex.exec(this.code); |
||||
if (shebangMatch) { |
||||
this.shebang = shebangMatch[0]; |
||||
this.code = this.code.replace(shebangRegex, ""); |
||||
} |
||||
}; |
||||
|
||||
File.prototype.makeResult = function makeResult(_ref4) { |
||||
var code = _ref4.code, |
||||
map = _ref4.map, |
||||
ast = _ref4.ast, |
||||
ignored = _ref4.ignored; |
||||
|
||||
var result = { |
||||
metadata: null, |
||||
options: this.opts, |
||||
ignored: !!ignored, |
||||
code: null, |
||||
ast: null, |
||||
map: map || null |
||||
}; |
||||
|
||||
if (this.opts.code) { |
||||
result.code = code; |
||||
} |
||||
|
||||
if (this.opts.ast) { |
||||
result.ast = ast; |
||||
} |
||||
|
||||
if (this.opts.metadata) { |
||||
result.metadata = this.metadata; |
||||
} |
||||
|
||||
return result; |
||||
}; |
||||
|
||||
File.prototype.generate = function generate() { |
||||
var opts = this.opts; |
||||
var ast = this.ast; |
||||
|
||||
var result = { ast: ast }; |
||||
if (!opts.code) return this.makeResult(result); |
||||
|
||||
var gen = _babelGenerator2.default; |
||||
if (opts.generatorOpts.generator) { |
||||
gen = opts.generatorOpts.generator; |
||||
|
||||
if (typeof gen === "string") { |
||||
var dirname = _path2.default.dirname(this.opts.filename) || process.cwd(); |
||||
var generator = (0, _resolve2.default)(gen, dirname); |
||||
if (generator) { |
||||
gen = require(generator).print; |
||||
} else { |
||||
throw new Error("Couldn't find generator " + gen + " with \"print\" method relative " + ("to directory " + dirname)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
this.log.debug("Generation start"); |
||||
|
||||
var _result = gen(ast, opts.generatorOpts ? (0, _assign2.default)(opts, opts.generatorOpts) : opts, this.code); |
||||
result.code = _result.code; |
||||
result.map = _result.map; |
||||
|
||||
this.log.debug("Generation end"); |
||||
|
||||
if (this.shebang) { |
||||
result.code = this.shebang + "\n" + result.code; |
||||
} |
||||
|
||||
if (result.map) { |
||||
result.map = this.mergeSourceMap(result.map); |
||||
} |
||||
|
||||
if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") { |
||||
result.code += "\n" + _convertSourceMap2.default.fromObject(result.map).toComment(); |
||||
} |
||||
|
||||
if (opts.sourceMaps === "inline") { |
||||
result.map = null; |
||||
} |
||||
|
||||
return this.makeResult(result); |
||||
}; |
||||
|
||||
return File; |
||||
}(_store2.default); |
||||
|
||||
exports.default = File; |
||||
exports.File = File; |
@ -1,72 +0,0 @@
@@ -1,72 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
|
||||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); |
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); |
||||
|
||||
var _node = require("debug/node"); |
||||
|
||||
var _node2 = _interopRequireDefault(_node); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
var verboseDebug = (0, _node2.default)("babel:verbose"); |
||||
var generalDebug = (0, _node2.default)("babel"); |
||||
|
||||
var seenDeprecatedMessages = []; |
||||
|
||||
var Logger = function () { |
||||
function Logger(file, filename) { |
||||
(0, _classCallCheck3.default)(this, Logger); |
||||
|
||||
this.filename = filename; |
||||
this.file = file; |
||||
} |
||||
|
||||
Logger.prototype._buildMessage = function _buildMessage(msg) { |
||||
var parts = "[BABEL] " + this.filename; |
||||
if (msg) parts += ": " + msg; |
||||
return parts; |
||||
}; |
||||
|
||||
Logger.prototype.warn = function warn(msg) { |
||||
console.warn(this._buildMessage(msg)); |
||||
}; |
||||
|
||||
Logger.prototype.error = function error(msg) { |
||||
var Constructor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Error; |
||||
|
||||
throw new Constructor(this._buildMessage(msg)); |
||||
}; |
||||
|
||||
Logger.prototype.deprecate = function deprecate(msg) { |
||||
if (this.file.opts && this.file.opts.suppressDeprecationMessages) return; |
||||
|
||||
msg = this._buildMessage(msg); |
||||
|
||||
if (seenDeprecatedMessages.indexOf(msg) >= 0) return; |
||||
|
||||
seenDeprecatedMessages.push(msg); |
||||
|
||||
console.error(msg); |
||||
}; |
||||
|
||||
Logger.prototype.verbose = function verbose(msg) { |
||||
if (verboseDebug.enabled) verboseDebug(this._buildMessage(msg)); |
||||
}; |
||||
|
||||
Logger.prototype.debug = function debug(msg) { |
||||
if (generalDebug.enabled) generalDebug(this._buildMessage(msg)); |
||||
}; |
||||
|
||||
Logger.prototype.deopt = function deopt(node, msg) { |
||||
this.debug(msg); |
||||
}; |
||||
|
||||
return Logger; |
||||
}(); |
||||
|
||||
exports.default = Logger; |
||||
module.exports = exports["default"]; |
@ -1,354 +0,0 @@
@@ -1,354 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
|
||||
var _from = require("babel-runtime/core-js/array/from"); |
||||
|
||||
var _from2 = _interopRequireDefault(_from); |
||||
|
||||
var _extends2 = require("babel-runtime/helpers/extends"); |
||||
|
||||
var _extends3 = _interopRequireDefault(_extends2); |
||||
|
||||
var _stringify = require("babel-runtime/core-js/json/stringify"); |
||||
|
||||
var _stringify2 = _interopRequireDefault(_stringify); |
||||
|
||||
var _getIterator2 = require("babel-runtime/core-js/get-iterator"); |
||||
|
||||
var _getIterator3 = _interopRequireDefault(_getIterator2); |
||||
|
||||
var _map = require("babel-runtime/core-js/map"); |
||||
|
||||
var _map2 = _interopRequireDefault(_map); |
||||
|
||||
exports.default = mergeSourceMap; |
||||
|
||||
var _sourceMap = require("source-map"); |
||||
|
||||
var _sourceMap2 = _interopRequireDefault(_sourceMap); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
function mergeSourceMap(inputMap, map) { |
||||
var input = buildMappingData(inputMap); |
||||
var output = buildMappingData(map); |
||||
|
||||
var mergedGenerator = new _sourceMap2.default.SourceMapGenerator(); |
||||
for (var _iterator = input.sources, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { |
||||
var _ref2; |
||||
|
||||
if (_isArray) { |
||||
if (_i >= _iterator.length) break; |
||||
_ref2 = _iterator[_i++]; |
||||
} else { |
||||
_i = _iterator.next(); |
||||
if (_i.done) break; |
||||
_ref2 = _i.value; |
||||
} |
||||
|
||||
var _ref4 = _ref2; |
||||
var _source = _ref4.source; |
||||
|
||||
if (typeof _source.content === "string") { |
||||
mergedGenerator.setSourceContent(_source.path, _source.content); |
||||
} |
||||
} |
||||
|
||||
if (output.sources.length === 1) { |
||||
var defaultSource = output.sources[0]; |
||||
var insertedMappings = new _map2.default(); |
||||
|
||||
eachInputGeneratedRange(input, function (generated, original, source) { |
||||
eachOverlappingGeneratedOutputRange(defaultSource, generated, function (item) { |
||||
var key = makeMappingKey(item); |
||||
if (insertedMappings.has(key)) return; |
||||
insertedMappings.set(key, item); |
||||
|
||||
mergedGenerator.addMapping({ |
||||
source: source.path, |
||||
original: { |
||||
line: original.line, |
||||
column: original.columnStart |
||||
}, |
||||
generated: { |
||||
line: item.line, |
||||
column: item.columnStart |
||||
}, |
||||
name: original.name |
||||
}); |
||||
}); |
||||
}); |
||||
|
||||
for (var _iterator2 = insertedMappings.values(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { |
||||
var _ref3; |
||||
|
||||
if (_isArray2) { |
||||
if (_i2 >= _iterator2.length) break; |
||||
_ref3 = _iterator2[_i2++]; |
||||
} else { |
||||
_i2 = _iterator2.next(); |
||||
if (_i2.done) break; |
||||
_ref3 = _i2.value; |
||||
} |
||||
|
||||
var item = _ref3; |
||||
|
||||
if (item.columnEnd === Infinity) { |
||||
continue; |
||||
} |
||||
|
||||
var clearItem = { |
||||
line: item.line, |
||||
columnStart: item.columnEnd |
||||
}; |
||||
|
||||
var key = makeMappingKey(clearItem); |
||||
if (insertedMappings.has(key)) { |
||||
continue; |
||||
} |
||||
|
||||
mergedGenerator.addMapping({ |
||||
generated: { |
||||
line: clearItem.line, |
||||
column: clearItem.columnStart |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
var result = mergedGenerator.toJSON(); |
||||
|
||||
if (typeof input.sourceRoot === "string") { |
||||
result.sourceRoot = input.sourceRoot; |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
function makeMappingKey(item) { |
||||
return (0, _stringify2.default)([item.line, item.columnStart]); |
||||
} |
||||
|
||||
function eachOverlappingGeneratedOutputRange(outputFile, inputGeneratedRange, callback) { |
||||
var overlappingOriginal = filterApplicableOriginalRanges(outputFile, inputGeneratedRange); |
||||
|
||||
for (var _iterator3 = overlappingOriginal, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { |
||||
var _ref6; |
||||
|
||||
if (_isArray3) { |
||||
if (_i3 >= _iterator3.length) break; |
||||
_ref6 = _iterator3[_i3++]; |
||||
} else { |
||||
_i3 = _iterator3.next(); |
||||
if (_i3.done) break; |
||||
_ref6 = _i3.value; |
||||
} |
||||
|
||||
var _ref7 = _ref6; |
||||
var _generated = _ref7.generated; |
||||
|
||||
for (var _iterator4 = _generated, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { |
||||
var _ref8; |
||||
|
||||
if (_isArray4) { |
||||
if (_i4 >= _iterator4.length) break; |
||||
_ref8 = _iterator4[_i4++]; |
||||
} else { |
||||
_i4 = _iterator4.next(); |
||||
if (_i4.done) break; |
||||
_ref8 = _i4.value; |
||||
} |
||||
|
||||
var item = _ref8; |
||||
|
||||
callback(item); |
||||
} |
||||
} |
||||
} |
||||
|
||||
function filterApplicableOriginalRanges(_ref9, _ref10) { |
||||
var mappings = _ref9.mappings; |
||||
var line = _ref10.line, |
||||
columnStart = _ref10.columnStart, |
||||
columnEnd = _ref10.columnEnd; |
||||
|
||||
return filterSortedArray(mappings, function (_ref11) { |
||||
var outOriginal = _ref11.original; |
||||
|
||||
if (line > outOriginal.line) return -1; |
||||
if (line < outOriginal.line) return 1; |
||||
|
||||
if (columnStart >= outOriginal.columnEnd) return -1; |
||||
if (columnEnd <= outOriginal.columnStart) return 1; |
||||
|
||||
return 0; |
||||
}); |
||||
} |
||||
|
||||
function eachInputGeneratedRange(map, callback) { |
||||
for (var _iterator5 = map.sources, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) { |
||||
var _ref13; |
||||
|
||||
if (_isArray5) { |
||||
if (_i5 >= _iterator5.length) break; |
||||
_ref13 = _iterator5[_i5++]; |
||||
} else { |
||||
_i5 = _iterator5.next(); |
||||
if (_i5.done) break; |
||||
_ref13 = _i5.value; |
||||
} |
||||
|
||||
var _ref14 = _ref13; |
||||
var _source2 = _ref14.source, |
||||
_mappings = _ref14.mappings; |
||||
|
||||
for (var _iterator6 = _mappings, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) { |
||||
var _ref16; |
||||
|
||||
if (_isArray6) { |
||||
if (_i6 >= _iterator6.length) break; |
||||
_ref16 = _iterator6[_i6++]; |
||||
} else { |
||||
_i6 = _iterator6.next(); |
||||
if (_i6.done) break; |
||||
_ref16 = _i6.value; |
||||
} |
||||
|
||||
var _ref17 = _ref16; |
||||
var _original = _ref17.original, |
||||
_generated2 = _ref17.generated; |
||||
|
||||
for (var _iterator7 = _generated2, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) { |
||||
var _ref18; |
||||
|
||||
if (_isArray7) { |
||||
if (_i7 >= _iterator7.length) break; |
||||
_ref18 = _iterator7[_i7++]; |
||||
} else { |
||||
_i7 = _iterator7.next(); |
||||
if (_i7.done) break; |
||||
_ref18 = _i7.value; |
||||
} |
||||
|
||||
var item = _ref18; |
||||
|
||||
callback(item, _original, _source2); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
function buildMappingData(map) { |
||||
var consumer = new _sourceMap2.default.SourceMapConsumer((0, _extends3.default)({}, map, { |
||||
sourceRoot: null |
||||
})); |
||||
|
||||
var sources = new _map2.default(); |
||||
var mappings = new _map2.default(); |
||||
|
||||
var last = null; |
||||
|
||||
consumer.computeColumnSpans(); |
||||
|
||||
consumer.eachMapping(function (m) { |
||||
if (m.originalLine === null) return; |
||||
|
||||
var source = sources.get(m.source); |
||||
if (!source) { |
||||
source = { |
||||
path: m.source, |
||||
content: consumer.sourceContentFor(m.source, true) |
||||
}; |
||||
sources.set(m.source, source); |
||||
} |
||||
|
||||
var sourceData = mappings.get(source); |
||||
if (!sourceData) { |
||||
sourceData = { |
||||
source: source, |
||||
mappings: [] |
||||
}; |
||||
mappings.set(source, sourceData); |
||||
} |
||||
|
||||
var obj = { |
||||
line: m.originalLine, |
||||
columnStart: m.originalColumn, |
||||
columnEnd: Infinity, |
||||
name: m.name |
||||
}; |
||||
|
||||
if (last && last.source === source && last.mapping.line === m.originalLine) { |
||||
last.mapping.columnEnd = m.originalColumn; |
||||
} |
||||
|
||||
last = { |
||||
source: source, |
||||
mapping: obj |
||||
}; |
||||
|
||||
sourceData.mappings.push({ |
||||
original: obj, |
||||
generated: consumer.allGeneratedPositionsFor({ |
||||
source: m.source, |
||||
line: m.originalLine, |
||||
column: m.originalColumn |
||||
}).map(function (item) { |
||||
return { |
||||
line: item.line, |
||||
columnStart: item.column, |
||||
|
||||
columnEnd: item.lastColumn + 1 |
||||
}; |
||||
}) |
||||
}); |
||||
}, null, _sourceMap2.default.SourceMapConsumer.ORIGINAL_ORDER); |
||||
|
||||
return { |
||||
file: map.file, |
||||
sourceRoot: map.sourceRoot, |
||||
sources: (0, _from2.default)(mappings.values()) |
||||
}; |
||||
} |
||||
|
||||
function findInsertionLocation(array, callback) { |
||||
var left = 0; |
||||
var right = array.length; |
||||
while (left < right) { |
||||
var mid = Math.floor((left + right) / 2); |
||||
var item = array[mid]; |
||||
|
||||
var result = callback(item); |
||||
if (result === 0) { |
||||
left = mid; |
||||
break; |
||||
} |
||||
if (result >= 0) { |
||||
right = mid; |
||||
} else { |
||||
left = mid + 1; |
||||
} |
||||
} |
||||
|
||||
var i = left; |
||||
if (i < array.length) { |
||||
while (i > 0 && callback(array[i]) >= 0) { |
||||
i--; |
||||
} |
||||
return i + 1; |
||||
} |
||||
|
||||
return i; |
||||
} |
||||
|
||||
function filterSortedArray(array, callback) { |
||||
var start = findInsertionLocation(array, callback); |
||||
|
||||
var results = []; |
||||
for (var i = start; i < array.length && callback(array[i]) === 0; i++) { |
||||
results.push(array[i]); |
||||
} |
||||
|
||||
return results; |
||||
} |
||||
module.exports = exports["default"]; |
@ -1,178 +0,0 @@
@@ -1,178 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
exports.ImportDeclaration = exports.ModuleDeclaration = undefined; |
||||
|
||||
var _getIterator2 = require("babel-runtime/core-js/get-iterator"); |
||||
|
||||
var _getIterator3 = _interopRequireDefault(_getIterator2); |
||||
|
||||
exports.ExportDeclaration = ExportDeclaration; |
||||
exports.Scope = Scope; |
||||
|
||||
var _babelTypes = require("babel-types"); |
||||
|
||||
var t = _interopRequireWildcard(_babelTypes); |
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
var ModuleDeclaration = exports.ModuleDeclaration = { |
||||
enter: function enter(path, file) { |
||||
var node = path.node; |
||||
|
||||
if (node.source) { |
||||
node.source.value = file.resolveModuleSource(node.source.value); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
var ImportDeclaration = exports.ImportDeclaration = { |
||||
exit: function exit(path, file) { |
||||
var node = path.node; |
||||
|
||||
|
||||
var specifiers = []; |
||||
var imported = []; |
||||
file.metadata.modules.imports.push({ |
||||
source: node.source.value, |
||||
imported: imported, |
||||
specifiers: specifiers |
||||
}); |
||||
|
||||
for (var _iterator = path.get("specifiers"), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { |
||||
var _ref; |
||||
|
||||
if (_isArray) { |
||||
if (_i >= _iterator.length) break; |
||||
_ref = _iterator[_i++]; |
||||
} else { |
||||
_i = _iterator.next(); |
||||
if (_i.done) break; |
||||
_ref = _i.value; |
||||
} |
||||
|
||||
var specifier = _ref; |
||||
|
||||
var local = specifier.node.local.name; |
||||
|
||||
if (specifier.isImportDefaultSpecifier()) { |
||||
imported.push("default"); |
||||
specifiers.push({ |
||||
kind: "named", |
||||
imported: "default", |
||||
local: local |
||||
}); |
||||
} |
||||
|
||||
if (specifier.isImportSpecifier()) { |
||||
var importedName = specifier.node.imported.name; |
||||
imported.push(importedName); |
||||
specifiers.push({ |
||||
kind: "named", |
||||
imported: importedName, |
||||
local: local |
||||
}); |
||||
} |
||||
|
||||
if (specifier.isImportNamespaceSpecifier()) { |
||||
imported.push("*"); |
||||
specifiers.push({ |
||||
kind: "namespace", |
||||
local: local |
||||
}); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
|
||||
function ExportDeclaration(path, file) { |
||||
var node = path.node; |
||||
|
||||
|
||||
var source = node.source ? node.source.value : null; |
||||
var exports = file.metadata.modules.exports; |
||||
|
||||
var declar = path.get("declaration"); |
||||
if (declar.isStatement()) { |
||||
var bindings = declar.getBindingIdentifiers(); |
||||
|
||||
for (var name in bindings) { |
||||
exports.exported.push(name); |
||||
exports.specifiers.push({ |
||||
kind: "local", |
||||
local: name, |
||||
exported: path.isExportDefaultDeclaration() ? "default" : name |
||||
}); |
||||
} |
||||
} |
||||
|
||||
if (path.isExportNamedDeclaration() && node.specifiers) { |
||||
for (var _iterator2 = node.specifiers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { |
||||
var _ref2; |
||||
|
||||
if (_isArray2) { |
||||
if (_i2 >= _iterator2.length) break; |
||||
_ref2 = _iterator2[_i2++]; |
||||
} else { |
||||
_i2 = _iterator2.next(); |
||||
if (_i2.done) break; |
||||
_ref2 = _i2.value; |
||||
} |
||||
|
||||
var specifier = _ref2; |
||||
|
||||
var exported = specifier.exported.name; |
||||
exports.exported.push(exported); |
||||
|
||||
if (t.isExportDefaultSpecifier(specifier)) { |
||||
exports.specifiers.push({ |
||||
kind: "external", |
||||
local: exported, |
||||
exported: exported, |
||||
source: source |
||||
}); |
||||
} |
||||
|
||||
if (t.isExportNamespaceSpecifier(specifier)) { |
||||
exports.specifiers.push({ |
||||
kind: "external-namespace", |
||||
exported: exported, |
||||
source: source |
||||
}); |
||||
} |
||||
|
||||
var local = specifier.local; |
||||
if (!local) continue; |
||||
|
||||
if (source) { |
||||
exports.specifiers.push({ |
||||
kind: "external", |
||||
local: local.name, |
||||
exported: exported, |
||||
source: source |
||||
}); |
||||
} |
||||
|
||||
if (!source) { |
||||
exports.specifiers.push({ |
||||
kind: "local", |
||||
local: local.name, |
||||
exported: exported |
||||
}); |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (path.isExportAllDeclaration()) { |
||||
exports.specifiers.push({ |
||||
kind: "external-all", |
||||
source: source |
||||
}); |
||||
} |
||||
} |
||||
|
||||
function Scope(path) { |
||||
path.skip(); |
||||
} |
@ -1,215 +0,0 @@
@@ -1,215 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
exports.__esModule = true; |
||||
|
||||
var _assign = require("babel-runtime/core-js/object/assign"); |
||||
|
||||
var _assign2 = _interopRequireDefault(_assign); |
||||
|
||||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); |
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); |
||||
|
||||
exports.default = buildConfigChain; |
||||
|
||||
var _resolve = require("../../../helpers/resolve"); |
||||
|
||||
var _resolve2 = _interopRequireDefault(_resolve); |
||||
|
||||
var _json = require("json5"); |
||||
|
||||
var _json2 = _interopRequireDefault(_json); |
||||
|
||||
var _pathIsAbsolute = require("path-is-absolute"); |
||||
|
||||
var _pathIsAbsolute2 = _interopRequireDefault(_pathIsAbsolute); |
||||
|
||||
var _path = require("path"); |
||||
|
||||
var _path2 = _interopRequireDefault(_path); |
||||
|
||||
var _fs = require("fs"); |
||||
|
||||
var _fs2 = _interopRequireDefault(_fs); |
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
||||
|
||||
var existsCache = {}; |
||||
var jsonCache = {}; |
||||
|
||||
var BABELIGNORE_FILENAME = ".babelignore"; |
||||
var BABELRC_FILENAME = ".babelrc"; |
||||
var PACKAGE_FILENAME = "package.json"; |
||||
|
||||
function exists(filename) { |
||||
var cached = existsCache[filename]; |
||||
if (cached == null) { |
||||
return existsCache[filename] = _fs2.default.existsSync(filename); |
||||
} else { |
||||
return cached; |
||||
} |
||||
} |
||||
|
||||
function buildConfigChain() { |
||||
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
||||
var log = arguments[1]; |
||||
|
||||
var filename = opts.filename; |
||||
var builder = new ConfigChainBuilder(log); |
||||
|
||||
if (opts.babelrc !== false) { |
||||
builder.findConfigs(filename); |
||||
} |
||||
|
||||
builder.mergeConfig({ |
||||
options: opts, |
||||
alias: "base", |
||||
dirname: filename && _path2.default.dirname(filename) |
||||
}); |
||||
|
||||
return builder.configs; |
||||
} |
||||
|
||||
var ConfigChainBuilder = function () { |
||||
function ConfigChainBuilder(log) { |
||||
(0, _classCallCheck3.default)(this, ConfigChainBuilder); |
||||
|
||||
this.resolvedConfigs = []; |
||||
this.configs = []; |
||||
this.log = log; |
||||
} |
||||
|
||||
ConfigChainBuilder.prototype.findConfigs = function findConfigs(loc) { |
||||
if (!loc) return; |
||||
|
||||
if (!(0, _pathIsAbsolute2.default)(loc)) { |
||||
loc = _path2.default.join(process.cwd(), loc); |
||||
} |
||||
|
||||
var foundConfig = false; |
||||
var foundIgnore = false; |
||||
|
||||
while (loc !== (loc = _path2.default.dirname(loc))) { |
||||
if (!foundConfig) { |
||||
var configLoc = _path2.default.join(loc, BABELRC_FILENAME); |
||||
if (exists(configLoc)) { |
||||
this.addConfig(configLoc); |
||||
foundConfig = true; |
||||
} |
||||
|
||||
var pkgLoc = _path2.default.join(loc, PACKAGE_FILENAME); |
||||
if (!foundConfig && exists(pkgLoc)) { |
||||
foundConfig = this.addConfig(pkgLoc, "babel", JSON); |
||||
} |
||||
} |
||||
|
||||
if (!foundIgnore) { |
||||
var ignoreLoc = _path2.default.join(loc, BABELIGNORE_FILENAME); |
||||
if (exists(ignoreLoc)) { |
||||
this.addIgnoreConfig(ignoreLoc); |
||||
foundIgnore = true; |
||||
} |
||||
} |
||||
|
||||
if (foundIgnore && foundConfig) return; |
||||
} |
||||
}; |
||||
|
||||
ConfigChainBuilder.prototype.addIgnoreConfig = function addIgnoreConfig(loc) { |
||||
var file = _fs2.default.readFileSync(loc, "utf8"); |
||||
var lines = file.split("\n"); |
||||
|
||||
lines = lines.map(function (line) { |
||||
return line.replace(/#(.*?)$/, "").trim(); |
||||
}).filter(function (line) { |
||||
return !!line; |
||||
}); |
||||
|
||||
if (lines.length) { |
||||
this.mergeConfig({ |
||||
options: { ignore: lines }, |
||||
alias: loc, |
||||
dirname: _path2.default.dirname(loc) |
||||
}); |
||||
} |
||||
}; |
||||
|
||||
ConfigChainBuilder.prototype.addConfig = function addConfig(loc, key) { |
||||
var json = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _json2.default; |
||||
|
||||
if (this.resolvedConfigs.indexOf(loc) >= 0) { |
||||
return false; |
||||
} |
||||
|
||||
this.resolvedConfigs.push(loc); |
||||
|
||||
var content = _fs2.default.readFileSync(loc, "utf8"); |
||||
var options = void 0; |
||||
|
||||
try { |
||||
options = jsonCache[content] = jsonCache[content] || json.parse(content); |
||||
if (key) options = options[key]; |
||||
} catch (err) { |
||||
err.message = loc + ": Error while parsing JSON - " + err.message; |
||||
throw err; |
||||
} |
||||
|
||||
this.mergeConfig({ |
||||
options: options, |
||||
alias: loc, |
||||
dirname: _path2.default.dirname(loc) |
||||
}); |
||||
|
||||
return !!options; |
||||
}; |
||||
|
||||
ConfigChainBuilder.prototype.mergeConfig = function mergeConfig(_ref) { |
||||
var options = _ref.options, |
||||
alias = _ref.alias, |
||||
loc = _ref.loc, |
||||
dirname = _ref.dirname; |
||||
|
||||
if (!options) { |
||||
return false; |
||||
} |
||||
|
||||
options = (0, _assign2.default)({}, options); |
||||
|
||||
dirname = dirname || process.cwd(); |
||||
loc = loc || alias; |
||||
|
||||
if (options.extends) { |
||||
var extendsLoc = (0, _resolve2.default)(options.extends, dirname); |
||||
if (extendsLoc) { |
||||
this.addConfig(extendsLoc); |
||||
} else { |
||||
if (this.log) this.log.error("Couldn't resolve extends clause of " + options.extends + " in " + alias); |
||||
} |
||||
delete options.extends; |
||||
} |
||||
|
||||
this.configs.push({ |
||||
options: options, |
||||
alias: alias, |
||||
loc: loc, |
||||
dirname: dirname |
||||
}); |
||||
|
||||
var envOpts = void 0; |
||||
var envKey = process.env.BABEL_ENV || process.env.NODE_ENV || "development"; |
||||
if (options.env) { |
||||
envOpts = options.env[envKey]; |
||||
delete options.env; |
||||
} |
||||
|
||||
this.mergeConfig({ |
||||
options: envOpts, |
||||
alias: alias + ".env." + envKey, |
||||
dirname: dirname |
||||
}); |
||||
}; |
||||
|
||||
return ConfigChainBuilder; |
||||
}(); |
||||
|
||||
module.exports = exports["default"]; |
@ -1,211 +0,0 @@
@@ -1,211 +0,0 @@
|
||||
"use strict"; |
||||
|
||||
module.exports = { |
||||
filename: { |
||||
type: "filename", |
||||
description: "filename to use when reading from stdin - this will be used in source-maps, errors etc", |
||||
default: "unknown", |
||||
shorthand: "f" |
||||
}, |
||||
|
||||
filenameRelative: { |
||||
hidden: true, |
||||
type: "string" |
||||
}, |
||||
|
||||
inputSourceMap: { |
||||
hidden: true |
||||
}, |
||||
|
||||
env: { |
||||
hidden: true, |
||||
default: {} |
||||
}, |
||||
|
||||
mode: { |
||||
description: "", |
||||
hidden: true |
||||
}, |
||||
|
||||
retainLines: { |
||||
type: "boolean", |
||||
default: false, |
||||
description: "retain line numbers - will result in really ugly code" |
||||
}, |
||||
|
||||
highlightCode: { |
||||
description: "enable/disable ANSI syntax highlighting of code frames (on by default)", |
||||
type: "boolean", |
||||
default: true |
||||
}, |
||||
|
||||
suppressDeprecationMessages: { |
||||
type: "boolean", |
||||
default: false, |
||||
hidden: true |
||||
}, |
||||
|
||||
presets: { |
||||
type: "list", |
||||
description: "", |
||||
default: [] |
||||
}, |
||||
|
||||
plugins: { |
||||
type: "list", |
||||
default: [], |
||||
description: "" |
||||
}, |
||||
|
||||
ignore: { |
||||
type: "list", |
||||
description: "list of glob paths to **not** compile", |
||||
default: [] |
||||
}, |
||||
|
||||
only: { |
||||
type: "list", |
||||
description: "list of glob paths to **only** compile" |
||||
}, |
||||
|
||||
code: { |
||||
hidden: true, |
||||
default: true, |
||||
type: "boolean" |
||||
}, |
||||
|
||||
metadata: { |
||||
hidden: true, |
||||
default: true, |
||||
type: "boolean" |
||||
}, |
||||
|
||||
ast: { |
||||
hidden: true, |
||||
default: true, |
||||
type: "boolean" |
||||
}, |
||||
|
||||
extends: { |
||||
type: "string", |
||||
hidden: true |
||||
}, |
||||
|
||||
comments: { |
||||
type: "boolean", |
||||
default: true, |
||||
description: "write comments to generated output (true by default)" |
||||
}, |
||||
|
||||
shouldPrintComment: { |
||||
hidden: true, |
||||
description: "optional callback to control whether a comment should be inserted, when this is used the comments option is ignored" |
||||
}, |
||||
|
||||
wrapPluginVisitorMethod: { |
||||
hidden: true, |
||||
description: "optional callback to wrap all visitor methods" |
||||
}, |
||||
|
||||
compact: { |
||||
type: "booleanString", |
||||
default: "auto", |
||||
description: "do not include superfluous whitespace characters and line terminators [true|false|auto]" |
||||
}, |
||||
|
||||
minified: { |
||||
type: "boolean", |
||||
default: false, |
||||
description: "save as much bytes when printing [true|false]" |
||||
}, |
||||
|
||||
sourceMap: { |
||||
alias: "sourceMaps", |
||||
hidden: true |
||||
}, |
||||
|
||||
sourceMaps: { |
||||
type: "booleanString", |
||||
description: "[true|false|inline]", |
||||
default: false, |
||||
shorthand: "s" |
||||
}, |
||||
|
||||
sourceMapTarget: { |
||||
type: "string", |
||||
description: "set `file` on returned source map" |
||||
}, |
||||
|
||||
sourceFileName: { |
||||
type: "string", |
||||
description: "set `sources[0]` on returned source map" |
||||
}, |
||||
|
||||
sourceRoot: { |
||||
type: "filename", |
||||
description: "the root from which all sources are relative" |
||||
}, |
||||
|
||||
babelrc: { |
||||
description: "Whether or not to look up .babelrc and .babelignore files", |
||||
type: "boolean", |
||||
default: true |
||||
}, |
||||
|
||||
sourceType: { |
||||
description: "", |
||||
default: "module" |
||||
}, |
||||
|
||||
auxiliaryCommentBefore: { |
||||
type: "string", |
||||
description: "print a comment before any injected non-user code" |
||||
}, |
||||
|
||||
auxiliaryCommentAfter: { |
||||
type: "string", |
||||
description: "print a comment after any injected non-user code" |
||||
}, |
||||
|
||||
resolveModuleSource: { |
||||
hidden: true |
||||
}, |
||||
|
||||
getModuleId: { |
||||
hidden: true |
||||
}, |
||||
|
||||
moduleRoot: { |
||||
type: "filename", |
||||
description: "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions" |
||||
}, |
||||
|
||||
moduleIds: { |
||||
type: "boolean", |
||||
default: false, |
||||
shorthand: "M", |
||||
description: "insert an explicit id for modules" |
||||
}, |
||||
|
||||
moduleId: { |
||||
description: "specify a custom name for module ids", |
||||
type: "string" |
||||
}, |
||||
|
||||
passPerPreset: { |
||||
description: "Whether to spawn a traversal pass per a preset. By default all presets are merged.", |
||||
type: "boolean", |
||||
default: false, |
||||
hidden: true |
||||
}, |
||||
|
||||
parserOpts: { |
||||
description: "Options to pass into the parser, or to change parsers (parserOpts.parser)", |
||||
default: false |
||||
}, |
||||
|
||||
generatorOpts: { |
||||
description: "Options to pass into the generator, or to change generators (generatorOpts.generator)", |
||||
default: false |
||||
} |
||||
}; |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue