commit from php storm git client / remove workbench, update composer.json in root

pull/43/head
romanzpolski 2017-09-19 13:25:46 +01:00
parent 656bc8b425
commit 3c35412e66
5088 changed files with 5 additions and 323295 deletions

View File

@ -19,6 +19,10 @@
{
"type": "vcs",
"url": "https://github.com/pipindex/core"
},
{
"type":"vcs",
"url": "https://github.com/romanzpolski/flarum-ext-shawTheme"
}
],
"support": {
@ -59,11 +63,5 @@
"preferred-install": "dist"
},
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": {
"workbench": {
"type": "path",
"url": "workbench/*/"
}
}
"prefer-stable": true
}

View File

@ -1,19 +0,0 @@
<?php
use Flarum\Event\ConfigureClientView;
use Illuminate\Contracts\Events\Dispatcher;
return function (Dispatcher $events) {
$events->listen(ConfigureClientView::class, function (ConfigureClientView $event) {
if ($event->isForum()) {
$event->addAssets([
__DIR__ . '/js/forum/dist/extension.js',
__DIR__ . '/less/forum/extension.less',
]);
$event->addBootstrapper('romanzpolski/shawTheme/main');
}
});
$events->listen(PostWillBeSaved::class, function (PostWillBeSaved $event) {
$event->post->content = 'This is not what I wrote!';
});
};

View File

@ -1,18 +0,0 @@
{
"name": "romanzpolski/flarum-ext-shawTheme",
"description": "Custom Theme for Shaw Academy",
"type": "flarum-extension",
"require": {
"flarum/core": "^0.1.0-beta.6"
},
"extra": {
"flarum-extension": {
"title": "Shaw Theme",
"icon": {
"name": "star",
"backgroundColor": "#000",
"color": "#fff"
}
}
}
}

View File

@ -1,9 +0,0 @@
var flarum = require('flarum-gulp');
flarum({
modules: {
'romanzpolski/shawTheme': [
'src/**/*.js'
]
}
});

View File

@ -1,400 +0,0 @@
'use strict';
System.register('romanzpolski/shawTheme/listInline', ['flarum/extend', 'flarum/Component', 'flarum/helpers/listItems'], function (_export, _context) {
"use strict";
var extend, Component, listItems, listInline;
return {
setters: [function (_flarumExtend) {
extend = _flarumExtend.extend;
}, function (_flarumComponent) {
Component = _flarumComponent.default;
}, function (_flarumHelpersListItems) {
listItems = _flarumHelpersListItems.default;
}],
execute: function () {
listInline = function (_Component) {
babelHelpers.inherits(listInline, _Component);
function listInline() {
babelHelpers.classCallCheck(this, listInline);
return babelHelpers.possibleConstructorReturn(this, (listInline.__proto__ || Object.getPrototypeOf(listInline)).apply(this, arguments));
}
babelHelpers.createClass(listInline, [{
key: 'init',
value: function init() {
this.showing = false;
}
}, {
key: 'view',
value: function view() {
var items = this.props.children ? listItems(this.props.children) : [];
return m(
'div',
{ className: 'viewNavInline ' + this.props.className + ' itemCount' + items.length + (this.showing ? ' open' : '') },
this.getMenu(items)
);
}
}, {
key: 'getMenu',
value: function getMenu(items) {
return m(
'ul',
{ className: 'listInline ' + this.props.menuClassName },
items
);
}
}], [{
key: 'initProps',
value: function initProps(props) {
babelHelpers.get(listInline.__proto__ || Object.getPrototypeOf(listInline), 'initProps', this).call(this, props);
props.className = props.className || '';
props.buttonClassName = props.buttonClassName || '';
props.menuClassName = props.menuClassName || '';
props.label = props.label || '';
props.caretIcon = typeof props.caretIcon !== 'undefined' ? props.caretIcon : 'caret-down';
}
}]);
return listInline;
}(Component);
_export('default', listInline);
}
};
});;
'use strict';
System.register('romanzpolski/shawTheme/main', ['flarum/extend', 'flarum/components/Post', 'flarum/Component', 'flarum/components/Page', 'flarum/components/HeaderSecondary', 'flarum/components/SessionDropdown', 'flarum/components/Dropdown', 'flarum/components/IndexPage', 'flarum/helpers/listItems', 'flarum/utils/ItemList', 'flarum/components/Button', 'flarum/components/LinkButton', 'flarum/components/SelectDropdown', 'flarum/tags/helpers/tagLabel', 'flarum/tags/utils/sortTags', 'flarum/tags/components/TagsPage', 'flarum/helpers/humanTime', 'flarum/helpers/icon', 'flarum/helpers/avatar', 'flarum/helpers/username', 'romanzpolski/shawTheme/listInline'], function (_export, _context) {
"use strict";
var extend, Post, Component, Page, HeaderSecondary, SessionDropdown, Dropdown, IndexPage, listItems, ItemList, Button, LinkButton, SelectDropdown, tagLabel, sortTags, TagsPage, humanTime, icon, avatar, username, listInline;
return {
setters: [function (_flarumExtend) {
extend = _flarumExtend.extend;
}, function (_flarumComponentsPost) {
Post = _flarumComponentsPost.default;
}, function (_flarumComponent) {
Component = _flarumComponent.default;
}, function (_flarumComponentsPage) {
Page = _flarumComponentsPage.default;
}, function (_flarumComponentsHeaderSecondary) {
HeaderSecondary = _flarumComponentsHeaderSecondary.default;
}, function (_flarumComponentsSessionDropdown) {
SessionDropdown = _flarumComponentsSessionDropdown.default;
}, function (_flarumComponentsDropdown) {
Dropdown = _flarumComponentsDropdown.default;
}, function (_flarumComponentsIndexPage) {
IndexPage = _flarumComponentsIndexPage.default;
}, function (_flarumHelpersListItems) {
listItems = _flarumHelpersListItems.default;
}, function (_flarumUtilsItemList) {
ItemList = _flarumUtilsItemList.default;
}, function (_flarumComponentsButton) {
Button = _flarumComponentsButton.default;
}, function (_flarumComponentsLinkButton) {
LinkButton = _flarumComponentsLinkButton.default;
}, function (_flarumComponentsSelectDropdown) {
SelectDropdown = _flarumComponentsSelectDropdown.default;
}, function (_flarumTagsHelpersTagLabel) {
tagLabel = _flarumTagsHelpersTagLabel.default;
}, function (_flarumTagsUtilsSortTags) {
sortTags = _flarumTagsUtilsSortTags.default;
}, function (_flarumTagsComponentsTagsPage) {
TagsPage = _flarumTagsComponentsTagsPage.default;
}, function (_flarumHelpersHumanTime) {
humanTime = _flarumHelpersHumanTime.default;
}, function (_flarumHelpersIcon) {
icon = _flarumHelpersIcon.default;
}, function (_flarumHelpersAvatar) {
avatar = _flarumHelpersAvatar.default;
}, function (_flarumHelpersUsername) {
username = _flarumHelpersUsername.default;
}, function (_romanzpolskiShawThemeListInline) {
listInline = _romanzpolskiShawThemeListInline.default;
}],
execute: function () {
app.initializers.add('romanzpolski/shawTheme', function () {
SessionDropdown.prototype.getButtonContent = function () {
var user = app.session.user;
var attrs = {};
attrs.style = { background: '#000' };
return [m(
'span',
{ className: 'Button-label' },
username(user)
), avatar(user), ' '];
};
IndexPage.prototype.viewItems = function () {
var _this = this;
var items = new ItemList();
var sortMap = app.cache.discussionList.sortMap();
var sortOptions = {};
for (var i in sortMap) {
sortOptions[i] = app.translator.trans('core.forum.index_sort.' + i + '_button');
}
items.add('sort', listInline.component({
buttonClassName: 'Button',
label: sortOptions[this.params().sort] || Object.keys(sortMap).map(function (key) {
return sortOptions[key];
})[0],
children: Object.keys(sortOptions).map(function (value) {
var label = sortOptions[value];
var active = (_this.params().sort || Object.keys(sortMap)[0]) === value;
return Button.component({
className: 'Button',
children: label,
icon: active ? 'check' : true,
onclick: _this.changeSort.bind(_this, value),
active: active
});
})
}));
return items;
};
IndexPage.prototype.sidebarItems = function () {
var items = new ItemList();
var canStartDiscussion = app.forum.attribute('canStartDiscussion') || !app.session.user;
items.add('newDiscussion', Button.component({
children: app.translator.trans(canStartDiscussion ? 'core.forum.index.start_discussion_button' : 'core.forum.index.cannot_start_discussion_button'),
icon: 'edit',
className: 'Button Button--primary IndexPage-newDiscussion',
itemClassName: 'App-primaryControl',
onclick: this.newDiscussion.bind(this),
disabled: !canStartDiscussion
}));
items.add('nav', SelectDropdown.component({
children: this.navItems(this).toArray(),
buttonClassName: 'Button',
className: 'App-titleControl'
}));
return items;
};
TagsPage.prototype.view = function () {
var pinned = this.tags.filter(function (tag) {
return tag.position() !== null;
});
var cloud = this.tags.filter(function (tag) {
return tag.position() === null;
});
return m(
'div',
{ className: 'TagsPage' },
IndexPage.prototype.hero(),
m(
'div',
{ className: 'container' },
m(
'nav',
{ className: 'TagsPage-nav IndexPage-nav sideNav', config: IndexPage.prototype.affixSidebar },
m(
'ul',
null,
listItems(IndexPage.prototype.sidebarItems().toArray())
)
),
m(
'div',
{ className: 'TagsPage-content sideNavOffset' },
m(
'ul',
{ className: 'TagTiles' },
pinned.map(function (tag) {
var lastDiscussion = tag.lastDiscussion();
var children = sortTags(app.store.all('tags').filter(function (child) {
return child.parent() === tag;
}));
return m(
'li',
{ className: 'TagTile bgImg ' + tag.data.attributes.slug + (tag.color() ? ' colored' : ''),
style: { backgroundColor: tag.color() } },
m(
'a',
{ className: 'TagTile-info', href: app.route.tag(tag), config: m.route },
m(
'h3',
{ className: 'TagTile-name' },
tag.name()
),
m(
'p',
{ className: 'TagTile-description' },
tag.description()
),
children ? m(
'div',
{ className: 'TagTile-children' },
children.map(function (child) {
return [m(
'a',
{ href: app.route.tag(child), config: function config(element, isInitialized) {
if (isInitialized) return;
$(element).on('click', function (e) {
return e.stopPropagation();
});
m.route.apply(this, arguments);
} },
child.name()
), ' '];
})
) : ''
),
lastDiscussion ? m(
'a',
{ className: 'TagTile-lastDiscussion',
href: app.route.discussion(lastDiscussion, lastDiscussion.lastPostNumber()),
config: m.route },
m(
'span',
{ className: 'TagTile-lastDiscussion-title' },
lastDiscussion.title()
),
humanTime(lastDiscussion.lastTime())
) : m('span', { className: 'TagTile-lastDiscussion' })
);
})
),
cloud.length ? m(
'div',
{ className: 'TagCloud' },
cloud.map(function (tag) {
var color = tag.color();
return [tagLabel(tag, { link: true }), ' '];
})
) : ''
)
)
);
};
IndexPage.prototype.view = function () {
console.log(this.sidebarItems().toArray());
// console.log(this.viewItems().toArray());
return m(
'div',
{ className: 'IndexPage' },
this.hero(),
m(
'div',
{ className: 'container' },
m(
'nav',
{ className: 'IndexPage-nav sideNav' },
m(
'ul',
null,
listItems(this.sidebarItems().toArray())
)
),
m(
'div',
{ className: 'IndexPage-results sideNavOffset' },
m(
'div',
{ className: 'IndexPage-toolbar' },
m(
'ul',
{ className: 'IndexPage-toolbar-view kutas' },
listItems(this.viewItems().toArray())
),
m(
'ul',
{ className: 'IndexPage-toolbar-action' },
listItems(this.actionItems().toArray())
)
),
app.cache.discussionList.render()
)
)
);
};
/* extend(Post.prototype, 'view', function(vdom) {
// vdom.children.push('<div class="kutas"><p>this is some stuff to add after each post</p></div>');
vdom.attrs.style = 'background-color: #fafafa; border-bottom: 1px solid #000';
});*/
});
}
};
});;
'use strict';
System.register('romanzpolski/shawTheme/newComponent', ['flarum/extend', 'flarum/Component', 'flarum/helpers/listItems'], function (_export, _context) {
"use strict";
var extend, Component, listItems, NewComponent;
return {
setters: [function (_flarumExtend) {
extend = _flarumExtend.extend;
}, function (_flarumComponent) {
Component = _flarumComponent.default;
}, function (_flarumHelpersListItems) {
listItems = _flarumHelpersListItems.default;
}],
execute: function () {
NewComponent = function (_Component) {
babelHelpers.inherits(NewComponent, _Component);
function NewComponent() {
babelHelpers.classCallCheck(this, NewComponent);
return babelHelpers.possibleConstructorReturn(this, (NewComponent.__proto__ || Object.getPrototypeOf(NewComponent)).apply(this, arguments));
}
babelHelpers.createClass(NewComponent, [{
key: 'init',
value: function init() {
this.showing = false;
}
}, {
key: 'view',
value: function view() {
var items = this.props.children ? listItems(this.props.children) : [];
return m(
'div',
{ className: 'viewNavInline ' + this.props.className + ' itemCount' + items.length + (this.showing ? ' open' : '') },
this.getMenu(items)
);
}
}, {
key: 'getMenu',
value: function getMenu(items) {
return m(
'ul',
{ className: 'listInline ' + this.props.menuClassName },
items
);
}
}], [{
key: 'initProps',
value: function initProps(props) {
babelHelpers.get(NewComponent.__proto__ || Object.getPrototypeOf(NewComponent), 'initProps', this).call(this, props);
props.className = props.className || '';
props.buttonClassName = props.buttonClassName || '';
props.menuClassName = props.menuClassName || '';
props.label = props.label || '';
props.caretIcon = typeof props.caretIcon !== 'undefined' ? props.caretIcon : 'caret-down';
}
}]);
return NewComponent;
}(Component);
_export('default', NewComponent);
}
};
});

