archive
/
JSFuckify
Archived
1
Fork 0

Add basic transform plugin

This commit is contained in:
Jake Howard 2016-03-24 19:47:00 +00:00
parent 5ed4df7235
commit 48f46e25b4
4 changed files with 23 additions and 0 deletions

3
lib/default-options.json Normal file
View File

@ -0,0 +1,3 @@
{
"wrapWith": "call"
}

11
lib/index.js Executable file
View File

@ -0,0 +1,11 @@
var transformTools = require('browserify-transform-tools');
var transformer = require('./transformer');
const OPTIONS = {
excludeExtensions: ['.json']
};
module.exports = transformTools.makeStringTransform('jsfuckify', OPTIONS, function (content, transformOptions, done) {
const newContent = transformer(content, transformOptions.config);
done(null, newContent);
});

7
lib/transformer.js Normal file
View File

@ -0,0 +1,7 @@
var jscrewit = require('jscrewit');
var DEFAULT_OPTIONS = require('./default-options');
module.exports = function transformer(content, options) {
options = options || DEFAULT_OPTIONS;
return jscrewit.encode(content, options);
};

View File

@ -4,6 +4,8 @@
"description": "",
"main": "lib/index.js",
"scripts": {
"test": "browserify ./test/test.js -t ./lib/index.js -o ./test/out.js",
"lint": "eslint 'lib/'"
},
"author": "TheOrangeOne",
"dependencies": {