<commit_before>const path = require("path");
const Webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");

const config = {
    entry: "./src/index.js",

    output: {
        path: path.resolve(__dirname, "./dist"),
        filename: "index.min.js",
    },

    resolve: {
        extensions: [".js", ".jsx", ".json"],
    },

    watchOptions: {
        ignored: [
            path.resolve(__dirname, "./node_modules"),
            path.resolve(__dirname, "./build"),
            path.resolve(__dirname, "./cache"),
            path.resolve(__dirname, "./dist"),
            path.resolve(__dirname, "./bin"),
        ],
    },

    devtool: "source-map",
    context: __dirname,
    target: "node-webkit",

    module: {
        rules: [
            {
                test: /\.(jpg|jpeg|png|woff|woff2|eot|otf|ttf)$/,
                use: "url-loader?limit=1000",
            },
            {
                test: /\.svg$/,
                use: "file-loader",
            },
            {
                test: /\.json$/,
                use: "json-loader",
            },
            {
                test: /\.(js|jsx)$/,
                use: "babel-loader",
                exclude: /(node_modules|bower_components)/,
            },
            {
                test: /\.scss$/,
                use: ExtractTextPlugin.extract({
                    use: [
                        "css-loader",
                        "postcss-loader",
                        "sass-loader",
                    ],
                }),
            },
        ],
    },

    plugins: [
        new Webpack.optimize.ModuleConcatenationPlugin(),

        new Webpack.LoaderOptionsPlugin({
            options: {
                postcss: [
                    require("autoprefixer"),
                ],
                devServer: {
                    inline: true,
                },
            },
        }),

        new HtmlWebpackPlugin({
            template: "./src/index.html",
        }),

        new ExtractTextPlugin({
            filename: "./index.min.css",
            allChunks: true,
        }),

        new Webpack.DefinePlugin({
            "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
        }),
    ],
};

if (process.env.NODE_ENV === "production") {
    // …
}

module.exports = config;
<commit_msg>:heavy_plus_sign: Include .css files in loaders<commit_after>const path = require("path");
const Webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");

const config = {
    entry: "./src/index.js",

    output: {
        path: path.resolve(__dirname, "./dist"),
        filename: "index.min.js",
    },

    resolve: {
        extensions: [".js", ".jsx", ".json"],
    },

    watchOptions: {
        ignored: [
            path.resolve(__dirname, "./node_modules"),
            path.resolve(__dirname, "./build"),
            path.resolve(__dirname, "./cache"),
            path.resolve(__dirname, "./dist"),
            path.resolve(__dirname, "./bin"),
        ],
    },

    devtool: "source-map",
    context: __dirname,
    target: "node-webkit",

    module: {
        rules: [
            {
                test: /\.(jpg|jpeg|png|woff|woff2|eot|otf|ttf)$/,
                use: "url-loader?limit=1000",
            },
            {
                test: /\.svg$/,
                use: "file-loader",
            },
            {
                test: /\.json$/,
                use: "json-loader",
            },
            {
                test: /\.(js|jsx)$/,
                use: "babel-loader",
                exclude: /(node_modules|bower_components)/,
            },
            {
                test: /\.(scss|css)$/,
                use: ExtractTextPlugin.extract({
                    use: [
                        "css-loader",
                        "postcss-loader",
                        "sass-loader",
                    ],
                }),
            },
        ],
    },

    plugins: [
        new Webpack.optimize.ModuleConcatenationPlugin(),

        new Webpack.LoaderOptionsPlugin({
            options: {
                postcss: [
                    require("autoprefixer"),
                ],
                devServer: {
                    inline: true,
                },
            },
        }),

        new HtmlWebpackPlugin({
            template: "./src/index.html",
        }),

        new ExtractTextPlugin({
            filename: "./index.min.css",
            allChunks: true,
        }),

        new Webpack.DefinePlugin({
            "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
        }),
    ],
};

if (process.env.NODE_ENV === "production") {
    // …
}

module.exports = config;
<|endoftext|>


<commit_before>/*eslint-disable*/
require('dotenv').config()
var production = ['production', 'prod'];

// module.exports = (process.env.NODE_ENV && production.indexOf(process.env.NODE_ENV) > -1) ?
//     require('./webpack_configs/webpack.prod.config.js')
//   : (process.env.NODE_ENV === 'staging' ? require('./webpack_configs/webpack.staging.config.js') :
//   require('./webpack_configs/webpack.dev.config.js'))
if (process.env.RUN_MODE === 'lib') {
  if (process.env.NODE_ENV && process.env.NODE_ENV === 'dev') {
    module.exports = require('./webpack_configs/webpack.lib.dev.config.js')
  } else {
    module.exports = require('./webpack_configs/webpack.lib.config.js')
  }
} else if (process.env.NODE_ENV && production.indexOf(process.env.NODE_ENV) > -1) {
  module.exports = require('./webpack_configs/webpack.prod.config.js')
} else if (process.env.NODE_ENV === 'staging') {
  module.exports = require('./webpack_configs/webpack.staging.config.js')
} else {
  module.exports = require('./webpack_configs/webpack.dev.config.js')
}

<commit_msg>Add run mode qprod<commit_after>/*eslint-disable*/
require('dotenv').config()
var production = ['production', 'prod', 'qprod'];

// module.exports = (process.env.NODE_ENV && production.indexOf(process.env.NODE_ENV) > -1) ?
//     require('./webpack_configs/webpack.prod.config.js')
//   : (process.env.NODE_ENV === 'staging' ? require('./webpack_configs/webpack.staging.config.js') :
//   require('./webpack_configs/webpack.dev.config.js'))
if (process.env.RUN_MODE === 'lib') {
  if (process.env.NODE_ENV && process.env.NODE_ENV === 'dev') {
    module.exports = require('./webpack_configs/webpack.lib.dev.config.js')
  } else {
    module.exports = require('./webpack_configs/webpack.lib.config.js')
  }
} else if (process.env.NODE_ENV && production.indexOf(process.env.NODE_ENV) > -1) {
  module.exports = require('./webpack_configs/webpack.prod.config.js')
} else if (process.env.NODE_ENV === 'staging') {
  module.exports = require('./webpack_configs/webpack.staging.config.js')
} else {
  module.exports = require('./webpack_configs/webpack.dev.config.js')
}

<|endoftext|>


<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import ControlledVocab from '@folio/stripes-smart-components/lib/ControlledVocab';

class RefundReasonsSettings extends React.Component {
  static propTypes = {
    stripes: PropTypes.shape({
      connect: PropTypes.func.isRequired,
      intl: PropTypes.object.isRequired,
    }).isRequired,
  };

  constructor(props) {
    super(props);
    this.connectedControlledVocab = props.stripes.connect(ControlledVocab);
  }
  render() {
    return (
      <this.connectedControlledVocab
        {...this.props}
        baseUrl="refunds"
        records="refunds"
        label="Fee/fine: Refund reasons"
        labelSingular="Refund reason"
        objectLabel=""
        visibleFields={['nameReason']}
        columnMapping={{
          'nameReason': 'Reason*',
        }}
        nameKey="refundReasons"
        hiddenFields={['numberOfObjects']}
        id="refunds"
      />
    );
  }
}

export default RefundReasonsSettings;
<commit_msg>Add description field<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import ControlledVocab from '@folio/stripes-smart-components/lib/ControlledVocab';

class RefundReasonsSettings extends React.Component {
  static propTypes = {
    stripes: PropTypes.shape({
      connect: PropTypes.func.isRequired,
      intl: PropTypes.object.isRequired,
    }).isRequired,
  };

  constructor(props) {
    super(props);
    this.connectedControlledVocab = props.stripes.connect(ControlledVocab);
  }
  render() {
    return (
      <this.connectedControlledVocab
        {...this.props}
        baseUrl="refunds"
        records="refunds"
        label={this.props.stripes.intl.formatMessage({ id: 'ui-users.refunds.label' })}
        labelSingular={this.props.stripes.intl.formatMessage({ id: 'ui-users.refunds.singular' })}
        objectLabel=""
        visibleFields={['nameReason', 'description']}
        columnMapping={{
          nameReason: this.props.stripes.intl.formatMessage({ id: 'ui-users.refunds.columns.nameReason' }),
          description: this.props.stripes.intl.formatMessage({ id: 'ui-users.refunds.columns.description' }),
        }}
        nameKey="refund"
        hiddenFields={['numberOfObjects']}
        id="refunds"
      />
    );
  }
}

export default RefundReasonsSettings;
<|endoftext|>


<commit_before>const fs = require('fs');
const merge = require('webpack-merge');
const path = require('path');
const webpack = require('webpack');

const common = {
  entry: './src/index.js',
  output: {
    library: 'wargamer',
    libraryTarget: 'umd',
    path: path.resolve(__dirname, 'dist'),
    umdNamedDefine: true,
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        use: 'babel-loader',
        exclude: /node_modules/,
      },
      {
        test: /\.js$/,
        use: 'eslint-loader',
        exclude: /node_modules/,
      },
    ],
  },
  plugins: [
    new webpack.BannerPlugin(fs.readFileSync('./LICENSE', 'utf8').trim()),
  ],
  devtool: 'source-map',
};

const dev = {
  output: {
    filename: 'wargamer.js',
  },
};

const prod = {
  output: {
    filename: 'wargamer.min.js',
  },
  plugins: [
    new webpack.optimize.UglifyJsPlugin({ sourceMap: true }),
  ],
};