View File

@ -1 +0,0 @@
../babylon/bin/babylon.js

View File

@ -1 +0,0 @@
../gulp/bin/gulp.js

View File

@ -1 +0,0 @@
../jsesc/bin/jsesc

View File

@ -1 +0,0 @@
../json5/lib/cli.js

View File

@ -1 +0,0 @@
../loose-envify/cli.js

View File

@ -1 +0,0 @@
../mkdirp/bin/cmd.js

View File

@ -1 +0,0 @@
../regjsparser/bin/parser

View File

@ -1 +0,0 @@
../semver/bin/semver

View File

@ -1 +0,0 @@
../strip-indent/cli.js

View File

@ -1 +0,0 @@
../user-home/cli.js

View File

@ -1 +0,0 @@
../which/bin/which

View File

@ -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;
};

View File

@ -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.

View File

@ -1,132 +0,0 @@
{
"_args": [
[
{
"raw": "ansi-regex@^2.0.0",
"scope": null,
"escapedName": "ansi-regex",
"name": "ansi-regex",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/has-ansi"
]
],
"_from": "ansi-regex@>=2.0.0 <3.0.0",
"_id": "ansi-regex@2.1.1",
"_inCache": true,
"_location": "/ansi-regex",
"_nodeVersion": "0.10.32",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/ansi-regex-2.1.1.tgz_1484363378013_0.4482989883981645"
},
"_npmUser": {
"name": "qix",
"email": "i.am.qix@gmail.com"
},
"_npmVersion": "2.14.2",
"_phantomChildren": {},
"_requested": {
"raw": "ansi-regex@^2.0.0",
"scope": null,
"escapedName": "ansi-regex",
"name": "ansi-regex",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/has-ansi",
"/strip-ansi"
],
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df",
"_shrinkwrap": null,
"_spec": "ansi-regex@^2.0.0",
"_where": "/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/has-ansi",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/chalk/ansi-regex/issues"
},
"dependencies": {},
"description": "Regular expression for matching ANSI escape codes",
"devDependencies": {
"ava": "0.17.0",
"xo": "0.16.0"
},
"directories": {},
"dist": {
"shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df",
"tarball": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "7c908e7b4eb6cd82bfe1295e33fdf6d166c7ed85",
"homepage": "https://github.com/chalk/ansi-regex#readme",
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"command-line",
"text",
"regex",
"regexp",
"re",
"match",
"test",
"find",
"pattern"
],
"license": "MIT",
"maintainers": [
{
"name": "qix",
"email": "i.am.qix@gmail.com"
},
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "ansi-regex",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/ansi-regex.git"
},
"scripts": {
"test": "xo && ava --verbose",
"view-supported": "node fixtures/view-codes.js"
},
"version": "2.1.1",
"xo": {
"rules": {
"guard-for-in": 0,
"no-loop-func": 0
}
}
}

View File

@ -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)

View File

@ -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
});

View File

@ -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.

View File

@ -1,114 +0,0 @@
{
"_args": [
[
{
"raw": "ansi-styles@^2.2.1",
"scope": null,
"escapedName": "ansi-styles",
"name": "ansi-styles",
"rawSpec": "^2.2.1",
"spec": ">=2.2.1 <3.0.0",
"type": "range"
},
"/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/chalk"
]
],
"_from": "ansi-styles@>=2.2.1 <3.0.0",
"_id": "ansi-styles@2.2.1",
"_inCache": true,
"_location": "/ansi-styles",
"_nodeVersion": "4.3.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/ansi-styles-2.2.1.tgz_1459197317833_0.9694824463222176"
},
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "3.8.3",
"_phantomChildren": {},
"_requested": {
"raw": "ansi-styles@^2.2.1",
"scope": null,
"escapedName": "ansi-styles",
"name": "ansi-styles",
"rawSpec": "^2.2.1",
"spec": ">=2.2.1 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/chalk"
],
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"_shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe",
"_shrinkwrap": null,
"_spec": "ansi-styles@^2.2.1",
"_where": "/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/chalk",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/chalk/ansi-styles/issues"
},
"dependencies": {},
"description": "ANSI escape codes for styling strings in the terminal",
"devDependencies": {
"mocha": "*"
},
"directories": {},
"dist": {
"shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe",
"tarball": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "95c59b23be760108b6530ca1c89477c21b258032",
"homepage": "https://github.com/chalk/ansi-styles#readme",
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"license": "MIT",
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "ansi-styles",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/ansi-styles.git"
},
"scripts": {
"test": "mocha"
},
"version": "2.2.1"
}

View File

@ -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)

View File

@ -1,4 +0,0 @@
language: node_js
node_js:
- 0.6
- 0.8

View File

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

View File

@ -1,24 +0,0 @@
var archy = require('../');
var s = archy({
label : 'beep',
nodes : [
'ity',
{
label : 'boop',
nodes : [
{
label : 'o_O',
nodes : [
{
label : 'oh',
nodes : [ 'hello', 'puny' ]
},
'human'
]
},
'party\ntime!'
]
}
]
});
console.log(s);

View File

@ -1,25 +0,0 @@
var archy = require('../');
var s = archy({
label : 'beep\none\ntwo',
nodes : [
'ity',
{
label : 'boop',
nodes : [
{
label : 'o_O\nwheee',
nodes : [
{
label : 'oh',
nodes : [ 'hello', 'puny\nmeat' ]
},
'creature'
]
},
'party\ntime!'
]
}
]
});
console.log(s);

View File

