Skip to content

Commit

Permalink
Merge pull request #38 from mathieug/master
Browse files Browse the repository at this point in the history
Update js-beautify to v1.5.10
  • Loading branch information
enginespot committed Dec 10, 2015
2 parents 69d70c0 + 381cd79 commit 38f4004
Show file tree
Hide file tree
Showing 75 changed files with 10,543 additions and 11,316 deletions.
1 change: 1 addition & 0 deletions libs/js-beautify/.travis.yml
Expand Up @@ -3,6 +3,7 @@ python:
- "2.7"
- "3.2"
- "3.3"
- "3.4"

node_js:
- "0.8"
Expand Down
25 changes: 12 additions & 13 deletions libs/js-beautify/CONTRIBUTING.md 100755 → 100644
Expand Up @@ -2,22 +2,22 @@


## Report issues
If you find a bug, please report it, including environment andexamples of current behavior and what you believe to be the correct behavior. The clearer your description and information, the more likely it is someone will be able to make progress on it.
If you find a bug, please report it, including environment and examples of current behavior and what you believe to be the correct behavior. The clearer your description and information, the more likely it is someone will be able to make progress on it.

## Fix issues
Pull requests with fixes are totally welcome. Familiarize yourself with the folder structure and code style before you dive in. Where possible fixes should include tests to prevent future regressions in functionality. Also, if they apply and you have the ability, make fixes to both python and javascript implementations.

We use travis-ci.org to run build and test passes. If you run `make` from the root folder locally, tests will run and should all pass before your pull request will be accepted.
We use travis-ci.org to run build and test passes. If you run `make` from the root folder locally, tests will run and should all pass before your pull request will be accepted.


# Folders
# Folders
## js
## python
## web


# Branches
We use the `master` branch as the primrary development branch.
We use the `master` branch as the primrary development branch.

## Releases
Each platform has a branch that tracks to the latest release of that platform.
Expand All @@ -27,10 +27,10 @@ Each platform has a branch that tracks to the latest release of that platform.
* `gh-pages`

## Functional Parity
Keeping the platforms in some semblance of functional parity is one of the key features of this project. As such, there branches for the last time synchronization occured and when it stablized.
Keeping the platforms in some semblance of functional parity is one of the key features of this project. As such, there branches for the last time synchronization occured and when it stablized.

* `sync`
* `sync-stable`
* `sync-stable`

## Attic
This project has been around for a while. While some parts have improved significantly over time, others fell
Expand All @@ -47,22 +47,21 @@ available on branch `attic-other`. Take a look and feel free to resurrect them,
dusty back there.

### Generic Eval Unpacker
The `attic-genericeval` branch includes an unpacker that call `eval` on whatever source is passed to it.
The `attic-genericeval` branch includes an unpacker that call `eval` on whatever source is passed to it.
Useful when working with source that unpacks itself when eval is called on it, but also unsafe. We keep
it on this separate branch to keep it from hurting the other children.
it on this separate branch to keep it from hurting the other children.

# Publishing a Release
Each platform has it's own release process.
Each platform has it's own release process.

NOTE: Before you do any of these make sure the latest changes have passed the travis-ci build!

##Web
Merge changes from `master` to `gh-pages` branch. This is very low cost and can be done whenever is convenient.
If doing a general release, update the `bower.json` file to the new version and commit the change.

##Python
NOTE: For now, we'd like to keep python and node version numbers synchronized,
so if you publish a python release, you should publish a node release as well.
so if you publish a python release, you should publish a node release as well.

To perform these steps you will need:
1. A pypi user account from https://pypi.python.org/pypi?%3Aaction=register_form .
Expand All @@ -84,8 +83,8 @@ git push

##Node
NOTE: For now, we'd like to keep python and node version numbers synchronized,
so if you plan to publish a node release, you should publish a python release *first*,
then perform the steps below.
so if you plan to publish a node release, you should publish a python release *first*,
then perform the steps below.

To perform these steps you will need:
1. An npmjs.org user account from https://npmjs.org/signup .
Expand Down
Empty file modified libs/js-beautify/LICENSE 100755 → 100644
Empty file.
23 changes: 18 additions & 5 deletions libs/js-beautify/Makefile 100755 → 100644
Expand Up @@ -2,6 +2,8 @@
define AVAILABLE_ACTIONS

build: do static checking and build of js
buildp: do static checking and build of python
buildj: do static checking and build of javascript
test: test both implementations, js and python
testp: test python implementation
testj: test javascript implementation
Expand All @@ -11,24 +13,31 @@ export AVAILABLE_ACTIONS


.SILENT:
all: build test
all: build test status

help:
echo "$$AVAILABLE_ACTIONS"

build:
echo Building... ;\
build: buildj buildp