module.exports = (env) => {
  const { target } = env;

  switch (target) {
    case 'prod':
    case 'production':
      return merge(common, prod);
    default:
      return merge(common, dev);
  }
};
<commit_msg>Change the library export name.<commit_after>const fs = require('fs');
const merge = require('webpack-merge');
const path = require('path');
const webpack = require('webpack');

const common = {
  entry: './src/index.js',
  output: {
    library: 'Wargamer',
    libraryTarget: 'umd',
    path: path.resolve(__dirname, 'dist'),
    umdNamedDefine: true,
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        use: 'babel-loader',
        exclude: /node_modules/,
      },
      {
        test: /\.js$/,
        use: 'eslint-loader',
        exclude: /node_modules/,
      },
    ],
  },
  plugins: [
    new webpack.BannerPlugin(fs.readFileSync('./LICENSE', 'utf8').trim()),
  ],
  devtool: 'source-map',
};

const dev = {
  output: {
    filename: 'wargamer.js',
  },
};

const prod = {
  output: {
    filename: 'wargamer.min.js',
  },
  plugins: [
    new webpack.optimize.UglifyJsPlugin({ sourceMap: true }),
  ],
};

module.exports = (env) => {
  const { target } = env;

  switch (target) {
    case 'prod':
    case 'production':
      return merge(common, prod);
    default:
      return merge(common, dev);
  }
};
<|endoftext|>


<commit_before>// @AngularClass

var webpack = require('webpack');
var helpers = require('./helpers');

var CopyWebpackPlugin = require('copy-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;

var ENV = process.env.ENV = process.env.NODE_ENV = 'development';
var HMR = helpers.hasProcessFlag('hot');

var metadata = {
  title: 'Angular2 Webpack Starter by @gdi2990 from @AngularClass',
  baseUrl: '/',
  host: 'localhost',
  port: 3000,
  ENV: ENV,
  HMR: HMR
};
/*
 * Config
 * with default values at webpack.default.conf
 */
module.exports = {
  // static data for index.html
  metadata: metadata,
  devtool: 'cheap-module-eval-source-map',
  // cache: true,
  debug: true,
  // devtool: 'eval' // for faster builds use 'eval'

  // our angular app
  entry: {
    'polyfills': './src/polyfills.ts',
    'vendor': './src/vendor.ts',
    'main': './src/main.ts'
  },

  resolve: {
    extensions: ['', '.ts', '.js']
  },

  // Config for our build files
  output: {
    path: helpers.root('dist'),
    filename: '[name].bundle.js',
    sourceMapFilename: '[name].map',
    chunkFilename: '[id].chunk.js'
  },

  module: {
    preLoaders: [
      // { test: /\.ts$/, loader: 'tslint-loader', exclude: [ helpers.root('node_modules') ] },
      // TODO(gdi2290): `exclude: [ helpers.root('node_modules/rxjs') ]` fixed with rxjs 5 beta.3 release
      { test: /\.js$/, loader: 'source-map-loader', exclude: [ helpers.root('node_modules/rxjs') ] }
    ],
    loaders: [
      // Support for .ts files.
      { test: /\.ts$/, loader: 'awesome-typescript-loader', exclude: [ /\.(spec|e2e)\.ts$/ ] },

      // Support for *.json files.
      { test: /\.json$/,  loader: 'json-loader' },

      // Support for CSS as raw text
      { test: /\.css$/,   loader: 'raw-loader' },

      // support for .html as raw text
      { test: /\.html$/,  loader: 'raw-loader', exclude: [ helpers.root('src/index.html') ] }

    ]
  },

  plugins: [
    new ForkCheckerPlugin(),
    new webpack.optimize.OccurenceOrderPlugin(true),
    new webpack.optimize.CommonsChunkPlugin({ name: ['main', 'vendor', 'polyfills'], minChunks: Infinity }),
    // static assets
    new CopyWebpackPlugin([ { from: 'src/assets', to: 'assets' } ]),
    // generating html
    new HtmlWebpackPlugin({ template: 'src/index.html', chunksSortMode: 'none' }),
    // Environment helpers (when adding more properties make sure you include them in custom-typings.d.ts)
    new webpack.DefinePlugin({
      'ENV': JSON.stringify(metadata.ENV),
      'HMR': HMR
    })
  ],

  // Other module loader config

  // our Webpack Development Server config
  tslint: {
    emitErrors: false,
    failOnHint: false,
    resourcePath: 'src',
  },
  devServer: {
    port: metadata.port,
    host: metadata.host,
    historyApiFallback: true,
    watchOptions: {
      aggregateTimeout: 300,
      poll: 1000
    }
  },
  node: {
    global: 'window',
    process: true,
    crypto: 'empty',
    module: false,
    clearImmediate: false,
    setImmediate: false
  }
};
<commit_msg>chore(webpack.config.js): comments cleanup<commit_after>/**
 * @author: @AngularClass
 */

var webpack = require('webpack');
var helpers = require('./helpers');

/**
 * Webpack Plugins
 */
var CopyWebpackPlugin = require('copy-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;

/**
 * Webpack Constants
 */
const ENV = process.env.ENV = process.env.NODE_ENV = 'development';
const HMR = helpers.hasProcessFlag('hot');
const METADATA = {
  title: 'Angular2 Webpack Starter by @gdi2990 from @AngularClass',
  baseUrl: '/',
  host: 'localhost',
  port: 3000,
  ENV: ENV,
  HMR: HMR
};

/**
 * Webpack configuration
 */
module.exports = {

  // Static data for index.html
  metadata: METADATA,

  devtool: 'cheap-module-eval-source-map',
  // cache: true,
  debug: true,
  // devtool: 'eval' // for faster builds use 'eval'

  // Our Angular.js app
  entry: {
    'polyfills': './src/polyfills.ts',
    'vendor': './src/vendor.ts',
    'main': './src/main.ts'
  },

  resolve: {
    extensions: ['', '.ts', '.js']
  },

  // Configuration for our build files
  output: {
    path: helpers.root('dist'),
    filename: '[name].bundle.js',
    sourceMapFilename: '[name].map',
    chunkFilename: '[id].chunk.js'
  },

  module: {
    preLoaders: [
      // { test: /\.ts$/, loader: 'tslint-loader', exclude: [ helpers.root('node_modules') ] },
      // TODO(gdi2290): `exclude: [ helpers.root('node_modules/rxjs') ]` fixed with rxjs 5 beta.3 release
      { test: /\.js$/, loader: 'source-map-loader', exclude: [ helpers.root('node_modules/rxjs') ] }
    ],
    loaders: [
      // Support for .ts files.
      { test: /\.ts$/, loader: 'awesome-typescript-loader', exclude: [ /\.(spec|e2e)\.ts$/ ] },

      // Support for *.json files.
      { test: /\.json$/,  loader: 'json-loader' },

      // Support for CSS as raw text
      { test: /\.css$/,   loader: 'raw-loader' },

      // Support for .html as raw text
      { test: /\.html$/,  loader: 'raw-loader', exclude: [ helpers.root('src/index.html') ] }

    ]
  },

  plugins: [
    new ForkCheckerPlugin(),
    new webpack.optimize.OccurenceOrderPlugin(true),
    new webpack.optimize.CommonsChunkPlugin({ name: ['main', 'vendor', 'polyfills'], minChunks: Infinity }),
    // Static assets
    new CopyWebpackPlugin([ { from: 'src/assets', to: 'assets' } ]),
    // Generating HTML
    new HtmlWebpackPlugin({ template: 'src/index.html', chunksSortMode: 'none' }),
    // Environment helpers (when adding more properties make sure you include them in custom-typings.d.ts)
    new webpack.DefinePlugin({
      'ENV': JSON.stringify(METADATA.ENV),
      'HMR': HMR
    })
  ],

  // Other module loader config

  // Our Webpack Development Server config
  tslint: {
    emitErrors: false,
    failOnHint: false,
    resourcePath: 'src',
  },
  devServer: {
    port: METADATA.port,
    host: METADATA.host,
    historyApiFallback: true,
    watchOptions: {
      aggregateTimeout: 300,
      poll: 1000
    }
  },
  node: {
    global: 'window',
    process: true,
    crypto: 'empty',
    module: false,
    clearImmediate: false,
    setImmediate: false
  }
};
<|endoftext|>


<commit_before>const commonConfig = require('./webpack.common');
const path = require('path');
const Webpack = require('webpack');

const { version } = require('./package.json');

module.exports = Object.assign(commonConfig, {
  entry: './src/main.js',
  output: {
    path: path.join(__dirname, 'dist'),
    publicPath: '/assets/',
    filename: 'rekapi.js',
    library: 'rekapi',
    libraryTarget: 'umd',
    umdNamedDefine: true
  },
  externals: {
    shifty: 'shifty',
    lodash: 'lodash',
  },
  plugins: [
    new Webpack.BannerPlugin(version)
  ]
});
<commit_msg>Revert "Externalize Shifty and Lodash"<commit_after>const commonConfig = require('./webpack.common');
const path = require('path');
const Webpack = require('webpack');

const { version } = require('./package.json');

module.exports = Object.assign(commonConfig, {
  entry: './src/main.js',
  output: {
    path: path.join(__dirname, 'dist'),
    publicPath: '/assets/',
    filename: 'rekapi.js',
    library: 'rekapi',
    libraryTarget: 'umd',
    umdNamedDefine: true
  },
  plugins: [
    new Webpack.BannerPlugin(version)
  ]
});
<|endoftext|>


<commit_before>var webpack = require('webpack');
var path = require('path');

var BUILD_DIR = path.resolve(__dirname, 'dist');
var APP_DIR = path.resolve(__dirname, '.');

var plugins = [];
var filename = '[name].js';
var PROD = JSON.parse(process.env.BUILD_PROD || false);
if(PROD) {
  plugins.push(new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify('production') } }));
  plugins.push(new webpack.optimize.UglifyJsPlugin({ compress:{ warnings: true } }));
  filename = '[name].min.js';
}