@ -1,35 +0,0 @@
module.exports = function archy (obj, prefix, opts) {
if (prefix === undefined) prefix = '';
if (!opts) opts = {};
var chr = function (s) {
var chars = {
'│' : '|',
'└' : '`',
'├' : '+',
'─' : '-',
'┬' : '-'
};
return opts.unicode === false ? chars[s] : s;
};
if (typeof obj === 'string') obj = { label : obj };
var nodes = obj.nodes || [];
var lines = (obj.label || '').split('\n');
var splitter = '\n' + prefix + (nodes.length ? chr('│') : ' ') + ' ';
return prefix
+ lines.join(splitter) + '\n'
+ nodes.map(function (node, ix) {
var last = ix === nodes.length - 1;
var more = node.nodes && node.nodes.length;
var prefix_ = prefix + (last ? ' ' : chr('│')) + ' ';
return prefix
+ (last ? chr('└') : chr('├')) + chr('─')
+ (more ? chr('┬') : chr('─')) + ' '
+ archy(node, prefix_, opts).slice(prefix.length + 2)
;
}).join('')
;
};

View File

@ -1,114 +0,0 @@
{
"_args": [
[
{
"raw": "archy@^1.0.0",
"scope": null,
"escapedName": "archy",
"name": "archy",
"rawSpec": "^1.0.0",
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
"/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/gulp"
]
],
"_from": "archy@>=1.0.0 <2.0.0",
"_id": "archy@1.0.0",
"_inCache": true,
"_location": "/archy",
"_npmUser": {
"name": "substack",
"email": "mail@substack.net"
},
"_npmVersion": "1.4.25",
"_phantomChildren": {},
"_requested": {
"raw": "archy@^1.0.0",
"scope": null,
"escapedName": "archy",
"name": "archy",
"rawSpec": "^1.0.0",
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/gulp"
],
"_resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz",
"_shasum": "f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40",
"_shrinkwrap": null,
"_spec": "archy@^1.0.0",
"_where": "/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/gulp",
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"bugs": {
"url": "https://github.com/substack/node-archy/issues"
},
"dependencies": {},
"description": "render nested hierarchies `npm ls` style with unicode pipes",
"devDependencies": {
"tap": "~0.3.3",
"tape": "~0.1.1"
},
"directories": {},
"dist": {
"shasum": "f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40",
"tarball": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz"
},
"gitHead": "30223c16191e877bf027b15b12daf077b9b55b84",
"homepage": "https://github.com/substack/node-archy",
"keywords": [
"hierarchy",
"npm ls",
"unicode",
"pretty",
"print"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "substack",
"email": "mail@substack.net"
}
],
"name": "archy",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/substack/node-archy.git"
},
"scripts": {
"test": "tap test"
},
"testling": {
"files": "test/*.js",
"browsers": {
"iexplore": [
"6.0",
"7.0",
"8.0",
"9.0"
],
"chrome": [
"20.0"
],
"firefox": [
"10.0",
"15.0"
],
"safari": [
"5.1"
],
"opera": [
"12.0"
]
}
},
"version": "1.0.0"
}

View File

@ -1,88 +0,0 @@
# archy
Render nested hierarchies `npm ls` style with unicode pipes.
[![browser support](http://ci.testling.com/substack/node-archy.png)](http://ci.testling.com/substack/node-archy)
[![build status](https://secure.travis-ci.org/substack/node-archy.png)](http://travis-ci.org/substack/node-archy)
# example
``` js
var archy = require('archy');
var s = archy({
label : 'beep',
nodes : [
'ity',
{
label : 'boop',
nodes : [
{
label : 'o_O',
nodes : [
{
label : 'oh',
nodes : [ 'hello', 'puny' ]
},
'human'
]
},
'party\ntime!'
]
}
]
});
console.log(s);
```
output
```
beep
├── ity
└─┬ boop
├─┬ o_O
│ ├─┬ oh
│ │ ├── hello
│ │ └── puny
│ └── human
└── party
time!
```
# methods
var archy = require('archy')
## archy(obj, prefix='', opts={})
Return a string representation of `obj` with unicode pipe characters like how
`npm ls` looks.
`obj` should be a tree of nested objects with `'label'` and `'nodes'` fields.
`'label'` is a string of text to display at a node level and `'nodes'` is an
array of the descendents of the current node.
If a node is a string, that string will be used as the `'label'` and an empty
array of `'nodes'` will be used.
`prefix` gets prepended to all the lines and is used by the algorithm to
recursively update.
If `'label'` has newlines they will be indented at the present indentation level
with the current prefix.
To disable unicode results in favor of all-ansi output set `opts.unicode` to
`false`.
# install
With [npm](http://npmjs.org) do:
```
npm install archy
```
# license
MIT

View File

@ -1,40 +0,0 @@
var test = require('tape');
var archy = require('../');
test('beep', function (t) {
var s = archy({
label : 'beep',
nodes : [
'ity',
{
label : 'boop',
nodes : [
{
label : 'o_O',
nodes : [
{
label : 'oh',
nodes : [ 'hello', 'puny' ]
},
'human'
]
},
'party!'
]
}
]
});
t.equal(s, [
'beep',
'├── ity',
'└─┬ boop',
' ├─┬ o_O',
' │ ├─┬ oh',
' │ │ ├── hello',
' │ │ └── puny',
' │ └── human',
' └── party!',
''
].join('\n'));
t.end();
});

View File

@ -1,45 +0,0 @@
var test = require('tape');
var archy = require('../');
test('multi-line', function (t) {
var s = archy({
label : 'beep\none\ntwo',
nodes : [
'ity',
{
label : 'boop',
nodes : [
{
label : 'o_O\nwheee',
nodes : [
{
label : 'oh',
nodes : [ 'hello', 'puny\nmeat' ]
},
'creature'
]
},
'party\ntime!'
]
}
]
});
t.equal(s, [
'beep',
'│ one',
'│ two',
'├── ity',
'└─┬ boop',
' ├─┬ o_O',
' │ │ wheee',
' │ ├─┬ oh',
' │ │ ├── hello',
' │ │ └── puny',
' │ │ meat',
' │ └── creature',
' └── party',
' time!',
''
].join('\n'));
t.end();
});

View File

@ -1,40 +0,0 @@
var test = require('tape');
var archy = require('../');
test('beep', function (t) {
var s = archy({
label : 'beep',
nodes : [
'ity',
{
label : 'boop',
nodes : [
{
label : 'o_O',
nodes : [
{
label : 'oh',
nodes : [ 'hello', 'puny' ]
},
'human'
]
},
'party!'
]
}
]
}, '', { unicode : false });
t.equal(s, [
'beep',
'+-- ity',
'`-- boop',
' +-- o_O',
' | +-- oh',
' | | +-- hello',
' | | `-- puny',
' | `-- human',
' `-- party!',
''
].join('\n'));
t.end();
});

View File

@ -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.

View File

@ -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)._

View File

@ -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;

View File

@ -1,119 +0,0 @@
{
"_args": [
[
{
"raw": "arr-diff@^2.0.0",
"scope": null,
"escapedName": "arr-diff",
"name": "arr-diff",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/micromatch"
]
],
"_from": "arr-diff@>=2.0.0 <3.0.0",
"_id": "arr-diff@2.0.0",
"_inCache": true,
"_location": "/arr-diff",
"_nodeVersion": "5.0.0",
"_npmUser": {
"name": "jonschlinkert",
"email": "github@sellside.com"
},
"_npmVersion": "3.3.6",
"_phantomChildren": {},
"_requested": {
"raw": "arr-diff@^2.0.0",
"scope": null,
"escapedName": "arr-diff",
"name": "arr-diff",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/micromatch"
],
"_resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz",
"_shasum": "8f3b827f955a8bd669697e4a4256ac3ceae356cf",
"_shrinkwrap": null,
"_spec": "arr-diff@^2.0.0",
"_where": "/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/micromatch",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/arr-diff/issues"
},
"dependencies": {
"arr-flatten": "^1.0.1"
},
"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": "*"
},
"directories": {},
"dist": {
"shasum": "8f3b827f955a8bd669697e4a4256ac3ceae356cf",
"tarball": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "b89f54eb88ca51afd0e0ea6be9a4a63e5ccecf27",
"homepage": "https://github.com/jonschlinkert/arr-diff",
"keywords": [
"arr",
"array",
"diff",
"differ",
"difference"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "doowb",
"email": "brian.woodward@gmail.com"
},
{
"name": "jonschlinkert",
"email": "github@sellside.com"
},
{
"name": "paulmillr",
"email": "paul@paulmillr.com"
}
],
"name": "arr-diff",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"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"
}

View File

@ -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.

View File

@ -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._

View File

@ -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;
}

View File

@ -1,150 +0,0 @@
{
"_args": [
[
{
"raw": "arr-flatten@^1.0.1",
"scope": null,
"escapedName": "arr-flatten",
"name": "arr-flatten",
"rawSpec": "^1.0.1",
"spec": ">=1.0.1 <2.0.0",
"type": "range"
},
"/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/arr-diff"
]
],
"_from": "arr-flatten@>=1.0.1 <2.0.0",
"_id": "arr-flatten@1.1.0",
"_inCache": true,
"_location": "/arr-flatten",
"_nodeVersion": "7.7.3",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/arr-flatten-1.1.0.tgz_1499280630530_0.4138362631201744"
},
"_npmUser": {
"name": "jonschlinkert",
"email": "github@sellside.com"
},
"_npmVersion": "5.0.4",
"_phantomChildren": {},
"_requested": {
"raw": "arr-flatten@^1.0.1",
"scope": null,
"escapedName": "arr-flatten",
"name": "arr-flatten",
"rawSpec": "^1.0.1",
"spec": ">=1.0.1 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/arr-diff"
],
"_resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
"_shasum": "36048bbff4e7b47e136644316c99669ea5ae91f1",
"_shrinkwrap": null,
"_spec": "arr-flatten@^1.0.1",
"_where": "/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/arr-diff",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/arr-flatten/issues"
},
"contributors": [
{
"name": "Jon Schlinkert",
"url": "http://twitter.com/jonschlinkert"
},
{
"name": "Luke Edwards",
"url": "https://lukeed.com"
}
],
"dependencies": {},
"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"
},
"directories": {},
"dist": {
"integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
"shasum": "36048bbff4e7b47e136644316c99669ea5ae91f1",
"tarball": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "76a1ae28b03fdb1cbe5d49fa521bc4807b9f94d3",
"homepage": "https://github.com/jonschlinkert/arr-flatten",
"keywords": [
"arr",
"array",
"elements",
"flat",
"flatten",
"nested",
"recurse",
"recursive",
"recursively"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "jonschlinkert",
"email": "github@sellside.com"
}
],
"name": "arr-flatten",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"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"
}