buildj:
echo Building javascript... ;\
npm install ;\

buildp:
echo Building python... ;\
pip install -e ./python

testp:
echo Testing python implementation...
node test/generate-tests.js || exit 1;\
cd python ;\
python --version ;\
./jsbeautifier/tests/shell-smoke-test.sh && \
PYTHON=python ./js-beautify-test
./jsbeautifier/tests/shell-smoke-test.sh

testj:
echo Testing javascript implementation...
node test/generate-tests.js || exit 1;\
node --version; \
npm test

Expand All @@ -49,6 +58,10 @@ tests: testj testp

test: testj testp

status:
test/git-status-clear.sh || exit 1


gh:
git push origin master &&\
cd gh-pages &&\
Expand Down
109 changes: 79 additions & 30 deletions libs/js-beautify/README.md 100755 → 100644
@@ -1,6 +1,11 @@
# JS Beautifier
[![Build Status](https://secure.travis-ci.org/einars/js-beautify.png?branch=master)](http://travis-ci.org/einars/js-beautify)
[![NPM version](https://badge.fury.io/js/js-beautify.png)](http://badge.fury.io/js/js-beautify)
[![Build Status](https://img.shields.io/travis/beautify-web/js-beautify/master.svg)](http://travis-ci.org/beautify-web/js-beautify)
[![NPM version](https://img.shields.io/npm/v/js-beautify.svg)](https://www.npmjs.com/package/js-beautify)
[![Download stats](https://img.shields.io/npm/dm/js-beautify.svg)](https://www.npmjs.com/package/js-beautify)
[![Join the chat at https://gitter.im/beautify-web/js-beautify](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/beautify-web/js-beautify?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![NPM stats](https://nodei.co/npm/js-beautify.svg?downloadRank=true&downloads=true)](https://www.npmjs.org/package/js-beautify)


This little beautifier will reformat and reindent bookmarklets, ugly
JavaScript, unpack scripts packed by Dean Edward’s popular packer,
Expand Down Expand Up @@ -82,21 +87,25 @@ CLI Options:
-v, --version Show the version
Beautifier Options:
-s, --indent-size Indentation size [4]
-c, --indent-char Indentation character [" "]
-l, --indent-level Initial indentation level [0]
-t, --indent-with-tabs Indent with tabs, overrides -s and -c
-p, --preserve-newlines Preserve line-breaks (--no-preserve-newlines disables)
-m, --max-preserve-newlines Number of line-breaks to be preserved in one chunk [10]
-P, --space-in-paren Add padding spaces within paren, ie. f( a, b )
-j, --jslint-happy Enable jslint-stricter mode
-b, --brace-style [collapse|expand|end-expand] ["collapse"]
-B, --break-chained-methods Break chained method calls across subsequent lines
-k, --keep-array-indentation Preserve array indentation
-x, --unescape-strings Decode printable characters encoded in xNN notation
-w, --wrap-line-length Wrap lines at next opportunity after N characters [0]
-X, --e4x Pass E4X xml literals through untouched
--good-stuff Warm the cockles of Crockford's heart
-s, --indent-size Indentation size [4]
-c, --indent-char Indentation character [" "]
-e, --eol character(s) to use as line terminators. (default newline - "\\n")');
-l, --indent-level Initial indentation level [0]
-t, --indent-with-tabs Indent with tabs, overrides -s and -c
-p, --preserve-newlines Preserve line-breaks (--no-preserve-newlines disables)
-m, --max-preserve-newlines Number of line-breaks to be preserved in one chunk [10]
-P, --space-in-paren Add padding spaces within paren, ie. f( a, b )
-j, --jslint-happy Enable jslint-stricter mode
-a, --space-after-anon-function Add a space before an anonymous function's parens, ie. function ()
-b, --brace-style [collapse|expand|end-expand|none] ["collapse"]
-B, --break-chained-methods Break chained method calls across subsequent lines
-k, --keep-array-indentation Preserve array indentation
-x, --unescape-strings Decode printable characters encoded in xNN notation
-w, --wrap-line-length Wrap lines at next opportunity after N characters [0]
-X, --e4x Pass E4X xml literals through untouched
-n, --end-with-newline End output with newline
-C, --comma-first Put commas at the beginning of new line instead of end
--good-stuff Warm the cockles of Crockford's heart
```

These largely correspond to the underscored option keys for both library interfaces, which have these defaults:
Expand All @@ -105,19 +114,24 @@ These largely correspond to the underscored option keys for both library interfa
{
"indent_size": 4,
"indent_char": " ",
"eol": "\n",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"jslint_happy": false,
"space_after_anon_function": false,
"brace_style": "collapse",
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"break_chained_methods": false,
"eval_code": false,
"unescape_strings": false,
"wrap_line_length": 0
"wrap_line_length": 0,
"wrap_attributes": "auto",
"wrap_attributes_indent_size": 4,
"end_with_newline": false
}
```

Expand All @@ -131,6 +145,30 @@ Configuration sources provided earlier in this stack will override later ones.

You might notice that the CLI options and defaults hash aren't 100% correlated. Historically, the Python and JS APIs have not been 100% identical. For example, `space_before_conditional` is currently JS-only, and not addressable from the CLI script. There are a few other additional cases keeping us from 100% API-compatibility. Patches welcome!

## Directives to Ignore or Preserve sections (Javascript only)

Beautifier for supports directives in comments inside the file.
This allows you to tell the beautifier to preserve the formtatting of or completely ignore part of a file.
The example input below will remain changed after beautification

```js
// Use preserve when the content is not javascript, but you don't want it reformatted.
/* beautify preserve:start */
{
browserName: 'internet explorer',
platform: 'Windows 7',
version: '8'
}
/* beautify preserve:end */

// Use ignore when the content is not parsable as javascript.
var a = 1;
/* beautify ignore:start */
{This is some strange{template language{using open-braces?
/* beautify ignore:end */
```
### CSS & HTML
In addition to the `js-beautify` executable, `css-beautify` and `html-beautify` are also provided as an easy interface into those scripts. Alternatively, `js-beautify --css` or `js-beautify --html` will accomplish the same thing, respectively.
Expand All @@ -148,19 +186,30 @@ The CSS & HTML beautifiers are much simpler in scope, and possess far fewer opti
```text
CSS Beautifier Options:
-s, --indent-size Indentation size [4]
-c, --indent-char Indentation character [" "]
-s, --indent-size Indentation size [4]
-c, --indent-char Indentation character [" "]
-t, --indent-with-tabs Indent with tabs, overrides -s and -c
-e, --eol Character(s) to use as line terminators. (default newline - "\\n")
-n, --end-with-newline End output with newline
-L, --selector-separator-newline Add a newline between multiple selectors
-N, --newline-between-rules Add a newline between CSS rules

HTML Beautifier Options:
-I, --indent-inner-html Indent <head> and <body> sections. Default is false.
-s, --indent-size Indentation size [4]
-c, --indent-char Indentation character [" "]
-b, --brace-style [collapse|expand|end-expand] ["collapse"]
-S, --indent-scripts [keep|separate|normal] ["normal"]
-w, --wrap-line-length Maximum characters per line (0 disables) [250]
-p, --preserve-newlines Preserve existing line-breaks (--no-preserve-newlines disables)
-m, --max-preserve-newlines Maximum number of line-breaks to be preserved in one chunk [10]
-U, --unformatted List of tags (defaults to inline) that should not be reformatted
-s, --indent-size Indentation size [4]
-c, --indent-char Indentation character [" "]
-t, --indent-with-tabs Indent with tabs, overrides -s and -c
-e, --eol Character(s) to use as line terminators. (default newline - "\\n")
-n, --end-with-newline End output with newline
-p, --preserve-newlines Preserve existing line-breaks (--no-preserve-newlines disables)
-m, --max-preserve-newlines Maximum number of line-breaks to be preserved in one chunk [10]
-I, --indent-inner-html Indent <head> and <body> sections. Default is false.
-b, --brace-style [collapse|expand|end-expand|none] ["collapse"]
-S, --indent-scripts [keep|separate|normal] ["normal"]
-w, --wrap-line-length Maximum characters per line (0 disables) [250]
-A, --wrap-attributes Wrap attributes to new lines [auto|force] ["auto"]
-i, --wrap-attributes-indent-size Indent wrapped attributes to after N characters [indent-size]
-U, --unformatted List of tags (defaults to inline) that should not be reformatted
-E, --extra_liners List of tags (defaults to [head,body,/html] that should have an extra newline before them.
```
# License
Expand All @@ -178,5 +227,5 @@ useful or working for you but you must keep the copyright notice and license. (M
Thanks also to Jason Diamond, Patrick Hof, Nochum Sossonko, Andreas Schneider, Dave
Vasilevsky, Vital Batmanov, Ron Baldwin, Gabriel Harrison, Chris J. Shull,
Mathias Bynens, Vittorio Gambaletta and others.
js-beautify@1.3.4
js-beautify@1.5.7
1 change: 0 additions & 1 deletion libs/js-beautify/bower.json 100755 → 100644
@@ -1,6 +1,5 @@
{
"name": "js-beautify",
"version": "1.5.0",
"main": [
"./js/lib/beautify.js",
"./js/lib/beautify-css.js",
Expand Down

0 comments on commit 38f4004

Please sign in to comment.