@@ -2,38 +2,6 @@ const fs = require("fs");
2
2
const path = require ( "path" ) ;
3
3
var execSync = require ( "child_process" ) . execSync ;
4
4
5
- const catsrcIgnore = "/* wenyan-catsrc-ignore */" ;
6
-
7
- function remotelib ( urls ) {
8
- var src = urls
9
- . map ( url => execSync ( `curl -s ${ url } ` , { encoding : "utf-8" } ) . toString ( ) )
10
- . join ( "\n" )
11
- . replace ( / " u s e s t r i c t " / g, / " u s e s h i t " / ) ;
12
- ( 1 , eval ) ( src ) ;
13
- }
14
-
15
- function catsrc ( ) {
16
- var s = "" ;
17
- var rootPath = "../src/" ;
18
- var compilerPath = "../src/compiler/" ;
19
- var compilerList = [ "base" , "js" , "py" , "rb" , "compilers" ] ;
20
- // Must make sure compilers.js in the end.
21
- compilerList . push ( "compilers" ) ;
22
- compilerList = compilerList . map ( filename => compilerPath + filename + ".js" ) ;
23
- var srcs = fs . readdirSync ( rootPath ) . map ( filename => rootPath + filename ) ;
24
- srcs = srcs . concat ( compilerList ) ;
25
-
26
- for ( var i = 0 ; i < srcs . length ; i ++ ) {
27
- if ( srcs [ i ] . endsWith ( ".js" ) && ! srcs [ i ] . includes ( "cli" ) ) {
28
- const raw = fs . readFileSync ( srcs [ i ] , "utf-8" ) ;
29
-
30
- if ( ! raw . startsWith ( catsrcIgnore ) )
31
- s += raw . replace ( / c o n s t \s / g, "var " ) + ";\n" ;
32
- }
33
- }
34
- return s ;
35
- }
36
-
37
5
function loadlib ( libDir = path . resolve ( __dirname , "../lib/" ) ) {
38
6
var lib = { } ;
39
7
var srcs = fs . readdirSync ( libDir ) ;
@@ -48,21 +16,6 @@ function loadlib(libDir = path.resolve(__dirname, "../lib/")) {
48
16
return lib ;
49
17
}
50
18
51
- function uglifier ( ) {
52
- remotelib ( [
53
- "https://skalman.github.io/UglifyJS-online/uglify/lib/utils.js" ,
54
- "https://skalman.github.io/UglifyJS-online/uglify/lib/ast.js" ,
55
- "https://skalman.github.io/UglifyJS-online/uglify/lib/parse.js" ,
56
- "https://skalman.github.io/UglifyJS-online/uglify/lib/transform.js" ,
57
- "https://skalman.github.io/UglifyJS-online/uglify/lib/scope.js" ,
58
- "https://skalman.github.io/UglifyJS-online/uglify/lib/output.js" ,
59
- "https://skalman.github.io/UglifyJS-online/uglify/lib/compress.js" ,
60
- "https://skalman.github.io/UglifyJS-online/uglify/lib/propmangle.js" ,
61
- "https://skalman.github.io/UglifyJS-online/uglify/lib/minify.js"
62
- ] ) ;
63
- return minify ;
64
- }
65
-
66
19
function pyeval ( py ) {
67
20
fs . writeFileSync ( "tmp.py" , py ) ;
68
21
var ret = execSync (
@@ -79,19 +32,8 @@ function rbeval(rb) {
79
32
return ret ;
80
33
}
81
34
82
- function beautifier ( ) {
83
- remotelib ( [
84
- "https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.10.2/beautify.js"
85
- ] ) ;
86
- return js_beautify ;
87
- }
88
-
89
35
module . exports = {
90
- uglifier,
91
- beautifier,
92
- catsrc,
93
36
loadlib,
94
- remotelib,
95
37
pyeval,
96
38
rbeval
97
39
} ;
0 commit comments