Replace webpack with rollup (#138)

pull/141/head
Glen Cheney 7 years ago committed by GitHub
parent 80974cb685
commit a56ccb3cd5

@ -1,5 +1,6 @@
{ {
"presets": [ "presets": [
["es2015", { "modules": false }] ["es2015", { "modules": false }]
] ],
"plugins": ["external-helpers"]
} }

@ -1148,10 +1148,6 @@ input.faq-search {
color: #95A5A6; color: #95A5A6;
-webkit-transition: .15s; -webkit-transition: .15s;
transition: .15s; } transition: .15s; }
input.faq-search::-moz-placeholder {
color: #95A5A6;
-webkit-transition: .15s;
transition: .15s; }
input.faq-search:-ms-input-placeholder { input.faq-search:-ms-input-placeholder {
color: #95A5A6; color: #95A5A6;
-webkit-transition: .15s; -webkit-transition: .15s;
@ -1166,8 +1162,6 @@ input.faq-search {
border-color: #5D6D77; } border-color: #5D6D77; }
input.faq-search:hover::-webkit-input-placeholder { input.faq-search:hover::-webkit-input-placeholder {
color: #5D6D77; } color: #5D6D77; }
input.faq-search:hover::-moz-placeholder {
color: #5D6D77; }
input.faq-search:hover:-ms-input-placeholder { input.faq-search:hover:-ms-input-placeholder {
color: #5D6D77; } color: #5D6D77; }
input.faq-search:hover::placeholder { input.faq-search:hover::placeholder {
@ -1178,8 +1172,6 @@ input.faq-search {
border-color: #27AE60; } border-color: #27AE60; }
input.faq-search:focus::-webkit-input-placeholder { input.faq-search:focus::-webkit-input-placeholder {
color: #27AE60; } color: #27AE60; }
input.faq-search:focus::-moz-placeholder {
color: #27AE60; }
input.faq-search:focus:-ms-input-placeholder { input.faq-search:focus:-ms-input-placeholder {
color: #27AE60; } color: #27AE60; }
input.faq-search:focus::placeholder { input.faq-search:focus::placeholder {

3427
dist/shuffle.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,4 +1,61 @@
const babel = require('rollup-plugin-babel');
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const uglify = require('rollup-plugin-uglify');
module.exports = { const commonjsOptions = {
watch: false, include: 'node_modules/**',
}; };
const babelOptions = {
exclude: 'node_modules/**',
};
const uglifyOptions = {
sourceMap: true,
comments: false,
screw_ie8: true,
compress: {
warnings: true,
drop_console: true,
},
mangle: true,
};
const entry = './src/shuffle.js';
const moduleName = 'shuffle';
const format = 'umd';
const sourceMap = true;
module.exports.configs = [
{
entry,
cache: undefined,
plugins: [
resolve(),
commonjs(commonjsOptions),
babel(babelOptions),
],
dest: './dist/shuffle.js',
sourceMap,
moduleName,
format,
},
{
entry,
cache: undefined,
plugins: [
resolve(),
commonjs(commonjsOptions),
babel(babelOptions),
uglify(uglifyOptions),
],
dest: './dist/shuffle.min.js',
sourceMap,
moduleName,
format,
},
];
module.exports.watch = false;

@ -1,31 +0,0 @@
'use strict';
const gutil = require('gulp-util');
const webpack = require('webpack');
const config = require('../config');
module.exports = function compile(done) {
let main = Object.assign({}, require('../../webpack.config.js'));
let min = Object.assign({}, require('../../webpack.config.min.js'));
let compiler = webpack([main, min]);
let isDone = false;
function callback(err, stats) {
if (err) {
throw new Error(err);
}
gutil.log(stats.toString({ colors: true }));
if (!isDone) {
isDone = true;
done();
}
}
if (config.watch) {
compiler.watch({}, callback);
} else {
compiler.run(callback);
}
};

@ -0,0 +1,11 @@
const rollup = require('rollup').rollup;
const configs = require('../config').configs;
module.exports = function scripts() {
const bundles = configs.map(config => rollup(config).then((bundle) => {
config.cache = bundle;
return bundle.write(config);
}));
return Promise.all(bundles);
};

@ -1,13 +1,13 @@
'use strict';
const gulp = require('gulp'); const gulp = require('gulp');
const config = require('../config'); const config = require('../config');
const cssTask = require('./css'); const cssTask = require('./css');
const testTask = require('./test'); const testTask = require('./test');
const scriptsTask = require('./scripts');
module.exports = function setWatching(done) { module.exports = function setWatching(done) {
config.watch = true; config.watch = true;
gulp.watch('_scss/*.scss', cssTask); gulp.watch('_scss/*.scss', cssTask);
gulp.watch('test/*', testTask); gulp.watch('test/*', testTask);
gulp.watch('src/*', scriptsTask);
done(); done();
}; };

@ -1,5 +1,3 @@
'use strict';
const gulp = require('gulp'); const gulp = require('gulp');
const mochaPhantomJS = require('gulp-mocha-phantomjs'); const mochaPhantomJS = require('gulp-mocha-phantomjs');
const config = require('../config'); const config = require('../config');

@ -2,7 +2,7 @@
const gulp = require('gulp'); const gulp = require('gulp');
gulp.task('scripts', require('./gulp/tasks/compile')); gulp.task('scripts', require('./gulp/tasks/scripts'));
gulp.task('set-watching', require('./gulp/tasks/set-watching')); gulp.task('set-watching', require('./gulp/tasks/set-watching'));
gulp.task('css', require('./gulp/tasks/css')); gulp.task('css', require('./gulp/tasks/css'));
gulp.task('jekyll', require('./gulp/tasks/jekyll')); gulp.task('jekyll', require('./gulp/tasks/jekyll'));

@ -48,10 +48,8 @@
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^6.3.4", "autoprefixer": "^6.3.4",
"babel-core": "^6.5.2", "babel-plugin-external-helpers": "^6.22.0",
"babel-loader": "^6.2.2", "babel-preset-es2015": "^6.24.1",
"babel-preset-es2015": "^6.5.0",
"babel-register": "^6.5.2",
"chai": "^3.5.0", "chai": "^3.5.0",
"chai-dom": "^1.4.0", "chai-dom": "^1.4.0",
"es6-promise": "^4.0.5", "es6-promise": "^4.0.5",
@ -62,7 +60,11 @@
"gulp-shell": "^0.6.1", "gulp-shell": "^0.6.1",
"gulp-util": "^3.0.7", "gulp-util": "^3.0.7",
"mocha": "^3.0.0", "mocha": "^3.0.0",
"sinon": "^2.1.0", "rollup": "^0.41.6",
"webpack": "^2.2.1" "rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-uglify": "^1.0.1",
"sinon": "^2.1.0"
} }
} }

@ -0,0 +1,3 @@
export default function arrayMax(array) {
return Math.max.apply(Math, array);
}

3
src/array-min.js vendored

@ -0,0 +1,3 @@
export default function arrayMin(array) {
return Math.min.apply(Math, array);
}

@ -1,4 +1,3 @@
let element = document.body || document.documentElement; let element = document.body || document.documentElement;
let e = document.createElement('div'); let e = document.createElement('div');
e.style.cssText = 'width:10px;padding:2px;box-sizing:border-box;'; e.style.cssText = 'width:10px;padding:2px;box-sizing:border-box;';

@ -1,5 +1,3 @@
'use strict';
import getNumber from './get-number'; import getNumber from './get-number';
import COMPUTED_SIZE_INCLUDES_PADDING from './computed-size'; import COMPUTED_SIZE_INCLUDES_PADDING from './computed-size';

@ -1,5 +1,3 @@
'use strict';
/** /**
* Always returns a numeric value, given a value. Logic from jQuery's `isNumeric`. * Always returns a numeric value, given a value. Logic from jQuery's `isNumeric`.
* @param {*} value Possibly numeric value. * @param {*} value Possibly numeric value.

@ -1 +0,0 @@
module.exports = require('./shuffle').default;

@ -1,14 +1,8 @@
'use strict'; 'use strict';
import Point from './point'; import Point from './point';
import arrayMax from './array-max';
function arrayMax(array) { import arrayMin from './array-min';
return Math.max.apply(Math, array);
}
function arrayMin(array) {
return Math.min.apply(Math, array);
}
/** /**
* Determine the location of the next item, based on its size. * Determine the location of the next item, based on its size.

@ -1,5 +1,3 @@
'use strict';
let transitions = {}; let transitions = {};
let eventName = 'transitionend'; let eventName = 'transitionend';
let count = 0; let count = 0;

@ -1,5 +1,3 @@
'use strict';
import getNumber from './get-number'; import getNumber from './get-number';
/** /**

@ -1,5 +1,3 @@
'use strict';
import 'custom-event-polyfill'; import 'custom-event-polyfill';
import matches from 'matches-selector'; import matches from 'matches-selector';
import arrayUnique from 'array-uniq'; import arrayUnique from 'array-uniq';
@ -13,15 +11,12 @@ import getNumberStyle from './get-number-style';
import sorter from './sorter'; import sorter from './sorter';
import { onTransitionEnd, cancelTransitionEnd } from './on-transition-end'; import { onTransitionEnd, cancelTransitionEnd } from './on-transition-end';
import { getItemPosition, getColumnSpan, getAvailablePositions, getShortColumn } from './layout'; import { getItemPosition, getColumnSpan, getAvailablePositions, getShortColumn } from './layout';
import arrayMax from './array-max';
function toArray(arrayLike) { function toArray(arrayLike) {
return Array.prototype.slice.call(arrayLike); return Array.prototype.slice.call(arrayLike);
} }
function arrayMax(array) {
return Math.max.apply(Math, array);
}
function arrayIncludes(array, obj) { function arrayIncludes(array, obj) {
if (arguments.length === 2) { if (arguments.length === 2) {
return arrayIncludes(array)(obj); return arrayIncludes(array)(obj);

@ -1,5 +1,3 @@
'use strict';
import xtend from 'xtend'; import xtend from 'xtend';
// http://stackoverflow.com/a/962890/373422 // http://stackoverflow.com/a/962890/373422

@ -1,29 +0,0 @@
const path = require('path');
module.exports = {
name: 'build',
devtool: 'source-map',
entry: './src/index.js',
output: {
filename: 'shuffle.js',
path: './dist',
library: 'shuffle',
libraryTarget: 'umd',
},
resolve: {
modules: [
path.resolve('./src'),
'node_modules',
],
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
],
},
plugins: [],
};

@ -1,41 +0,0 @@
const path = require('path');
const webpack = require('webpack');
module.exports = {
name: 'minified',
devtool: 'source-map',
entry: './src/index.js',
output: {
filename: 'shuffle.min.js',
path: './dist',
library: 'shuffle',
libraryTarget: 'umd',
},
resolve: {
modules: [
path.resolve('./src'),
'node_modules',
],
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
],
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
comments: false,
screw_ie8: true,
compress: {
warnings: true,
drop_console: true,
},
mangle: true,
}),
],
};
Loading…
Cancel
Save