module.exports = {
	entry: {
    Viewer: APP_DIR + '/src/viewer.jsx',
    Composer: APP_DIR + '/src/composer.jsx'
  },
	output: {
    path: BUILD_DIR,
    filename: filename,
    library: '[name]',
    libraryTarget: 'umd',
    umdNamedDefine: true,
    publicPath: "/dist/"
	},
  node: {fs: "empty"},
  plugins: plugins,
	module: {
		loaders: [
      {
        test: /\.(js|jsx)$/,
        loader: 'babel-loader',
        exclude: /node_modules/
      },
      { test: /\.css$/, loader: "style-loader!css-loader" },
      { test: /\.json$/, loader: "json-loader" },
      { test: /\.(png|gif|jpg|jpeg|svg|otf|ttf|eot|woff)$/, loader: 'file-loader' }
    ]
	}
};
<commit_msg>Get rid of webpack warnings<commit_after>var webpack = require('webpack');
var path = require('path');

var BUILD_DIR = path.resolve(__dirname, 'dist');
var APP_DIR = path.resolve(__dirname, '.');

var plugins = [];
var filename = '[name].js';
var PROD = JSON.parse(process.env.BUILD_PROD || false);
if(PROD) {
  plugins.push(new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify('production') } }));
  plugins.push(new webpack.optimize.UglifyJsPlugin({ compress:{ warnings: true } }));
  filename = '[name].min.js';
}

module.exports = {
  entry: {
    Viewer: APP_DIR + '/src/viewer.jsx',
    Composer: APP_DIR + '/src/composer.jsx'
  },
  output: {
    path: BUILD_DIR,
    filename: filename,
    library: '[name]',
    libraryTarget: 'umd',
    umdNamedDefine: true,
    publicPath: "/dist/"
  },
  node: {fs: "empty"},
  plugins: plugins,
  module: {
    loaders: [
      {
        test: /\.(js|jsx)$/,
        loader: 'babel-loader',
        exclude: /node_modules/
      }, {
        test: /\.css$/,
        loader: "style-loader!css-loader"
      }, {
        test: /\.json$/,
        loader: "json-loader"
      }, {
        test: /\.(png|gif|jpg|jpeg|svg|otf|ttf|eot|woff)$/,
        loader: 'file-loader'
      }
    ],
    noParse: [/dist\/ol.js/, /dist\/jspdf.debug.js/]
  }
};
<|endoftext|>


<commit_before>/* global describe, it */

var suite = require('..');
var sinon = require('sinon');
var expect = require('chai').expect;

describe('bixby-vault', function() {

  describe('object specifications', function() {

    describe('client', function() {
      var client = suite('client');

      it('should be annotated', function() {
        expect(client['@implements']).to.equal('http://i.bixbyjs.org/opt/vault/Client/0');
      });
    });

  });

  describe('inexistent object specification', function() {
    it('should not return specification', function() {
      expect(suite('inexistent')).to.be.undefined;
    });
  });

  describe('used as a source of objects', function() {
    var container = { spec: function(){} };
    var spy = sinon.stub(container, 'spec')

    suite.used(container);

    it('should specify objects ahead-of-time', function() {
      expect(spy).to.have.callCount(1);
      expect(spy.getCall(0).args).to.deep.equal([ 'client' ]);
    });
  });

});
<commit_msg>Add test case.<commit_after>/* global describe, it */

var suite = require('..');
var sinon = require('sinon');
var expect = require('chai').expect;

describe('bixby-vault', function() {

  it('should be named', function() {
    expect(suite.name).to.equal('vault');
  });

  describe('object specifications', function() {

    describe('client', function() {
      var client = suite('client');

      it('should be annotated', function() {
        expect(client['@implements']).to.equal('http://i.bixbyjs.org/opt/vault/Client/0');
      });
    });

  });

  describe('inexistent object specification', function() {
    it('should not return specification', function() {
      expect(suite('inexistent')).to.be.undefined;
    });
  });

  describe('used as a source of objects', function() {
    var container = { spec: function(){} };
    var spy = sinon.stub(container, 'spec')

    suite.used(container);

    it('should specify objects ahead-of-time', function() {
      expect(spy).to.have.callCount(1);
      expect(spy.getCall(0).args).to.deep.equal([ 'client' ]);
    });
  });

});
<|endoftext|>


<commit_before>// @AngularClass

/*
 * Helper
 * env(), getBanner(), root(), and rootDir()
 * are defined at the bottom
 */
var sliceArgs = Function.prototype.call.bind(Array.prototype.slice);
var toString  = Function.prototype.call.bind(Object.prototype.toString);
var NODE_ENV  = process.env.NODE_ENV || 'development';
var pkg = require('./package.json');

// Polyfill
Object.assign = require('object-assign');

// Node
var path = require('path');

// NPM
var webpack = require('webpack');

// Webpack Plugins
var OccurenceOrderPlugin = webpack.optimize.OccurenceOrderPlugin;
var CommonsChunkPlugin   = webpack.optimize.CommonsChunkPlugin;
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
var DedupePlugin   = webpack.optimize.DedupePlugin;
var DefinePlugin   = webpack.DefinePlugin;
var BannerPlugin   = webpack.BannerPlugin;

/*
 * Config
 */
module.exports = {
  devtool: 'source-map',
  debug: true,
  cache: true,

  verbose: true,
  displayErrorDetails: true,
  context: __dirname,
  stats: {
    colors: true,
    reasons: true
  },

  // our Development Server config
  devServer: {
    inline: true,
    colors: true,
    historyApiFallback: true,
    contentBase: 'src/public',
    publicPath: '/__build__'
  },

  //
  entry: {
    'angular2': [
      // Angular 2 Deps
      '@reactivex/rxjs',
      'zone.js',
      'reflect-metadata',
      // to ensure these modules are grouped together in one file
      'angular2/angular2',
      'angular2/core',
      'angular2/router',
      'angular2/http'
    ],
    'app': [
      // App

      // './examples/  /bootstrap' <-- view examples

      // './examples/rx-autosuggest/bootstrap'
      // './examples/rx-draggable/bootstrap'
      './examples/rx-timeflies/bootstrap'
      // './examples/simple-component/bootstrap'
      // './examples/simple-todo/bootstrap'

      // './src/app/bootstrap'
    ]
  },

  // Config for our build files
  output: {
    path: root('__build__'),
    filename: '[name].js',
    sourceMapFilename: '[name].js.map',
    chunkFilename: '[id].chunk.js'
    // publicPath: 'http://mycdn.com/'
  },

  resolve: {
    root: __dirname,
    extensions: ['','.ts','.js','.json'],
    alias: {
      'rx': '@reactivex/rxjs'
      // 'common': 'src/common',
      // 'bindings': 'src/bindings',
      // 'components': 'src/app/components'
      // 'services': 'src/app/services',
      // 'stores': 'src/app/stores'
    }
  },

  module: {
    loaders: [
      // Support for *.json files.
      { test: /\.json$/,  loader: 'json' },

      // Support for CSS as raw text
      { test: /\.css$/,   loader: 'raw' },

      // support for .html as raw text
      { test: /\.html$/,  loader: 'raw' },

      // Support for .ts files.
      { test: /\.ts$/,    loader: 'typescript-simple',
        query: {
          'ignoreWarnings': [
            // 2300, // 2300 -> Duplicate identifier
            2309 // 2309 -> An export assignment cannot be used in a module with other exported elements.
          ]
        },
        exclude: [
          /\.min\.js$/,
          /\.spec\.ts$/,
          /\.e2e\.ts$/,
          /web_modules/,
          /test/,
          /node_modules/
        ]
      }
    ],
    noParse: [
      /rtts_assert\/src\/rtts_assert/,
      /reflect-metadata/
    ]
  },

  plugins: [
    new DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
      'VERSION': JSON.stringify(pkg.version)
    }),
    new OccurenceOrderPlugin(),
    new DedupePlugin(),
    new CommonsChunkPlugin({
      name: 'angular2',
      minChunks: Infinity,
      filename: 'angular2.js'
    }),
    new CommonsChunkPlugin({
      name: 'common',
      filename: 'common.js'
    })
  ],

  /*
   * When using `templateUrl` and `styleUrls` please use `__filename`
   * rather than `module.id` for `moduleId` in `@View`
   */
  node: {
    crypto: false,
    __filename: true
  }
};

// Helper functions

function env(configEnv) {
  if (configEnv === undefined) { return configEnv; }
  switch (toString(configEnv[NODE_ENV])) {
    case '[object Object]'    : return Object.assign({}, configEnv.all || {}, configEnv[NODE_ENV]);
    case '[object Array]'     : return [].concat(configEnv.all || [], configEnv[NODE_ENV]);
    case '[object Undefined]' : return configEnv.all;
    default                   : return configEnv[NODE_ENV];
  }
}