View File

@ -1,7 +0,0 @@
'use strict';
module.exports = function (arr) {
var rest = [].concat.apply([], [].slice.call(arguments, 1));
return arr.filter(function (el) {
return rest.indexOf(el) === -1;
});
};

View File

@ -1,95 +0,0 @@
{
"_args": [
[
{
"raw": "array-differ@^1.0.0",
"scope": null,
"escapedName": "array-differ",
"name": "array-differ",
"rawSpec": "^1.0.0",
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
"/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/gulp-util"
]
],
"_from": "array-differ@>=1.0.0 <2.0.0",
"_id": "array-differ@1.0.0",
"_inCache": true,
"_location": "/array-differ",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "1.4.14",
"_phantomChildren": {},
"_requested": {
"raw": "array-differ@^1.0.0",
"scope": null,
"escapedName": "array-differ",
"name": "array-differ",
"rawSpec": "^1.0.0",
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/gulp-util"
],
"_resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz",
"_shasum": "eff52e3758249d33be402b8bb8e564bb2b5d4031",
"_shrinkwrap": null,
"_spec": "array-differ@^1.0.0",
"_where": "/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/gulp-util",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/array-differ/issues"
},
"dependencies": {},
"description": "Create an array with values that are present in the first input array but not additional ones",
"devDependencies": {
"mocha": "*"
},
"directories": {},
"dist": {
"shasum": "eff52e3758249d33be402b8bb8e564bb2b5d4031",
"tarball": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "e91802976c4710eef8dea2090d48e48525cf41b1",
"homepage": "https://github.com/sindresorhus/array-differ",
"keywords": [
"array",
"difference",
"diff",
"differ",
"filter",
"exclude"
],
"license": "MIT",
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "array-differ",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/sindresorhus/array-differ.git"
},
"scripts": {
"test": "mocha"
},
"version": "1.0.0"
}

View File

@ -1,41 +0,0 @@
# array-differ [![Build Status](https://travis-ci.org/sindresorhus/array-differ.svg?branch=master)](https://travis-ci.org/sindresorhus/array-differ)
> Create an array with values that are present in the first input array but not additional ones
## Install
```sh
$ npm install --save array-differ
```
## Usage
```js
var arrayDiffer = require('array-differ');
arrayDiffer([2, 3, 4], [3, 50]);
//=> [2, 4]
```
## API
### arrayDiffer(input, values, [values, ...])
Returns the new array.
#### input
Type: `array`
#### values
Type: `array`
Arrays of values to exclude.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015, 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.

View File

@ -1,84 +0,0 @@
# array-each [![NPM version](https://img.shields.io/npm/v/array-each.svg?style=flat)](https://www.npmjs.com/package/array-each) [![NPM monthly downloads](https://img.shields.io/npm/dm/array-each.svg?style=flat)](https://npmjs.org/package/array-each) [![NPM total downloads](https://img.shields.io/npm/dt/array-each.svg?style=flat)](https://npmjs.org/package/array-each) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/array-each.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/array-each)
> Loop over each item in an array and call the given function on every element.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save array-each
```
## Usage
### [each](index.js#L34)
Loop over each item in an array and call the given function on every element.
**Params**
* `array` **{Array}**
* `fn` **{Function}**
* `thisArg` **{Object}**: (optional) pass a `thisArg` to be used as the context in which to call the function.
* `returns` **{undefined}**
**Example**
```js
each(['a', 'b', 'c'], function(ele) {
return ele + ele;
});
//=> ['aa', 'bb', 'cc']
each(['a', 'b', 'c'], function(ele, i) {
return i + ele;
});
//=> ['0a', '1b', '2c']
```
## 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-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 "Faster, node.js focused alternative to JavaScript's native array map.")
* [collection-map](https://www.npmjs.com/package/collection-map): Returns an array of mapped values from an array or object. | [homepage](https://github.com/jonschlinkert/collection-map "Returns an array of mapped values from an array or object.")
### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### 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.4.2, on February 26, 2017._

View File

@ -1,46 +0,0 @@
/*!
* array-each <https://github.com/jonschlinkert/array-each>
*
* Copyright (c) 2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
/**
* Loop over each item in an array and call the given function on every element.
*
* ```js
* each(['a', 'b', 'c'], function(ele) {
* return ele + ele;
* });
* //=> ['aa', 'bb', 'cc']
*
* each(['a', 'b', 'c'], function(ele, i) {
* return i + ele;
* });
* //=> ['0a', '1b', '2c']
* ```
*
* @name each
* @alias forEach
* @param {Array} `array`
* @param {Function} `fn`
* @param {Object} `thisArg` (optional) pass a `thisArg` to be used as the context in which to call the function.
* @return {undefined}
* @api public
*/
module.exports = function each(arr, cb, thisArg) {
if (arr == null) return;
var len = arr.length;
var idx = -1;
while (++idx < len) {
var ele = arr[idx];
if (cb.call(thisArg, ele, idx, arr) === false) {
break;
}
}
};

View File

@ -1,117 +0,0 @@
{
"_args": [
[
{
"raw": "array-each@^1.0.1",
"scope": null,
"escapedName": "array-each",
"name": "array-each",
"rawSpec": "^1.0.1",
"spec": ">=1.0.1 <2.0.0",
"type": "range"
},
"/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/object.defaults"
]
],
"_from": "array-each@>=1.0.1 <2.0.0",
"_id": "array-each@1.0.1",
"_inCache": true,
"_location": "/array-each",
"_nodeVersion": "7.5.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/array-each-1.0.1.tgz_1488156048457_0.42185514722950757"
},
"_npmUser": {
"name": "jonschlinkert",
"email": "github@sellside.com"
},
"_npmVersion": "4.1.2",
"_phantomChildren": {},
"_requested": {
"raw": "array-each@^1.0.1",
"scope": null,
"escapedName": "array-each",
"name": "array-each",
"rawSpec": "^1.0.1",
"spec": ">=1.0.1 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/object.defaults"
],
"_resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz",
"_shasum": "a794af0c05ab1752846ee753a1f211a05ba0c44f",
"_shrinkwrap": null,
"_spec": "array-each@^1.0.1",
"_where": "/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/object.defaults",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/array-each/issues"
},
"dependencies": {},
"description": "Loop over each item in an array and call the given function on every element.",
"devDependencies": {
"gulp-format-md": "^0.1.11",
"mocha": "^3.2.0"
},
"directories": {},
"dist": {
"shasum": "a794af0c05ab1752846ee753a1f211a05ba0c44f",
"tarball": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "a752d70897f25abfd38bfb51bb1b3a06ffcd2aed",
"homepage": "https://github.com/jonschlinkert/array-each",
"keywords": [
"array",
"each"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "jonschlinkert",
"email": "github@sellside.com"
}
],
"name": "array-each",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/array-each.git"
},
"scripts": {
"test": "mocha"
},
"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"related": {
"list": [
"collection-map",
"arr-filter",
"arr-map"
]
},
"lint": {
"reflinks": true
}
},
"version": "1.0.1"
}

View File

@ -1,25 +0,0 @@
'use strict';
module.exports = function (arr, predicate, ctx) {
if (typeof Array.prototype.findIndex === 'function') {
return arr.findIndex(predicate, ctx);
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(arr);
var len = list.length;
if (len === 0) {
return -1;
}
for (var i = 0; i < len; i++) {
if (predicate.call(ctx, list[i], i, list)) {
return i;
}
}
return -1;
};

View File

@ -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.

View File

@ -1,103 +0,0 @@
{
"_args": [
[
{
"raw": "array-find-index@^1.0.1",
"scope": null,
"escapedName": "array-find-index",
"name": "array-find-index",
"rawSpec": "^1.0.1",
"spec": ">=1.0.1 <2.0.0",
"type": "range"
},
"/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/currently-unhandled"
]
],
"_from": "array-find-index@>=1.0.1 <2.0.0",
"_id": "array-find-index@1.0.2",
"_inCache": true,
"_location": "/array-find-index",
"_nodeVersion": "4.5.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/array-find-index-1.0.2.tgz_1475224789159_0.7274378235451877"
},
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "2.15.9",
"_phantomChildren": {},
"_requested": {
"raw": "array-find-index@^1.0.1",
"scope": null,
"escapedName": "array-find-index",
"name": "array-find-index",
"rawSpec": "^1.0.1",
"spec": ">=1.0.1 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/currently-unhandled"
],
"_resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz",
"_shasum": "df010aa1287e164bbda6f9723b0a96a1ec4187a1",
"_shrinkwrap": null,
"_spec": "array-find-index@^1.0.1",
"_where": "/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/currently-unhandled",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/array-find-index/issues"
},
"dependencies": {},
"description": "ES2015 `Array#findIndex()` ponyfill",
"devDependencies": {
"ava": "*",
"xo": "*"
},
"directories": {},
"dist": {
"shasum": "df010aa1287e164bbda6f9723b0a96a1ec4187a1",
"tarball": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "983f4c827ad22fa0353182b1ddcbfaecd4412859",
"homepage": "https://github.com/sindresorhus/array-find-index#readme",
"keywords": [
"es2015",
"ponyfill",
"polyfill",
"shim",
"find",
"index",
"findindex",
"array"
],
"license": "MIT",
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "array-find-index",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/array-find-index.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "1.0.2"
}

View File

