crabatool 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (625) hide show
  1. package/index.js +23 -2
  2. package/ngp/config.js +2 -2
  3. package/ngp/node_modules/.bin/mime +12 -0
  4. package/ngp/node_modules/.bin/mime.cmd +17 -0
  5. package/ngp/node_modules/.bin/mime.ps1 +28 -0
  6. package/ngp/node_modules/.bin/uglifyjs +12 -0
  7. package/ngp/node_modules/.bin/uglifyjs.cmd +17 -0
  8. package/ngp/node_modules/.bin/uglifyjs.ps1 +28 -0
  9. package/ngp/node_modules/.package-lock.json +863 -0
  10. package/ngp/node_modules/accepts/HISTORY.md +243 -0
  11. package/ngp/node_modules/accepts/LICENSE +23 -0
  12. package/ngp/node_modules/accepts/README.md +140 -0
  13. package/ngp/node_modules/accepts/index.js +238 -0
  14. package/ngp/node_modules/accepts/package.json +47 -0
  15. package/ngp/node_modules/anymatch/LICENSE +15 -0
  16. package/ngp/node_modules/anymatch/README.md +87 -0
  17. package/ngp/node_modules/anymatch/index.d.ts +19 -0
  18. package/ngp/node_modules/anymatch/index.js +104 -0
  19. package/ngp/node_modules/anymatch/package.json +48 -0
  20. package/ngp/node_modules/array-flatten/LICENSE +21 -0
  21. package/ngp/node_modules/array-flatten/README.md +43 -0
  22. package/ngp/node_modules/array-flatten/array-flatten.js +64 -0
  23. package/ngp/node_modules/array-flatten/package.json +39 -0
  24. package/ngp/node_modules/binary-extensions/binary-extensions.json +260 -0
  25. package/ngp/node_modules/binary-extensions/binary-extensions.json.d.ts +3 -0
  26. package/ngp/node_modules/binary-extensions/index.d.ts +14 -0
  27. package/ngp/node_modules/binary-extensions/index.js +1 -0
  28. package/ngp/node_modules/binary-extensions/license +9 -0
  29. package/ngp/node_modules/binary-extensions/package.json +38 -0
  30. package/ngp/node_modules/binary-extensions/readme.md +41 -0
  31. package/ngp/node_modules/body-parser/HISTORY.md +651 -0
  32. package/ngp/node_modules/body-parser/LICENSE +23 -0
  33. package/ngp/node_modules/body-parser/README.md +464 -0
  34. package/ngp/node_modules/body-parser/SECURITY.md +25 -0
  35. package/ngp/node_modules/body-parser/index.js +157 -0
  36. package/ngp/node_modules/body-parser/lib/read.js +205 -0
  37. package/ngp/node_modules/body-parser/lib/types/json.js +236 -0
  38. package/ngp/node_modules/body-parser/lib/types/raw.js +101 -0
  39. package/ngp/node_modules/body-parser/lib/types/text.js +121 -0
  40. package/ngp/node_modules/body-parser/lib/types/urlencoded.js +284 -0
  41. package/ngp/node_modules/body-parser/node_modules/bytes/History.md +97 -0
  42. package/ngp/node_modules/body-parser/node_modules/bytes/LICENSE +23 -0
  43. package/ngp/node_modules/body-parser/node_modules/bytes/Readme.md +152 -0
  44. package/ngp/node_modules/body-parser/node_modules/bytes/index.js +170 -0
  45. package/ngp/node_modules/body-parser/node_modules/bytes/package.json +42 -0
  46. package/ngp/node_modules/body-parser/node_modules/iconv-lite/Changelog.md +162 -0
  47. package/ngp/node_modules/body-parser/node_modules/iconv-lite/LICENSE +21 -0
  48. package/ngp/node_modules/body-parser/node_modules/iconv-lite/README.md +156 -0
  49. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/dbcs-codec.js +555 -0
  50. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/dbcs-data.js +176 -0
  51. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/index.js +22 -0
  52. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/internal.js +188 -0
  53. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
  54. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  55. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/sbcs-data.js +174 -0
  56. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  57. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  58. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  59. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  60. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  61. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  62. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/gbk-added.json +55 -0
  63. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  64. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/utf16.js +177 -0
  65. package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/utf7.js +290 -0
  66. package/ngp/node_modules/body-parser/node_modules/iconv-lite/lib/bom-handling.js +52 -0
  67. package/ngp/node_modules/body-parser/node_modules/iconv-lite/lib/extend-node.js +217 -0
  68. package/ngp/node_modules/body-parser/node_modules/iconv-lite/lib/index.d.ts +24 -0
  69. package/ngp/node_modules/body-parser/node_modules/iconv-lite/lib/index.js +153 -0
  70. package/ngp/node_modules/body-parser/node_modules/iconv-lite/lib/streams.js +121 -0
  71. package/ngp/node_modules/body-parser/node_modules/iconv-lite/package.json +46 -0
  72. package/ngp/node_modules/body-parser/package.json +56 -0
  73. package/ngp/node_modules/braces/CHANGELOG.md +184 -0
  74. package/ngp/node_modules/braces/LICENSE +21 -0
  75. package/ngp/node_modules/braces/README.md +593 -0
  76. package/ngp/node_modules/braces/index.js +170 -0
  77. package/ngp/node_modules/braces/lib/compile.js +57 -0
  78. package/ngp/node_modules/braces/lib/constants.js +57 -0
  79. package/ngp/node_modules/braces/lib/expand.js +113 -0
  80. package/ngp/node_modules/braces/lib/parse.js +333 -0
  81. package/ngp/node_modules/braces/lib/stringify.js +32 -0
  82. package/ngp/node_modules/braces/lib/utils.js +112 -0
  83. package/ngp/node_modules/braces/package.json +77 -0
  84. package/ngp/node_modules/bytes/History.md +82 -0
  85. package/ngp/node_modules/bytes/LICENSE +23 -0
  86. package/ngp/node_modules/bytes/Readme.md +125 -0
  87. package/ngp/node_modules/bytes/index.js +159 -0
  88. package/ngp/node_modules/bytes/package.json +39 -0
  89. package/ngp/node_modules/call-bind/.eslintignore +1 -0
  90. package/ngp/node_modules/call-bind/.eslintrc +17 -0
  91. package/ngp/node_modules/call-bind/.github/FUNDING.yml +12 -0
  92. package/ngp/node_modules/call-bind/.nycrc +13 -0
  93. package/ngp/node_modules/call-bind/CHANGELOG.md +42 -0
  94. package/ngp/node_modules/call-bind/LICENSE +21 -0
  95. package/ngp/node_modules/call-bind/README.md +2 -0
  96. package/ngp/node_modules/call-bind/callBound.js +15 -0
  97. package/ngp/node_modules/call-bind/index.js +47 -0
  98. package/ngp/node_modules/call-bind/package.json +80 -0
  99. package/ngp/node_modules/call-bind/test/callBound.js +55 -0
  100. package/ngp/node_modules/call-bind/test/index.js +66 -0
  101. package/ngp/node_modules/chokidar/LICENSE +21 -0
  102. package/ngp/node_modules/chokidar/README.md +308 -0
  103. package/ngp/node_modules/chokidar/index.js +973 -0
  104. package/ngp/node_modules/chokidar/lib/constants.js +65 -0
  105. package/ngp/node_modules/chokidar/lib/fsevents-handler.js +524 -0
  106. package/ngp/node_modules/chokidar/lib/nodefs-handler.js +654 -0
  107. package/ngp/node_modules/chokidar/package.json +85 -0
  108. package/ngp/node_modules/chokidar/types/index.d.ts +188 -0
  109. package/ngp/node_modules/compressible/HISTORY.md +111 -0
  110. package/ngp/node_modules/compressible/LICENSE +24 -0
  111. package/ngp/node_modules/compressible/README.md +61 -0
  112. package/ngp/node_modules/compressible/index.js +58 -0
  113. package/ngp/node_modules/compressible/package.json +48 -0
  114. package/ngp/node_modules/compression/HISTORY.md +307 -0
  115. package/ngp/node_modules/compression/LICENSE +23 -0
  116. package/ngp/node_modules/compression/README.md +240 -0
  117. package/ngp/node_modules/compression/index.js +288 -0
  118. package/ngp/node_modules/compression/package.json +47 -0
  119. package/ngp/node_modules/content-disposition/HISTORY.md +60 -0
  120. package/ngp/node_modules/content-disposition/LICENSE +22 -0
  121. package/ngp/node_modules/content-disposition/README.md +142 -0
  122. package/ngp/node_modules/content-disposition/index.js +458 -0
  123. package/ngp/node_modules/content-disposition/node_modules/safe-buffer/LICENSE +21 -0
  124. package/ngp/node_modules/content-disposition/node_modules/safe-buffer/README.md +584 -0
  125. package/ngp/node_modules/content-disposition/node_modules/safe-buffer/index.d.ts +187 -0
  126. package/ngp/node_modules/content-disposition/node_modules/safe-buffer/index.js +65 -0
  127. package/ngp/node_modules/content-disposition/node_modules/safe-buffer/package.json +51 -0
  128. package/ngp/node_modules/content-disposition/package.json +44 -0
  129. package/ngp/node_modules/content-type/HISTORY.md +24 -0
  130. package/ngp/node_modules/content-type/LICENSE +22 -0
  131. package/ngp/node_modules/content-type/README.md +92 -0
  132. package/ngp/node_modules/content-type/index.js +222 -0
  133. package/ngp/node_modules/content-type/package.json +40 -0
  134. package/ngp/node_modules/cookie/HISTORY.md +142 -0
  135. package/ngp/node_modules/cookie/LICENSE +24 -0
  136. package/ngp/node_modules/cookie/README.md +302 -0
  137. package/ngp/node_modules/cookie/SECURITY.md +25 -0
  138. package/ngp/node_modules/cookie/index.js +270 -0
  139. package/ngp/node_modules/cookie/package.json +44 -0
  140. package/ngp/node_modules/cookie-signature/History.md +38 -0
  141. package/ngp/node_modules/cookie-signature/Readme.md +42 -0
  142. package/ngp/node_modules/cookie-signature/index.js +51 -0
  143. package/ngp/node_modules/cookie-signature/package.json +18 -0
  144. package/ngp/node_modules/crabatool/index.js +28 -0
  145. package/ngp/node_modules/crabatool/ngp/config.js +25 -0
  146. package/ngp/node_modules/crabatool/ngp/ngp.js +3 -0
  147. package/ngp/node_modules/crabatool/ngp/package.json +15 -0
  148. package/ngp/node_modules/crabatool/ngp/readme.md +4 -0
  149. package/ngp/node_modules/crabatool/package.json +25 -0
  150. package/ngp/node_modules/crabatool/readme.md +12 -0
  151. package/ngp/node_modules/crabatool/server.js +124 -0
  152. package/ngp/node_modules/debug/.coveralls.yml +1 -0
  153. package/ngp/node_modules/debug/.eslintrc +11 -0
  154. package/ngp/node_modules/debug/.travis.yml +14 -0
  155. package/ngp/node_modules/debug/CHANGELOG.md +362 -0
  156. package/ngp/node_modules/debug/LICENSE +19 -0
  157. package/ngp/node_modules/debug/Makefile +50 -0
  158. package/ngp/node_modules/debug/README.md +312 -0
  159. package/ngp/node_modules/debug/component.json +19 -0
  160. package/ngp/node_modules/debug/karma.conf.js +70 -0
  161. package/ngp/node_modules/debug/node.js +1 -0
  162. package/ngp/node_modules/debug/package.json +49 -0
  163. package/ngp/node_modules/debug/src/browser.js +185 -0
  164. package/ngp/node_modules/debug/src/debug.js +202 -0
  165. package/ngp/node_modules/debug/src/index.js +10 -0
  166. package/ngp/node_modules/debug/src/inspector-log.js +15 -0
  167. package/ngp/node_modules/debug/src/node.js +248 -0
  168. package/ngp/node_modules/depd/History.md +103 -0
  169. package/ngp/node_modules/depd/LICENSE +22 -0
  170. package/ngp/node_modules/depd/Readme.md +280 -0
  171. package/ngp/node_modules/depd/index.js +538 -0
  172. package/ngp/node_modules/depd/lib/browser/index.js +77 -0
  173. package/ngp/node_modules/depd/package.json +45 -0
  174. package/ngp/node_modules/destroy/LICENSE +23 -0
  175. package/ngp/node_modules/destroy/README.md +63 -0
  176. package/ngp/node_modules/destroy/index.js +209 -0
  177. package/ngp/node_modules/destroy/package.json +48 -0
  178. package/ngp/node_modules/ee-first/LICENSE +22 -0
  179. package/ngp/node_modules/ee-first/README.md +80 -0
  180. package/ngp/node_modules/ee-first/index.js +95 -0
  181. package/ngp/node_modules/ee-first/package.json +29 -0
  182. package/ngp/node_modules/encodeurl/HISTORY.md +14 -0
  183. package/ngp/node_modules/encodeurl/LICENSE +22 -0
  184. package/ngp/node_modules/encodeurl/README.md +128 -0
  185. package/ngp/node_modules/encodeurl/index.js +60 -0
  186. package/ngp/node_modules/encodeurl/package.json +40 -0
  187. package/ngp/node_modules/escape-html/LICENSE +24 -0
  188. package/ngp/node_modules/escape-html/Readme.md +43 -0
  189. package/ngp/node_modules/escape-html/index.js +78 -0
  190. package/ngp/node_modules/escape-html/package.json +24 -0
  191. package/ngp/node_modules/etag/HISTORY.md +83 -0
  192. package/ngp/node_modules/etag/LICENSE +22 -0
  193. package/ngp/node_modules/etag/README.md +159 -0
  194. package/ngp/node_modules/etag/index.js +131 -0
  195. package/ngp/node_modules/etag/package.json +47 -0
  196. package/ngp/node_modules/express/History.md +3579 -0
  197. package/ngp/node_modules/express/LICENSE +24 -0
  198. package/ngp/node_modules/express/Readme.md +166 -0
  199. package/ngp/node_modules/express/index.js +11 -0
  200. package/ngp/node_modules/express/lib/application.js +661 -0
  201. package/ngp/node_modules/express/lib/express.js +116 -0
  202. package/ngp/node_modules/express/lib/middleware/init.js +43 -0
  203. package/ngp/node_modules/express/lib/middleware/query.js +47 -0
  204. package/ngp/node_modules/express/lib/request.js +525 -0
  205. package/ngp/node_modules/express/lib/response.js +1169 -0
  206. package/ngp/node_modules/express/lib/router/index.js +673 -0
  207. package/ngp/node_modules/express/lib/router/layer.js +181 -0
  208. package/ngp/node_modules/express/lib/router/route.js +225 -0
  209. package/ngp/node_modules/express/lib/utils.js +304 -0
  210. package/ngp/node_modules/express/lib/view.js +182 -0
  211. package/ngp/node_modules/express/node_modules/safe-buffer/LICENSE +21 -0
  212. package/ngp/node_modules/express/node_modules/safe-buffer/README.md +584 -0
  213. package/ngp/node_modules/express/node_modules/safe-buffer/index.d.ts +187 -0
  214. package/ngp/node_modules/express/node_modules/safe-buffer/index.js +65 -0
  215. package/ngp/node_modules/express/node_modules/safe-buffer/package.json +51 -0
  216. package/ngp/node_modules/express/package.json +99 -0
  217. package/ngp/node_modules/fill-range/LICENSE +21 -0
  218. package/ngp/node_modules/fill-range/README.md +237 -0
  219. package/ngp/node_modules/fill-range/index.js +249 -0
  220. package/ngp/node_modules/fill-range/package.json +69 -0
  221. package/ngp/node_modules/finalhandler/HISTORY.md +195 -0
  222. package/ngp/node_modules/finalhandler/LICENSE +22 -0
  223. package/ngp/node_modules/finalhandler/README.md +147 -0
  224. package/ngp/node_modules/finalhandler/SECURITY.md +25 -0
  225. package/ngp/node_modules/finalhandler/index.js +336 -0
  226. package/ngp/node_modules/finalhandler/package.json +46 -0
  227. package/ngp/node_modules/forwarded/HISTORY.md +21 -0
  228. package/ngp/node_modules/forwarded/LICENSE +22 -0
  229. package/ngp/node_modules/forwarded/README.md +57 -0
  230. package/ngp/node_modules/forwarded/index.js +90 -0
  231. package/ngp/node_modules/forwarded/package.json +45 -0
  232. package/ngp/node_modules/fresh/HISTORY.md +70 -0
  233. package/ngp/node_modules/fresh/LICENSE +23 -0
  234. package/ngp/node_modules/fresh/README.md +119 -0
  235. package/ngp/node_modules/fresh/index.js +137 -0
  236. package/ngp/node_modules/fresh/package.json +46 -0
  237. package/ngp/node_modules/function-bind/.editorconfig +20 -0
  238. package/ngp/node_modules/function-bind/.eslintrc +15 -0
  239. package/ngp/node_modules/function-bind/.jscs.json +176 -0
  240. package/ngp/node_modules/function-bind/.travis.yml +168 -0
  241. package/ngp/node_modules/function-bind/LICENSE +20 -0
  242. package/ngp/node_modules/function-bind/README.md +48 -0
  243. package/ngp/node_modules/function-bind/implementation.js +52 -0
  244. package/ngp/node_modules/function-bind/index.js +5 -0
  245. package/ngp/node_modules/function-bind/package.json +63 -0
  246. package/ngp/node_modules/function-bind/test/.eslintrc +9 -0
  247. package/ngp/node_modules/function-bind/test/index.js +252 -0
  248. package/ngp/node_modules/get-intrinsic/.eslintignore +1 -0
  249. package/ngp/node_modules/get-intrinsic/.eslintrc +43 -0
  250. package/ngp/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  251. package/ngp/node_modules/get-intrinsic/.nycrc +13 -0
  252. package/ngp/node_modules/get-intrinsic/CHANGELOG.md +64 -0
  253. package/ngp/node_modules/get-intrinsic/LICENSE +21 -0
  254. package/ngp/node_modules/get-intrinsic/README.md +65 -0
  255. package/ngp/node_modules/get-intrinsic/index.js +330 -0
  256. package/ngp/node_modules/get-intrinsic/package.json +78 -0
  257. package/ngp/node_modules/get-intrinsic/test/GetIntrinsic.js +260 -0
  258. package/ngp/node_modules/glob-parent/CHANGELOG.md +110 -0
  259. package/ngp/node_modules/glob-parent/LICENSE +15 -0
  260. package/ngp/node_modules/glob-parent/README.md +137 -0
  261. package/ngp/node_modules/glob-parent/index.js +42 -0
  262. package/ngp/node_modules/glob-parent/package.json +48 -0
  263. package/ngp/node_modules/has/LICENSE-MIT +22 -0
  264. package/ngp/node_modules/has/README.md +18 -0
  265. package/ngp/node_modules/has/package.json +48 -0
  266. package/ngp/node_modules/has/src/index.js +5 -0
  267. package/ngp/node_modules/has/test/index.js +10 -0
  268. package/ngp/node_modules/has-symbols/.eslintrc +11 -0
  269. package/ngp/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  270. package/ngp/node_modules/has-symbols/.nycrc +9 -0
  271. package/ngp/node_modules/has-symbols/CHANGELOG.md +75 -0
  272. package/ngp/node_modules/has-symbols/LICENSE +21 -0
  273. package/ngp/node_modules/has-symbols/README.md +46 -0
  274. package/ngp/node_modules/has-symbols/index.js +13 -0
  275. package/ngp/node_modules/has-symbols/package.json +101 -0
  276. package/ngp/node_modules/has-symbols/shams.js +42 -0
  277. package/ngp/node_modules/has-symbols/test/index.js +22 -0
  278. package/ngp/node_modules/has-symbols/test/shams/core-js.js +28 -0
  279. package/ngp/node_modules/has-symbols/test/shams/get-own-property-symbols.js +28 -0
  280. package/ngp/node_modules/has-symbols/test/tests.js +56 -0
  281. package/ngp/node_modules/http-errors/HISTORY.md +180 -0
  282. package/ngp/node_modules/http-errors/LICENSE +23 -0
  283. package/ngp/node_modules/http-errors/README.md +169 -0
  284. package/ngp/node_modules/http-errors/index.js +289 -0
  285. package/ngp/node_modules/http-errors/package.json +50 -0
  286. package/ngp/node_modules/iconv-lite/Changelog.md +184 -0
  287. package/ngp/node_modules/iconv-lite/LICENSE +21 -0
  288. package/ngp/node_modules/iconv-lite/README.md +166 -0
  289. package/ngp/node_modules/iconv-lite/encodings/dbcs-codec.js +555 -0
  290. package/ngp/node_modules/iconv-lite/encodings/dbcs-data.js +176 -0
  291. package/ngp/node_modules/iconv-lite/encodings/index.js +23 -0
  292. package/ngp/node_modules/iconv-lite/encodings/internal.js +188 -0
  293. package/ngp/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
  294. package/ngp/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  295. package/ngp/node_modules/iconv-lite/encodings/sbcs-data.js +179 -0
  296. package/ngp/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  297. package/ngp/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  298. package/ngp/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  299. package/ngp/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  300. package/ngp/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  301. package/ngp/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  302. package/ngp/node_modules/iconv-lite/encodings/tables/gbk-added.json +55 -0
  303. package/ngp/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  304. package/ngp/node_modules/iconv-lite/encodings/utf16.js +177 -0
  305. package/ngp/node_modules/iconv-lite/encodings/utf32.js +281 -0
  306. package/ngp/node_modules/iconv-lite/encodings/utf7.js +290 -0
  307. package/ngp/node_modules/iconv-lite/lib/bom-handling.js +52 -0
  308. package/ngp/node_modules/iconv-lite/lib/extend-node.js +217 -0
  309. package/ngp/node_modules/iconv-lite/lib/index.d.ts +41 -0
  310. package/ngp/node_modules/iconv-lite/lib/index.js +153 -0
  311. package/ngp/node_modules/iconv-lite/lib/streams.js +121 -0
  312. package/ngp/node_modules/iconv-lite/package.json +45 -0
  313. package/ngp/node_modules/inherits/LICENSE +16 -0
  314. package/ngp/node_modules/inherits/README.md +42 -0
  315. package/ngp/node_modules/inherits/inherits.js +9 -0
  316. package/ngp/node_modules/inherits/inherits_browser.js +27 -0
  317. package/ngp/node_modules/inherits/package.json +29 -0
  318. package/ngp/node_modules/ipaddr.js/LICENSE +19 -0
  319. package/ngp/node_modules/ipaddr.js/README.md +233 -0
  320. package/ngp/node_modules/ipaddr.js/ipaddr.min.js +1 -0
  321. package/ngp/node_modules/ipaddr.js/lib/ipaddr.js +673 -0
  322. package/ngp/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +68 -0
  323. package/ngp/node_modules/ipaddr.js/package.json +35 -0
  324. package/ngp/node_modules/is-binary-path/index.d.ts +17 -0
  325. package/ngp/node_modules/is-binary-path/index.js +7 -0
  326. package/ngp/node_modules/is-binary-path/license +9 -0
  327. package/ngp/node_modules/is-binary-path/package.json +40 -0
  328. package/ngp/node_modules/is-binary-path/readme.md +34 -0
  329. package/ngp/node_modules/is-extglob/LICENSE +21 -0
  330. package/ngp/node_modules/is-extglob/README.md +107 -0
  331. package/ngp/node_modules/is-extglob/index.js +20 -0
  332. package/ngp/node_modules/is-extglob/package.json +69 -0
  333. package/ngp/node_modules/is-glob/LICENSE +21 -0
  334. package/ngp/node_modules/is-glob/README.md +206 -0
  335. package/ngp/node_modules/is-glob/index.js +150 -0
  336. package/ngp/node_modules/is-glob/package.json +81 -0
  337. package/ngp/node_modules/is-number/LICENSE +21 -0
  338. package/ngp/node_modules/is-number/README.md +187 -0
  339. package/ngp/node_modules/is-number/index.js +18 -0
  340. package/ngp/node_modules/is-number/package.json +82 -0
  341. package/ngp/node_modules/media-typer/HISTORY.md +22 -0
  342. package/ngp/node_modules/media-typer/LICENSE +22 -0
  343. package/ngp/node_modules/media-typer/README.md +81 -0
  344. package/ngp/node_modules/media-typer/index.js +270 -0
  345. package/ngp/node_modules/media-typer/package.json +26 -0
  346. package/ngp/node_modules/merge-descriptors/HISTORY.md +21 -0
  347. package/ngp/node_modules/merge-descriptors/LICENSE +23 -0
  348. package/ngp/node_modules/merge-descriptors/README.md +48 -0
  349. package/ngp/node_modules/merge-descriptors/index.js +60 -0
  350. package/ngp/node_modules/merge-descriptors/package.json +32 -0
  351. package/ngp/node_modules/methods/HISTORY.md +29 -0
  352. package/ngp/node_modules/methods/LICENSE +24 -0
  353. package/ngp/node_modules/methods/README.md +51 -0
  354. package/ngp/node_modules/methods/index.js +69 -0
  355. package/ngp/node_modules/methods/package.json +36 -0
  356. package/ngp/node_modules/mime/CHANGELOG.md +164 -0
  357. package/ngp/node_modules/mime/LICENSE +21 -0
  358. package/ngp/node_modules/mime/README.md +90 -0
  359. package/ngp/node_modules/mime/cli.js +8 -0
  360. package/ngp/node_modules/mime/mime.js +108 -0
  361. package/ngp/node_modules/mime/package.json +44 -0
  362. package/ngp/node_modules/mime/src/build.js +53 -0
  363. package/ngp/node_modules/mime/src/test.js +60 -0
  364. package/ngp/node_modules/mime/types.json +1 -0
  365. package/ngp/node_modules/mime-db/HISTORY.md +507 -0
  366. package/ngp/node_modules/mime-db/LICENSE +23 -0
  367. package/ngp/node_modules/mime-db/README.md +100 -0
  368. package/ngp/node_modules/mime-db/db.json +8519 -0
  369. package/ngp/node_modules/mime-db/index.js +12 -0
  370. package/ngp/node_modules/mime-db/package.json +60 -0
  371. package/ngp/node_modules/mime-types/HISTORY.md +397 -0
  372. package/ngp/node_modules/mime-types/LICENSE +23 -0
  373. package/ngp/node_modules/mime-types/README.md +113 -0
  374. package/ngp/node_modules/mime-types/index.js +188 -0
  375. package/ngp/node_modules/mime-types/package.json +44 -0
  376. package/ngp/node_modules/ms/index.js +152 -0
  377. package/ngp/node_modules/ms/license.md +21 -0
  378. package/ngp/node_modules/ms/package.json +37 -0
  379. package/ngp/node_modules/ms/readme.md +51 -0
  380. package/ngp/node_modules/negotiator/HISTORY.md +108 -0
  381. package/ngp/node_modules/negotiator/LICENSE +24 -0
  382. package/ngp/node_modules/negotiator/README.md +203 -0
  383. package/ngp/node_modules/negotiator/index.js +82 -0
  384. package/ngp/node_modules/negotiator/lib/charset.js +169 -0
  385. package/ngp/node_modules/negotiator/lib/encoding.js +184 -0
  386. package/ngp/node_modules/negotiator/lib/language.js +179 -0
  387. package/ngp/node_modules/negotiator/lib/mediaType.js +294 -0
  388. package/ngp/node_modules/negotiator/package.json +42 -0
  389. package/ngp/node_modules/normalize-path/LICENSE +21 -0
  390. package/ngp/node_modules/normalize-path/README.md +127 -0
  391. package/ngp/node_modules/normalize-path/index.js +35 -0
  392. package/ngp/node_modules/normalize-path/package.json +77 -0
  393. package/ngp/node_modules/object-inspect/.eslintrc +53 -0
  394. package/ngp/node_modules/object-inspect/.github/FUNDING.yml +12 -0
  395. package/ngp/node_modules/object-inspect/.nycrc +13 -0
  396. package/ngp/node_modules/object-inspect/CHANGELOG.md +360 -0
  397. package/ngp/node_modules/object-inspect/LICENSE +21 -0
  398. package/ngp/node_modules/object-inspect/example/all.js +23 -0
  399. package/ngp/node_modules/object-inspect/example/circular.js +6 -0
  400. package/ngp/node_modules/object-inspect/example/fn.js +5 -0
  401. package/ngp/node_modules/object-inspect/example/inspect.js +10 -0
  402. package/ngp/node_modules/object-inspect/index.js +512 -0
  403. package/ngp/node_modules/object-inspect/package-support.json +20 -0
  404. package/ngp/node_modules/object-inspect/package.json +94 -0
  405. package/ngp/node_modules/object-inspect/readme.markdown +86 -0
  406. package/ngp/node_modules/object-inspect/test/bigint.js +58 -0
  407. package/ngp/node_modules/object-inspect/test/browser/dom.js +15 -0
  408. package/ngp/node_modules/object-inspect/test/circular.js +16 -0
  409. package/ngp/node_modules/object-inspect/test/deep.js +12 -0
  410. package/ngp/node_modules/object-inspect/test/element.js +53 -0
  411. package/ngp/node_modules/object-inspect/test/err.js +48 -0
  412. package/ngp/node_modules/object-inspect/test/fakes.js +29 -0
  413. package/ngp/node_modules/object-inspect/test/fn.js +76 -0
  414. package/ngp/node_modules/object-inspect/test/has.js +15 -0
  415. package/ngp/node_modules/object-inspect/test/holes.js +15 -0
  416. package/ngp/node_modules/object-inspect/test/indent-option.js +271 -0
  417. package/ngp/node_modules/object-inspect/test/inspect.js +139 -0
  418. package/ngp/node_modules/object-inspect/test/lowbyte.js +12 -0
  419. package/ngp/node_modules/object-inspect/test/number.js +58 -0
  420. package/ngp/node_modules/object-inspect/test/quoteStyle.js +17 -0
  421. package/ngp/node_modules/object-inspect/test/toStringTag.js +40 -0
  422. package/ngp/node_modules/object-inspect/test/undef.js +12 -0
  423. package/ngp/node_modules/object-inspect/test/values.js +211 -0
  424. package/ngp/node_modules/object-inspect/test-core-js.js +26 -0
  425. package/ngp/node_modules/object-inspect/util.inspect.js +1 -0
  426. package/ngp/node_modules/on-finished/HISTORY.md +98 -0
  427. package/ngp/node_modules/on-finished/LICENSE +23 -0
  428. package/ngp/node_modules/on-finished/README.md +162 -0
  429. package/ngp/node_modules/on-finished/index.js +234 -0
  430. package/ngp/node_modules/on-finished/package.json +39 -0
  431. package/ngp/node_modules/on-headers/HISTORY.md +21 -0
  432. package/ngp/node_modules/on-headers/LICENSE +22 -0
  433. package/ngp/node_modules/on-headers/README.md +81 -0
  434. package/ngp/node_modules/on-headers/index.js +132 -0
  435. package/ngp/node_modules/on-headers/package.json +42 -0
  436. package/ngp/node_modules/parseurl/HISTORY.md +58 -0
  437. package/ngp/node_modules/parseurl/LICENSE +24 -0
  438. package/ngp/node_modules/parseurl/README.md +133 -0
  439. package/ngp/node_modules/parseurl/index.js +158 -0
  440. package/ngp/node_modules/parseurl/package.json +40 -0
  441. package/ngp/node_modules/path-to-regexp/History.md +36 -0
  442. package/ngp/node_modules/path-to-regexp/LICENSE +21 -0
  443. package/ngp/node_modules/path-to-regexp/Readme.md +35 -0
  444. package/ngp/node_modules/path-to-regexp/index.js +129 -0
  445. package/ngp/node_modules/path-to-regexp/package.json +30 -0
  446. package/ngp/node_modules/picomatch/CHANGELOG.md +136 -0
  447. package/ngp/node_modules/picomatch/LICENSE +21 -0
  448. package/ngp/node_modules/picomatch/README.md +708 -0
  449. package/ngp/node_modules/picomatch/index.js +3 -0
  450. package/ngp/node_modules/picomatch/lib/constants.js +179 -0
  451. package/ngp/node_modules/picomatch/lib/parse.js +1091 -0
  452. package/ngp/node_modules/picomatch/lib/picomatch.js +342 -0
  453. package/ngp/node_modules/picomatch/lib/scan.js +391 -0
  454. package/ngp/node_modules/picomatch/lib/utils.js +64 -0
  455. package/ngp/node_modules/picomatch/package.json +81 -0
  456. package/ngp/node_modules/proxy-addr/HISTORY.md +161 -0
  457. package/ngp/node_modules/proxy-addr/LICENSE +22 -0
  458. package/ngp/node_modules/proxy-addr/README.md +139 -0
  459. package/ngp/node_modules/proxy-addr/index.js +327 -0
  460. package/ngp/node_modules/proxy-addr/package.json +47 -0
  461. package/ngp/node_modules/qs/.editorconfig +40 -0
  462. package/ngp/node_modules/qs/.eslintrc +38 -0
  463. package/ngp/node_modules/qs/.github/FUNDING.yml +12 -0
  464. package/ngp/node_modules/qs/.nycrc +13 -0
  465. package/ngp/node_modules/qs/CHANGELOG.md +388 -0
  466. package/ngp/node_modules/qs/LICENSE.md +29 -0
  467. package/ngp/node_modules/qs/README.md +623 -0
  468. package/ngp/node_modules/qs/dist/qs.js +2044 -0
  469. package/ngp/node_modules/qs/lib/formats.js +23 -0
  470. package/ngp/node_modules/qs/lib/index.js +11 -0
  471. package/ngp/node_modules/qs/lib/parse.js +263 -0
  472. package/ngp/node_modules/qs/lib/stringify.js +317 -0
  473. package/ngp/node_modules/qs/lib/utils.js +252 -0
  474. package/ngp/node_modules/qs/package.json +73 -0
  475. package/ngp/node_modules/qs/test/parse.js +841 -0
  476. package/ngp/node_modules/qs/test/stringify.js +865 -0
  477. package/ngp/node_modules/qs/test/utils.js +136 -0
  478. package/ngp/node_modules/range-parser/HISTORY.md +56 -0
  479. package/ngp/node_modules/range-parser/LICENSE +23 -0
  480. package/ngp/node_modules/range-parser/README.md +84 -0
  481. package/ngp/node_modules/range-parser/index.js +162 -0
  482. package/ngp/node_modules/range-parser/package.json +44 -0
  483. package/ngp/node_modules/raw-body/HISTORY.md +303 -0
  484. package/ngp/node_modules/raw-body/LICENSE +22 -0
  485. package/ngp/node_modules/raw-body/README.md +223 -0
  486. package/ngp/node_modules/raw-body/SECURITY.md +24 -0
  487. package/ngp/node_modules/raw-body/index.d.ts +87 -0
  488. package/ngp/node_modules/raw-body/index.js +329 -0
  489. package/ngp/node_modules/raw-body/node_modules/bytes/History.md +97 -0
  490. package/ngp/node_modules/raw-body/node_modules/bytes/LICENSE +23 -0
  491. package/ngp/node_modules/raw-body/node_modules/bytes/Readme.md +152 -0
  492. package/ngp/node_modules/raw-body/node_modules/bytes/index.js +170 -0
  493. package/ngp/node_modules/raw-body/node_modules/bytes/package.json +42 -0
  494. package/ngp/node_modules/raw-body/node_modules/iconv-lite/Changelog.md +162 -0
  495. package/ngp/node_modules/raw-body/node_modules/iconv-lite/LICENSE +21 -0
  496. package/ngp/node_modules/raw-body/node_modules/iconv-lite/README.md +156 -0
  497. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/dbcs-codec.js +555 -0
  498. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/dbcs-data.js +176 -0
  499. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/index.js +22 -0
  500. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/internal.js +188 -0
  501. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
  502. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  503. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/sbcs-data.js +174 -0
  504. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  505. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  506. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  507. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  508. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  509. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  510. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/gbk-added.json +55 -0
  511. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  512. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/utf16.js +177 -0
  513. package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/utf7.js +290 -0
  514. package/ngp/node_modules/raw-body/node_modules/iconv-lite/lib/bom-handling.js +52 -0
  515. package/ngp/node_modules/raw-body/node_modules/iconv-lite/lib/extend-node.js +217 -0
  516. package/ngp/node_modules/raw-body/node_modules/iconv-lite/lib/index.d.ts +24 -0
  517. package/ngp/node_modules/raw-body/node_modules/iconv-lite/lib/index.js +153 -0
  518. package/ngp/node_modules/raw-body/node_modules/iconv-lite/lib/streams.js +121 -0
  519. package/ngp/node_modules/raw-body/node_modules/iconv-lite/package.json +46 -0
  520. package/ngp/node_modules/raw-body/package.json +49 -0
  521. package/ngp/node_modules/readdirp/LICENSE +21 -0
  522. package/ngp/node_modules/readdirp/README.md +122 -0
  523. package/ngp/node_modules/readdirp/index.d.ts +43 -0
  524. package/ngp/node_modules/readdirp/index.js +287 -0
  525. package/ngp/node_modules/readdirp/package.json +122 -0
  526. package/ngp/node_modules/safe-buffer/LICENSE +21 -0
  527. package/ngp/node_modules/safe-buffer/README.md +584 -0
  528. package/ngp/node_modules/safe-buffer/index.d.ts +187 -0
  529. package/ngp/node_modules/safe-buffer/index.js +62 -0
  530. package/ngp/node_modules/safe-buffer/package.json +37 -0
  531. package/ngp/node_modules/safer-buffer/LICENSE +21 -0
  532. package/ngp/node_modules/safer-buffer/Porting-Buffer.md +268 -0
  533. package/ngp/node_modules/safer-buffer/Readme.md +156 -0
  534. package/ngp/node_modules/safer-buffer/dangerous.js +58 -0
  535. package/ngp/node_modules/safer-buffer/package.json +34 -0
  536. package/ngp/node_modules/safer-buffer/safer.js +77 -0
  537. package/ngp/node_modules/safer-buffer/tests.js +406 -0
  538. package/ngp/node_modules/send/HISTORY.md +521 -0
  539. package/ngp/node_modules/send/LICENSE +23 -0
  540. package/ngp/node_modules/send/README.md +327 -0
  541. package/ngp/node_modules/send/SECURITY.md +24 -0
  542. package/ngp/node_modules/send/index.js +1143 -0
  543. package/ngp/node_modules/send/node_modules/ms/index.js +162 -0
  544. package/ngp/node_modules/send/node_modules/ms/license.md +21 -0
  545. package/ngp/node_modules/send/node_modules/ms/package.json +38 -0
  546. package/ngp/node_modules/send/node_modules/ms/readme.md +59 -0
  547. package/ngp/node_modules/send/package.json +62 -0
  548. package/ngp/node_modules/serve-static/HISTORY.md +471 -0
  549. package/ngp/node_modules/serve-static/LICENSE +25 -0
  550. package/ngp/node_modules/serve-static/README.md +257 -0
  551. package/ngp/node_modules/serve-static/index.js +210 -0
  552. package/ngp/node_modules/serve-static/package.json +42 -0
  553. package/ngp/node_modules/setprototypeof/LICENSE +13 -0
  554. package/ngp/node_modules/setprototypeof/README.md +31 -0
  555. package/ngp/node_modules/setprototypeof/index.d.ts +2 -0
  556. package/ngp/node_modules/setprototypeof/index.js +17 -0
  557. package/ngp/node_modules/setprototypeof/package.json +38 -0
  558. package/ngp/node_modules/setprototypeof/test/index.js +24 -0
  559. package/ngp/node_modules/side-channel/.eslintignore +1 -0
  560. package/ngp/node_modules/side-channel/.eslintrc +11 -0
  561. package/ngp/node_modules/side-channel/.github/FUNDING.yml +12 -0
  562. package/ngp/node_modules/side-channel/.nycrc +13 -0
  563. package/ngp/node_modules/side-channel/CHANGELOG.md +65 -0
  564. package/ngp/node_modules/side-channel/LICENSE +21 -0
  565. package/ngp/node_modules/side-channel/README.md +2 -0
  566. package/ngp/node_modules/side-channel/index.js +124 -0
  567. package/ngp/node_modules/side-channel/package.json +67 -0
  568. package/ngp/node_modules/side-channel/test/index.js +78 -0
  569. package/ngp/node_modules/statuses/HISTORY.md +82 -0
  570. package/ngp/node_modules/statuses/LICENSE +23 -0
  571. package/ngp/node_modules/statuses/README.md +136 -0
  572. package/ngp/node_modules/statuses/codes.json +65 -0
  573. package/ngp/node_modules/statuses/index.js +146 -0
  574. package/ngp/node_modules/statuses/package.json +49 -0
  575. package/ngp/node_modules/to-regex-range/LICENSE +21 -0
  576. package/ngp/node_modules/to-regex-range/README.md +305 -0
  577. package/ngp/node_modules/to-regex-range/index.js +288 -0
  578. package/ngp/node_modules/to-regex-range/package.json +88 -0
  579. package/ngp/node_modules/toidentifier/HISTORY.md +9 -0
  580. package/ngp/node_modules/toidentifier/LICENSE +21 -0
  581. package/ngp/node_modules/toidentifier/README.md +61 -0
  582. package/ngp/node_modules/toidentifier/index.js +32 -0
  583. package/ngp/node_modules/toidentifier/package.json +38 -0
  584. package/ngp/node_modules/type-is/HISTORY.md +259 -0
  585. package/ngp/node_modules/type-is/LICENSE +23 -0
  586. package/ngp/node_modules/type-is/README.md +170 -0
  587. package/ngp/node_modules/type-is/index.js +266 -0
  588. package/ngp/node_modules/type-is/package.json +45 -0
  589. package/ngp/node_modules/uglify-js/LICENSE +29 -0
  590. package/ngp/node_modules/uglify-js/README.md +1423 -0
  591. package/ngp/node_modules/uglify-js/bin/uglifyjs +603 -0
  592. package/ngp/node_modules/uglify-js/lib/ast.js +2132 -0
  593. package/ngp/node_modules/uglify-js/lib/compress.js +13762 -0
  594. package/ngp/node_modules/uglify-js/lib/minify.js +277 -0
  595. package/ngp/node_modules/uglify-js/lib/mozilla-ast.js +1274 -0
  596. package/ngp/node_modules/uglify-js/lib/output.js +1936 -0
  597. package/ngp/node_modules/uglify-js/lib/parse.js +2559 -0
  598. package/ngp/node_modules/uglify-js/lib/propmangle.js +259 -0
  599. package/ngp/node_modules/uglify-js/lib/scope.js +860 -0
  600. package/ngp/node_modules/uglify-js/lib/sourcemap.js +195 -0
  601. package/ngp/node_modules/uglify-js/lib/transform.js +250 -0
  602. package/ngp/node_modules/uglify-js/lib/utils.js +285 -0
  603. package/ngp/node_modules/uglify-js/package.json +56 -0
  604. package/ngp/node_modules/uglify-js/tools/domprops.html +456 -0
  605. package/ngp/node_modules/uglify-js/tools/domprops.json +8325 -0
  606. package/ngp/node_modules/uglify-js/tools/exports.js +8 -0
  607. package/ngp/node_modules/uglify-js/tools/node.js +110 -0
  608. package/ngp/node_modules/uglify-js/tools/tty.js +22 -0
  609. package/ngp/node_modules/unpipe/HISTORY.md +4 -0
  610. package/ngp/node_modules/unpipe/LICENSE +22 -0
  611. package/ngp/node_modules/unpipe/README.md +43 -0
  612. package/ngp/node_modules/unpipe/index.js +69 -0
  613. package/ngp/node_modules/unpipe/package.json +27 -0
  614. package/ngp/node_modules/utils-merge/LICENSE +20 -0
  615. package/ngp/node_modules/utils-merge/README.md +34 -0
  616. package/ngp/node_modules/utils-merge/index.js +23 -0
  617. package/ngp/node_modules/utils-merge/package.json +40 -0
  618. package/ngp/node_modules/vary/HISTORY.md +39 -0
  619. package/ngp/node_modules/vary/LICENSE +22 -0
  620. package/ngp/node_modules/vary/README.md +101 -0
  621. package/ngp/node_modules/vary/index.js +149 -0
  622. package/ngp/node_modules/vary/package.json +43 -0
  623. package/ngp/package-lock.json +1508 -0
  624. package/package.json +3 -2
  625. package/readme.md +0 -4