function getBanner() {
  return 'Angular2 Webpack Starter v'+ pkg.version +' by @gdi2990 from @AngularClass';
}

function root(args) {
  args = sliceArgs(arguments, 0);
  return path.join.apply(path, [__dirname].concat(args));
}

function rootNode(args) {
  args = sliceArgs(arguments, 0);
  return root.apply(path, ['node_modules'].concat(args));
}
<commit_msg>chore(webpack.config): set default entry for alpha.39<commit_after>// @AngularClass

/*
 * Helper
 * env(), getBanner(), root(), and rootDir()
 * are defined at the bottom
 */
var sliceArgs = Function.prototype.call.bind(Array.prototype.slice);
var toString  = Function.prototype.call.bind(Object.prototype.toString);
var NODE_ENV  = process.env.NODE_ENV || 'development';
var pkg = require('./package.json');

// Polyfill
Object.assign = require('object-assign');

// Node
var path = require('path');

// NPM
var webpack = require('webpack');

// Webpack Plugins
var OccurenceOrderPlugin = webpack.optimize.OccurenceOrderPlugin;
var CommonsChunkPlugin   = webpack.optimize.CommonsChunkPlugin;
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
var DedupePlugin   = webpack.optimize.DedupePlugin;
var DefinePlugin   = webpack.DefinePlugin;
var BannerPlugin   = webpack.BannerPlugin;

/*
 * Config
 */
module.exports = {
  devtool: 'source-map',
  debug: true,
  cache: true,

  verbose: true,
  displayErrorDetails: true,
  context: __dirname,
  stats: {
    colors: true,
    reasons: true
  },

  // our Development Server config
  devServer: {
    inline: true,
    colors: true,
    historyApiFallback: true,
    contentBase: 'src/public',
    publicPath: '/__build__'
  },

  //
  entry: {
    'angular2': [
      // Angular 2 Deps
      '@reactivex/rxjs',
      'zone.js',
      'reflect-metadata',
      // to ensure these modules are grouped together in one file
      'angular2/angular2',
      'angular2/core',
      'angular2/router',
      'angular2/http'
    ],
    'app': [
      // App

      // './examples/  /bootstrap' <-- view examples

      // './examples/rx-autosuggest/bootstrap'
      // './examples/rx-draggable/bootstrap'
      // './examples/rx-timeflies/bootstrap'
      // './examples/simple-component/bootstrap'
      // './examples/simple-todo/bootstrap'

      './src/app/bootstrap'
    ]
  },

  // Config for our build files
  output: {
    path: root('__build__'),
    filename: '[name].js',
    sourceMapFilename: '[name].js.map',
    chunkFilename: '[id].chunk.js'
    // publicPath: 'http://mycdn.com/'
  },

  resolve: {
    root: __dirname,
    extensions: ['','.ts','.js','.json'],
    alias: {
      'rx': '@reactivex/rxjs'
      // 'common': 'src/common',
      // 'bindings': 'src/bindings',
      // 'components': 'src/app/components'
      // 'services': 'src/app/services',
      // 'stores': 'src/app/stores'
    }
  },

  module: {
    loaders: [
      // Support for *.json files.
      { test: /\.json$/,  loader: 'json' },

      // Support for CSS as raw text
      { test: /\.css$/,   loader: 'raw' },

      // support for .html as raw text
      { test: /\.html$/,  loader: 'raw' },

      // Support for .ts files.
      { test: /\.ts$/,    loader: 'typescript-simple',
        query: {
          'ignoreWarnings': [
            // 2300, // 2300 -> Duplicate identifier
            2309 // 2309 -> An export assignment cannot be used in a module with other exported elements.
          ]
        },
        exclude: [
          /\.min\.js$/,
          /\.spec\.ts$/,
          /\.e2e\.ts$/,
          /web_modules/,
          /test/,
          /node_modules/
        ]
      }
    ],
    noParse: [
      /rtts_assert\/src\/rtts_assert/,
      /reflect-metadata/
    ]
  },

  plugins: [
    new DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
      'VERSION': JSON.stringify(pkg.version)
    }),
    new OccurenceOrderPlugin(),
    new DedupePlugin(),
    new CommonsChunkPlugin({
      name: 'angular2',
      minChunks: Infinity,
      filename: 'angular2.js'
    }),
    new CommonsChunkPlugin({
      name: 'common',
      filename: 'common.js'
    })
  ],

  /*
   * When using `templateUrl` and `styleUrls` please use `__filename`
   * rather than `module.id` for `moduleId` in `@View`
   */
  node: {
    crypto: false,
    __filename: true
  }
};

// Helper functions

function env(configEnv) {
  if (configEnv === undefined) { return configEnv; }
  switch (toString(configEnv[NODE_ENV])) {
    case '[object Object]'    : return Object.assign({}, configEnv.all || {}, configEnv[NODE_ENV]);
    case '[object Array]'     : return [].concat(configEnv.all || [], configEnv[NODE_ENV]);
    case '[object Undefined]' : return configEnv.all;
    default                   : return configEnv[NODE_ENV];
  }
}

function getBanner() {
  return 'Angular2 Webpack Starter v'+ pkg.version +' by @gdi2990 from @AngularClass';
}

function root(args) {
  args = sliceArgs(arguments, 0);
  return path.join.apply(path, [__dirname].concat(args));
}

function rootNode(args) {
  args = sliceArgs(arguments, 0);
  return root.apply(path, ['node_modules'].concat(args));
}
<|endoftext|>


