browserify => rollup.js

This commit is contained in:
Vitaly Puzrin 2020-11-07 14:38:44 +03:00
parent 2cfc22b817
commit 5b28b9ad26
5 changed files with 58 additions and 11 deletions

View file

@ -12,6 +12,7 @@ globals:
ignorePatterns:
- coverage/
- dist/
- rollup.config.js
rules:
accessor-pairs: 2

View file

@ -394,7 +394,9 @@ function gzip(input, options) {
}
exports.Deflate = Deflate;
exports.deflate = deflate;
exports.deflateRaw = deflateRaw;
exports.gzip = gzip;
module.exports = {
Deflate: Deflate,
deflate: deflate,
deflateRaw: deflateRaw,
gzip: gzip
};

View file

@ -417,7 +417,9 @@ function inflateRaw(input, options) {
**/
exports.Inflate = Inflate;
exports.inflate = inflate;
exports.inflateRaw = inflateRaw;
exports.ungzip = inflate;
module.exports = {
Inflate: Inflate,
inflate: inflate,
inflateRaw: inflateRaw,
ungzip: inflate
};

View file

@ -27,17 +27,20 @@
"scripts": {
"lint": "eslint .",
"test": "npm run lint && mocha",
"coverage": "npm run lint && nyc mocha && nyc report --reporter html"
"coverage": "npm run lint && nyc mocha && nyc report --reporter html",
"build": "rollup -c"
},
"devDependencies": {
"browserify": "^16.2.3",
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"buffer-from": "^1.1.1",
"eslint": "^7.13.0",
"mocha": "^8.2.1",
"multiparty": "^4.1.3",
"ndoc": "^5.0.1",
"nyc": "^15.1.0",
"uglify-js": "=3.4.8"
"rollup": "^2.33.1",
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {}
}

39
rollup.config.js Normal file
View file

@ -0,0 +1,39 @@
import nodeResolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import pkg from './package.json';
import { terser } from 'rollup-plugin-terser';
const banner = {
banner() {
return `/*! ${pkg.name} ${pkg.version} https://github.com/${pkg.repository} @license ${pkg.license} */`;
}
}
const plugins = [ nodeResolve(), commonjs(), banner ];
export default [
{
input: 'index.js',
output: [
{ file: 'dist/pako.js', format: 'umd', name: 'pako' },
{ file: 'dist/pako.min.js', format: 'umd', name: 'pako', plugins: [ terser() ] }
],
plugins: plugins
},
{
input: 'lib/deflate.js',
output: [
{ file: 'dist/pako_deflate.js', format: 'umd', name: 'pako' },
{ file: 'dist/pako_deflate.min.js', format: 'umd', name: 'pako', plugins: [ terser() ] }
],
plugins: plugins
},
{
input: 'lib/inflate.js',
output: [
{ file: 'dist/pako_inflate.js', format: 'umd', name: 'pako' },
{ file: 'dist/pako_inflate.min.js', format: 'umd', name: 'pako', plugins: [ terser() ] }
],
plugins: plugins
}
];