Skip to content
This repository has been archived by the owner on Jul 26, 2019. It is now read-only.

Commit

Permalink
perf(*): initial release.
Browse files Browse the repository at this point in the history
BREAKING CHANGE: release.
  • Loading branch information
Michael Ledin committed Sep 4, 2017
0 parents commit 63582ab
Show file tree
Hide file tree
Showing 13 changed files with 7,054 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root = true

[*]
indent_style = space
indent_size = 2
33 changes: 33 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
"env": {
"es6": true,
"node": true,
"mocha": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"semi": [
"error",
"always"
],
"no-unused-expressions": [
"error"
]
}
};
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# IntelliJ based IDEs
.idea
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
language: node_js
cache:
directories:
- node_modules
notifications:
email: false
node_js:
- '7'
- '6'
before_script:
- npm prune
script:
- npm run lint && npm test
after_success:
- npm run semantic-release
branches:
except:
- /^v\d+\.\d+\.\d+$/
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Michael Ledin

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.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[![npm](https://img.shields.io/npm/v/flavors-plugin-loader-config.svg)](https://www.npmjs.com/package/flavors-plugin-loader-config)
[![Build Status](https://travis-ci.org/flavors-js/flavors-plugin-loader-config.svg?branch=master)](https://travis-ci.org/flavors-js/flavors-plugin-loader-config)
[![David](https://img.shields.io/david/flavors-js/flavors-plugin-loader-config.svg)](https://david-dm.org/flavors-js/flavors-plugin-loader-config)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Join the chat at https://gitter.im/flavors-js/flavors](https://badges.gitter.im/flavors-js/flavors.svg)](https://gitter.im/flavors-js/flavors?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

# flavors-plugin-loader-config

Flavors configuration plugin loader.

## Install

```text
$ npm install --save-dev flavors-plugin-loader-config
```

## Maintainers

- [@mxl](https://github.com/mxl)

## License

See the [LICENSE](https://github.com/flavors-js/flavors-plugin-loader-config/blob/master/LICENSE) file for details.
27 changes: 27 additions & 0 deletions getOptions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';

module.exports = (options, pluginOptions) => {
pluginOptions = pluginOptions || {};
let loaders = options.loaders;
if (!options.overrideLoaders && pluginOptions.loaders) {
loaders = [...pluginOptions.loaders, ...(loaders || [])];
}

let transform = options.transform;
if (!options.overrideTransform && pluginOptions.transform) {
if (transform) {
const transform2 = transform, transform1 = pluginOptions.transform;
transform = (config, info) => transform2(transform1(config, info), info);
} else {
transform = pluginOptions.transform;
}
}
const result = Object.assign({}, pluginOptions, options);
if (loaders) {
result.loaders = loaders;
}
if (transform) {
result.transform = transform;
}
return result;
};
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = options => rawPlugin => ({
config: require('flavors')(options.configName, require('./getOptions')(options, typeof rawPlugin === 'object' ? rawPlugin.options : undefined))
});
Loading

0 comments on commit 63582ab

Please sign in to comment.