<commit_before>describe('Pagelet', function () {
  'use strict';

  var Pagelet = require('../').extend({ name: 'test' })
    , custom = '/unexisting/absolute/path/to/prepend'
    , assume = require('assume')
    , pagelet
    , P;

  //
  // A lazy mans temper, we just want ignore all temper actions sometimes
  // because our pagelet is not exported using `.on(module)`
  //
  var temper = { prefetch: function () {} };

  beforeEach(function () {
    P = Pagelet.extend({
      directory: __dirname,
      view: 'fixtures/view.html',
      css: 'fixtures/style.css',
      js: '//cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.min.js',
      dependencies: [
        'http://code.jquery.com/jquery-2.0.0.js',
        'fixtures/custom.js'
      ]
    });

    pagelet = new P();
  });

  afterEach(function each() {
    pagelet = null;
  });

  it('rendering is asynchronously', function (done) {
    pagelet.get(pagelet.emits('called'));

    // Listening only till after the event is potentially emitted, will ensure
    // callbacks are called asynchronously by pagelet#render.
    pagelet.on('called', done);
  });

  describe('.on', function () {
    it('sets the pathname', function () {
      var pagelet = Pagelet.extend({});
      assume(pagelet.prototype.directory).to.equal('');

      pagelet.prototype.directory = 'foo';
      assume(pagelet.prototype.directory).to.equal('foo');

      pagelet.on(module);

      assume(pagelet.prototype.directory).to.be.a('string');
      assume(pagelet.prototype.directory).to.equal(__dirname);
    });

    it('resolves the view', function () {
      assume(P.prototype.view).to.equal('fixtures/view.html');
      P.on(module);

      assume(P.prototype.view).to.equal(__dirname +'/fixtures/view.html');
    });

    it('resolves the `error` view');
    it('resolves the `css` files in to an array');
    it('resolves the `js` files in to an array');
    it('resolves the `dependencies` files in to an array');
  });

  describe('.resolve', function () {
    it('is a function', function () {
      assume(Pagelet.resolve).to.be.a('function');
      assume(P.resolve).to.be.a('function');
      assume(Pagelet.resolve).to.equal(P.resolve);
    });

    it('will resolve provided property on prototype', function () {
      var result = P.resolve('css');

      assume(result).to.equal(P);
      assume(P.prototype.css).to.be.an('array');
      assume(P.prototype.css.length).to.equal(1);
      assume(P.prototype.css[0]).to.equal(__dirname + '/fixtures/style.css');
    });

    it('can resolve multiple properties at once', function () {
      P.resolve(['css', 'js']);

      assume(P.prototype.css).to.be.an('array');
      assume(P.prototype.js).to.be.an('array');
      assume(P.prototype.css.length).to.equal(1);
      assume(P.prototype.js.length).to.equal(1);
    });

    it('can be provided with a custom source directory', function () {
      P.resolve('css', custom);

      assume(P.prototype.css[0]).to.equal(custom + '/fixtures/style.css');
    });

    it('only resolves local files', function () {
      P.resolve('js', custom);

      assume(P.prototype.js[0]).to.not.include(custom);
      assume(P.prototype.js[0]).to.equal('//cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.min.js');
    });

    it('can handle property values that are already an array', function () {
      P.resolve('dependencies', custom);

      assume(P.prototype.dependencies.length).to.equal(2);
      assume(P.prototype.dependencies[0]).to.not.include(custom);
      assume(P.prototype.dependencies[0]).to.equal('http://code.jquery.com/jquery-2.0.0.js');
      assume(P.prototype.dependencies[1]).to.equal(custom + '/fixtures/custom.js');
    });

    it('can be overriden', function () {
      P.resolve = function () {
        throw new Error('fucked');
      };

      P.on({});
    });
  });

  describe('.optimize', function () {
    it('is a function', function () {
      assume(Pagelet.optimize).to.be.a('function');
      assume(P.optimize).to.be.a('function');
      assume(Pagelet.optimize).to.equal(P.optimize);
    });

    it('uses the supplied temper for prefetching', function (next) {
      var calls = 0;
      P.optimize({
        temper: {
          prefetch: function () {
            ++calls;
          }
        }
      }, function (err) {
        if (err) return next(err);

        assume(calls).to.equal(2);
        next();
      });
    });

    it('prefetches the `view`');
    it('prefetches the `error` view');

    it('allows rpc as a string', function (next) {
      var X = P.extend({
        RPC: 'fixtures, bar',
        fixtures: function () {},
        bar: function () {}
      });

      X.optimize({ temper: temper }, function (err) {
        if (err) return next(err);

        assume(X.prototype.RPC).to.be.a('array');
        assume(X.prototype.RPC).to.have.length(2);
        assume(X.prototype.RPC).to.include('bar');
        assume(X.prototype.RPC).to.include('fixtures');

        next();
      });
    });

    it('checks if all rpc functions are available', function (next) {
      var X = P.extend({
        RPC: 'fixtures, bar',
        bar: function () {}
      });

      X.optimize({ temper: temper }, function (err) {
        assume(err).to.be.a('error');
        assume(err.message).to.include('fixtures');

        next();
      });
    });

    it('allows lowercase rpc', function (next) {
      var X = P.extend({
        rpc: ['fixtures', 'bar'],
        bar: function () {}
      });

      X.optimize({ temper: temper }, function (err) {
        assume(err).to.be.a('error');
        assume(err.message).to.include('fixtures');

        next();
      });
    });
  });

  describe('.traverse', function () {
    it('is a function', function () {
      assume(Pagelet.traverse).to.be.a('function');
      assume(P.traverse).to.be.a('function');
      assume(Pagelet.traverse).to.equal(P.traverse);
    });

    it('returns an array', function () {
      var one = P.traverse()
        , recur = P.extend({
            pagelets: {
              child: P.extend({ name: 'child' })
            }
          }).traverse('this one');

      assume(one).to.be.an('array');
      assume(one.length).to.equal(1);

      assume(recur).to.be.an('array');
      assume(recur.length).to.equal(2);
    });

    it('will at least return the pagelet', function () {
      var single = P.traverse();

      assume(single[0].prototype._parent).to.equal(undefined);
      assume(single[0].prototype.directory).to.equal(__dirname);
      assume(single[0].prototype.view).to.equal('fixtures/view.html');
    });

    it('does recursive pagelet discovery', function () {
      var recur = P.extend({
        pagelets: {
          child: P.extend({
            name: 'child' ,
            pagelets: {
              another: P.extend({ name: 'another' })
            }
          }),
        }
      }).traverse('multiple');

      assume(recur).is.an('array');
      assume(recur.length).to.equal(3);

      assume(recur[1].prototype.name).to.equal('child');
      assume(recur[2].prototype.name).to.equal('another');
    });

    it('sets the pagelets parent name on `_parent`', function () {
      var recur = P.extend({
        pagelets: {
          child: P.extend({
            name: 'child'
          })
        }
      }).traverse('parental');

      assume(recur[0].prototype._parent).to.equal(undefined);
      assume(recur[1].prototype._parent).to.equal('parental');
    });
  });
});
<commit_msg>[test] move resolve view test<commit_after>describe('Pagelet', function () {
  'use strict';

  var Pagelet = require('../').extend({ name: 'test' })
    , custom = '/unexisting/absolute/path/to/prepend'
    , assume = require('assume')
    , pagelet
    , P;

  //
  // A lazy mans temper, we just want ignore all temper actions sometimes
  // because our pagelet is not exported using `.on(module)`
  //
  var temper = { prefetch: function () {} };

  beforeEach(function () {
    P = Pagelet.extend({
      directory: __dirname,
      view: 'fixtures/view.html',
      css: 'fixtures/style.css',
      js: '//cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.min.js',
      dependencies: [
        'http://code.jquery.com/jquery-2.0.0.js',
        'fixtures/custom.js'
      ]
    });

    pagelet = new P();
  });

  afterEach(function each() {
    pagelet = null;
  });

  it('rendering is asynchronously', function (done) {
    pagelet.get(pagelet.emits('called'));

    // Listening only till after the event is potentially emitted, will ensure
    // callbacks are called asynchronously by pagelet#render.
    pagelet.on('called', done);
  });

  describe('.on', function () {
    it('sets the pathname', function () {
      var pagelet = Pagelet.extend({});
      assume(pagelet.prototype.directory).to.equal('');

      pagelet.prototype.directory = 'foo';
      assume(pagelet.prototype.directory).to.equal('foo');

      pagelet.on(module);

      assume(pagelet.prototype.directory).to.be.a('string');
      assume(pagelet.prototype.directory).to.equal(__dirname);
    });

    it('resolves the `error` view');
    it('resolves the `css` files in to an array');
    it('resolves the `js` files in to an array');
    it('resolves the `dependencies` files in to an array');
  });

  describe('.resolve', function () {
    it('is a function', function () {
      assume(Pagelet.resolve).to.be.a('function');
      assume(P.resolve).to.be.a('function');
      assume(Pagelet.resolve).to.equal(P.resolve);
    });

    it('will resolve provided property on prototype', function () {
      var result = P.resolve('css');

      assume(result).to.equal(P);
      assume(P.prototype.css).to.be.an('array');
      assume(P.prototype.css.length).to.equal(1);
      assume(P.prototype.css[0]).to.equal(__dirname + '/fixtures/style.css');
    });

    it('can resolve multiple properties at once', function () {
      P.resolve(['css', 'js']);

      assume(P.prototype.css).to.be.an('array');
      assume(P.prototype.js).to.be.an('array');
      assume(P.prototype.css.length).to.equal(1);
      assume(P.prototype.js.length).to.equal(1);
    });

    it('can be provided with a custom source directory', function () {
      P.resolve('css', custom);

      assume(P.prototype.css[0]).to.equal(custom + '/fixtures/style.css');
    });

    it('only resolves local files', function () {
      P.resolve('js', custom);

      assume(P.prototype.js[0]).to.not.include(custom);
      assume(P.prototype.js[0]).to.equal('//cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.min.js');
    });

    it('can handle property values that are already an array', function () {
      P.resolve('dependencies', custom);

      assume(P.prototype.dependencies.length).to.equal(2);
      assume(P.prototype.dependencies[0]).to.not.include(custom);
      assume(P.prototype.dependencies[0]).to.equal('http://code.jquery.com/jquery-2.0.0.js');
      assume(P.prototype.dependencies[1]).to.equal(custom + '/fixtures/custom.js');
    });

    it('can be overriden', function () {
      P.resolve = function () {
        throw new Error('fucked');
      };

      P.on({});
    });
  });

  describe('.optimize', function () {
    it('is a function', function () {
      assume(Pagelet.optimize).to.be.a('function');
      assume(P.optimize).to.be.a('function');
      assume(Pagelet.optimize).to.equal(P.optimize);
    });

    it('uses the supplied temper for prefetching', function (next) {
      var calls = 0;
      P.optimize({
        temper: {
          prefetch: function () {
            ++calls;
          }
        }
      }, function (err) {
        if (err) return next(err);

        assume(calls).to.equal(2);
        next();
      });
    });

    it('resolves the view', function (next) {
      assume(P.prototype.view).to.equal('fixtures/view.html');
      P.optimize({}, function () {
        assume(P.prototype.view).to.equal(__dirname +'/fixtures/view.html');
        next();
      });
    });

    it('prefetches the `view`');
    it('prefetches the `error` view');

    it('allows rpc as a string', function (next) {
      var X = P.extend({
        RPC: 'fixtures, bar',
        fixtures: function () {},
        bar: function () {}
      });

      X.optimize({ temper: temper }, function (err) {
        if (err) return next(err);

        assume(X.prototype.RPC).to.be.a('array');
        assume(X.prototype.RPC).to.have.length(2);
        assume(X.prototype.RPC).to.include('bar');
        assume(X.prototype.RPC).to.include('fixtures');

        next();
      });
    });

    it('checks if all rpc functions are available', function (next) {
      var X = P.extend({
        RPC: 'fixtures, bar',
        bar: function () {}
      });

      X.optimize({ temper: temper }, function (err) {
        assume(err).to.be.a('error');
        assume(err.message).to.include('fixtures');

        next();
      });
    });

    it('allows lowercase rpc', function (next) {
      var X = P.extend({
        rpc: ['fixtures', 'bar'],
        bar: function () {}
      });

      X.optimize({ temper: temper }, function (err) {
        assume(err).to.be.a('error');
        assume(err.message).to.include('fixtures');

        next();
      });
    });
  });

  describe('.traverse', function () {
    it('is a function', function () {
      assume(Pagelet.traverse).to.be.a('function');
      assume(P.traverse).to.be.a('function');
      assume(Pagelet.traverse).to.equal(P.traverse);
    });

    it('returns an array', function () {
      var one = P.traverse()
        , recur = P.extend({
            pagelets: {
              child: P.extend({ name: 'child' })
            }
          }).traverse('this one');

      assume(one).to.be.an('array');
      assume(one.length).to.equal(1);

      assume(recur).to.be.an('array');
      assume(recur.length).to.equal(2);
    });

    it('will at least return the pagelet', function () {
      var single = P.traverse();

      assume(single[0].prototype._parent).to.equal(undefined);
      assume(single[0].prototype.directory).to.equal(__dirname);
      assume(single[0].prototype.view).to.equal('fixtures/view.html');
    });

    it('does recursive pagelet discovery', function () {
      var recur = P.extend({
        pagelets: {
          child: P.extend({
            name: 'child' ,
            pagelets: {
              another: P.extend({ name: 'another' })
            }
          }),
        }
      }).traverse('multiple');

      assume(recur).is.an('array');
      assume(recur.length).to.equal(3);

      assume(recur[1].prototype.name).to.equal('child');
      assume(recur[2].prototype.name).to.equal('another');
    });

    it('sets the pagelets parent name on `_parent`', function () {
      var recur = P.extend({
        pagelets: {
          child: P.extend({
            name: 'child'
          })
        }
      }).traverse('parental');

      assume(recur[0].prototype._parent).to.equal(undefined);
      assume(recur[1].prototype._parent).to.equal('parental');
    });
  });
});
<|endoftext|>


