Add basic transform plugin
This commit is contained in:
parent
5ed4df7235
commit
48f46e25b4
4 changed files with 23 additions and 0 deletions
3
lib/default-options.json
Normal file
3
lib/default-options.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"wrapWith": "call"
|
||||
}
|
11
lib/index.js
Executable file
11
lib/index.js
Executable 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
7
lib/transformer.js
Normal 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);
|
||||
};
|
|
@ -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": {
|
||||
|
|
Reference in a new issue