1.0.0
commit
2c93b36c1f
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
.vscode
|
||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
|
|
||||||
|
*.sublime-project
|
||||||
|
*.sublime-workspace
|
||||||
|
package-lock.json
|
||||||
|
|
||||||
|
|
||||||
|
._*
|
||||||
|
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018
|
||||||
|
|
||||||
|
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.
|
|
@ -0,0 +1,2 @@
|
||||||
|
## @rollup/plugin-uglify
|
||||||
|
> Rollup plugin to minify generated bundle, base on terser. Support ES6+.
|
|
@ -0,0 +1,24 @@
|
||||||
|
/**
|
||||||
|
* rollup plugin
|
||||||
|
* @author yutent<yutent.io@gmail.com>
|
||||||
|
* @date 2020/08/11 15:46:57
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { minify } from 'terser'
|
||||||
|
|
||||||
|
export default function uglify(options = {}) {
|
||||||
|
// force sourcemap creation
|
||||||
|
var opt = Object.assign({ sourceMap: true }, options)
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: 'uglify',
|
||||||
|
renderChunk(code) {
|
||||||
|
var result = minify(code, opt)
|
||||||
|
if (result.error) {
|
||||||
|
console.error(result.error)
|
||||||
|
throw result.error
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
/**
|
||||||
|
* rollup plugin
|
||||||
|
* @author yutent<yutent.io@gmail.com>
|
||||||
|
* @date 2020/08/11 15:46:57
|
||||||
|
*/
|
||||||
|
|
||||||
|
var minify = require('terser').minify
|
||||||
|
|
||||||
|
function uglify(options = {}) {
|
||||||
|
// force sourcemap creation
|
||||||
|
var opt = Object.assign({ sourceMap: true }, options)
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: 'uglify',
|
||||||
|
renderChunk(code) {
|
||||||
|
var result = minify(code, opt)
|
||||||
|
if (result.error) {
|
||||||
|
console.error(result.error)
|
||||||
|
throw result.error
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = uglify
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"name": "@bytedo/rollup-plugin-uglify",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Rollup plugin to minify generated bundle, base on terser. Support ES6+.",
|
||||||
|
"main": "index.js",
|
||||||
|
"module": "index.es.js",
|
||||||
|
"author": "yutent",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/bytedo/rollup-plugin-uglify.git"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"terser": "^5.0.0"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue