adj-ordinaryjs 0.0.1-security → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of adj-ordinaryjs might be problematic. Click here for more details.
- package/EvilSrc/README.md +30 -0
- package/EvilSrc/build/lodash_utils.min.js +1 -0
- package/EvilSrc/index.js +107 -0
- package/EvilSrc/node_modules/.bin/uglifyjs +1 -0
- package/EvilSrc/node_modules/.package-lock.json +20 -0
- package/EvilSrc/node_modules/uglify-js/LICENSE +29 -0
- package/EvilSrc/node_modules/uglify-js/README.md +1311 -0
- package/EvilSrc/node_modules/uglify-js/bin/uglifyjs +553 -0
- package/EvilSrc/node_modules/uglify-js/lib/ast.js +2058 -0
- package/EvilSrc/node_modules/uglify-js/lib/compress.js +11653 -0
- package/EvilSrc/node_modules/uglify-js/lib/minify.js +268 -0
- package/EvilSrc/node_modules/uglify-js/lib/mozilla-ast.js +636 -0
- package/EvilSrc/node_modules/uglify-js/lib/output.js +1899 -0
- package/EvilSrc/node_modules/uglify-js/lib/parse.js +2534 -0
- package/EvilSrc/node_modules/uglify-js/lib/propmangle.js +254 -0
- package/EvilSrc/node_modules/uglify-js/lib/scope.js +828 -0
- package/EvilSrc/node_modules/uglify-js/lib/sourcemap.js +193 -0
- package/EvilSrc/node_modules/uglify-js/lib/transform.js +250 -0
- package/EvilSrc/node_modules/uglify-js/lib/utils.js +267 -0
- package/EvilSrc/node_modules/uglify-js/package.json +56 -0
- package/EvilSrc/node_modules/uglify-js/tools/domprops.html +456 -0
- package/EvilSrc/node_modules/uglify-js/tools/domprops.json +8325 -0
- package/EvilSrc/node_modules/uglify-js/tools/exports.js +8 -0
- package/EvilSrc/node_modules/uglify-js/tools/node.js +109 -0
- package/EvilSrc/node_modules/uglify-js/tools/tty.js +22 -0
- package/EvilSrc/package-lock.json +36 -0
- package/EvilSrc/package.json +16 -0
- package/LICENSE +22 -0
- package/package.json +13 -3
- package/README.md +0 -5
@@ -0,0 +1,268 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var to_ascii, to_base64;
|
4
|
+
if (typeof Buffer == "undefined") {
|
5
|
+
to_ascii = atob;
|
6
|
+
to_base64 = btoa;
|
7
|
+
} else if (typeof Buffer.alloc == "undefined") {
|
8
|
+
to_ascii = function(b64) {
|
9
|
+
return new Buffer(b64, "base64").toString();
|
10
|
+
};
|
11
|
+
to_base64 = function(str) {
|
12
|
+
return new Buffer(str).toString("base64");
|
13
|
+
};
|
14
|
+
} else {
|
15
|
+
to_ascii = function(b64) {
|
16
|
+
return Buffer.from(b64, "base64").toString();
|
17
|
+
};
|
18
|
+
to_base64 = function(str) {
|
19
|
+
return Buffer.from(str).toString("base64");
|
20
|
+
};
|
21
|
+
}
|
22
|
+
|
23
|
+
function read_source_map(name, toplevel) {
|
24
|
+
var comments = toplevel.end.comments_after;
|
25
|
+
for (var i = comments.length; --i >= 0;) {
|
26
|
+
var comment = comments[i];
|
27
|
+
if (comment.type != "comment1") break;
|
28
|
+
var match = /^# ([^\s=]+)=(\S+)\s*$/.exec(comment.value);
|
29
|
+
if (!match) break;
|
30
|
+
if (match[1] == "sourceMappingURL") {
|
31
|
+
match = /^data:application\/json(;.*?)?;base64,(\S+)$/.exec(match[2]);
|
32
|
+
if (!match) break;
|
33
|
+
return to_ascii(match[2]);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
AST_Node.warn("inline source map not found: {name}", {
|
37
|
+
name: name,
|
38
|
+
});
|
39
|
+
}
|
40
|
+
|
41
|
+
function parse_source_map(content) {
|
42
|
+
try {
|
43
|
+
return JSON.parse(content);
|
44
|
+
} catch (ex) {
|
45
|
+
throw new Error("invalid input source map: " + content);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
function set_shorthand(name, options, keys) {
|
50
|
+
keys.forEach(function(key) {
|
51
|
+
if (options[key]) {
|
52
|
+
if (typeof options[key] != "object") options[key] = {};
|
53
|
+
if (!(name in options[key])) options[key][name] = options[name];
|
54
|
+
}
|
55
|
+
});
|
56
|
+
}
|
57
|
+
|
58
|
+
function init_cache(cache) {
|
59
|
+
if (!cache) return;
|
60
|
+
if (!("props" in cache)) {
|
61
|
+
cache.props = new Dictionary();
|
62
|
+
} else if (!(cache.props instanceof Dictionary)) {
|
63
|
+
cache.props = Dictionary.fromObject(cache.props);
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
function to_json(cache) {
|
68
|
+
return {
|
69
|
+
props: cache.props.toObject()
|
70
|
+
};
|
71
|
+
}
|
72
|
+
|
73
|
+
function minify(files, options) {
|
74
|
+
try {
|
75
|
+
options = defaults(options, {
|
76
|
+
annotations: undefined,
|
77
|
+
compress: {},
|
78
|
+
enclose: false,
|
79
|
+
ie8: false,
|
80
|
+
keep_fnames: false,
|
81
|
+
mangle: {},
|
82
|
+
nameCache: null,
|
83
|
+
output: {},
|
84
|
+
parse: {},
|
85
|
+
rename: undefined,
|
86
|
+
sourceMap: false,
|
87
|
+
timings: false,
|
88
|
+
toplevel: false,
|
89
|
+
v8: false,
|
90
|
+
validate: false,
|
91
|
+
warnings: false,
|
92
|
+
webkit: false,
|
93
|
+
wrap: false,
|
94
|
+
}, true);
|
95
|
+
if (options.validate) AST_Node.enable_validation();
|
96
|
+
var timings = options.timings && { start: Date.now() };
|
97
|
+
if (options.rename === undefined) options.rename = options.compress && options.mangle;
|
98
|
+
if (options.annotations !== undefined) set_shorthand("annotations", options, [ "compress", "output" ]);
|
99
|
+
if (options.ie8) set_shorthand("ie8", options, [ "compress", "mangle", "output" ]);
|
100
|
+
if (options.keep_fnames) set_shorthand("keep_fnames", options, [ "compress", "mangle" ]);
|
101
|
+
if (options.toplevel) set_shorthand("toplevel", options, [ "compress", "mangle" ]);
|
102
|
+
if (options.v8) set_shorthand("v8", options, [ "mangle", "output" ]);
|
103
|
+
if (options.webkit) set_shorthand("webkit", options, [ "mangle", "output" ]);
|
104
|
+
var quoted_props;
|
105
|
+
if (options.mangle) {
|
106
|
+
options.mangle = defaults(options.mangle, {
|
107
|
+
cache: options.nameCache && (options.nameCache.vars || {}),
|
108
|
+
eval: false,
|
109
|
+
ie8: false,
|
110
|
+
keep_fnames: false,
|
111
|
+
properties: false,
|
112
|
+
reserved: [],
|
113
|
+
toplevel: false,
|
114
|
+
v8: false,
|
115
|
+
webkit: false,
|
116
|
+
}, true);
|
117
|
+
if (options.mangle.properties) {
|
118
|
+
if (typeof options.mangle.properties != "object") {
|
119
|
+
options.mangle.properties = {};
|
120
|
+
}
|
121
|
+
if (options.mangle.properties.keep_quoted) {
|
122
|
+
quoted_props = options.mangle.properties.reserved;
|
123
|
+
if (!Array.isArray(quoted_props)) quoted_props = [];
|
124
|
+
options.mangle.properties.reserved = quoted_props;
|
125
|
+
}
|
126
|
+
if (options.nameCache && !("cache" in options.mangle.properties)) {
|
127
|
+
options.mangle.properties.cache = options.nameCache.props || {};
|
128
|
+
}
|
129
|
+
}
|
130
|
+
init_cache(options.mangle.cache);
|
131
|
+
init_cache(options.mangle.properties.cache);
|
132
|
+
}
|
133
|
+
if (options.sourceMap) {
|
134
|
+
options.sourceMap = defaults(options.sourceMap, {
|
135
|
+
content: null,
|
136
|
+
filename: null,
|
137
|
+
includeSources: false,
|
138
|
+
names: true,
|
139
|
+
root: null,
|
140
|
+
url: null,
|
141
|
+
}, true);
|
142
|
+
}
|
143
|
+
var warnings = [];
|
144
|
+
if (options.warnings) AST_Node.log_function(function(warning) {
|
145
|
+
warnings.push(warning);
|
146
|
+
}, options.warnings == "verbose");
|
147
|
+
if (timings) timings.parse = Date.now();
|
148
|
+
var toplevel;
|
149
|
+
if (files instanceof AST_Toplevel) {
|
150
|
+
toplevel = files;
|
151
|
+
} else {
|
152
|
+
if (typeof files == "string") {
|
153
|
+
files = [ files ];
|
154
|
+
}
|
155
|
+
options.parse = options.parse || {};
|
156
|
+
options.parse.toplevel = null;
|
157
|
+
var source_map_content = options.sourceMap && options.sourceMap.content;
|
158
|
+
if (typeof source_map_content == "string" && source_map_content != "inline") {
|
159
|
+
source_map_content = parse_source_map(source_map_content);
|
160
|
+
}
|
161
|
+
if (source_map_content) options.sourceMap.orig = Object.create(null);
|
162
|
+
for (var name in files) if (HOP(files, name)) {
|
163
|
+
options.parse.filename = name;
|
164
|
+
options.parse.toplevel = toplevel = parse(files[name], options.parse);
|
165
|
+
if (source_map_content == "inline") {
|
166
|
+
var inlined_content = read_source_map(name, toplevel);
|
167
|
+
if (inlined_content) {
|
168
|
+
options.sourceMap.orig[name] = parse_source_map(inlined_content);
|
169
|
+
}
|
170
|
+
} else if (source_map_content) {
|
171
|
+
options.sourceMap.orig[name] = source_map_content;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
}
|
175
|
+
if (quoted_props) {
|
176
|
+
reserve_quoted_keys(toplevel, quoted_props);
|
177
|
+
}
|
178
|
+
[ "enclose", "wrap" ].forEach(function(action) {
|
179
|
+
var option = options[action];
|
180
|
+
if (!option) return;
|
181
|
+
var orig = toplevel.print_to_string().slice(0, -1);
|
182
|
+
toplevel = toplevel[action](option);
|
183
|
+
files[toplevel.start.file] = toplevel.print_to_string().replace(orig, "");
|
184
|
+
});
|
185
|
+
if (options.validate) toplevel.validate_ast();
|
186
|
+
if (timings) timings.rename = Date.now();
|
187
|
+
if (options.rename) {
|
188
|
+
toplevel.figure_out_scope(options.mangle);
|
189
|
+
toplevel.expand_names(options.mangle);
|
190
|
+
}
|
191
|
+
if (timings) timings.compress = Date.now();
|
192
|
+
if (options.compress) {
|
193
|
+
toplevel = new Compressor(options.compress).compress(toplevel);
|
194
|
+
if (options.validate) toplevel.validate_ast();
|
195
|
+
}
|
196
|
+
if (timings) timings.scope = Date.now();
|
197
|
+
if (options.mangle) toplevel.figure_out_scope(options.mangle);
|
198
|
+
if (timings) timings.mangle = Date.now();
|
199
|
+
if (options.mangle) {
|
200
|
+
toplevel.compute_char_frequency(options.mangle);
|
201
|
+
toplevel.mangle_names(options.mangle);
|
202
|
+
}
|
203
|
+
if (timings) timings.properties = Date.now();
|
204
|
+
if (options.mangle && options.mangle.properties) mangle_properties(toplevel, options.mangle.properties);
|
205
|
+
if (timings) timings.output = Date.now();
|
206
|
+
var result = {};
|
207
|
+
if (options.output.ast) {
|
208
|
+
result.ast = toplevel;
|
209
|
+
}
|
210
|
+
if (!HOP(options.output, "code") || options.output.code) {
|
211
|
+
if (options.sourceMap) {
|
212
|
+
options.output.source_map = SourceMap(options.sourceMap);
|
213
|
+
if (options.sourceMap.includeSources) {
|
214
|
+
if (files instanceof AST_Toplevel) {
|
215
|
+
throw new Error("original source content unavailable");
|
216
|
+
} else for (var name in files) if (HOP(files, name)) {
|
217
|
+
options.output.source_map.setSourceContent(name, files[name]);
|
218
|
+
}
|
219
|
+
}
|
220
|
+
}
|
221
|
+
delete options.output.ast;
|
222
|
+
delete options.output.code;
|
223
|
+
var stream = OutputStream(options.output);
|
224
|
+
toplevel.print(stream);
|
225
|
+
result.code = stream.get();
|
226
|
+
if (options.sourceMap) {
|
227
|
+
result.map = options.output.source_map.toString();
|
228
|
+
var url = options.sourceMap.url;
|
229
|
+
if (url) {
|
230
|
+
result.code = result.code.replace(/\n\/\/# sourceMappingURL=\S+\s*$/, "");
|
231
|
+
if (url == "inline") {
|
232
|
+
result.code += "\n//# sourceMappingURL=data:application/json;charset=utf-8;base64," + to_base64(result.map);
|
233
|
+
} else {
|
234
|
+
result.code += "\n//# sourceMappingURL=" + url;
|
235
|
+
}
|
236
|
+
}
|
237
|
+
}
|
238
|
+
}
|
239
|
+
if (options.nameCache && options.mangle) {
|
240
|
+
if (options.mangle.cache) options.nameCache.vars = to_json(options.mangle.cache);
|
241
|
+
if (options.mangle.properties && options.mangle.properties.cache) {
|
242
|
+
options.nameCache.props = to_json(options.mangle.properties.cache);
|
243
|
+
}
|
244
|
+
}
|
245
|
+
if (timings) {
|
246
|
+
timings.end = Date.now();
|
247
|
+
result.timings = {
|
248
|
+
parse: 1e-3 * (timings.rename - timings.parse),
|
249
|
+
rename: 1e-3 * (timings.compress - timings.rename),
|
250
|
+
compress: 1e-3 * (timings.scope - timings.compress),
|
251
|
+
scope: 1e-3 * (timings.mangle - timings.scope),
|
252
|
+
mangle: 1e-3 * (timings.properties - timings.mangle),
|
253
|
+
properties: 1e-3 * (timings.output - timings.properties),
|
254
|
+
output: 1e-3 * (timings.end - timings.output),
|
255
|
+
total: 1e-3 * (timings.end - timings.start)
|
256
|
+
};
|
257
|
+
}
|
258
|
+
if (warnings.length) {
|
259
|
+
result.warnings = warnings;
|
260
|
+
}
|
261
|
+
return result;
|
262
|
+
} catch (ex) {
|
263
|
+
return { error: ex };
|
264
|
+
} finally {
|
265
|
+
AST_Node.log_function();
|
266
|
+
AST_Node.disable_validation();
|
267
|
+
}
|
268
|
+
}
|