<commit_before>module.exports = {
	output: {
		filename: 'd3-funnel.js',
		libraryTarget: 'umd',
		library: 'D3Funnel',
	},
	externals: {
		// Do not compile d3 with the output
		// In non-CommonJS, allows window.d3 to be used
		// In CommonJS, this will use the included d3 package
		d3: 'd3',
	},
	module: {
		loaders: [
			{
				test: /\.js?$/,
				exclude: /(node_modules|bower_components|vender_modules)/,
				loader: 'babel',
				query: {
					presets: ['es2015', 'stage-0']
				},
			},
		],
	},
};
<commit_msg>Add missing comma<commit_after>module.exports = {
	output: {
		filename: 'd3-funnel.js',
		libraryTarget: 'umd',
		library: 'D3Funnel',
	},
	externals: {
		// Do not compile d3 with the output
		// In non-CommonJS, allows window.d3 to be used
		// In CommonJS, this will use the included d3 package
		d3: 'd3',
	},
	module: {
		loaders: [
			{
				test: /\.js?$/,
				exclude: /(node_modules|bower_components|vender_modules)/,
				loader: 'babel',
				query: {
					presets: ['es2015', 'stage-0'],
				},
			},
		],
	},
};
<|endoftext|>


<commit_before>// LICENSE : MIT
"use strict";
const assert = require("power-assert");
const cli = require("../src/").cli;
const path = require("path");
describe("parsing-test", function () {
    it("should return error when text with incorrect quotes is passed as argument", function () {
        var ruleDir = "--rulesdir " + path.join(__dirname, "fixtures/rules/no-error");
        var testDir = __dirname + "/input/";
        return cli.execute(ruleDir + " "+ testDir).then(result => {
            assert.equal(result, 0);
        });
    });
});<commit_msg>chore(test): fix test case name<commit_after>// LICENSE : MIT
"use strict";
const assert = require("power-assert");
const cli = require("../src/").cli;
const path = require("path");
describe("parsing", function () {
    it("should lint all files without error", function () {
        var ruleDir = "--rulesdir " + path.join(__dirname, "fixtures/rules/no-error");
        var testDir = __dirname + "/input/";
        return cli.execute(ruleDir + " " + testDir).then(result => {
            assert.equal(result, 0);
        });
    });
});<|endoftext|>


<commit_before>/// ----- ZUI change begin -----
/// Add jquery object to namespace

/// (function(){ // Old code
(function($){

/// ----- ZUI change end -----
    "use strict";

/// ----- ZUI change begin -----
/// Change root to zui shared object
///
///   var root = this, // old code
      var root = $ && $.zui ? $.zui : this,
/// ----- ZUI change end -----
        Chart = root.Chart,
        //Cache a local reference to Chart.helpers
        helpers = Chart.helpers;

    var defaultConfig = {
        //Boolean - Whether we should show a stroke on each segment
        segmentShowStroke: true,

        //String - The colour of each segment stroke
        segmentStrokeColor: "#fff",

        //Number - The width of each segment stroke
        segmentStrokeWidth: 2,

        //The percentage of the chart that we cut out of the middle.
        percentageInnerCutout: 50,

/// ZUI change begin
        // Boolean - Whether to show labels on the scale
        scaleShowLabels: false,

        // Interpolated JS string - can access value
        scaleLabel: "<%=value%>",

        // String - Scale label position
        scaleLabelPlacement: 'auto',

///        Number - Amount of animation steps // old code
///        animationSteps: 100, // old code
        animationSteps: 60,
/// ZUI change end

        //String - Animation easing effect
        animationEasing: "easeOutBounce",

        //Boolean - Whether we animate the rotation of the Doughnut
        animateRotate: true,

        //Boolean - Whether we animate scaling the Doughnut from the centre
        animateScale: false,

        //String - A legend template
        legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%>
<span style=\"background-color:<%=segments[i].fillColor%>\"><%if(segments[i].label){%><%=segments[i].label%><%}%>
<%}%>
"

    };

    Chart.Type.extend(
    {
        //Passing in a name registers this chart in the Chart namespace
        name: "Doughnut",
        //Providing a defaults will also register the deafults in the chart namespace
        defaults: defaultConfig,
        //Initialize is fired when the chart is initialized - Data is passed in as a parameter
        //Config is automatically merged by the core of Chart.js, and is available at this.options
        initialize: function(data)
        {

            //Declare segments as a static property to prevent inheriting across the Chart type prototype
            this.segments = [];
            this.outerRadius = (helpers.min([this.chart.width, this.chart.height]) - this.options.segmentStrokeWidth / 2) / 2;

            this.SegmentArc = Chart.Arc.extend(
            {
                ctx: this.chart.ctx,
                x: this.chart.width / 2,
                y: this.chart.height / 2
            });

            //Set up tooltip events on the chart
            if (this.options.showTooltips)
            {
                helpers.bindEvents(this, this.options.tooltipEvents, function(evt)
                {
                    var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : [];

                    helpers.each(this.segments, function(segment)
                    {
                        segment.restore(["fillColor"]);
                    });
                    helpers.each(activeSegments, function(activeSegment)
                    {
                        activeSegment.fillColor = activeSegment.highlightColor;
                    });
                    this.showTooltip(activeSegments);
                });
            }
            this.calculateTotal(data);

            helpers.each(data, function(datapoint, index)
            {
                this.addData(datapoint, index, true);
            }, this);

            this.render();
        },
        getSegmentsAtEvent: function(e)
        {
            var segmentsArray = [];

            var location = helpers.getRelativePosition(e);

            helpers.each(this.segments, function(segment)
            {
                if (segment.inRange(location.x, location.y)) segmentsArray.push(segment);
            }, this);
            return segmentsArray;
        },
        addData: function(segment, atIndex, silent)
        {
/// ----- ZUI change begin -----
/// Init segment color
            if($.zui && $.zui.Color && $.zui.Color.get)
            {
                var color = new $.zui.Color.get(segment.color);
                segment.color = color.toCssStr();
                if(!segment.highlight) segment.highlight = color.lighten(5).toCssStr();
            }
/// ----- ZUI change begin -----
            var index = atIndex || this.segments.length;
            this.segments.splice(index, 0, new this.SegmentArc(
            {
                value: segment.value,
                outerRadius: (this.options.animateScale) ? 0 : this.outerRadius,
                innerRadius: (this.options.animateScale) ? 0 : (this.outerRadius / 100) * this.options.percentageInnerCutout,
                fillColor: segment.color,
                highlightColor: segment.highlight || segment.color,
                showStroke: this.options.segmentShowStroke,
                strokeWidth: this.options.segmentStrokeWidth,
                strokeColor: this.options.segmentStrokeColor,
                startAngle: Math.PI * 1.5,
                circumference: (this.options.animateRotate) ? 0 : this.calculateCircumference(segment.value),
                label: segment.label
            }));
            if (!silent)
            {
                this.reflow();
                this.update();
            }
        },
        calculateCircumference: function(value)
        {
            return (Math.PI * 2) * (Math.abs(value) / this.total);
        },
        calculateTotal: function(data)
        {
            this.total = 0;
            helpers.each(data, function(segment)
            {
                this.total += Math.abs(segment.value);
            }, this);
        },
        update: function()
        {
            this.calculateTotal(this.segments);

            // Reset any highlight colours before updating.
            helpers.each(this.activeElements, function(activeElement)
            {
                activeElement.restore(['fillColor']);
            });

            helpers.each(this.segments, function(segment)
            {
                segment.save();
            });
            this.render();
        },

        removeData: function(atIndex)
        {
            var indexToDelete = (helpers.isNumber(atIndex)) ? atIndex : this.segments.length - 1;
            this.segments.splice(indexToDelete, 1);
            this.reflow();
            this.update();
        },

        reflow: function()
        {
            helpers.extend(this.SegmentArc.prototype,
            {
                x: this.chart.width / 2,
                y: this.chart.height / 2
            });
            this.outerRadius = (helpers.min([this.chart.width, this.chart.height]) - this.options.segmentStrokeWidth / 2) / 2;
            helpers.each(this.segments, function(segment)
            {
                segment.update(
                {
                    outerRadius: this.outerRadius,
                    innerRadius: (this.outerRadius / 100) * this.options.percentageInnerCutout
                });
            }, this);
        },
/// ZUI change begin
        drawLabel: function(segment, easeDecimal)
        {
            var options = this.options;
            var middleAngle = (segment.endAngle + segment.startAngle) / 2;
            var placement = options.scaleLabelPlacement;
            if(placement !== 'inside' && placement !== 'outside') {
                if((this.chart.width - this.chart.height) > 50) {
                    if(segment.circumference < (Math.PI / 36)) {
                        placement = 'outside';
                    }
                }
            }

            var x = Math.cos(middleAngle) * segment.outerRadius,
                y = Math.sin(middleAngle) * segment.outerRadius,
                text = helpers.template(options.scaleLabel, {value: typeof easeDecimal === 'undefined' ? segment.value : Math.round(easeDecimal * segment.value)});

            var ctx = this.chart.ctx;
            ctx.font = helpers.fontString(options.scaleFontSize, options.scaleFontStyle, options.scaleFontFamily);

            var textWidth = ctx.measureText(text).width;
            var chartWidthHalf = this.chart.width / 2;
            var chartHeightHalf = this.chart.height / 2;

            if(placement === 'outside') {
                var isRight = x >= 0;
                var lineX = x + chartWidthHalf;
                var lineY = y + chartHeightHalf;
                if(isRight)
                {
                    x = Math.max(chartWidthHalf + segment.outerRadius + 10, x + 30 + chartWidthHalf);
                } else {
                    x = Math.min(chartWidthHalf - segment.outerRadius - 10 - textWidth, x - 30 + chartWidthHalf - textWidth);
                }
                y = Math.max(15, Math.min(this.chart.height - 15, y + chartHeightHalf - 20));

                ctx.beginPath();
                ctx.moveTo(lineX, lineY);
                ctx.lineTo(isRight ? (x - 5) : (x + 5 + textWidth), y + 7);
                ctx.lineTo(isRight ? (x + textWidth + 5) : (x - 5), y + 7)
                ctx.strokeStyle = ($.zui && $.zui.Color) ? (new $.zui.Color(segment.fillColor).fade(20).toCssStr()) : segment.fillColor;
                ctx.strokeWidth = options.scaleLineWidth;
                ctx.stroke();
                ctx.closePath();

                ctx.fillStyle = segment.fillColor;
                x += 5;
            } else { // outside
                x = x * 0.7 + chartWidthHalf;
                y = y * 0.7 + chartHeightHalf;
                ctx.fillStyle = ($.zui && $.zui.Color) ? (new $.zui.Color(segment.fillColor).contrast().toCssStr()) : '#fff';

                x -= textWidth / 2;
                y -= 6;
            }

            ctx.fillText(text, x, y);
        },
// ZUI change end
        draw: function(easeDecimal)
        {
            var animDecimal = (easeDecimal) ? easeDecimal : 1;
            this.clear();
            helpers.each(this.segments, function(segment, index)
            {
                segment.transition(
                {
                    circumference: this.calculateCircumference(segment.value),
                    outerRadius: this.outerRadius,
                    innerRadius: (this.outerRadius / 100) * this.options.percentageInnerCutout
                }, animDecimal);

                segment.endAngle = segment.startAngle + segment.circumference;

                segment.draw();
                if (index === 0)
                {
                    segment.startAngle = Math.PI * 1.5;
                }
                //Check to see if it's the last segment, if not get the next and update the start angle
                if (index < this.segments.length - 1)
                {
                    this.segments[index + 1].startAngle = segment.endAngle;
                }

/// ZUI change begin
                if(this.options.scaleShowLabels)
                {
                    this.drawLabel(segment, easeDecimal);
                }
/// ZUI change end
            }, this);

        }
    });

    Chart.types.Doughnut.extend(
    {
        name: "Pie",
        defaults: helpers.merge(defaultConfig,
        {
            percentageInnerCutout: 0
        })
    });

/// ----- ZUI change begin -----
/// Use jquery object to create Chart object
    $.fn.pieChart = function(data, options)
    {
        var pieCharts = [];
        this.each(function(){
            var $this = $(this);
            pieCharts.push(new Chart(this.getContext("2d")).Pie(data, $.extend($this.data(), options)));
        });
        return pieCharts.length === 1 ? pieCharts[0] : pieCharts;
    }

    $.fn.doughnutChart = function(data, options)
    {
        var doughnutCharts = [];
        this.each(function(){
            var $this = $(this);
            doughnutCharts.push(new Chart(this.getContext("2d")).Doughnut(data, $.extend($this.data(), options)));
        });
        return doughnutCharts.length === 1 ? doughnutCharts[0] : doughnutCharts;
    }

/// ----- ZUI change end -----

/// ----- ZUI change begin -----
/// Add jquery object to namespace

/// }).call(this); // Old code
}).call(this, jQuery);

