Git Product home page Git Product logo

packer's Introduction

⚠️ ⚠️ ⚠️ DO NOT USE THIS ⚠️ ⚠️ ⚠️

I threw this up on npm a long time ago but there are better options now. Packer appears to be unsupported and has bugs like this that cause it to generate invalid JavaScript. I recommend using a community-supported JavaScript minifier such as uglify instead. I'm only keeping this page up on GitHub because some packages likely depend on this package and may attempt to navigate here.

packer.js

This is a simple port of /packer/ by Dean Edwards to node.js.

Installation

If you use npm:

npm install packer

If you don't use npm, clone this repository or download the latest version using the GitHub repository Downloads link.

Usage

This module contains one function called pack(script, base62, shrink):

> var packer = require('packer');
> packer.pack('1 + 2');
'1+2'
> packer.pack('', true);
'eval(function(p,a,c,k,e,r){e=String;if(!\'\'.replace(/^/,String)){while(c--)r[c]=k[c]||c;k=[function(e){return r[e]}];e=function(){return\'\\\\w+\'};c=1};while(c--)if(k[c])p=p.replace(new RegExp(\'\\\\b\'+e(c)+\'\\\\b\',\'g\'),k[c]);return p}(\'\',2,0,\'\'.split(\'|\'),0,{}))'

It also adds the packer command:

$ packer -h
usage: <script> [options]

options:
-i FILE	Input file (default stdin)
-o FILE	Output file (default stdout)
-b	Base62 encode
-s	Shrink variables

$ echo 1 + a | packer -b
eval(function(p,a,c,k,e,r){e=String;if(!''.replace(/^/,String)){while(c--)r[c]=k[c]||c;k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('1+0',2,2,'a|'.split('|'),0,{}))

packer's People

Contributors

djj734 avatar evanw avatar introquest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

packer's Issues

upgrade jsdom version

Hi, would you consider upgrading the version of jsdom for this package? I have been running into a bunch of issues with node-gyp rebuild failing from contextify in Node 8, and finally narrowed it down to the old version of jsdom that gets pulled in through packer. If this isn't maintained, I can fork it for my own use, but thought I'd check here first. Thanks.

jsdom 4.0.0 release no longer works with Node.js™.

The jsdom dependency used by this package no longer supports Node going forward. Because of this, when using this package, the latest version of the dependency results with the error below.

jsdom 4.x onward only works on io.js, not Node.js™: https://github.com/tmpvar
^
SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)

I have created the pull request #4 to resolve this issue.

unmatching outcome

Hello, first of all thank You for the great work!!! Dean you are one of my heroes!!! But I'm not here for adulation: starting from the same code the node version has a different result then the one obtained in http://dean.edwards.name/packer/
( Base62 encoded, no Shrink variables )
the first breaks, the second run smooth as expected
I use the node version on a builder I wrote, it would be great if the node port could be as reliable as the online version.
Many Thanks

packer.js is missing shebang

ian % /opt/bin/packer -i foo.js
/opt/bin/packer: line 1: syntax error near unexpected token `('
/opt/bin/packer: line 1: `var fs = require('fs');'

I installed packer via npm install packer and the executable seems to be missing a shebang. Every other npm-installed executable has #!/usr/bin/env node at the top of the file.

Thanks!

Gulp Install

Im trying to install the plugin via NPM and Im getting this error every single time

$ npm install --save-dev gulp-packer

> [email protected] install C:\test\node_modules\contextify
> node-gyp rebuild


C:\test\node_modules\contextify>if not defined npm_config_node_gyp (node "C:\Pro                                           gram Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp                                           \bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python2.7", you can set the                                            PYTHON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\nod                                           e_modules\node-gyp\lib\configure.js:401:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node                                           -gyp\lib\configure.js:356:11
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej                                           s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\test\node_modules\contextify
gyp ERR! node -v v5.11.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
[email protected] C:\test
`-- [email protected]

npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\                                           node_modules\\npm\\bin\\npm-cli.js" "install" "--save-dev" "gulp-packer"
npm ERR! node v5.11.0
npm ERR! npm  v3.8.6
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs contextify
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls contextify
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\test\npm-debug.log

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.