Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

ender-minify

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ender-minify - npm Package Compare versions

Comparing version
0.0.4
to
0.1.0
+9
.travis.yml
language: node_js
node_js:
- 0.8
branches:
only:
- master
notifications:
email:
- rod@vagg.org
Copyright 2012, Rod Vagg, Dustin Diaz, Jacob Thornton and other contributors. (the "Original Author")
All rights reserved.
MIT +no-false-attribs License
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.
Distributions of all or part of the Software intended to be used
by the recipients as they would use the unmodified Software,
containing modifications that substantially alter, remove, or
disable functionality of the Software, outside of the documented
configuration mechanisms provided by the Software, shall be
modified such that the Original Author's bug reporting email
addresses and urls are either replaced with the contact information
of the parties responsible for the changes, or removed entirely.
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.
Except where noted, this license applies to any and all software
programs and associated documentation files created by the
Original Author, when distributed with the Software.
+2
-1

@@ -27,3 +27,4 @@ {

, "es5": true
, "esnext": true
, "strict": false
}
}

@@ -25,24 +25,25 @@ /*!

var childProcess = require('child_process')
, path = require('path')
, closureJar = 'closure_r2180.jar'
, jarPath = path.resolve(__dirname, '../support/' + closureJar)
, javaCmd = 'java'
, javaArgs = [
'-jar'
, '{jarPath}'
, '--compilation_level'
, '{level}'
, '{externs}'
]
, levels = {
whitespace : 'WHITESPACE_ONLY'
, simple : 'SIMPLE_OPTIMIZATIONS'
, advanced : 'ADVANCED_OPTIMIZATIONS'
}
, reMultiComments = /\/\*!([\s\S]*?)\*\//g
, token = 'Ender: preserved comment block'
, reTokens = RegExp('(\\/*\\n*\\s*)?' + token, 'g')
const childProcess = require('child_process')
, path = require('path')
, extend = require('util')._extend
, closureJar = 'closure_r2180.jar'
, jarPath = path.resolve(__dirname, '../support/' + closureJar)
, javaCmd = 'java'
, javaArgs = [
'-jar'
, '{jarPath}'
, '--compilation_level'
, '{level}'
, '{externs}'
]
, levels = {
whitespace : 'WHITESPACE_ONLY'
, simple : 'SIMPLE_OPTIMIZATIONS'
, advanced : 'ADVANCED_OPTIMIZATIONS'
}
, reMultiComments = /\/\*!([\s\S]*?)\*\//g
, token = 'Ender: preserved comment block'
, reTokens = RegExp('(\\/*\\n*\\s*)?' + token, 'g')
, minify = function (source, options, callback) {
var minify = function (source, options, callback) {
var stdout = ''

@@ -93,6 +94,6 @@ , stderr = ''

module.exports = {
minify : minify
, levels : Object.keys(levels)
module.exports = minify
extend(module.exports, {
levels : Object.keys(levels)
, jarPath : jarPath
}
})

@@ -25,10 +25,11 @@ /*!

var minifiers = {
uglify : require('./uglify')
, closure : require('./closure')
}
const minifiers = {
uglify : require('./uglify')
, closure : require('./closure')
}
, extend = require('util')._extend
, minify = function (minifier, source, options, callback) {
var minify = function (minifier, source, options, callback) {
if (minifiers[minifier]) {
minifiers[minifier].minify(source, options, callback)
minifiers[minifier](source, options, callback)
} else {

@@ -39,7 +40,7 @@ callback('No such minifier "' + minifier + '"')

module.exports = {
minify : minify
, minifiers : Object.keys(minifiers)
module.exports = minify
extend(module.exports, {
minifiers : Object.keys(minifiers)
, closureLevels : minifiers.closure.levels
, closureJar : minifiers.closure.jarPath
}
})

@@ -25,6 +25,6 @@ /*!

var uglifyParser = require('uglify-js').parser
, uglifyMangler = require('uglify-js').uglify
const uglifyParser = require('uglify-js').parser
, uglifyMangler = require('uglify-js').uglify
, minify = function (source, options, callback) {
var minify = function (source, options, callback) {
var comments = []

@@ -59,2 +59,2 @@ , token = '"Ender: preserved comment block"'

module.exports.minify = minify
module.exports = minify
{
"name": "ender-minify"
, "description": "Interface to UglifyJS Closure Compiler and YUICompressor"
, "version": "0.0.4"
, "version": "0.1.0"
, "authors": [
"Rod Vagg @rvagg <rod@vagg.org> (https://github.com/rvagg)"
, "Dustin Diaz @ded <dustin@obvious.com> (https://github.com/ded)"
, "Jacob Thornton @fat <jacob@twitter.com> (https://github.com/fat)"
]
, "keywords": [ "minify", "uglify", "yuicompressor", "closure" ]
, "main": "./lib/main.js"
, "homepage": "https://ender.no.de"
, "homepage": "https://ender.jit.su"
, "dependencies": {

@@ -20,7 +22,5 @@ "uglify-js" : "~1.3.0"

, "rimraf" : "~2.0.1"
, "jshint" : "~0.7.1"
, "colors" : "~0.6.0"
}
, "scripts": {
"test" : "make tests"
"test" : "./node_modules/.bin/buster-test"
}

@@ -27,0 +27,0 @@ , "repository": {

@@ -1,9 +0,14 @@

# ender-minify
# Ender Minify [![Build Status](https://secure.travis-ci.org/ender-js/ender-minify.png)](http://travis-ci.org/ender-js/ender-minify)
Bundled minifier utilities for Node, designed primarily for use with the Ender CLI.
Bundled minifier utilities for Node, designed primarily for use with the [Ender CLI](https://github.com/ender-js/Ender/).
## About Ender
## [UglifyJS](https://github.com/mishoo/UglifyJS)
For more information checkout [http://ender.jit.su](http://ender.jit.su)
```
## API
### enderMinify() ([UglifyJS](https://github.com/mishoo/UglifyJS))
```js
var fs = require('fs')

@@ -16,3 +21,3 @@ var em = require('ender-minify')

em.minify('uglify', source, options, function (err, minifiedSource) {
em('uglify', source, options, function (err, minifiedSource) {
if (err) throw err

@@ -25,5 +30,5 @@

## [Closure Compiler](http://closure-compiler.googlecode.com/)
### enderMinify() ([Closure Compiler](http://closure-compiler.googlecode.com/))
```
```js
var fs = require('fs')

@@ -39,3 +44,3 @@ var em = require('ender-minify')

em.minify('closure', source, options, function (err, minifiedSource) {
em('closure', source, options, function (err, minifiedSource) {
if (err) throw err

@@ -48,2 +53,48 @@

## YUICompressor coming soon...
### YUICompressor coming soon...
-----------------------------
### enderMinify.minifiers
Exposes the minfiers for direct external use. The object contains a `'uglify'` key and a `'closure'` key. These functions may be called directly without the `'minifier'` first-arg:
```js
enderMinify.minifiers.uglify(source, options, callback)
```
-----------------------------
### enderMinify.closureLevels
An object with mappings of the Closure Compiler compression levels, from nice-key to verbose-Closure-key.
i.e.:
```js
{
whitespace : 'WHITESPACE_ONLY'
, simple : 'SIMPLE_OPTIMIZATIONS'
, advanced : 'ADVANCED_OPTIMIZATIONS'
}
```
-----------------------------
### enderMinify.closureJar
The absolute path name to the *closure.jar* file used to run Closure Compiler within this package. Useful if you wanted to call it directly.
-----------------------------
## Contributing
Contributions are more than welcome! Just fork and submit a GitHub pull request! If you have changes that need to be synchronized across the various Ender CLI repositories then please make that clear in your pull requests.
### Tests
Ender Minify uses [Buster](http://busterjs.org) for unit testing. You'll get it (and a bazillion unnecessary dependencies) when you `npm install` in your cloned local repository. Simply run `npm test` to run the test suite.
## Licence
*Ender Minify* is Copyright (c) 2012 [@rvagg](https://github.com/rvagg), [@ded](https://github.com/ded), [@fat](https://github.com/fat) and other contributors. It is licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.

@@ -39,3 +39,3 @@ /*!

closure.minify(original, {}, function (err, actual) {
closure(original, {}, function (err, actual) {
refute(err)

@@ -48,3 +48,3 @@ assert.equals(actual, expected)

, 'test minification syntax error': function (done) {
closure.minify('this is not javascript!', {}, function (err, output) {
closure('this is not javascript!', {}, function (err, output) {
refute(output)

@@ -72,3 +72,3 @@ assert(err)

closure.minify(original, {}, function (err, actual) {
closure(original, {}, function (err, actual) {
refute(err)

@@ -75,0 +75,0 @@ assert.equals(actual, expected)

@@ -25,9 +25,8 @@ /*!

var buster = require('buster')
, assert = buster.assert
, main = require('../lib/main')
var buster = require('buster')
, assert = buster.assert
, main = require('../lib/main')
, testSource = '(function foo (bar) { alert("b" + "a" + "n" + "g"); });'
, expected = {
, testSource = '(function foo (bar) { alert("b" + "a" + "n" + "g"); });'
, expected = {
uglify : '(function(t){alert("bang")})'

@@ -37,4 +36,4 @@ , closure : '(function(){alert("bang")});'

, runTest = function (minifier, done) {
main.minify(minifier, testSource, {}, function (err, actual) {
, runTest = function (minifier, done) {
main(minifier, testSource, {}, function (err, actual) {
refute(err)

@@ -41,0 +40,0 @@ assert.match(actual, expected[minifier])

@@ -35,3 +35,3 @@ /*!

uglify.minify(original, {}, function (err, actual) {
uglify(original, {}, function (err, actual) {
refute(err)

@@ -44,3 +44,3 @@ assert.match(actual, expected)

, 'test minification syntax error': function (done) {
uglify.minify('this is not javascript!', {}, function (err, output) {
uglify('this is not javascript!', {}, function (err, output) {
refute(output)

@@ -68,3 +68,3 @@ assert(err)

uglify.minify(original, {}, function (err, actual) {
uglify(original, {}, function (err, actual) {
refute(err)

@@ -71,0 +71,0 @@ assert.match(actual, expected)

tests:
@node -e "require('colors');console.log('Running tests...'.bold.yellow)"
@./node_modules/.bin/jshint lib/ test/
@./node_modules/.bin/buster-test -g all