/// ----- ZUI change end -----
<commit_msg> * chanage segment stroke width option default value.<commit_after>/// ----- ZUI change begin -----
/// Add jquery object to namespace

/// (function(){ // Old code
(function($){

/// ----- ZUI change end -----
    "use strict";

/// ----- ZUI change begin -----
/// Change root to zui shared object
///
///   var root = this, // old code
      var root = $ && $.zui ? $.zui : this,
/// ----- ZUI change end -----
        Chart = root.Chart,
        //Cache a local reference to Chart.helpers
        helpers = Chart.helpers;

    var defaultConfig = {
        //Boolean - Whether we should show a stroke on each segment
        segmentShowStroke: true,

        //String - The colour of each segment stroke
        segmentStrokeColor: "#fff",

        //Number - The width of each segment stroke
/// ZUI change begin
///        segmentStrokeWidth: 2, // old code
        segmentStrokeWidth: 1,
/// ZUI change end

        //The percentage of the chart that we cut out of the middle.
        percentageInnerCutout: 50,

/// ZUI change begin
        // Boolean - Whether to show labels on the scale
        scaleShowLabels: false,

        // Interpolated JS string - can access value
        scaleLabel: "<%=value%>",

        // String - Scale label position
        scaleLabelPlacement: 'auto',

///        Number - Amount of animation steps // old code
///        animationSteps: 100, // old code
        animationSteps: 60,
/// ZUI change end

        //String - Animation easing effect
        animationEasing: "easeOutBounce",

        //Boolean - Whether we animate the rotation of the Doughnut
        animateRotate: true,

        //Boolean - Whether we animate scaling the Doughnut from the centre
        animateScale: false,

        //String - A legend template
        legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%>
<span style=\"background-color:<%=segments[i].fillColor%>\"><%if(segments[i].label){%><%=segments[i].label%><%}%>
<%}%>
"

    };

    Chart.Type.extend(
    {
        //Passing in a name registers this chart in the Chart namespace
        name: "Doughnut",
        //Providing a defaults will also register the deafults in the chart namespace
        defaults: defaultConfig,
        //Initialize is fired when the chart is initialized - Data is passed in as a parameter
        //Config is automatically merged by the core of Chart.js, and is available at this.options
        initialize: function(data)
        {

            //Declare segments as a static property to prevent inheriting across the Chart type prototype
            this.segments = [];
            this.outerRadius = (helpers.min([this.chart.width, this.chart.height]) - this.options.segmentStrokeWidth / 2) / 2;

            this.SegmentArc = Chart.Arc.extend(
            {
                ctx: this.chart.ctx,
                x: this.chart.width / 2,
                y: this.chart.height / 2
            });

            //Set up tooltip events on the chart
            if (this.options.showTooltips)
            {
                helpers.bindEvents(this, this.options.tooltipEvents, function(evt)
                {
                    var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : [];

                    helpers.each(this.segments, function(segment)
                    {
                        segment.restore(["fillColor"]);
                    });
                    helpers.each(activeSegments, function(activeSegment)
                    {
                        activeSegment.fillColor = activeSegment.highlightColor;
                    });
                    this.showTooltip(activeSegments);
                });
            }
            this.calculateTotal(data);

            helpers.each(data, function(datapoint, index)
            {
                this.addData(datapoint, index, true);
            }, this);

            this.render();
        },
        getSegmentsAtEvent: function(e)
        {
            var segmentsArray = [];

            var location = helpers.getRelativePosition(e);

            helpers.each(this.segments, function(segment)
            {
                if (segment.inRange(location.x, location.y)) segmentsArray.push(segment);
            }, this);
            return segmentsArray;
        },
        addData: function(segment, atIndex, silent)
        {
/// ----- ZUI change begin -----
/// Init segment color
            if($.zui && $.zui.Color && $.zui.Color.get)
            {
                var color = new $.zui.Color.get(segment.color);
                segment.color = color.toCssStr();
                if(!segment.highlight) segment.highlight = color.lighten(5).toCssStr();
            }
/// ----- ZUI change begin -----
            var index = atIndex || this.segments.length;
            this.segments.splice(index, 0, new this.SegmentArc(
            {
                value: segment.value,
                outerRadius: (this.options.animateScale) ? 0 : this.outerRadius,
                innerRadius: (this.options.animateScale) ? 0 : (this.outerRadius / 100) * this.options.percentageInnerCutout,
                fillColor: segment.color,
                highlightColor: segment.highlight || segment.color,
                showStroke: this.options.segmentShowStroke,
                strokeWidth: this.options.segmentStrokeWidth,
                strokeColor: this.options.segmentStrokeColor,
                startAngle: Math.PI * 1.5,
                circumference: (this.options.animateRotate) ? 0 : this.calculateCircumference(segment.value),
                label: segment.label
            }));
            if (!silent)
            {
                this.reflow();
                this.update();
            }
        },
        calculateCircumference: function(value)
        {
            return (Math.PI * 2) * (Math.abs(value) / this.total);
        },
        calculateTotal: function(data)
        {
            this.total = 0;
            helpers.each(data, function(segment)
            {
                this.total += Math.abs(segment.value);
            }, this);
        },
        update: function()
        {
            this.calculateTotal(this.segments);

            // Reset any highlight colours before updating.
            helpers.each(this.activeElements, function(activeElement)
            {
                activeElement.restore(['fillColor']);
            });

            helpers.each(this.segments, function(segment)
            {
                segment.save();
            });
            this.render();
        },

        removeData: function(atIndex)
        {
            var indexToDelete = (helpers.isNumber(atIndex)) ? atIndex : this.segments.length - 1;
            this.segments.splice(indexToDelete, 1);
            this.reflow();
            this.update();
        },

        reflow: function()
        {
            helpers.extend(this.SegmentArc.prototype,
            {
                x: this.chart.width / 2,
                y: this.chart.height / 2
            });
            this.outerRadius = (helpers.min([this.chart.width, this.chart.height]) - this.options.segmentStrokeWidth / 2) / 2;
            helpers.each(this.segments, function(segment)
            {
                segment.update(
                {
                    outerRadius: this.outerRadius,
                    innerRadius: (this.outerRadius / 100) * this.options.percentageInnerCutout
                });
            }, this);
        },
/// ZUI change begin
        drawLabel: function(segment, easeDecimal)
        {
            var options = this.options;
            var middleAngle = (segment.endAngle + segment.startAngle) / 2;
            var placement = options.scaleLabelPlacement;
            if(placement !== 'inside' && placement !== 'outside') {
                if((this.chart.width - this.chart.height) > 50) {
                    if(segment.circumference < (Math.PI / 36)) {
                        placement = 'outside';
                    }
                }
            }

            var x = Math.cos(middleAngle) * segment.outerRadius,
                y = Math.sin(middleAngle) * segment.outerRadius,
                text = helpers.template(options.scaleLabel, {value: typeof easeDecimal === 'undefined' ? segment.value : Math.round(easeDecimal * segment.value)});

            var ctx = this.chart.ctx;
            ctx.font = helpers.fontString(options.scaleFontSize, options.scaleFontStyle, options.scaleFontFamily);

            var textWidth = ctx.measureText(text).width;
            var chartWidthHalf = this.chart.width / 2;
            var chartHeightHalf = this.chart.height / 2;

            if(placement === 'outside') {
                var isRight = x >= 0;
                var lineX = x + chartWidthHalf;
                var lineY = y + chartHeightHalf;
                if(isRight)
                {
                    x = Math.max(chartWidthHalf + segment.outerRadius + 10, x + 30 + chartWidthHalf);
                } else {
                    x = Math.min(chartWidthHalf - segment.outerRadius - 10 - textWidth, x - 30 + chartWidthHalf - textWidth);
                }
                y = Math.max(15, Math.min(this.chart.height - 15, y + chartHeightHalf - 20));

                ctx.beginPath();
                ctx.moveTo(lineX, lineY);
                ctx.lineTo(isRight ? (x - 5) : (x + 5 + textWidth), y + 7);
                ctx.lineTo(isRight ? (x + textWidth + 5) : (x - 5), y + 7)
                ctx.strokeStyle = ($.zui && $.zui.Color) ? (new $.zui.Color(segment.fillColor).fade(20).toCssStr()) : segment.fillColor;
                ctx.strokeWidth = options.scaleLineWidth;
                ctx.stroke();
                ctx.closePath();

                ctx.fillStyle = segment.fillColor;
                x += 5;
            } else { // outside
                x = x * 0.7 + chartWidthHalf;
                y = y * 0.7 + chartHeightHalf;
                ctx.fillStyle = ($.zui && $.zui.Color) ? (new $.zui.Color(segment.fillColor).contrast().toCssStr()) : '#fff';

                x -= textWidth / 2;
                y -= 6;
            }

            ctx.fillText(text, x, y);
        },
// ZUI change end
        draw: function(easeDecimal)
        {
            var animDecimal = (easeDecimal) ? easeDecimal : 1;
            this.clear();
            helpers.each(this.segments, function(segment, index)
            {
                segment.transition(
                {
                    circumference: this.calculateCircumference(segment.value),
                    outerRadius: this.outerRadius,
                    innerRadius: (this.outerRadius / 100) * this.options.percentageInnerCutout
                }, animDecimal);

                segment.endAngle = segment.startAngle + segment.circumference;

                segment.draw();
                if (index === 0)
                {
                    segment.startAngle = Math.PI * 1.5;
                }
                //Check to see if it's the last segment, if not get the next and update the start angle
                if (index < this.segments.length - 1)
                {
                    this.segments[index + 1].startAngle = segment.endAngle;
                }

/// ZUI change begin
                if(this.options.scaleShowLabels)
                {
                    this.drawLabel(segment, easeDecimal);
                }
/// ZUI change end
            }, this);

        }
    });

    Chart.types.Doughnut.extend(
    {
        name: "Pie",
        defaults: helpers.merge(defaultConfig,
        {
            percentageInnerCutout: 0
        })
    });

/// ----- ZUI change begin -----
/// Use jquery object to create Chart object
    $.fn.pieChart = function(data, options)
    {
        var pieCharts = [];
        this.each(function(){
            var $this = $(this);
            pieCharts.push(new Chart(this.getContext("2d")).Pie(data, $.extend($this.data(), options)));
        });
        return pieCharts.length === 1 ? pieCharts[0] : pieCharts;
    }

    $.fn.doughnutChart = function(data, options)
    {
        var doughnutCharts = [];
        this.each(function(){
            var $this = $(this);
            doughnutCharts.push(new Chart(this.getContext("2d")).Doughnut(data, $.extend($this.data(), options)));
        });
        return doughnutCharts.length === 1 ? doughnutCharts[0] : doughnutCharts;
    }

/// ----- ZUI change end -----

/// ----- ZUI change begin -----
/// Add jquery object to namespace

/// }).call(this); // Old code
}).call(this, jQuery);

