11var fs = require ( 'fs' ) ;
22
33function cleanJavascriptFile ( content ) {
4- content = content . replace ( / ^ .* e x p o r t .* $ / mi, '' ) ; // Remove exports
5- content = content . replace ( / ^ .* e x p o r t .* $ / mi, '' ) ; // Remove exports
6- content = content . replace ( / ^ .* e x p o r t .* $ / mi, '' ) ; // Remove exports
7- content = content . replace ( / ^ .* r e q u i r e .* $ / mi, '' ) ; // Remove reqires
8- content = content . replace ( / m d 5 _ 1 \. / g, '' ) ; // Fix reference to Md5 class
9- content = content . replace ( / \n \n / g, '\n' ) ; // Reduce new lines
10- return content ;
4+ var output = content ;
5+ output = output . replace ( / ^ .* e x p o r t .* $ / mi, '' ) ; // Remove exports
6+ output = output . replace ( / ^ .* e x p o r t .* $ / mi, '' ) ; // Remove exports
7+ output = output . replace ( / ^ .* e x p o r t .* $ / mi, '' ) ; // Remove exports
8+ output = output . replace ( / ^ .* r e q u i r e .* $ / mi, '' ) ; // Remove reqires
9+ output = output . replace ( / m d 5 _ 1 \. / g, '' ) ; // Fix reference to Md5 class
10+ output = output . replace ( / \n \n / g, '\n' ) ; // Reduce new lines
11+ return output ;
1112}
1213
1314console . log ( "Loading javascript files..." ) ;
@@ -19,8 +20,10 @@ var worker = fs.readFileSync('./src/worker.js').toString();
1920console . log ( "Clean javascript files..." ) ;
2021
2122file_hasher = cleanJavascriptFile ( file_hasher ) ;
22- md5 = cleanJavascriptFile ( md5 ) ;
23+ var md5_clean = cleanJavascriptFile ( md5 ) ;
2324
2425console . log ( "Creating worker javascript..." ) ;
2526
26- fs . writeFileSync ( './dist/md5_worker.js' , file_hasher + md5 + worker ) ;
27+ fs . writeFileSync ( './dist/md5_worker.js' , file_hasher + md5_clean + worker ) ;
28+
29+ fs . writeFileSync ( './dist/md5.js' , md5 ) ;
0 commit comments