js-beautify 1.7.0 → 1.7.4

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 (50) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/CONTRIBUTING.md +3 -3
  3. package/README.md +15 -12
  4. package/js/bin/css-beautify.js +4 -0
  5. package/js/bin/html-beautify.js +4 -0
  6. package/js/bin/js-beautify.js +4 -0
  7. package/js/config/defaults.json +18 -0
  8. package/js/lib/beautify-css.js +1046 -0
  9. package/js/lib/beautify-html.js +1387 -0
  10. package/js/lib/beautify.js +2820 -0
  11. package/js/lib/cli.js +623 -0
  12. package/js/lib/unpackers/javascriptobfuscator_unpacker.js +103 -0
  13. package/js/lib/unpackers/myobfuscate_unpacker.js +90 -0
  14. package/js/lib/unpackers/p_a_c_k_e_r_unpacker.js +83 -0
  15. package/js/lib/unpackers/urlencode_unpacker.js +73 -0
  16. package/js/src/core/acorn.js +63 -0
  17. package/js/src/core/inputscanner.js +95 -0
  18. package/js/src/core/options.js +48 -0
  19. package/js/src/core/output.js +234 -0
  20. package/js/src/core/token.js +49 -0
  21. package/js/src/css/beautifier.js +477 -0
  22. package/js/src/css/index.js +36 -0
  23. package/js/src/html/beautifier.js +1035 -0
  24. package/js/src/html/index.js +36 -0
  25. package/js/src/index.js +27 -0
  26. package/js/src/javascript/beautifier.js +1449 -0
  27. package/js/src/javascript/index.js +36 -0
  28. package/js/src/javascript/tokenizer.js +620 -0
  29. package/js/test/amd-beautify-tests.js +62 -0
  30. package/js/test/generated/beautify-css-tests.js +1393 -0
  31. package/js/test/generated/beautify-html-tests.js +3212 -0
  32. package/js/test/generated/beautify-javascript-tests.js +5896 -0
  33. package/js/test/node-beautify-html-perf-tests.js +51 -0
  34. package/js/test/node-beautify-perf-tests.js +50 -0
  35. package/js/test/node-beautify-tests.js +45 -0
  36. package/js/test/requirejs-html-beautify.html +58 -0
  37. package/js/test/resources/configerror/.jsbeautifyrc +6 -0
  38. package/js/test/resources/configerror/subDir1/subDir2/empty.txt +0 -0
  39. package/js/test/resources/editorconfig/.editorconfig +6 -0
  40. package/js/test/resources/editorconfig/cr/.editorconfig +3 -0
  41. package/js/test/resources/editorconfig/crlf/.editorconfig +3 -0
  42. package/js/test/resources/editorconfig/error/.editorconfig +1 -0
  43. package/js/test/resources/editorconfig/example-base.js +3 -0
  44. package/js/test/resources/example1.js +3 -0
  45. package/js/test/resources/indent11chars/.jsbeautifyrc +6 -0
  46. package/js/test/resources/indent11chars/subDir1/subDir2/empty.txt +0 -0
  47. package/js/test/run-tests +17 -0
  48. package/js/test/sanitytest.js +144 -0
  49. package/js/test/shell-smoke-test.sh +383 -0
  50. package/package.json +1 -1
@@ -0,0 +1,62 @@
1
+ /*jshint node:true */
2
+
3
+ var requirejs = require('requirejs'),
4
+ SanityTest = require('./sanitytest'),
5
+ Urlencoded = require('../lib/unpackers/urlencode_unpacker'),
6
+ run_javascript_tests = require('./generated/beautify-javascript-tests').run_javascript_tests,
7
+ run_css_tests = require('./generated/beautify-css-tests').run_css_tests,
8
+ run_html_tests = require('./generated/beautify-html-tests').run_html_tests;
9
+
10
+ requirejs.config({
11
+ paths: {
12
+ 'beautify': "..",
13
+ 'beautify-lib': "../lib"
14
+ }
15
+ });
16
+
17
+ function amd_beautifier_index_tests(name, test_runner) {
18
+ console.log('Testing ' + name + ' with node.js Require.js (index file)...');
19
+ var results = new SanityTest();
20
+ var beautify = requirejs('beautify/index');
21
+
22
+ test_runner(
23
+ results,
24
+ Urlencoded,
25
+ beautify.js,
26
+ beautify.html,
27
+ beautify.css);
28
+
29
+ console.log(results.results_raw());
30
+ return results;
31
+ }
32
+
33
+ function amd_beautifier_tests(name, test_runner) {
34
+ console.log('Testing ' + name + ' with node.js Require.js (separate file)...');
35
+ var results = new SanityTest();
36
+ var js_beautify = requirejs('beautify-lib/beautify'),
37
+ css_beautify = requirejs('beautify-lib/beautify-css'),
38
+ html_beautify = requirejs('beautify-lib/beautify-html');
39
+
40
+ test_runner(
41
+ results,
42
+ Urlencoded,
43
+ js_beautify.js_beautify,
44
+ html_beautify.html_beautify,
45
+ css_beautify.css_beautify);
46
+
47
+ console.log(results.results_raw());
48
+ return results;
49
+ }
50
+
51
+
52
+
53
+ if (require.main === module) {
54
+ process.exit(
55
+ amd_beautifier_tests('js-beautifier', run_javascript_tests).get_exitcode() +
56
+ amd_beautifier_index_tests('js-beautifier', run_javascript_tests).get_exitcode() +
57
+ amd_beautifier_tests('cs-beautifier', run_css_tests).get_exitcode() +
58
+ amd_beautifier_index_tests('css-beautifier', run_css_tests).get_exitcode() +
59
+ amd_beautifier_tests('html-beautifier', run_html_tests).get_exitcode() +
60
+ amd_beautifier_index_tests('html-beautifier', run_html_tests).get_exitcode()
61
+ );
62
+ }