/// ----- ZUI change end -----
<|endoftext|>


<commit_before>const path = require('path');
const webpack = require('webpack');

module.exports = {
  entry: './src/index.js',

  output: {
    filename: 'public/bundle.js'
  },

  module: {
    rules: [
      {
        test: /\.vue$/,
        exclude: path.resolve(__dirname, 'node_modules'),
        loader: 'vue-loader'
      },
      {
        test: /\.js$/,
        exclude: path.resolve(__dirname, 'node_modules'),
        loader: 'babel-loader'
      },
      {
        test: /\.scss$/,
        use: ['style-loader', 'css-loader', 'sass-loader']
      },
      {
        test: /\.png$/,
        exclude: path.resolve(__dirname, 'node_modules'),
        loader: 'file-loader?name=[name].[ext]&outputPath=public/'
      }
    ]
  },

  devServer: {
    contentBase: path.join(__dirname, 'public')
  },

  resolve: {
    extensions: ['.js', '.vue']
  },

  plugins: [
    new webpack.DefinePlugin({
      NODE_ENV: JSON.stringify(process.env.NODE_ENV),
      FIREBASE_API_KEY: JSON.stringify(process.env.FIREBASE_API_KEY),
      FIREBASE_AUTH_DOMAIN: JSON.stringify(process.env.FIREBASE_AUTH_DOMAIN),
      FIREBASE_DATABASE_URL: JSON.stringify(process.env.FIREBASE_DATABASE_URL),
      FIREBASE_STORAGE_BUCKET: JSON.stringify(process.env.FIREBASE_STORAGE_BUCKET),
      FIREBASE_MESSAGING_SENDER_ID: JSON.stringify(process.env.FIREBASE_MESSAGING_SENDER_ID)
    })
  ]
};
<commit_msg>fix webpack config<commit_after>const path = require('path');
const webpack = require('webpack');

module.exports = {
  entry: './src/index.js',

  output: {
    path: path.join(__dirname, 'public'),
    filename: 'bundle.js'
  },

  module: {
    rules: [
      {
        test: /\.vue$/,
        exclude: path.resolve(__dirname, 'node_modules'),
        loader: 'vue-loader'
      },
      {
        test: /\.js$/,
        exclude: path.resolve(__dirname, 'node_modules'),
        loader: 'babel-loader'
      },
      {
        test: /\.scss$/,
        use: ['style-loader', 'css-loader', 'sass-loader']
      },
      {
        test: /\.png$/,
        exclude: path.resolve(__dirname, 'node_modules'),
        loader: 'file-loader?name=[name].[ext]'
      }
    ]
  },

  devServer: {
    contentBase: path.join(__dirname, 'public'),
  },

  resolve: {
    extensions: ['.js', '.vue']
  },

  plugins: [
    new webpack.DefinePlugin({
      NODE_ENV: JSON.stringify(process.env.NODE_ENV),
      FIREBASE_API_KEY: JSON.stringify(process.env.FIREBASE_API_KEY),
      FIREBASE_AUTH_DOMAIN: JSON.stringify(process.env.FIREBASE_AUTH_DOMAIN),
      FIREBASE_DATABASE_URL: JSON.stringify(process.env.FIREBASE_DATABASE_URL),
      FIREBASE_STORAGE_BUCKET: JSON.stringify(process.env.FIREBASE_STORAGE_BUCKET),
      FIREBASE_MESSAGING_SENDER_ID: JSON.stringify(process.env.FIREBASE_MESSAGING_SENDER_ID)
    })
  ]
};
<|endoftext|>