@ -1,30 +0,0 @@
# array-find-index [![Build Status](https://travis-ci.org/sindresorhus/array-find-index.svg?branch=master)](https://travis-ci.org/sindresorhus/array-find-index)
> ES2015 [`Array#findIndex()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) [ponyfill](https://ponyfill.com)
## Install
```
$ npm install --save array-find-index
```
## Usage
```js
const arrayFindIndex = require('array-find-index');
arrayFindIndex(['rainbow', 'unicorn', 'pony'], x => x === 'unicorn');
//=> 1
```
## API
Same as `Array#findIndex()`, but with the input array as the first argument.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2014-2015, 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.

View File

@ -1,69 +0,0 @@
# array-slice [![NPM version](https://img.shields.io/npm/v/array-slice.svg?style=flat)](https://www.npmjs.com/package/array-slice) [![NPM monthly downloads](https://img.shields.io/npm/dm/array-slice.svg?style=flat)](https://npmjs.org/package/array-slice) [![NPM total downloads](https://img.shields.io/npm/dt/array-slice.svg?style=flat)](https://npmjs.org/package/array-slice) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/array-slice.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/array-slice)
> Array-slice method. Slices `array` from the `start` index up to, but not including, the `end` index.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save array-slice
```
This function is used instead of `Array#slice` to support node lists in IE < 9 and to ensure dense arrays are returned. This is also faster than native slice in some cases.
## Usage
```js
var slice = require('array-slice');
var arr = ['a', 'b', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
slice(arr, 3, 6);
//=> ['e', 'f', 'g']
```
## About
### 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 "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.")
* [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.")
* [array-xor](https://www.npmjs.com/package/array-xor): Returns the symmetric difference (exclusive-or) of an array of elements (elements that are present in… [more](https://github.com/jonschlinkert/array-xor) | [homepage](https://github.com/jonschlinkert/array-xor "Returns the symmetric difference (exclusive-or) of an array of elements (elements that are present in all given arrays and not in their intersections).")
### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### 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.4.3, on March 02, 2017._

View File

@ -1,35 +0,0 @@
/*!
* array-slice <https://github.com/jonschlinkert/array-slice>
*
* Copyright (c) 2014-2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
module.exports = function slice(arr, start, end) {
var len = arr.length;
var range = [];
start = idx(arr, start);
end = idx(arr, end, len);
while (start < end) {
range.push(arr[start++]);
}
return range;
};
function idx(arr, pos, end) {
var len = arr.length;
if (pos == null) {
pos = end || 0;
} else if (pos < 0) {
pos = Math.max(len + pos, 0);
} else {
pos = Math.min(pos, len);
}
return pos;
}

View File

@ -1,125 +0,0 @@
{
"_args": [
[
{
"raw": "array-slice@^1.0.0",
"scope": null,
"escapedName": "array-slice",
"name": "array-slice",
"rawSpec": "^1.0.0",
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
"/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/object.defaults"
]
],
"_from": "array-slice@>=1.0.0 <2.0.0",
"_id": "array-slice@1.0.0",
"_inCache": true,
"_location": "/array-slice",
"_nodeVersion": "7.6.0",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/array-slice-1.0.0.tgz_1488482499689_0.4508651338983327"
},
"_npmUser": {
"name": "jonschlinkert",
"email": "github@sellside.com"
},
"_npmVersion": "4.1.2",
"_phantomChildren": {},
"_requested": {
"raw": "array-slice@^1.0.0",
"scope": null,
"escapedName": "array-slice",
"name": "array-slice",
"rawSpec": "^1.0.0",
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/object.defaults"
],
"_resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.0.0.tgz",
"_shasum": "e73034f00dcc1f40876008fd20feae77bd4b7c2f",
"_shrinkwrap": null,
"_spec": "array-slice@^1.0.0",
"_where": "/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/object.defaults",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/array-slice/issues"
},
"dependencies": {},
"description": "Array-slice method. Slices `array` from the `start` index up to, but not including, the `end` index.",
"devDependencies": {
"gulp-format-md": "^0.1.11",
"mocha": "^3.2.0"
},
"directories": {},
"dist": {
"shasum": "e73034f00dcc1f40876008fd20feae77bd4b7c2f",
"tarball": "https://registry.npmjs.org/array-slice/-/array-slice-1.0.0.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "834333ad84ed4d354532d43350a8b9cd48b5751b",
"homepage": "https://github.com/jonschlinkert/array-slice",
"keywords": [
"array",
"javascript",
"js",
"slice",
"util",
"utils"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "jonschlinkert",
"email": "github@sellside.com"
},
{
"name": "doowb",
"email": "brian.woodward@gmail.com"
}
],
"name": "array-slice",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/array-slice.git"
},
"scripts": {
"test": "mocha"
},
"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"related": {
"list": [
"arr-flatten",
"array-unique",
"array-xor"
]
},
"lint": {
"reflinks": true
}
},
"version": "1.0.0"
}

View File

@ -1,62 +0,0 @@
'use strict';
// there's 3 implementations written in increasing order of efficiency
// 1 - no Set type is defined
function uniqNoSet(arr) {
var ret = [];
for (var i = 0; i < arr.length; i++) {
if (ret.indexOf(arr[i]) === -1) {
ret.push(arr[i]);
}
}
return ret;
}
// 2 - a simple Set type is defined
function uniqSet(arr) {
var seen = new Set();
return arr.filter(function (el) {
if (!seen.has(el)) {
seen.add(el);
return true;
}
return false;
});
}
// 3 - a standard Set type is defined and it has a forEach method
function uniqSetWithForEach(arr) {
var ret = [];
(new Set(arr)).forEach(function (el) {
ret.push(el);
});
return ret;
}
// V8 currently has a broken implementation
// https://github.com/joyent/node/issues/8449
function doesForEachActuallyWork() {
var ret = false;
(new Set([true])).forEach(function (el) {
ret = el;
});
return ret === true;
}
if ('Set' in global) {
if (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {
module.exports = uniqSetWithForEach;
} else {
module.exports = uniqSet;
}
} else {
module.exports = uniqNoSet;
}

View File

@ -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.

View File

@ -1,105 +0,0 @@
{
"_args": [
[
{
"raw": "array-uniq@^1.0.2",
"scope": null,
"escapedName": "array-uniq",
"name": "array-uniq",
"rawSpec": "^1.0.2",
"spec": ">=1.0.2 <2.0.0",
"type": "range"
},
"/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/gulp-util"
]
],
"_from": "array-uniq@>=1.0.2 <2.0.0",
"_id": "array-uniq@1.0.3",
"_inCache": true,
"_location": "/array-uniq",
"_nodeVersion": "4.4.2",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/array-uniq-1.0.3.tgz_1466079716839_0.9139188586268574"
},
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "2.15.0",
"_phantomChildren": {},
"_requested": {
"raw": "array-uniq@^1.0.2",
"scope": null,
"escapedName": "array-uniq",
"name": "array-uniq",
"rawSpec": "^1.0.2",
"spec": ">=1.0.2 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/gulp-util"
],
"_resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
"_shasum": "af6ac877a25cc7f74e058894753858dfdb24fdb6",
"_shrinkwrap": null,
"_spec": "array-uniq@^1.0.2",
"_where": "/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/gulp-util",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/array-uniq/issues"
},
"dependencies": {},
"description": "Create an array without duplicates",
"devDependencies": {
"ava": "*",
"es6-set": "^0.1.0",
"require-uncached": "^1.0.2",
"xo": "*"
},
"directories": {},
"dist": {
"shasum": "af6ac877a25cc7f74e058894753858dfdb24fdb6",
"tarball": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "3b5bf5a90a585b3950284d575f33d09663f6083a",
"homepage": "https://github.com/sindresorhus/array-uniq#readme",
"keywords": [
"array",
"arr",
"set",
"uniq",
"unique",
"es6",
"duplicate",
"remove"
],
"license": "MIT",
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "array-uniq",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/array-uniq.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "1.0.3"
}

View File

@ -1,30 +0,0 @@
# array-uniq [![Build Status](https://travis-ci.org/sindresorhus/array-uniq.svg?branch=master)](https://travis-ci.org/sindresorhus/array-uniq)
> Create an array without duplicates
It's already pretty fast, but will be much faster when [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) becomes available in V8 (especially with large arrays).
## Install
```
$ npm install --save array-uniq
```
## Usage
```js
const arrayUniq = require('array-uniq');
arrayUniq([1, 1, 2, 3, 3]);
//=> [1, 2, 3]
arrayUniq(['foo', 'foo', 'bar', 'foo']);
//=> ['foo', 'bar']
```
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@ -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.

View File

@ -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._

View File

@ -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;
};

View File

@ -1,94 +0,0 @@
{
"_args": [
[
{
"raw": "array-unique@^0.2.1",
"scope": null,
"escapedName": "array-unique",
"name": "array-unique",
"rawSpec": "^0.2.1",
"spec": ">=0.2.1 <0.3.0",
"type": "range"
},
"/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/micromatch"
]
],
"_from": "array-unique@>=0.2.1 <0.3.0",
"_id": "array-unique@0.2.1",
"_inCache": true,
"_location": "/array-unique",
"_nodeVersion": "1.6.2",
"_npmUser": {
"name": "jonschlinkert",
"email": "github@sellside.com"
},
"_npmVersion": "2.7.1",
"_phantomChildren": {},
"_requested": {
"raw": "array-unique@^0.2.1",
"scope": null,
"escapedName": "array-unique",
"name": "array-unique",
"rawSpec": "^0.2.1",
"spec": ">=0.2.1 <0.3.0",
"type": "range"
},
"_requiredBy": [
"/micromatch"
],
"_resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz",
"_shasum": "a1d97ccafcbc2625cc70fadceb36a50c58b01a53",
"_shrinkwrap": null,
"_spec": "array-unique@^0.2.1",
"_where": "/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/micromatch",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/array-unique/issues"
},
"dependencies": {},
"description": "Return an array free of duplicate values. Fastest ES5 implementation.",
"devDependencies": {
"array-uniq": "^1.0.2",
"benchmarked": "^0.1.3",
"mocha": "*",
"should": "*"
},
"directories": {},
"dist": {
"shasum": "a1d97ccafcbc2625cc70fadceb36a50c58b01a53",
"tarball": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "36fde8e586fb7cf880b8b3aa6515df889e64ed85",
"homepage": "https://github.com/jonschlinkert/array-unique",
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/array-unique/blob/master/LICENSE"
},
"main": "index.js",
"maintainers": [
{
"name": "jonschlinkert",
"email": "github@sellside.com"
}
],
"name": "array-unique",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/jonschlinkert/array-unique.git"
},
"scripts": {
"test": "mocha"
},
"version": "0.2.1"
}

View File

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

View File

@ -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`.

View File

@ -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"];

View File

@ -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="
}
}
}

View File

@ -1,99 +0,0 @@
{
"_args": [
[
{
"raw": "babel-code-frame@^6.26.0",
"scope": null,
"escapedName": "babel-code-frame",
"name": "babel-code-frame",
"rawSpec": "^6.26.0",
"spec": ">=6.26.0 <7.0.0",
"type": "range"
},
"/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/babel-core"
]
],
"_from": "babel-code-frame@>=6.26.0 <7.0.0",
"_id": "babel-code-frame@6.26.0",
"_inCache": true,
"_location": "/babel-code-frame",
"_nodeVersion": "6.9.0",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/babel-code-frame-6.26.0.tgz_1502898849653_0.8458143274765462"
},
"_npmUser": {
"name": "hzoo",
"email": "hi@henryzoo.com"
},
"_npmVersion": "4.6.1",
"_phantomChildren": {},
"_requested": {
"raw": "babel-code-frame@^6.26.0",
"scope": null,
"escapedName": "babel-code-frame",
"name": "babel-code-frame",
"rawSpec": "^6.26.0",
"spec": ">=6.26.0 <7.0.0",
"type": "range"
},
"_requiredBy": [
"/babel-core",
"/babel-traverse"
],
"_resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
"_shasum": "63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b",
"_shrinkwrap": null,
"_spec": "babel-code-frame@^6.26.0",
"_where": "/Users/roman/flarum/workbench/flarum-ext-shawTheme/js/forum/node_modules/babel-core",
"author": {
"name": "Sebastian McKenzie",
"email": "sebmck@gmail.com"
},
"dependencies": {
"chalk": "^1.1.3",
"esutils": "^2.0.2",
"js-tokens": "^3.0.2"
},
"description": "Generate errors that contain a code frame that point to source locations.",
"devDependencies": {},
"directories": {},
"dist": {
"shasum": "63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b",
"tarball": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz"
},
"homepage": "https://babeljs.io/",
"license": "MIT",
"main": "lib/index.js",
"maintainers": [
{
"name": "thejameskyle",
"email": "me@thejameskyle.com"
},
{
"name": "sebmck",
"email": "sebmck@gmail.com"
},
{
"name": "danez",
"email": "daniel@tschinder.de"
},
{
"name": "hzoo",
"email": "hi@henryzoo.com"
},
{
"name": "loganfsmyth",
"email": "loganfsmyth@gmail.com"
}
],
"name": "babel-code-frame",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-code-frame"
},
"scripts": {},
"version": "6.26.0"
}

View File

@ -1,121 +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
<blockquote class="babel-callout babel-callout-info">
<h4>Babel CLI</h4>
<p>
You can pass these options from the Babel CLI like so:
</p>
<p>
<code>babel --name<span class="o">=</span>value</code>
</p>
</blockquote>
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/usage/cli/#babel-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/plugins/) to load and use. |
| `presets` | `[]` | List of [presets](https://babeljs.io/docs/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)`.

View File

@ -1 +0,0 @@
module.exports = require("./lib/api/node.js");

View File

@ -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);
}

View File

@ -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);
}

View File

@ -1,8 +0,0 @@
"use strict";
exports.__esModule = true;
exports.default = getPossiblePluginNames;
function getPossiblePluginNames(pluginName) {
return ["babel-plugin-" + pluginName, pluginName];
}
module.exports = exports["default"];

View File

@ -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"];

View File

@ -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"];

View File

@ -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"];

View File

@ -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"];

View File

@ -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"];

View File

@ -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"];

View File

@ -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"];

View File

@ -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"];

View File

@ -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"];

View File

@ -1,737 +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 _sourceMap = require("source-map");
var _sourceMap2 = _interopRequireDefault(_sourceMap);
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 _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) {
var inputMapConsumer = new _sourceMap2.default.SourceMapConsumer(inputMap);
var outputMapConsumer = new _sourceMap2.default.SourceMapConsumer(map);
var mergedGenerator = new _sourceMap2.default.SourceMapGenerator({
file: inputMapConsumer.file,
sourceRoot: inputMapConsumer.sourceRoot
});
var source = outputMapConsumer.sources[0];
inputMapConsumer.eachMapping(function (mapping) {
var generatedPosition = outputMapConsumer.generatedPositionFor({
line: mapping.generatedLine,
column: mapping.generatedColumn,
source: source
});
if (generatedPosition.column != null) {
mergedGenerator.addMapping({
source: mapping.source,
original: mapping.source == null ? null : {
line: mapping.originalLine,
column: mapping.originalColumn
},
generated: generatedPosition
});
}
});
var mergedMap = mergedGenerator.toJSON();
inputMap.mappings = mergedMap.mappings;
return inputMap;
} 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;

View File

@ -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"];

View File

@ -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();
}

View File

@ -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"];

View File

@ -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
}
};

View File

@ -1,38 +0,0 @@
"use strict";
exports.__esModule = true;
exports.config = undefined;
exports.normaliseOptions = normaliseOptions;
var _parsers = require("./parsers");
var parsers = _interopRequireWildcard(_parsers);
var _config = require("./config");
var _config2 = _interopRequireDefault(_config);
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; } }
exports.config = _config2.default;
function normaliseOptions() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
for (var key in options) {
var val = options[key];
if (val == null) continue;
var opt = _config2.default[key];
if (opt && opt.alias) opt = _config2.default[opt.alias];
if (!opt) continue;
var parser = parsers[opt.type];
if (parser) val = parser(val);
options[key] = val;
}
return options;
}

View File

@ -1,383 +0,0 @@
"use strict";
exports.__esModule = true;
var _objectWithoutProperties2 = require("babel-runtime/helpers/objectWithoutProperties");
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _stringify = require("babel-runtime/core-js/json/stringify");
var _stringify2 = _interopRequireDefault(_stringify);
var _assign = require("babel-runtime/core-js/object/assign");
var _assign2 = _interopRequireDefault(_assign);
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _getIterator3 = _interopRequireDefault(_getIterator2);
var _typeof2 = require("babel-runtime/helpers/typeof");
var _typeof3 = _interopRequireDefault(_typeof2);
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _node = require("../../../api/node");
var context = _interopRequireWildcard(_node);
var _plugin2 = require("../../plugin");
var _plugin3 = _interopRequireDefault(_plugin2);
var _babelMessages = require("babel-messages");
var messages = _interopRequireWildcard(_babelMessages);
var _index = require("./index");
var _resolvePlugin = require("../../../helpers/resolve-plugin");
var _resolvePlugin2 = _interopRequireDefault(_resolvePlugin);
var _resolvePreset = require("../../../helpers/resolve-preset");
var _resolvePreset2 = _interopRequireDefault(_resolvePreset);
var _cloneDeepWith = require("lodash/cloneDeepWith");
var _cloneDeepWith2 = _interopRequireDefault(_cloneDeepWith);
var _clone = require("lodash/clone");
var _clone2 = _interopRequireDefault(_clone);
var _merge = require("../../../helpers/merge");
var _merge2 = _interopRequireDefault(_merge);
var _config2 = require("./config");
var _config3 = _interopRequireDefault(_config2);
var _removed = require("./removed");
var _removed2 = _interopRequireDefault(_removed);
var _buildConfigChain = require("./build-config-chain");
var _buildConfigChain2 = _interopRequireDefault(_buildConfigChain);
var _path = require("path");
var _path2 = _interopRequireDefault(_path);
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 OptionManager = function () {
function OptionManager(log) {
(0, _classCallCheck3.default)(this, OptionManager);
this.resolvedConfigs = [];
this.options = OptionManager.createBareOptions();
this.log = log;
}
OptionManager.memoisePluginContainer = function memoisePluginContainer(fn, loc, i, alias) {
for (var _iterator = OptionManager.memoisedPlugins, _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 cache = _ref;
if (cache.container === fn) return cache.plugin;
}
var obj = void 0;
if (typeof fn === "function") {
obj = fn(context);
} else {
obj = fn;
}
if ((typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) === "object") {
var _plugin = new _plugin3.default(obj, alias);
OptionManager.memoisedPlugins.push({
container: fn,
plugin: _plugin
});
return _plugin;
} else {
throw new TypeError(messages.get("pluginNotObject", loc, i, typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) + loc + i);
}
};
OptionManager.createBareOptions = function createBareOptions() {
var opts = {};
for (var _key in _config3.default) {
var opt = _config3.default[_key];
opts[_key] = (0, _clone2.default)(opt.default);
}
return opts;
};
OptionManager.normalisePlugin = function normalisePlugin(plugin, loc, i, alias) {
plugin = plugin.__esModule ? plugin.default : plugin;
if (!(plugin instanceof _plugin3.default)) {
if (typeof plugin === "function" || (typeof plugin === "undefined" ? "undefined" : (0, _typeof3.default)(plugin)) === "object") {
plugin = OptionManager.memoisePluginContainer(plugin, loc, i, alias);
} else {
throw new TypeError(messages.get("pluginNotFunction", loc, i, typeof plugin === "undefined" ? "undefined" : (0, _typeof3.default)(plugin)));
}
}
plugin.init(loc, i);
return plugin;
};
OptionManager.normalisePlugins = function normalisePlugins(loc, dirname, plugins) {
return plugins.map(function (val, i) {
var plugin = void 0,
options = void 0;
if (!val) {
throw new TypeError("Falsy value found in plugins");
}
if (Array.isArray(val)) {
plugin = val[0];
options = val[1];
} else {
plugin = val;
}
var alias = typeof plugin === "string" ? plugin : loc + "$" + i;
if (typeof plugin === "string") {
var pluginLoc = (0, _resolvePlugin2.default)(plugin, dirname);
if (pluginLoc) {
plugin = require(pluginLoc);
} else {
throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname));
}
}
plugin = OptionManager.normalisePlugin(plugin, loc, i, alias);
return [plugin, options];
});
};
OptionManager.prototype.mergeOptions = function mergeOptions(_ref2) {
var _this = this;
var rawOpts = _ref2.options,
extendingOpts = _ref2.extending,
alias = _ref2.alias,
loc = _ref2.loc,
dirname = _ref2.dirname;
alias = alias || "foreign";
if (!rawOpts) return;
if ((typeof rawOpts === "undefined" ? "undefined" : (0, _typeof3.default)(rawOpts)) !== "object" || Array.isArray(rawOpts)) {
this.log.error("Invalid options type for " + alias, TypeError);
}
var opts = (0, _cloneDeepWith2.default)(rawOpts, function (val) {
if (val instanceof _plugin3.default) {
return val;
}
});
dirname = dirname || process.cwd();
loc = loc || alias;
for (var _key2 in opts) {
var option = _config3.default[_key2];
if (!option && this.log) {
if (_removed2.default[_key2]) {
this.log.error("Using removed Babel 5 option: " + alias + "." + _key2 + " - " + _removed2.default[_key2].message, ReferenceError);
} else {
var unknownOptErr = "Unknown option: " + alias + "." + _key2 + ". Check out http://babeljs.io/docs/usage/options/ for more information about options.";
var presetConfigErr = "A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options.";
this.log.error(unknownOptErr + "\n\n" + presetConfigErr, ReferenceError);
}
}
}
(0, _index.normaliseOptions)(opts);
if (opts.plugins) {
opts.plugins = OptionManager.normalisePlugins(loc, dirname, opts.plugins);
}
if (opts.presets) {
if (opts.passPerPreset) {
opts.presets = this.resolvePresets(opts.presets, dirname, function (preset, presetLoc) {
_this.mergeOptions({
options: preset,
extending: preset,
alias: presetLoc,
loc: presetLoc,
dirname: dirname
});
});
} else {
this.mergePresets(opts.presets, dirname);
delete opts.presets;
}
}
if (rawOpts === extendingOpts) {
(0, _assign2.default)(extendingOpts, opts);
} else {
(0, _merge2.default)(extendingOpts || this.options, opts);
}
};
OptionManager.prototype.mergePresets = function mergePresets(presets, dirname) {
var _this2 = this;
this.resolvePresets(presets, dirname, function (presetOpts, presetLoc) {
_this2.mergeOptions({
options: presetOpts,
alias: presetLoc,
loc: presetLoc,
dirname: _path2.default.dirname(presetLoc || "")
});
});
};
OptionManager.prototype.resolvePresets = function resolvePresets(presets, dirname, onResolve) {
return presets.map(function (val) {
var options = void 0;
if (Array.isArray(val)) {
if (val.length > 2) {
throw new Error("Unexpected extra options " + (0, _stringify2.default)(val.slice(2)) + " passed to preset.");
}
var _val = val;
val = _val[0];
options = _val[1];
}
var presetLoc = void 0;
try {
if (typeof val === "string") {
presetLoc = (0, _resolvePreset2.default)(val, dirname);
if (!presetLoc) {
throw new Error("Couldn't find preset " + (0, _stringify2.default)(val) + " relative to directory " + (0, _stringify2.default)(dirname));
}
val = require(presetLoc);
}
if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) === "object" && val.__esModule) {
if (val.default) {
val = val.default;
} else {
var _val2 = val,
__esModule = _val2.__esModule,
rest = (0, _objectWithoutProperties3.default)(_val2, ["__esModule"]);
val = rest;
}
}
if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) === "object" && val.buildPreset) val = val.buildPreset;
if (typeof val !== "function" && options !== undefined) {
throw new Error("Options " + (0, _stringify2.default)(options) + " passed to " + (presetLoc || "a preset") + " which does not accept options.");
}
if (typeof val === "function") val = val(context, options, { dirname: dirname });
if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) !== "object") {
throw new Error("Unsupported preset format: " + val + ".");
}
onResolve && onResolve(val, presetLoc);
} catch (e) {
if (presetLoc) {
e.message += " (While processing preset: " + (0, _stringify2.default)(presetLoc) + ")";
}
throw e;
}
return val;
});
};
OptionManager.prototype.normaliseOptions = function normaliseOptions() {
var opts = this.options;
for (var _key3 in _config3.default) {
var option = _config3.default[_key3];
var val = opts[_key3];
if (!val && option.optional) continue;
if (option.alias) {
opts[option.alias] = opts[option.alias] || val;
} else {
opts[_key3] = val;
}
}
};
OptionManager.prototype.init = function init() {
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
for (var _iterator2 = (0, _buildConfigChain2.default)(opts, this.log), _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 _config = _ref3;
this.mergeOptions(_config);
}
this.normaliseOptions(opts);
return this.options;
};
return OptionManager;
}();
exports.default = OptionManager;
OptionManager.memoisedPlugins = [];
module.exports = exports["default"];

View File

@ -1,33 +0,0 @@
"use strict";
exports.__esModule = true;
exports.filename = undefined;
exports.boolean = boolean;
exports.booleanString = booleanString;
exports.list = list;
var _slash = require("slash");
var _slash2 = _interopRequireDefault(_slash);
var _util = require("../../../util");
var util = _interopRequireWildcard(_util);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var filename = exports.filename = _slash2.default;
function boolean(val) {
return !!val;
}
function booleanString(val) {
return util.booleanify(val);
}
function list(val) {
return util.list(val);
}

View File

@ -1,50 +0,0 @@
"use strict";
module.exports = {
"auxiliaryComment": {
"message": "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"
},
"blacklist": {
"message": "Put the specific transforms you want in the `plugins` option"
},
"breakConfig": {
"message": "This is not a necessary option in Babel 6"
},
"experimental": {
"message": "Put the specific transforms you want in the `plugins` option"
},
"externalHelpers": {
"message": "Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/"
},
"extra": {
"message": ""
},
"jsxPragma": {
"message": "use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/"
},
"loose": {
"message": "Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option."
},
"metadataUsedHelpers": {
"message": "Not required anymore as this is enabled by default"
},
"modules": {
"message": "Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules"
},
"nonStandard": {
"message": "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"
},
"optional": {
"message": "Put the specific transforms you want in the `plugins` option"
},
"sourceMapName": {
"message": "Use the `sourceMapTarget` option"
},
"stage": {
"message": "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"
},
"whitelist": {
"message": "Put the specific transforms you want in the `plugins` option"
}
};

View File

@ -1,45 +0,0 @@
"use strict";
exports.__esModule = true;
var _plugin = require("../plugin");
var _plugin2 = _interopRequireDefault(_plugin);
var _sortBy = require("lodash/sortBy");
var _sortBy2 = _interopRequireDefault(_sortBy);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = new _plugin2.default({
name: "internal.blockHoist",
visitor: {
Block: {
exit: function exit(_ref) {
var node = _ref.node;
var hasChange = false;
for (var i = 0; i < node.body.length; i++) {
var bodyNode = node.body[i];
if (bodyNode && bodyNode._blockHoist != null) {
hasChange = true;
break;
}
}
if (!hasChange) return;
node.body = (0, _sortBy2.default)(node.body, function (bodyNode) {
var priority = bodyNode && bodyNode._blockHoist;
if (priority == null) priority = 1;
if (priority === true) priority = 2;
return -1 * priority;
});
}
}
}
});
module.exports = exports["default"];

View File

@ -1,132 +0,0 @@
"use strict";
exports.__esModule = true;
var _symbol = require("babel-runtime/core-js/symbol");
var _symbol2 = _interopRequireDefault(_symbol);
var _plugin = require("../plugin");
var _plugin2 = _interopRequireDefault(_plugin);
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 SUPER_THIS_BOUND = (0, _symbol2.default)("super this bound");
var superVisitor = {
CallExpression: function CallExpression(path) {
if (!path.get("callee").isSuper()) return;
var node = path.node;
if (node[SUPER_THIS_BOUND]) return;
node[SUPER_THIS_BOUND] = true;
path.replaceWith(t.assignmentExpression("=", this.id, node));
}
};
exports.default = new _plugin2.default({
name: "internal.shadowFunctions",
visitor: {
ThisExpression: function ThisExpression(path) {
remap(path, "this");
},
ReferencedIdentifier: function ReferencedIdentifier(path) {
if (path.node.name === "arguments") {
remap(path, "arguments");
}
}
}
});
function shouldShadow(path, shadowPath) {
if (path.is("_forceShadow")) {
return true;
} else {
return shadowPath;
}
}
function remap(path, key) {
var shadowPath = path.inShadow(key);
if (!shouldShadow(path, shadowPath)) return;
var shadowFunction = path.node._shadowedFunctionLiteral;
var currentFunction = void 0;
var passedShadowFunction = false;
var fnPath = path.find(function (innerPath) {
if (innerPath.parentPath && innerPath.parentPath.isClassProperty() && innerPath.key === "value") {
return true;
}
if (path === innerPath) return false;
if (innerPath.isProgram() || innerPath.isFunction()) {
currentFunction = currentFunction || innerPath;
}
if (innerPath.isProgram()) {
passedShadowFunction = true;
return true;
} else if (innerPath.isFunction() && !innerPath.isArrowFunctionExpression()) {
if (shadowFunction) {
if (innerPath === shadowFunction || innerPath.node === shadowFunction.node) return true;
} else {
if (!innerPath.is("shadow")) return true;
}
passedShadowFunction = true;
return false;
}
return false;
});
if (shadowFunction && fnPath.isProgram() && !shadowFunction.isProgram()) {
fnPath = path.findParent(function (p) {
return p.isProgram() || p.isFunction();
});
}
if (fnPath === currentFunction) return;
if (!passedShadowFunction) return;
var cached = fnPath.getData(key);
if (cached) return path.replaceWith(cached);
var id = path.scope.generateUidIdentifier(key);
fnPath.setData(key, id);
var classPath = fnPath.findParent(function (p) {
return p.isClass();
});
var hasSuperClass = !!(classPath && classPath.node && classPath.node.superClass);
if (key === "this" && fnPath.isMethod({ kind: "constructor" }) && hasSuperClass) {
fnPath.scope.push({ id: id });
fnPath.traverse(superVisitor, { id: id });
} else {
var init = key === "this" ? t.thisExpression() : t.identifier(key);
if (shadowFunction) init._shadowedFunctionLiteral = shadowFunction;
fnPath.scope.push({ id: id, init: init });
}
return path.replaceWith(id);
}
module.exports = exports["default"];

View File

@ -1,81 +0,0 @@
"use strict";
exports.__esModule = true;
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _normalizeAst = require("../helpers/normalize-ast");
var _normalizeAst2 = _interopRequireDefault(_normalizeAst);
var _plugin = require("./plugin");
var _plugin2 = _interopRequireDefault(_plugin);
var _file = require("./file");
var _file2 = _interopRequireDefault(_file);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Pipeline = function () {
function Pipeline() {
(0, _classCallCheck3.default)(this, Pipeline);
}
Pipeline.prototype.lint = function lint(code) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
opts.code = false;
opts.mode = "lint";
return this.transform(code, opts);
};
Pipeline.prototype.pretransform = function pretransform(code, opts) {
var file = new _file2.default(opts, this);
return file.wrap(code, function () {
file.addCode(code);
file.parseCode(code);
return file;
});
};
Pipeline.prototype.transform = function transform(code, opts) {
var file = new _file2.default(opts, this);
return file.wrap(code, function () {
file.addCode(code);
file.parseCode(code);
return file.transform();
});
};
Pipeline.prototype.analyse = function analyse(code) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var visitor = arguments[2];
opts.code = false;
if (visitor) {
opts.plugins = opts.plugins || [];
opts.plugins.push(new _plugin2.default({ visitor: visitor }));
}
return this.transform(code, opts).metadata;
};
Pipeline.prototype.transformFromAst = function transformFromAst(ast, code, opts) {
ast = (0, _normalizeAst2.default)(ast);
var file = new _file2.default(opts, this);
return file.wrap(code, function () {
file.addCode(code);
file.addAst(ast);
return file.transform();
});
};
return Pipeline;
}();
exports.default = Pipeline;
module.exports = exports["default"];

View File

@ -1,71 +0,0 @@
"use strict";
exports.__esModule = true;
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 _store = require("../store");
var _store2 = _interopRequireDefault(_store);
var _file5 = require("./file");
var _file6 = _interopRequireDefault(_file5);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var PluginPass = function (_Store) {
(0, _inherits3.default)(PluginPass, _Store);
function PluginPass(file, plugin) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
(0, _classCallCheck3.default)(this, PluginPass);
var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
_this.plugin = plugin;
_this.key = plugin.key;
_this.file = file;
_this.opts = options;
return _this;
}
PluginPass.prototype.addHelper = function addHelper() {
var _file;
return (_file = this.file).addHelper.apply(_file, arguments);
};
PluginPass.prototype.addImport = function addImport() {
var _file2;
return (_file2 = this.file).addImport.apply(_file2, arguments);
};
PluginPass.prototype.getModuleName = function getModuleName() {
var _file3;
return (_file3 = this.file).getModuleName.apply(_file3, arguments);
};
PluginPass.prototype.buildCodeFrameError = function buildCodeFrameError() {
var _file4;
return (_file4 = this.file).buildCodeFrameError.apply(_file4, arguments);
};
return PluginPass;
}(_store2.default);
exports.default = PluginPass;
module.exports = exports["default"];

View File

@ -1,163 +0,0 @@
"use strict";
exports.__esModule = true;
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _getIterator3 = _interopRequireDefault(_getIterator2);
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 _optionManager = require("./file/options/option-manager");
var _optionManager2 = _interopRequireDefault(_optionManager);
var _babelMessages = require("babel-messages");
var messages = _interopRequireWildcard(_babelMessages);
var _store = require("../store");
var _store2 = _interopRequireDefault(_store);
var _babelTraverse = require("babel-traverse");
var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
var _assign = require("lodash/assign");
var _assign2 = _interopRequireDefault(_assign);
var _clone = require("lodash/clone");
var _clone2 = _interopRequireDefault(_clone);
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 GLOBAL_VISITOR_PROPS = ["enter", "exit"];
var Plugin = function (_Store) {
(0, _inherits3.default)(Plugin, _Store);
function Plugin(plugin, key) {
(0, _classCallCheck3.default)(this, Plugin);
var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
_this.initialized = false;
_this.raw = (0, _assign2.default)({}, plugin);
_this.key = _this.take("name") || key;
_this.manipulateOptions = _this.take("manipulateOptions");
_this.post = _this.take("post");
_this.pre = _this.take("pre");
_this.visitor = _this.normaliseVisitor((0, _clone2.default)(_this.take("visitor")) || {});
return _this;
}
Plugin.prototype.take = function take(key) {
var val = this.raw[key];
delete this.raw[key];
return val;
};
Plugin.prototype.chain = function chain(target, key) {
if (!target[key]) return this[key];
if (!this[key]) return target[key];
var fns = [target[key], this[key]];
return function () {
var val = void 0;
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
for (var _iterator = fns, _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 fn = _ref;
if (fn) {
var ret = fn.apply(this, args);
if (ret != null) val = ret;
}
}
return val;
};
};
Plugin.prototype.maybeInherit = function maybeInherit(loc) {
var inherits = this.take("inherits");
if (!inherits) return;
inherits = _optionManager2.default.normalisePlugin(inherits, loc, "inherits");
this.manipulateOptions = this.chain(inherits, "manipulateOptions");
this.post = this.chain(inherits, "post");
this.pre = this.chain(inherits, "pre");
this.visitor = _babelTraverse2.default.visitors.merge([inherits.visitor, this.visitor]);
};
Plugin.prototype.init = function init(loc, i) {
if (this.initialized) return;
this.initialized = true;
this.maybeInherit(loc);
for (var key in this.raw) {
throw new Error(messages.get("pluginInvalidProperty", loc, i, key));
}
};
Plugin.prototype.normaliseVisitor = function normaliseVisitor(visitor) {
for (var _iterator2 = GLOBAL_VISITOR_PROPS, _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 key = _ref2;
if (visitor[key]) {
throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. " + "Please target individual nodes.");
}
}
_babelTraverse2.default.explode(visitor);
return visitor;
};
return Plugin;
}(_store2.default);
exports.default = Plugin;
module.exports = exports["default"];

View File

@ -1,184 +0,0 @@
"use strict";
exports.__esModule = true;
exports.inspect = exports.inherits = undefined;
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _getIterator3 = _interopRequireDefault(_getIterator2);
var _util = require("util");
Object.defineProperty(exports, "inherits", {
enumerable: true,
get: function get() {
return _util.inherits;
}
});
Object.defineProperty(exports, "inspect", {
enumerable: true,
get: function get() {
return _util.inspect;
}
});
exports.canCompile = canCompile;
exports.list = list;
exports.regexify = regexify;
exports.arrayify = arrayify;
exports.booleanify = booleanify;
exports.shouldIgnore = shouldIgnore;
var _escapeRegExp = require("lodash/escapeRegExp");
var _escapeRegExp2 = _interopRequireDefault(_escapeRegExp);
var _startsWith = require("lodash/startsWith");
var _startsWith2 = _interopRequireDefault(_startsWith);
var _minimatch = require("minimatch");
var _minimatch2 = _interopRequireDefault(_minimatch);
var _includes = require("lodash/includes");
var _includes2 = _interopRequireDefault(_includes);
var _isRegExp = require("lodash/isRegExp");
var _isRegExp2 = _interopRequireDefault(_isRegExp);
var _path = require("path");
var _path2 = _interopRequireDefault(_path);
var _slash = require("slash");
var _slash2 = _interopRequireDefault(_slash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function canCompile(filename, altExts) {
var exts = altExts || canCompile.EXTENSIONS;
var ext = _path2.default.extname(filename);
return (0, _includes2.default)(exts, ext);
}
canCompile.EXTENSIONS = [".js", ".jsx", ".es6", ".es"];
function list(val) {
if (!val) {
return [];
} else if (Array.isArray(val)) {
return val;
} else if (typeof val === "string") {
return val.split(",");
} else {
return [val];
}
}
function regexify(val) {
if (!val) {
return new RegExp(/.^/);
}
if (Array.isArray(val)) {
val = new RegExp(val.map(_escapeRegExp2.default).join("|"), "i");
}
if (typeof val === "string") {
val = (0, _slash2.default)(val);
if ((0, _startsWith2.default)(val, "./") || (0, _startsWith2.default)(val, "*/")) val = val.slice(2);
if ((0, _startsWith2.default)(val, "**/")) val = val.slice(3);
var regex = _minimatch2.default.makeRe(val, { nocase: true });
return new RegExp(regex.source.slice(1, -1), "i");
}
if ((0, _isRegExp2.default)(val)) {
return val;
}
throw new TypeError("illegal type for regexify");
}
function arrayify(val, mapFn) {
if (!val) return [];
if (typeof val === "boolean") return arrayify([val], mapFn);
if (typeof val === "string") return arrayify(list(val), mapFn);
if (Array.isArray(val)) {
if (mapFn) val = val.map(mapFn);
return val;
}
return [val];
}
function booleanify(val) {
if (val === "true" || val == 1) {
return true;
}
if (val === "false" || val == 0 || !val) {
return false;
}
return val;
}
function shouldIgnore(filename) {
var ignore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var only = arguments[2];
filename = filename.replace(/\\/g, "/");
if (only) {
for (var _iterator = only, _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 pattern = _ref;
if (_shouldIgnore(pattern, filename)) return false;
}
return true;
} else if (ignore.length) {
for (var _iterator2 = ignore, _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 _pattern = _ref2;
if (_shouldIgnore(_pattern, filename)) return true;
}
}
return false;
}
function _shouldIgnore(pattern, filename) {
if (typeof pattern === "function") {
return pattern(filename);
} else {
return pattern.test(filename);
}
}

View File

@ -1,88 +0,0 @@
{
"name": "babel-core",
"version": "6.25.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"babylon": {
"version": "6.18.0",
"resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz",
"integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ=="
},
"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"
}
},
"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="
},
"debug": {
"version": "2.6.8",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz",
"integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=",
"requires": {
"ms": "2.0.0"
}
},
"json5": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
"integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE="
},
"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"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"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="
},
"private": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz",
"integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE="
},
"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="
}
}
}

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