@@ -0,0 +1,1423 @@
1
+ UglifyJS 3
2
+ ==========
3
+
4
+ UglifyJS is a JavaScript parser, minifier, compressor and beautifier toolkit.
5
+
6
+ #### Note:
7
+ - `uglify-js` supports JavaScript and most language features in ECMAScript.
8
+ - For more exotic parts of ECMAScript, process your source file with transpilers
9
+ like [Babel](https://babeljs.io/) before passing onto `uglify-js`.
10
+ - `uglify-js@3` has a simplified [API](#api-reference) and [CLI](#command-line-usage)
11
+ that is not backwards compatible with [`uglify-js@2`](https://github.com/mishoo/UglifyJS/tree/v2.x).
12
+
13
+ Install
14
+ -------
15
+
16
+ First make sure you have installed the latest version of [node.js](http://nodejs.org/)
17
+ (You may need to restart your computer after this step).
18
+
19
+ From NPM for use as a command line app:
20
+
21
+ npm install uglify-js -g
22
+
23
+ From NPM for programmatic use:
24
+
25
+ npm install uglify-js
26
+
27
+ # Command line usage
28
+
29
+ uglifyjs [input files] [options]
30
+
31
+ UglifyJS can take multiple input files. It's recommended that you pass the
32
+ input files first, then pass the options. UglifyJS will parse input files
33
+ in sequence and apply any compression options. The files are parsed in the
34
+ same global scope, that is, a reference from a file to some
35
+ variable/function declared in another file will be matched properly.
36
+
37
+ If no input file is specified, UglifyJS will read from STDIN.
38
+
39
+ If you wish to pass your options before the input files, separate the two with
40
+ a double dash to prevent input files being used as option arguments:
41
+
42
+ uglifyjs --compress --mangle -- input.js
43
+
44
+ ### Command line options
45
+
46
+ ```
47
+ -h, --help Print usage information.
48
+ `--help options` for details on available options.
49
+ -V, --version Print version number.
50
+ -p, --parse <options> Specify parser options:
51
+ `acorn` Use Acorn for parsing.
52
+ `bare_returns` Allow return outside of functions.
53
+ Useful when minifying CommonJS
54
+ modules and Userscripts that may
55
+ be anonymous function wrapped (IIFE)
56
+ by the .user.js engine `caller`.
57
+ `expression` Parse a single expression, rather than
58
+ a program (for parsing JSON).
59
+ `spidermonkey` Assume input files are SpiderMonkey
60
+ AST format (as JSON).
61
+ -c, --compress [options] Enable compressor/specify compressor options:
62
+ `pure_funcs` List of functions that can be safely
63
+ removed when their return values are
64
+ not used.
65
+ -m, --mangle [options] Mangle names/specify mangler options:
66
+ `reserved` List of names that should not be mangled.
67
+ --mangle-props [options] Mangle properties/specify mangler options:
68
+ `builtins` Mangle property names that overlaps
69
+ with standard JavaScript globals.
70
+ `debug` Add debug prefix and suffix.
71
+ `domprops` Mangle property names that overlaps
72
+ with DOM properties.
73
+ `keep_quoted` Only mangle unquoted properties.
74
+ `regex` Only mangle matched property names.
75
+ `reserved` List of names that should not be mangled.
76
+ -b, --beautify [options] Beautify output/specify output options:
77
+ `beautify` Enabled with `--beautify` by default.
78
+ `preamble` Preamble to prepend to the output. You
79
+ can use this to insert a comment, for
80
+ example for licensing information.
81
+ This will not be parsed, but the source
82
+ map will adjust for its presence.
83
+ `quote_style` Quote style:
84
+ 0 - auto
85
+ 1 - single
86
+ 2 - double
87
+ 3 - original
88
+ `wrap_iife` Wrap IIFEs in parentheses. Note: you may
89
+ want to disable `negate_iife` under
90
+ compressor options.
91
+ -O, --output-opts [options] Specify output options (`beautify` disabled by default).
92
+ -o, --output <file> Output file path (default STDOUT). Specify `ast` or
93
+ `spidermonkey` to write UglifyJS or SpiderMonkey AST
94
+ as JSON to STDOUT respectively.
95
+ --annotations Process and preserve comment annotations.
96
+ (`/*@__PURE__*/` or `/*#__PURE__*/`)
97
+ --no-annotations Ignore and discard comment annotations.
98
+ --comments [filter] Preserve copyright comments in the output. By
99
+ default this works like Google Closure, keeping
100
+ JSDoc-style comments that contain "@license" or
101
+ "@preserve". You can optionally pass one of the
102
+ following arguments to this flag:
103
+ - "all" to keep all comments
104
+ - a valid JS RegExp like `/foo/` or `/^!/` to
105
+ keep only matching comments.
106
+ Note that currently not *all* comments can be
107
+ kept when compression is on, because of dead
108
+ code removal or cascading statements into
109
+ sequences.
110
+ --config-file <file> Read `minify()` options from JSON file.
111
+ -d, --define <expr>[=value] Global definitions.
112
+ -e, --enclose [arg[:value]] Embed everything in a big function, with configurable
113
+ argument(s) & value(s).
114
+ --ie Support non-standard Internet Explorer.
115
+ Equivalent to setting `ie: true` in `minify()`
116
+ for `compress`, `mangle` and `output` options.
117
+ By default UglifyJS will not try to be IE-proof.
118
+ --keep-fargs Do not mangle/drop function arguments.
119
+ --keep-fnames Do not mangle/drop function names. Useful for
120
+ code relying on Function.prototype.name.
121
+ --module Process input as ES module (implies --toplevel)
122
+ --name-cache <file> File to hold mangled name mappings.
123
+ --self Build UglifyJS as a library (implies --wrap UglifyJS)
124
+ --source-map [options] Enable source map/specify source map options:
125
+ `base` Path to compute relative paths from input files.
126
+ `content` Input source map, useful if you're compressing
127
+ JS that was generated from some other original
128
+ code. Specify "inline" if the source map is
129
+ included within the sources.
130
+ `filename` Filename and/or location of the output source
131
+ (sets `file` attribute in source map).
132
+ `includeSources` Pass this flag if you want to include
133
+ the content of source files in the
134
+ source map as sourcesContent property.
135
+ `names` Include symbol names in the source map.
136
+ `root` Path to the original source to be included in
137
+ the source map.
138
+ `url` If specified, path to the source map to append in
139
+ `//# sourceMappingURL`.
140
+ --timings Display operations run time on STDERR.
141
+ --toplevel Compress and/or mangle variables in top level scope.
142
+ --v8 Support non-standard Chrome & Node.js
143
+ Equivalent to setting `v8: true` in `minify()`
144
+ for `mangle` and `output` options.
145
+ By default UglifyJS will not try to be v8-proof.
146
+ --verbose Print diagnostic messages.
147
+ --warn Print warning messages.
148
+ --webkit Support non-standard Safari/Webkit.
149
+ Equivalent to setting `webkit: true` in `minify()`
150
+ for `compress`, `mangle` and `output` options.
151
+ By default UglifyJS will not try to be Safari-proof.
152
+ --wrap <name> Embed everything in a big function, making the
153
+ “exports” and “global” variables available. You
154
+ need to pass an argument to this option to
155
+ specify the name that your module will take
156
+ when included in, say, a browser.
157
+ ```
158
+
159
+ Specify `--output` (`-o`) to declare the output file. Otherwise the output
160
+ goes to STDOUT.
161
+
162
+ ## CLI source map options
163
+
164
+ UglifyJS can generate a source map file, which is highly useful for
165
+ debugging your compressed JavaScript. To get a source map, pass
166
+ `--source-map --output output.js` (source map will be written out to
167
+ `output.js.map`).
168
+
169
+ Additional options:
170
+
171
+ - `--source-map "filename='<NAME>'"` to specify the name of the source map. The value of
172
+ `filename` is only used to set `file` attribute (see [the spec][sm-spec])
173
+ in source map file.
174
+
175
+ - `--source-map "root='<URL>'"` to pass the URL where the original files can be found.
176
+
177
+ - `--source-map "names=false"` to omit symbol names if you want to reduce size
178
+ of the source map file.
179
+
180
+ - `--source-map "url='<URL>'"` to specify the URL where the source map can be found.
181
+ Otherwise UglifyJS assumes HTTP `X-SourceMap` is being used and will omit the
182
+ `//# sourceMappingURL=` directive.
183
+
184
+ For example:
185
+
186
+ uglifyjs js/file1.js js/file2.js \
187
+ -o foo.min.js -c -m \
188
+ --source-map "root='http://foo.com/src',url='foo.min.js.map'"
189
+
190
+ The above will compress and mangle `file1.js` and `file2.js`, will drop the
191
+ output in `foo.min.js` and the source map in `foo.min.js.map`. The source
192
+ mapping will refer to `http://foo.com/src/js/file1.js` and
193
+ `http://foo.com/src/js/file2.js` (in fact it will list `http://foo.com/src`
194
+ as the source map root, and the original files as `js/file1.js` and
195
+ `js/file2.js`).
196
+
197
+ ### Composed source map
198
+
199
+ When you're compressing JS code that was output by a compiler such as
200
+ CoffeeScript, mapping to the JS code won't be too helpful. Instead, you'd
201
+ like to map back to the original code (i.e. CoffeeScript). UglifyJS has an
202
+ option to take an input source map. Assuming you have a mapping from
203
+ CoffeeScript → compiled JS, UglifyJS can generate a map from CoffeeScript →
204
+ compressed JS by mapping every token in the compiled JS to its original
205
+ location.
206
+
207
+ To use this feature pass `--source-map "content='/path/to/input/source.map'"`
208
+ or `--source-map "content=inline"` if the source map is included inline with
209
+ the sources.
210
+
211
+ ## CLI compress options
212
+
213
+ You need to pass `--compress` (`-c`) to enable the compressor. Optionally
214
+ you can pass a comma-separated list of [compress options](#compress-options).
215
+
216
+ Options are in the form `foo=bar`, or just `foo` (the latter implies
217
+ a boolean option that you want to set `true`; it's effectively a
218
+ shortcut for `foo=true`).
219
+
220
+ Example:
221
+
222
+ uglifyjs file.js -c toplevel,sequences=false
223
+
224
+ ## CLI mangle options
225
+
226
+ To enable the mangler you need to pass `--mangle` (`-m`). The following
227
+ (comma-separated) options are supported:
228
+
229
+ - `eval` (default: `false`) — mangle names visible in scopes where `eval` or
230
+ `with` are used.
231
+
232
+ - `reserved` (default: `[]`) — when mangling is enabled but you want to
233
+ prevent certain names from being mangled, you can declare those names with
234
+ `--mangle reserved` — pass a comma-separated list of names. For example:
235
+
236
+ uglifyjs ... -m reserved=['$','require','exports']
237
+
238
+ to prevent the `require`, `exports` and `$` names from being changed.
239
+
240
+ ### CLI mangling property names (`--mangle-props`)
241
+
242
+ **Note:** THIS WILL PROBABLY BREAK YOUR CODE. Mangling property names
243
+ is a separate step, different from variable name mangling. Pass
244
+ `--mangle-props` to enable it. It will mangle all properties in the
245
+ input code with the exception of built in DOM properties and properties
246
+ in core JavaScript classes. For example:
247
+
248
+ ```javascript
249
+ // example.js
250
+ var x = {
251
+ baz_: 0,
252
+ foo_: 1,
253
+ calc: function() {
254
+ return this.foo_ + this.baz_;
255
+ }
256
+ };
257
+ x.bar_ = 2;
258
+ x["baz_"] = 3;
259
+ console.log(x.calc());
260
+ ```
261
+ Mangle all properties (except for JavaScript `builtins`):
262
+ ```bash
263
+ $ uglifyjs example.js -c -m --mangle-props
264
+ ```
265
+ ```javascript
266
+ var x={o:0,_:1,l:function(){return this._+this.o}};x.t=2,x.o=3,console.log(x.l());
267
+ ```
268
+ Mangle all properties except for `reserved` properties:
269
+ ```bash
270
+ $ uglifyjs example.js -c -m --mangle-props reserved=[foo_,bar_]
271
+ ```
272
+ ```javascript
273
+ var x={o:0,foo_:1,_:function(){return this.foo_+this.o}};x.bar_=2,x.o=3,console.log(x._());
274
+ ```
275
+ Mangle all properties matching a `regex`:
276
+ ```bash
277
+ $ uglifyjs example.js -c -m --mangle-props regex=/_$/
278
+ ```
279
+ ```javascript
280
+ var x={o:0,_:1,calc:function(){return this._+this.o}};x.l=2,x.o=3,console.log(x.calc());
281
+ ```
282
+
283
+ Combining mangle properties options:
284
+ ```bash
285
+ $ uglifyjs example.js -c -m --mangle-props regex=/_$/,reserved=[bar_]
286
+ ```
287
+ ```javascript
288
+ var x={o:0,_:1,calc:function(){return this._+this.o}};x.bar_=2,x.o=3,console.log(x.calc());
289
+ ```
290
+
291
+ In order for this to be of any use, we avoid mangling standard JS names by
292
+ default (`--mangle-props builtins` to override).
293
+
294
+ A default exclusion file is provided in `tools/domprops.json` which should
295
+ cover most standard JS and DOM properties defined in various browsers. Pass
296
+ `--mangle-props domprops` to disable this feature.
297
+
298
+ A regular expression can be used to define which property names should be
299
+ mangled. For example, `--mangle-props regex=/^_/` will only mangle property
300
+ names that start with an underscore.
301
+
302
+ When you compress multiple files using this option, in order for them to
303
+ work together in the end we need to ensure somehow that one property gets
304
+ mangled to the same name in all of them. For this, pass `--name-cache filename.json`
305
+ and UglifyJS will maintain these mappings in a file which can then be reused.
306
+ It should be initially empty. Example:
307
+
308
+ ```bash
309
+ $ rm -f /tmp/cache.json # start fresh
310
+ $ uglifyjs file1.js file2.js --mangle-props --name-cache /tmp/cache.json -o part1.js
311
+ $ uglifyjs file3.js file4.js --mangle-props --name-cache /tmp/cache.json -o part2.js
312
+ ```
313
+
314
+ Now, `part1.js` and `part2.js` will be consistent with each other in terms
315
+ of mangled property names.
316
+
317
+ Using the name cache is not necessary if you compress all your files in a
318
+ single call to UglifyJS.
319
+
320
+ ### Mangling unquoted names (`--mangle-props keep_quoted`)
321
+
322
+ Using quoted property name (`o["foo"]`) reserves the property name (`foo`)
323
+ so that it is not mangled throughout the entire script even when used in an
324
+ unquoted style (`o.foo`). Example:
325
+
326
+ ```javascript
327
+ // stuff.js
328
+ var o = {
329
+ "foo": 1,
330
+ bar: 3
331
+ };
332
+ o.foo += o.bar;
333
+ console.log(o.foo);
334
+ ```
335
+ ```bash
336
+ $ uglifyjs stuff.js --mangle-props keep_quoted -c -m
337
+ ```
338
+ ```javascript
339
+ var o={foo:1,o:3};o.foo+=o.o,console.log(o.foo);
340
+ ```
341
+
342
+ ### Debugging property name mangling
343
+
344
+ You can also pass `--mangle-props debug` in order to mangle property names
345
+ without completely obscuring them. For example the property `o.foo`
346
+ would mangle to `o._$foo$_` with this option. This allows property mangling
347
+ of a large codebase while still being able to debug the code and identify
348
+ where mangling is breaking things.
349
+
350
+ ```bash
351
+ $ uglifyjs stuff.js --mangle-props debug -c -m
352
+ ```
353
+ ```javascript
354
+ var o={_$foo$_:1,_$bar$_:3};o._$foo$_+=o._$bar$_,console.log(o._$foo$_);
355
+ ```
356
+
357
+ You can also pass a custom suffix using `--mangle-props debug=XYZ`. This would then
358
+ mangle `o.foo` to `o._$foo$XYZ_`. You can change this each time you compile a
359
+ script to identify how a property got mangled. One technique is to pass a
360
+ random number on every compile to simulate mangling changing with different
361
+ inputs (e.g. as you update the input script with new properties), and to help
362
+ identify mistakes like writing mangled keys to storage.
363
+
364
+
365
+ # API Reference
366
+
367
+ Assuming installation via NPM, you can load UglifyJS in your application
368
+ like this:
369
+ ```javascript
370
+ var UglifyJS = require("uglify-js");
371
+ ```
372
+
373
+ There is a single high level function, **`minify(code, options)`**,
374
+ which will perform all minification [phases](#minify-options) in a configurable
375
+ manner. By default `minify()` will enable the options [`compress`](#compress-options)
376
+ and [`mangle`](#mangle-options). Example:
377
+ ```javascript
378
+ var code = "function add(first, second) { return first + second; }";
379
+ var result = UglifyJS.minify(code);
380
+ console.log(result.error); // runtime error, or `undefined` if no error
381
+ console.log(result.code); // minified output: function add(n,d){return n+d}
382
+ ```
383
+
384
+ You can `minify` more than one JavaScript file at a time by using an object
385
+ for the first argument where the keys are file names and the values are source
386
+ code:
387
+ ```javascript
388
+ var code = {
389
+ "file1.js": "function add(first, second) { return first + second; }",
390
+ "file2.js": "console.log(add(1 + 2, 3 + 4));"
391
+ };
392
+ var result = UglifyJS.minify(code);
393
+ console.log(result.code);
394
+ // function add(d,n){return d+n}console.log(add(3,7));
395
+ ```
396
+
397
+ The `toplevel` option:
398
+ ```javascript
399
+ var code = {
400
+ "file1.js": "function add(first, second) { return first + second; }",
401
+ "file2.js": "console.log(add(1 + 2, 3 + 4));"
402
+ };
403
+ var options = { toplevel: true };
404
+ var result = UglifyJS.minify(code, options);
405
+ console.log(result.code);
406
+ // console.log(3+7);
407
+ ```
408
+
409
+ The `nameCache` option:
410
+ ```javascript
411
+ var options = {
412
+ mangle: {
413
+ toplevel: true,
414
+ },
415
+ nameCache: {}
416
+ };
417
+ var result1 = UglifyJS.minify({
418
+ "file1.js": "function add(first, second) { return first + second; }"
419
+ }, options);
420
+ var result2 = UglifyJS.minify({
421
+ "file2.js": "console.log(add(1 + 2, 3 + 4));"
422
+ }, options);
423
+ console.log(result1.code);
424
+ // function n(n,r){return n+r}
425
+ console.log(result2.code);
426
+ // console.log(n(3,7));
427
+ ```
428
+
429
+ You may persist the name cache to the file system in the following way:
430
+ ```javascript
431
+ var cacheFileName = "/tmp/cache.json";
432
+ var options = {
433
+ mangle: {
434
+ properties: true,
435
+ },
436
+ nameCache: JSON.parse(fs.readFileSync(cacheFileName, "utf8"))
437
+ };
438
+ fs.writeFileSync("part1.js", UglifyJS.minify({
439
+ "file1.js": fs.readFileSync("file1.js", "utf8"),
440
+ "file2.js": fs.readFileSync("file2.js", "utf8")
441
+ }, options).code, "utf8");
442
+ fs.writeFileSync("part2.js", UglifyJS.minify({
443
+ "file3.js": fs.readFileSync("file3.js", "utf8"),
444
+ "file4.js": fs.readFileSync("file4.js", "utf8")
445
+ }, options).code, "utf8");
446
+ fs.writeFileSync(cacheFileName, JSON.stringify(options.nameCache), "utf8");
447
+ ```
448
+
449
+ An example of a combination of `minify()` options:
450
+ ```javascript
451
+ var code = {
452
+ "file1.js": "function add(first, second) { return first + second; }",
453
+ "file2.js": "console.log(add(1 + 2, 3 + 4));"
454
+ };
455
+ var options = {
456
+ toplevel: true,
457
+ compress: {
458
+ global_defs: {
459
+ "@console.log": "alert"
460
+ },
461
+ passes: 2
462
+ },
463
+ output: {
464
+ beautify: false,
465
+ preamble: "/* uglified */"
466
+ }
467
+ };
468
+ var result = UglifyJS.minify(code, options);
469
+ console.log(result.code);
470
+ // /* uglified */
471
+ // alert(10);"
472
+ ```
473
+
474
+ To produce warnings:
475
+ ```javascript
476
+ var code = "function f(){ var u; return 2 + 3; }";
477
+ var options = { warnings: true };
478
+ var result = UglifyJS.minify(code, options);
479
+ console.log(result.error); // runtime error, `undefined` in this case
480
+ console.log(result.warnings); // [ 'Dropping unused variable u [0:1,18]' ]
481
+ console.log(result.code); // function f(){return 5}
482
+ ```
483
+
484
+ An error example:
485
+ ```javascript
486
+ var result = UglifyJS.minify({"foo.js" : "if (0) else console.log(1);"});
487
+ console.log(JSON.stringify(result.error));
488
+ // {"message":"Unexpected token: keyword (else)","filename":"foo.js","line":1,"col":7,"pos":7}
489
+ ```
490
+ Note: unlike `uglify-js@2.x`, the `3.x` API does not throw errors. To
491
+ achieve a similar effect one could do the following:
492
+ ```javascript
493
+ var result = UglifyJS.minify(code, options);
494
+ if (result.error) throw result.error;
495
+ ```
496
+
497
+ ## Minify options
498
+
499
+ - `annotations` — pass `false` to ignore all comment annotations and elide them
500
+ from output. Useful when, for instance, external tools incorrectly applied
501
+ `/*@__PURE__*/` or `/*#__PURE__*/`. Pass `true` to both compress and retain
502
+ comment annotations in output to allow for further processing downstream.
503
+
504
+ - `compress` (default: `{}`) — pass `false` to skip compressing entirely.
505
+ Pass an object to specify custom [compress options](#compress-options).
506
+
507
+ - `ie` (default: `false`) — enable workarounds for Internet Explorer bugs.
508
+
509
+ - `keep_fargs` (default: `false`) — pass `true` to prevent discarding or mangling
510
+ of function arguments.
511
+
512
+ - `keep_fnames` (default: `false`) — pass `true` to prevent discarding or mangling
513
+ of function names. Useful for code relying on `Function.prototype.name`.
514
+
515
+ - `mangle` (default: `true`) — pass `false` to skip mangling names, or pass
516
+ an object to specify [mangle options](#mangle-options) (see below).
517
+
518
+ - `mangle.properties` (default: `false`) — a subcategory of the mangle option.
519
+ Pass an object to specify custom [mangle property options](#mangle-properties-options).
520
+
521
+ - `module` (default: `false`) — set to `true` if you wish to process input as
522
+ ES module, i.e. implicit `"use strict";` alongside with `toplevel` enabled.
523
+
524
+ - `nameCache` (default: `null`) — pass an empty object `{}` or a previously
525
+ used `nameCache` object if you wish to cache mangled variable and
526
+ property names across multiple invocations of `minify()`. Note: this is
527
+ a read/write property. `minify()` will read the name cache state of this
528
+ object and update it during minification so that it may be
529
+ reused or externally persisted by the user.
530
+
531
+ - `output` (default: `null`) — pass an object if you wish to specify
532
+ additional [output options](#output-options). The defaults are optimized
533
+ for best compression.
534
+
535
+ - `parse` (default: `{}`) — pass an object if you wish to specify some
536
+ additional [parse options](#parse-options).
537
+
538
+ - `sourceMap` (default: `false`) — pass an object if you wish to specify
539
+ [source map options](#source-map-options).
540
+
541
+ - `toplevel` (default: `false`) — set to `true` if you wish to enable top level
542
+ variable and function name mangling and to drop unused variables and functions.
543
+
544
+ - `v8` (default: `false`) — enable workarounds for Chrome & Node.js bugs.
545
+
546
+ - `warnings` (default: `false`) — pass `true` to return compressor warnings
547
+ in `result.warnings`. Use the value `"verbose"` for more detailed warnings.
548
+
549
+ - `webkit` (default: `false`) — enable workarounds for Safari/WebKit bugs.
550
+ PhantomJS users should set this option to `true`.
551
+
552
+ ## Minify options structure
553
+
554
+ ```javascript
555
+ {
556
+ parse: {
557
+ // parse options
558
+ },
559
+ compress: {
560
+ // compress options
561
+ },
562
+ mangle: {
563
+ // mangle options
564
+
565
+ properties: {
566
+ // mangle property options
567
+ }
568
+ },
569
+ output: {
570
+ // output options
571
+ },
572
+ sourceMap: {
573
+ // source map options
574
+ },
575
+ nameCache: null, // or specify a name cache object
576
+ toplevel: false,
577
+ warnings: false,
578
+ }
579
+ ```
580
+
581
+ ### Source map options
582
+
583
+ To generate a source map:
584
+ ```javascript
585
+ var result = UglifyJS.minify({"file1.js": "var a = function() {};"}, {
586
+ sourceMap: {
587
+ filename: "out.js",
588
+ url: "out.js.map"
589
+ }
590
+ });
591
+ console.log(result.code); // minified output
592
+ console.log(result.map); // source map
593
+ ```
594
+
595
+ Note that the source map is not saved in a file, it's just returned in
596
+ `result.map`. The value passed for `sourceMap.url` is only used to set
597
+ `//# sourceMappingURL=out.js.map` in `result.code`. The value of
598
+ `filename` is only used to set `file` attribute (see [the spec][sm-spec])
599
+ in source map file.
600
+
601
+ You can set option `sourceMap.url` to be `"inline"` and source map will
602
+ be appended to code.
603
+
604
+ You can also specify sourceRoot property to be included in source map:
605
+ ```javascript
606
+ var result = UglifyJS.minify({"file1.js": "var a = function() {};"}, {
607
+ sourceMap: {
608
+ root: "http://example.com/src",
609
+ url: "out.js.map"
610
+ }
611
+ });
612
+ ```
613
+
614
+ If you're compressing compiled JavaScript and have a source map for it, you
615
+ can use `sourceMap.content`:
616
+ ```javascript
617
+ var result = UglifyJS.minify({"compiled.js": "compiled code"}, {
618
+ sourceMap: {
619
+ content: "content from compiled.js.map",
620
+ url: "minified.js.map"
621
+ }
622
+ });
623
+ // same as before, it returns `code` and `map`
624
+ ```
625
+
626
+ If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.url`.
627
+
628
+ If you wish to reduce file size of the source map, set option `sourceMap.names`
629
+ to be `false` and all symbol names will be omitted.
630
+
631
+ ## Parse options
632
+
633
+ - `bare_returns` (default: `false`) — support top level `return` statements
634
+
635
+ - `html5_comments` (default: `true`)
636
+
637
+ - `shebang` (default: `true`) — support `#!command` as the first line
638
+
639
+ ## Compress options
640
+
641
+ - `annotations` (default: `true`) — Pass `false` to disable potentially dropping
642
+ functions marked as "pure". A function call is marked as "pure" if a comment
643
+ annotation `/*@__PURE__*/` or `/*#__PURE__*/` immediately precedes the call. For
644
+ example: `/*@__PURE__*/foo();`
645
+
646
+ - `arguments` (default: `true`) — replace `arguments[index]` with function
647
+ parameter name whenever possible.
648
+
649
+ - `arrows` (default: `true`) — apply optimizations to arrow functions
650
+
651
+ - `assignments` (default: `true`) — apply optimizations to assignment expressions
652
+
653
+ - `awaits` (default: `true`) — apply optimizations to `await` expressions
654
+
655
+ - `booleans` (default: `true`) — various optimizations for boolean context,
656
+ for example `!!a ? b : c → a ? b : c`
657
+
658
+ - `collapse_vars` (default: `true`) — Collapse single-use non-constant variables,
659
+ side effects permitting.
660
+
661
+ - `comparisons` (default: `true`) — apply certain optimizations to binary nodes,
662
+ e.g. `!(a <= b) → a > b`, attempts to negate binary nodes, e.g.
663
+ `a = !b && !c && !d && !e → a=!(b||c||d||e)` etc.
664
+
665
+ - `conditionals` (default: `true`) — apply optimizations for `if`-s and conditional
666
+ expressions
667
+
668
+ - `dead_code` (default: `true`) — remove unreachable code
669
+
670
+ - `default_values` (default: `true`) — drop overshadowed default values
671
+
672
+ - `directives` (default: `true`) — remove redundant or non-standard directives
673
+
674
+ - `drop_console` (default: `false`) — Pass `true` to discard calls to
675
+ `console.*` functions. If you wish to drop a specific function call
676
+ such as `console.info` and/or retain side effects from function arguments
677
+ after dropping the function call then use `pure_funcs` instead.
678
+
679
+ - `drop_debugger` (default: `true`) — remove `debugger;` statements
680
+
681
+ - `evaluate` (default: `true`) — Evaluate expression for shorter constant
682
+ representation. Pass `"eager"` to always replace function calls whenever
683
+ possible, or a positive integer to specify an upper bound for each individual
684
+ evaluation in number of characters.
685
+
686
+ - `expression` (default: `false`) — Pass `true` to preserve completion values
687
+ from terminal statements without `return`, e.g. in bookmarklets.
688
+
689
+ - `functions` (default: `true`) — convert declarations from `var` to `function`
690
+ whenever possible.
691
+
692
+ - `global_defs` (default: `{}`) — see [conditional compilation](#conditional-compilation)
693
+
694
+ - `hoist_exports` (default: `true`) — hoist `export` statements to facilitate
695
+ various `compress` and `mangle` optimizations.
696
+
697
+ - `hoist_funs` (default: `false`) — hoist function declarations
698
+
699
+ - `hoist_props` (default: `true`) — hoist properties from constant object and
700
+ array literals into regular variables subject to a set of constraints. For example:
701
+ `var o={p:1, q:2}; f(o.p, o.q);` is converted to `f(1, 2);`. Note: `hoist_props`
702
+ works best with `toplevel` and `mangle` enabled, alongside with `compress` option
703
+ `passes` set to `2` or higher.
704
+
705
+ - `hoist_vars` (default: `false`) — hoist `var` declarations (this is `false`
706
+ by default because it seems to increase the size of the output in general)
707
+
708
+ - `if_return` (default: `true`) — optimizations for if/return and if/continue
709
+
710
+ - `imports` (default: `true`) — drop unreferenced import symbols when used with `unused`
711
+
712
+ - `inline` (default: `true`) — inline calls to function with simple/`return` statement:
713
+ - `false` — same as `0`
714
+ - `0` — disabled inlining
715
+ - `1` — inline simple functions
716
+ - `2` — inline functions with arguments
717
+ - `3` — inline functions with arguments and variables
718
+ - `4` — inline functions with arguments, variables and statements
719
+ - `true` — same as `4`
720
+
721
+ - `join_vars` (default: `true`) — join consecutive `var` statements
722
+
723
+ - `keep_fargs` (default: `false`) — discard unused function arguments except
724
+ when unsafe to do so, e.g. code which relies on `Function.prototype.length`.
725
+ Pass `true` to always retain function arguments.
726
+
727
+ - `keep_infinity` (default: `false`) — Pass `true` to prevent `Infinity` from
728
+ being compressed into `1/0`, which may cause performance issues on Chrome.
729
+
730
+ - `loops` (default: `true`) — optimizations for `do`, `while` and `for` loops
731
+ when we can statically determine the condition.
732
+
733
+ - `merge_vars` (default: `true`) — combine and reuse variables.
734
+
735
+ - `module` (default: `false`) — set to `true` if you wish to process input as
736
+ ES module, i.e. implicit `"use strict";` alongside with `toplevel` enabled.
737
+
738
+ - `negate_iife` (default: `true`) — negate "Immediately-Called Function Expressions"
739
+ where the return value is discarded, to avoid the parens that the
740
+ code generator would insert.
741
+
742
+ - `objects` (default: `true`) — compact duplicate keys in object literals.
743
+
744
+ - `passes` (default: `1`) — The maximum number of times to run compress.
745
+ In some cases more than one pass leads to further compressed code. Keep in
746
+ mind more passes will take more time.
747
+
748
+ - `properties` (default: `true`) — rewrite property access using the dot notation, for
749
+ example `foo["bar"] → foo.bar`
750
+
751
+ - `pure_funcs` (default: `null`) — You can pass an array of names and
752
+ UglifyJS will assume that those functions do not produce side
753
+ effects. DANGER: will not check if the name is redefined in scope.
754
+ An example case here, for instance `var q = Math.floor(a/b)`. If
755
+ variable `q` is not used elsewhere, UglifyJS will drop it, but will
756
+ still keep the `Math.floor(a/b)`, not knowing what it does. You can
757
+ pass `pure_funcs: [ 'Math.floor' ]` to let it know that this
758
+ function won't produce any side effect, in which case the whole
759
+ statement would get discarded. The current implementation adds some
760
+ overhead (compression will be slower). Make sure symbols under `pure_funcs`
761
+ are also under `mangle.reserved` to avoid mangling.
762
+
763
+ - `pure_getters` (default: `"strict"`) — If you pass `true` for
764
+ this, UglifyJS will assume that object property access
765
+ (e.g. `foo.bar` or `foo["bar"]`) doesn't have any side effects.
766
+ Specify `"strict"` to treat `foo.bar` as side-effect-free only when
767
+ `foo` is certain to not throw, i.e. not `null` or `undefined`.
768
+
769
+ - `reduce_funcs` (default: `true`) — Allows single-use functions to be
770
+ inlined as function expressions when permissible allowing further
771
+ optimization. Enabled by default. Option depends on `reduce_vars`
772
+ being enabled. Some code runs faster in the Chrome V8 engine if this
773
+ option is disabled. Does not negatively impact other major browsers.
774
+
775
+ - `reduce_vars` (default: `true`) — Improve optimization on variables assigned with and
776
+ used as constant values.
777
+
778
+ - `rests` (default: `true`) — apply optimizations to rest parameters
779
+
780
+ - `sequences` (default: `true`) — join consecutive simple statements using the
781
+ comma operator. May be set to a positive integer to specify the maximum number
782
+ of consecutive comma sequences that will be generated. If this option is set to
783
+ `true` then the default `sequences` limit is `200`. Set option to `false` or `0`
784
+ to disable. The smallest `sequences` length is `2`. A `sequences` value of `1`
785
+ is grandfathered to be equivalent to `true` and as such means `200`. On rare
786
+ occasions the default sequences limit leads to very slow compress times in which
787
+ case a value of `20` or less is recommended.
788
+
789
+ - `side_effects` (default: `true`) — drop extraneous code which does not affect
790
+ outcome of runtime execution.
791
+
792
+ - `spreads` (default: `true`) — flatten spread expressions.
793
+
794
+ - `strings` (default: `true`) — compact string concatenations.
795
+
796
+ - `switches` (default: `true`) — de-duplicate and remove unreachable `switch` branches
797
+
798
+ - `templates` (default: `true`) — compact template literals by embedding expressions
799
+ and/or converting to string literals, e.g. `` `foo ${42}` → "foo 42"``
800
+
801
+ - `top_retain` (default: `null`) — prevent specific toplevel functions and
802
+ variables from `unused` removal (can be array, comma-separated, RegExp or
803
+ function. Implies `toplevel`)
804
+
805
+ - `toplevel` (default: `false`) — drop unreferenced functions (`"funcs"`) and/or
806
+ variables (`"vars"`) in the top level scope (`false` by default, `true` to drop
807
+ both unreferenced functions and variables)
808
+
809
+ - `typeofs` (default: `true`) — compress `typeof` expressions, e.g.
810
+ `typeof foo == "undefined" → void 0 === foo`
811
+
812
+ - `unsafe` (default: `false`) — apply "unsafe" transformations (discussion below)
813
+
814
+ - `unsafe_comps` (default: `false`) — compress expressions like `a <= b` assuming
815
+ none of the operands can be (coerced to) `NaN`.
816
+
817
+ - `unsafe_Function` (default: `false`) — compress and mangle `Function(args, code)`
818
+ when both `args` and `code` are string literals.
819
+
820
+ - `unsafe_math` (default: `false`) — optimize numerical expressions like
821
+ `2 * x * 3` into `6 * x`, which may give imprecise floating point results.
822
+
823
+ - `unsafe_proto` (default: `false`) — optimize expressions like
824
+ `Array.prototype.slice.call(a)` into `[].slice.call(a)`
825
+
826
+ - `unsafe_regexp` (default: `false`) — enable substitutions of variables with
827
+ `RegExp` values the same way as if they are constants.
828
+
829
+ - `unsafe_undefined` (default: `false`) — substitute `void 0` if there is a
830
+ variable named `undefined` in scope (variable name will be mangled, typically
831
+ reduced to a single character)
832
+
833
+ - `unused` (default: `true`) — drop unreferenced functions and variables (simple
834
+ direct variable assignments do not count as references unless set to `"keep_assign"`)
835
+
836
+ - `varify` (default: `true`) — convert block-scoped declaractions into `var`
837
+ whenever safe to do so
838
+
839
+ - `yields` (default: `true`) — apply optimizations to `yield` expressions
840
+
841
+ ## Mangle options
842
+
843
+ - `eval` (default: `false`) — Pass `true` to mangle names visible in scopes
844
+ where `eval` or `with` are used.
845
+
846
+ - `reserved` (default: `[]`) — Pass an array of identifiers that should be
847
+ excluded from mangling. Example: `["foo", "bar"]`.
848
+
849
+ - `toplevel` (default: `false`) — Pass `true` to mangle names declared in the
850
+ top level scope.
851
+
852
+ Examples:
853
+
854
+ ```javascript
855
+ // test.js
856
+ var globalVar;
857
+ function funcName(firstLongName, anotherLongName) {
858
+ var myVariable = firstLongName + anotherLongName;
859
+ }
860
+ ```
861
+ ```javascript
862
+ var code = fs.readFileSync("test.js", "utf8");
863
+
864
+ UglifyJS.minify(code).code;
865
+ // 'function funcName(a,n){}var globalVar;'
866
+
867
+ UglifyJS.minify(code, { mangle: { reserved: ['firstLongName'] } }).code;
868
+ // 'function funcName(firstLongName,a){}var globalVar;'
869
+
870
+ UglifyJS.minify(code, { mangle: { toplevel: true } }).code;
871
+ // 'function n(n,a){}var a;'
872
+ ```
873
+
874
+ ### Mangle properties options
875
+
876
+ - `builtins` (default: `false`) — Use `true` to allow the mangling of builtin
877
+ DOM properties. Not recommended to override this setting.
878
+
879
+ - `debug` (default: `false`) — Mangle names with the original name still present.
880
+ Pass an empty string `""` to enable, or a non-empty string to set the debug suffix.
881
+
882
+ - `keep_fargs` (default: `false`) — Use `true` to prevent mangling of function
883
+ arguments.
884
+
885
+ - `keep_quoted` (default: `false`) — Only mangle unquoted property names.
886
+
887
+ - `regex` (default: `null`) — Pass a RegExp literal to only mangle property
888
+ names matching the regular expression.
889
+
890
+ - `reserved` (default: `[]`) — Do not mangle property names listed in the
891
+ `reserved` array.
892
+
893
+ ## Output options
894
+
895
+ The code generator tries to output shortest code possible by default. In
896
+ case you want beautified output, pass `--beautify` (`-b`). Optionally you
897
+ can pass additional arguments that control the code output:
898
+
899
+ - `annotations` (default: `false`) — pass `true` to retain comment annotations
900
+ `/*@__PURE__*/` or `/*#__PURE__*/`, otherwise they will be discarded even if
901
+ `comments` is set.
902
+
903
+ - `ascii_only` (default: `false`) — escape Unicode characters in strings and
904
+ regexps (affects directives with non-ascii characters becoming invalid)
905
+
906
+ - `beautify` (default: `true`) — whether to actually beautify the output.
907
+ Passing `-b` will set this to true, but you might need to pass `-b` even
908
+ when you want to generate minified code, in order to specify additional
909
+ arguments, so you can use `-b beautify=false` to override it.
910
+
911
+ - `braces` (default: `false`) — always insert braces in `if`, `for`,
912
+ `do`, `while` or `with` statements, even if their body is a single
913
+ statement.
914
+
915
+ - `comments` (default: `false`) — pass `true` or `"all"` to preserve all
916
+ comments, `"some"` to preserve multi-line comments that contain `@cc_on`,
917
+ `@license`, or `@preserve` (case-insensitive), a regular expression string
918
+ (e.g. `/^!/`), or a function which returns `boolean`, e.g.
919
+ ```javascript
920
+ function(node, comment) {
921
+ return comment.value.indexOf("@type " + node.TYPE) >= 0;
922
+ }
923
+ ```
924
+
925
+ - `galio` (default: `false`) — enable workarounds for ANT Galio bugs
926
+
927
+ - `indent_level` (default: `4`) — indent by specified number of spaces or the
928
+ exact whitespace sequence supplied, e.g. `"\t"`.
929
+
930
+ - `indent_start` (default: `0`) — prefix all lines by whitespace sequence
931
+ specified in the same format as `indent_level`.
932
+
933
+ - `inline_script` (default: `true`) — escape HTML comments and the slash in
934
+ occurrences of `</script>` in strings
935
+
936
+ - `keep_quoted_props` (default: `false`) — when turned on, prevents stripping
937
+ quotes from property names in object literals.
938
+
939
+ - `max_line_len` (default: `false`) — maximum line length (for uglified code)
940
+
941
+ - `preamble` (default: `null`) — when passed it must be a string and
942
+ it will be prepended to the output literally. The source map will
943
+ adjust for this text. Can be used to insert a comment containing
944
+ licensing information, for example.
945
+
946
+ - `preserve_line` (default: `false`) — pass `true` to retain line numbering on
947
+ a best effort basis.
948
+
949
+ - `quote_keys` (default: `false`) — pass `true` to quote all keys in literal
950
+ objects
951
+
952
+ - `quote_style` (default: `0`) — preferred quote style for strings (affects
953
+ quoted property names and directives as well):
954
+ - `0` — prefers double quotes, switches to single quotes when there are
955
+ more double quotes in the string itself. `0` is best for gzip size.
956
+ - `1` — always use single quotes
957
+ - `2` — always use double quotes
958
+ - `3` — always use the original quotes
959
+
960
+ - `semicolons` (default: `true`) — separate statements with semicolons. If
961
+ you pass `false` then whenever possible we will use a newline instead of a
962
+ semicolon, leading to more readable output of uglified code (size before
963
+ gzip could be smaller; size after gzip insignificantly larger).
964
+
965
+ - `shebang` (default: `true`) — preserve shebang `#!` in preamble (bash scripts)
966
+
967
+ - `width` (default: `80`) — only takes effect when beautification is on, this
968
+ specifies an (orientative) line width that the beautifier will try to
969
+ obey. It refers to the width of the line text (excluding indentation).
970
+ It doesn't work very well currently, but it does make the code generated
971
+ by UglifyJS more readable.
972
+
973
+ - `wrap_iife` (default: `false`) — pass `true` to wrap immediately invoked
974
+ function expressions. See
975
+ [#640](https://github.com/mishoo/UglifyJS/issues/640) for more details.
976
+
977
+ # Miscellaneous
978
+
979
+ ### Keeping copyright notices or other comments
980
+
981
+ You can pass `--comments` to retain certain comments in the output. By
982
+ default it will keep JSDoc-style comments that contain "@preserve",
983
+ "@license" or "@cc_on" (conditional compilation for IE). You can pass
984
+ `--comments all` to keep all the comments, or a valid JavaScript regexp to
985
+ keep only comments that match this regexp. For example `--comments /^!/`
986
+ will keep comments like `/*! Copyright Notice */`.
987
+
988
+ Note, however, that there might be situations where comments are lost. For
989
+ example:
990
+ ```javascript
991
+ function f() {
992
+ /** @preserve Foo Bar */
993
+ function g() {
994
+ // this function is never called
995
+ }
996
+ return something();
997
+ }
998
+ ```
999
+
1000
+ Even though it has "@preserve", the comment will be lost because the inner
1001
+ function `g` (which is the AST node to which the comment is attached to) is
1002
+ discarded by the compressor as not referenced.
1003
+
1004
+ The safest comments where to place copyright information (or other info that
1005
+ needs to be kept in the output) are comments attached to toplevel nodes.
1006
+
1007
+ ### The `unsafe` `compress` option
1008
+
1009
+ It enables some transformations that *might* break code logic in certain
1010
+ contrived cases, but should be fine for most code. You might want to try it
1011
+ on your own code, it should reduce the minified size. Here's what happens
1012
+ when this flag is on:
1013
+
1014
+ - `new Array(1, 2, 3)` or `Array(1, 2, 3)` → `[ 1, 2, 3 ]`
1015
+ - `new Object()` → `{}`
1016
+ - `String(exp)` or `exp.toString()` → `"" + exp`
1017
+ - `new Object/RegExp/Function/Error/Array (...)` → we discard the `new`
1018
+
1019
+ ### Conditional compilation
1020
+
1021
+ You can use the `--define` (`-d`) switch in order to declare global
1022
+ variables that UglifyJS will assume to be constants (unless defined in
1023
+ scope). For example if you pass `--define DEBUG=false` then, coupled with
1024
+ dead code removal UglifyJS will discard the following from the output:
1025
+ ```javascript
1026
+ if (DEBUG) {
1027
+ console.log("debug stuff");
1028
+ }
1029
+ ```
1030
+
1031
+ You can specify nested constants in the form of `--define env.DEBUG=false`.
1032
+
1033
+ UglifyJS will warn about the condition being always false and about dropping
1034
+ unreachable code; for now there is no option to turn off only this specific
1035
+ warning, you can pass `warnings=false` to turn off *all* warnings.
1036
+
1037
+ Another way of doing that is to declare your globals as constants in a
1038
+ separate file and include it into the build. For example you can have a
1039
+ `build/defines.js` file with the following:
1040
+ ```javascript
1041
+ var DEBUG = false;
1042
+ var PRODUCTION = true;
1043
+ // etc.
1044
+ ```
1045
+
1046
+ and build your code like this:
1047
+
1048
+ uglifyjs build/defines.js js/foo.js js/bar.js... -c
1049
+
1050
+ UglifyJS will notice the constants and, since they cannot be altered, it
1051
+ will evaluate references to them to the value itself and drop unreachable
1052
+ code as usual. The build will contain the `const` declarations if you use
1053
+ them. If you are targeting < ES6 environments which does not support `const`,
1054
+ using `var` with `reduce_vars` (enabled by default) should suffice.
1055
+
1056
+ ### Conditional compilation API
1057
+
1058
+ You can also use conditional compilation via the programmatic API. With the difference that the
1059
+ property name is `global_defs` and is a compressor property:
1060
+
1061
+ ```javascript
1062
+ var result = UglifyJS.minify(fs.readFileSync("input.js", "utf8"), {
1063
+ compress: {
1064
+ dead_code: true,
1065
+ global_defs: {
1066
+ DEBUG: false
1067
+ }
1068
+ }
1069
+ });
1070
+ ```
1071
+
1072
+ To replace an identifier with an arbitrary non-constant expression it is
1073
+ necessary to prefix the `global_defs` key with `"@"` to instruct UglifyJS
1074
+ to parse the value as an expression:
1075
+ ```javascript
1076
+ UglifyJS.minify("alert('hello');", {
1077
+ compress: {
1078
+ global_defs: {
1079
+ "@alert": "console.log"
1080
+ }
1081
+ }
1082
+ }).code;
1083
+ // returns: 'console.log("hello");'
1084
+ ```
1085
+
1086
+ Otherwise it would be replaced as string literal:
1087
+ ```javascript
1088
+ UglifyJS.minify("alert('hello');", {
1089
+ compress: {
1090
+ global_defs: {
1091
+ "alert": "console.log"
1092
+ }
1093
+ }
1094
+ }).code;
1095
+ // returns: '"console.log"("hello");'
1096
+ ```
1097
+
1098
+ ### Using native Uglify AST with `minify()`
1099
+ ```javascript
1100
+ // example: parse only, produce native Uglify AST
1101
+
1102
+ var result = UglifyJS.minify(code, {
1103
+ parse: {},
1104
+ compress: false,
1105
+ mangle: false,
1106
+ output: {
1107
+ ast: true,
1108
+ code: false // optional - faster if false
1109
+ }
1110
+ });
1111
+
1112
+ // result.ast contains native Uglify AST
1113
+ ```
1114
+ ```javascript
1115
+ // example: accept native Uglify AST input and then compress and mangle
1116
+ // to produce both code and native AST.
1117
+
1118
+ var result = UglifyJS.minify(ast, {
1119
+ compress: {},
1120
+ mangle: {},
1121
+ output: {
1122
+ ast: true,
1123
+ code: true // optional - faster if false
1124
+ }
1125
+ });
1126
+
1127
+ // result.ast contains native Uglify AST
1128
+ // result.code contains the minified code in string form.
1129
+ ```
1130
+
1131
+ ### Working with Uglify AST
1132
+
1133
+ Transversal and transformation of the native AST can be performed through
1134
+ [`TreeWalker`](https://github.com/mishoo/UglifyJS/blob/master/lib/ast.js) and
1135
+ [`TreeTransformer`](https://github.com/mishoo/UglifyJS/blob/master/lib/transform.js)
1136
+ respectively.
1137
+
1138
+ ### ESTree / SpiderMonkey AST
1139
+
1140
+ UglifyJS has its own abstract syntax tree format; for
1141
+ [practical reasons](http://lisperator.net/blog/uglifyjs-why-not-switching-to-spidermonkey-ast/)
1142
+ we can't easily change to using the SpiderMonkey AST internally. However,
1143
+ UglifyJS now has a converter which can import a SpiderMonkey AST.
1144
+
1145
+ For example [Acorn][acorn] is a super-fast parser that produces a
1146
+ SpiderMonkey AST. It has a small CLI utility that parses one file and dumps
1147
+ the AST in JSON on the standard output. To use UglifyJS to mangle and
1148
+ compress that:
1149
+
1150
+ acorn file.js | uglifyjs -p spidermonkey -m -c
1151
+
1152
+ The `-p spidermonkey` option tells UglifyJS that all input files are not
1153
+ JavaScript, but JS code described in SpiderMonkey AST in JSON. Therefore we
1154
+ don't use our own parser in this case, but just transform that AST into our
1155
+ internal AST.
1156
+
1157
+ ### Use Acorn for parsing
1158
+
1159
+ More for fun, I added the `-p acorn` option which will use Acorn to do all
1160
+ the parsing. If you pass this option, UglifyJS will `require("acorn")`.
1161
+
1162
+ Acorn is really fast (e.g. 250ms instead of 380ms on some 650K code), but
1163
+ converting the SpiderMonkey tree that Acorn produces takes another 150ms so
1164
+ in total it's a bit more than just using UglifyJS's own parser.
1165
+
1166
+ [acorn]: https://github.com/ternjs/acorn
1167
+ [sm-spec]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k
1168
+
1169
+ ### Uglify Fast Minify Mode
1170
+
1171
+ It's not well known, but whitespace removal and symbol mangling accounts
1172
+ for 95% of the size reduction in minified code for most JavaScript - not
1173
+ elaborate code transforms. One can simply disable `compress` to speed up
1174
+ Uglify builds by 3 to 5 times.
1175
+
1176
+ | d3.js | minify size | gzip size | minify time (seconds) |
1177
+ | --- | ---: | ---: | ---: |
1178
+ | original | 511,371 | 119,932 | - |
1179
+ | uglify-js@3.13.0 mangle=false, compress=false | 363,988 | 95,695 | 0.56 |
1180
+ | uglify-js@3.13.0 mangle=true, compress=false | 253,305 | 81,281 | 0.99 |
1181
+ | uglify-js@3.13.0 mangle=true, compress=true | 244,436 | 79,854 | 5.30 |
1182
+
1183
+ To enable fast minify mode from the CLI use:
1184
+ ```
1185
+ uglifyjs file.js -m
1186
+ ```
1187
+ To enable fast minify mode with the API use:
1188
+ ```javascript
1189
+ UglifyJS.minify(code, { compress: false, mangle: true });
1190
+ ```
1191
+
1192
+ ### Source maps and debugging
1193
+
1194
+ Various `compress` transforms that simplify, rearrange, inline and remove code
1195
+ are known to have an adverse effect on debugging with source maps. This is
1196
+ expected as code is optimized and mappings are often simply not possible as
1197
+ some code no longer exists. For highest fidelity in source map debugging
1198
+ disable the Uglify `compress` option and just use `mangle`.
1199
+
1200
+ ### Compiler assumptions
1201
+
1202
+ To allow for better optimizations, the compiler makes various assumptions:
1203
+
1204
+ - The code does not rely on preserving its runtime performance characteristics.
1205
+ Typically uglified code will run faster due to less instructions and easier
1206
+ inlining, but may be slower on rare occasions for a specific platform, e.g.
1207
+ see [`reduce_funcs`](#compress-options).
1208
+ - `.toString()` and `.valueOf()` don't have side effects, and for built-in
1209
+ objects they have not been overridden.
1210
+ - `undefined`, `NaN` and `Infinity` have not been externally redefined.
1211
+ - `arguments.callee`, `arguments.caller` and `Function.prototype.caller` are not used.
1212
+ - The code doesn't expect the contents of `Function.prototype.toString()` or
1213
+ `Error.prototype.stack` to be anything in particular.
1214
+ - Getting and setting properties on a plain object does not cause other side effects
1215
+ (using `.watch()` or `Proxy`).
1216
+ - Object properties can be added, removed and modified (not prevented with
1217
+ `Object.defineProperty()`, `Object.defineProperties()`, `Object.freeze()`,
1218
+ `Object.preventExtensions()` or `Object.seal()`).
1219
+ - If array destructuring is present, index-like properties in `Array.prototype`
1220
+ have not been overridden:
1221
+ ```javascript
1222
+ Object.prototype[0] = 42;
1223
+ var [ a ] = [];
1224
+ var { 0: b } = {};
1225
+ // 42 undefined
1226
+ console.log([][0], a);
1227
+ // 42 42
1228
+ console.log({}[0], b);
1229
+ ```
1230
+ - Earlier versions of JavaScript will throw `SyntaxError` with the following:
1231
+ ```javascript
1232
+ ({
1233
+ p: 42,
1234
+ get p() {},
1235
+ });
1236
+ // SyntaxError: Object literal may not have data and accessor property with
1237
+ // the same name
1238
+ ```
1239
+ UglifyJS may modify the input which in turn may suppress those errors.
1240
+ - Iteration order of keys over an object which contains spread syntax in later
1241
+ versions of Chrome and Node.js may be altered.
1242
+ - When `toplevel` is enabled, UglifyJS effectively assumes input code is wrapped
1243
+ within `function(){ ... }`, thus forbids aliasing of declared global variables:
1244
+ ```javascript
1245
+ A = "FAIL";
1246
+ var B = "FAIL";
1247
+ // can be `global`, `self`, `window` etc.
1248
+ var top = function() {
1249
+ return this;
1250
+ }();
1251
+ // "PASS"
1252
+ top.A = "PASS";
1253
+ console.log(A);
1254
+ // "FAIL" after compress and/or mangle
1255
+ top.B = "PASS";
1256
+ console.log(B);
1257
+ ```
1258
+ - Use of `arguments` alongside destructuring as function parameters, e.g.
1259
+ `function({}, arguments) {}` will result in `SyntaxError` in earlier versions
1260
+ of Chrome and Node.js - UglifyJS may modify the input which in turn may
1261
+ suppress those errors.
1262
+ - Earlier versions of Chrome and Node.js will throw `ReferenceError` with the
1263
+ following:
1264
+ ```javascript
1265
+ var a;
1266
+ try {
1267
+ throw 42;
1268
+ } catch ({
1269
+ [a]: b,
1270
+ // ReferenceError: a is not defined
1271
+ }) {
1272
+ let a;
1273
+ }
1274
+ ```
1275
+ UglifyJS may modify the input which in turn may suppress those errors.
1276
+ - Later versions of JavaScript will throw `SyntaxError` with the following:
1277
+ ```javascript
1278
+ a => {
1279
+ let a;
1280
+ };
1281
+ // SyntaxError: Identifier 'a' has already been declared
1282
+ ```
1283
+ UglifyJS may modify the input which in turn may suppress those errors.
1284
+ - Later versions of JavaScript will throw `SyntaxError` with the following:
1285
+ ```javascript
1286
+ try {
1287
+ // ...
1288
+ } catch ({ message: a }) {
1289
+ var a;
1290
+ }
1291
+ // SyntaxError: Identifier 'a' has already been declared
1292
+ ```
1293
+ UglifyJS may modify the input which in turn may suppress those errors.
1294
+ - Some versions of Chrome and Node.js will throw `ReferenceError` with the
1295
+ following:
1296
+ ```javascript
1297
+ console.log(((a, b = function() {
1298
+ return a;
1299
+ // ReferenceError: a is not defined
1300
+ }()) => b)());
1301
+ ```
1302
+ UglifyJS may modify the input which in turn may suppress those errors.
1303
+ - Some arithmetic operations with `BigInt` may throw `TypeError`:
1304
+ ```javascript
1305
+ 1n + 1;
1306
+ // TypeError: can't convert BigInt to number
1307
+ ```
1308
+ UglifyJS may modify the input which in turn may suppress those errors.
1309
+ - Some versions of JavaScript will throw `SyntaxError` with the
1310
+ following:
1311
+ ```javascript
1312
+ console.log(String.raw`\uFo`);
1313
+ // SyntaxError: Invalid Unicode escape sequence
1314
+ ```
1315
+ UglifyJS may modify the input which in turn may suppress those errors.
1316
+ - Some versions of JavaScript will throw `SyntaxError` with the
1317
+ following:
1318
+ ```javascript
1319
+ try {} catch (e) {
1320
+ for (var e of []);
1321
+ }
1322
+ // SyntaxError: Identifier 'e' has already been declared
1323
+ ```
1324
+ UglifyJS may modify the input which in turn may suppress those errors.
1325
+ - Some versions of Chrome and Node.js will give incorrect results with the
1326
+ following:
1327
+ ```javascript
1328
+ console.log({
1329
+ ...{
1330
+ set 42(v) {},
1331
+ 42: "PASS",
1332
+ },
1333
+ });
1334
+ // Expected: { '42': 'PASS' }
1335
+ // Actual: { '42': undefined }
1336
+ ```
1337
+ UglifyJS may modify the input which in turn may suppress those errors.
1338
+ - Later versions of JavaScript will throw `SyntaxError` with the following:
1339
+ ```javascript
1340
+ var await;
1341
+ class A {
1342
+ static p = await;
1343
+ }
1344
+ // SyntaxError: Unexpected reserved word
1345
+ ```
1346
+ UglifyJS may modify the input which in turn may suppress those errors.
1347
+ - Later versions of JavaScript will throw `SyntaxError` with the following:
1348
+ ```javascript
1349
+ var async;
1350
+ for (async of []);
1351
+ // SyntaxError: The left-hand side of a for-of loop may not be 'async'.
1352
+ ```
1353
+ UglifyJS may modify the input which in turn may suppress those errors.
1354
+ - Later versions of Chrome and Node.js will give incorrect results with the
1355
+ following:
1356
+ ```javascript
1357
+ console.log({
1358
+ ...console,
1359
+ get 42() {
1360
+ return "FAIL";
1361
+ },
1362
+ [42]: "PASS",
1363
+ }[42]);
1364
+ // Expected: "PASS"
1365
+ // Actual: "FAIL"
1366
+ ```
1367
+ UglifyJS may modify the input which in turn may suppress those errors.
1368
+ - Earlier versions of JavaScript will throw `TypeError` with the following:
1369
+ ```javascript
1370
+ (function() {
1371
+ {
1372
+ const a = "foo";
1373
+ }
1374
+ {
1375
+ const a = "bar";
1376
+ }
1377
+ })();
1378
+ // TypeError: const 'a' has already been declared
1379
+ ```
1380
+ UglifyJS may modify the input which in turn may suppress those errors.
1381
+ - Later versions of Chrome and Node.js will give incorrect results with the
1382
+ following:
1383
+ ```javascript
1384
+ try {
1385
+ class A {
1386
+ static 42;
1387
+ static get 42() {}
1388
+ }
1389
+ console.log("PASS");
1390
+ } catch (e) {
1391
+ console.log("FAIL");
1392
+ }
1393
+ // Expected: "PASS"
1394
+ // Actual: "FAIL"
1395
+ ```
1396
+ UglifyJS may modify the input which in turn may suppress those errors.
1397
+ - Some versions of Chrome and Node.js will give incorrect results with the
1398
+ following:
1399
+ ```javascript
1400
+ (async function(a) {
1401
+ (function() {
1402
+ var b = await => console.log("PASS");
1403
+ b();
1404
+ })();
1405
+ })().catch(console.error);
1406
+ // Expected: "PASS"
1407
+ // Actual: SyntaxError: Unexpected reserved word
1408
+ ```
1409
+ UglifyJS may modify the input which in turn may suppress those errors.
1410
+ - Later versions of Chrome and Node.js will give incorrect results with the
1411
+ following:
1412
+ ```javascript
1413
+ try {
1414
+ f();
1415
+ function f() {
1416
+ throw 42;
1417
+ }
1418
+ } catch (e) {}
1419
+ console.log(typeof f);
1420
+ // Expected: "function"
1421
+ // Actual: "undefined"
1422
+ ```
1423
+ UglifyJS may modify the input which in turn may suppress those errors.