Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakerh400 committed Feb 24, 2018
1 parent c69a805 commit 7c1127d
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 35 deletions.
5 changes: 3 additions & 2 deletions framework/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var fs = require('fs');
var browser = require('../browser');
var dirs = require('./dirs.json');
var password = require('./password.json');
var passwords = require('./passwords.json');

var O = getFramework();

Expand All @@ -21,7 +21,8 @@ function getFramework(){

var O = func(window, document);
O.dirs = dirs;
O.password = password;
O.passwords = passwords;
O.password = passwords[0];

return O;
}
2 changes: 1 addition & 1 deletion github/no-copy-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"a.bat",
"b.bat",
"package-lock.json",
"password.json"
"passwords.json"
]
4 changes: 4 additions & 0 deletions minifier/explore-idents.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
cls

call node explore-idents.js
31 changes: 31 additions & 0 deletions minifier/explore-idents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use strict';

var fs = require('fs');
var readline = require('readline');

var rl = readline.createInterface(process.stdin, process.stdout);

var identsFile = './temp-dir/idents.txt';

setTimeout(main);

function main(){
var idents = fs.readFileSync(identsFile).toString().split(/\r\n|\r|\n/).map(a => a.split(/\s+/));

rl.on('line', input => {
if(input === '.exit'){
rl.close();
return;
}

var ident = idents.find(([ident]) => ident === input);
if(!ident) return logLine('Not found.');

logLine(ident[1]);
});
}

function logLine(...a){
console.log(...a);
console.log('');
}
13 changes: 10 additions & 3 deletions minifier/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ function minify(input, output, cb = O.nop){
}else{
var data = fs.readFileSync(d.fullPath);

if(path.parse(d.name).ext.slice(1) == 'js'){
data = minifyFile(data.toString(), true);
if(!/\_(?:\\|$)/.test(d.fullPath)){
if(path.parse(d.name).ext.slice(1) == 'js'){
data = minifyFile(data, true);
}
}

fs.writeFileSync(outputPath, data);
Expand All @@ -88,7 +90,10 @@ function minify(input, output, cb = O.nop){
cb(null);
}

function minifyFile(str, minify = false){
function minifyFile(data, minify = false){
//return data;

var str = data.toString();
var templateStrings = [];
var funcStrings = [];
var strings = [];
Expand Down Expand Up @@ -238,6 +243,8 @@ function processSources(arr, minify = false){
O.sortAsc(idents);
idents.sorted = true;

if(fs.existsSync(tempDir)) require('../fs-recursive').deleteFilesSync(tempDir);
fs.mkdirSync(tempDir);
fs.writeFileSync(identsFile, exportIdents(idents));
}

Expand Down
4 changes: 2 additions & 2 deletions minifier/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

var minifier = require('.');

var input = 'C:/Users/Thomas/Downloads/www';
var input = 'C:/wamp/www1';
var output = 'C:/wamp/www';

setTimeout(main);

function main(){
minifier.minify(input, output, err => {
if(err) return console.log(err);
console.log('Success.');
console.log('Finished.');
});
}
82 changes: 55 additions & 27 deletions minifier/whitelisted-idents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[
"evt",
"event",
"doc",
"body",
"xhr",

"window",
"addEventListener",
Expand All @@ -27,40 +30,65 @@
"prompt",
"Float32Array",

"open",
"send",
"onreadystatechange",
"readyState",
"status",
"responseText",

"var",
"const",
"typeof",
"function",
"return",
"instanceof",
"in",
"break",
"case",
"catch",
"class",
"const",
"continue",
"debugger",
"default",
"delete",
"do",
"else",
"export",
"extends",
"finally",
"for",
"function",
"if",
"else",
"import",
"in",
"instanceof",
"new",
"return",
"super",
"switch",
"case",
"break",
"continue",
"for",
"this",
"throw",
"try",
"typeof",
"var",
"void",
"while",
"do",
"new",
"delete",
"with",
"yield",
"async",
"await",
"import",
"export",
"enum",
"implements",
"interface",
"let",
"package",
"private",
"protected",
"public",
"static",
"debugger",
"await",
"abstract",
"boolean",
"byte",
"char",
"double",
"final",
"float",
"goto",
"int",
"long",
"native",
"short",
"synchronized",
"throws",
"transient",
"volatile",

"DEPTH_BUFFER_BIT",
"STENCIL_BUFFER_BIT",
Expand Down

0 comments on commit 7c1127d

Please sign in to comment.