js-beautify 1.14.4 → 1.14.5
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.
- package/README.md +14 -14
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ If you are interested, please take a look at the [CONTRIBUTING.md](https://githu
|
|
|
26
26
|
|
|
27
27
|
# Installation
|
|
28
28
|
|
|
29
|
-
You can install the beautifier for
|
|
29
|
+
You can install the beautifier for Node.js or Python.
|
|
30
30
|
|
|
31
31
|
## Node.js JavaScript
|
|
32
32
|
|
|
@@ -58,13 +58,13 @@ JS Beautifier is hosted on two CDN services: [cdnjs](https://cdnjs.com/libraries
|
|
|
58
58
|
|
|
59
59
|
To pull the latest version from one of these services include one set of the script tags below in your document:
|
|
60
60
|
```html
|
|
61
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.
|
|
62
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.
|
|
63
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.
|
|
61
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.5/beautify.js"></script>
|
|
62
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.5/beautify-css.js"></script>
|
|
63
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.5/beautify-html.js"></script>
|
|
64
64
|
|
|
65
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.
|
|
66
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.
|
|
67
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.
|
|
65
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.5/beautify.min.js"></script>
|
|
66
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.5/beautify-css.min.js"></script>
|
|
67
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.5/beautify-html.min.js"></script>
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
Older versions are available by changing the version number.
|
|
@@ -85,7 +85,7 @@ $ pip install cssbeautifier
|
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
# Usage
|
|
88
|
-
You can beautify
|
|
88
|
+
You can beautify JavaScript using JS Beautifier in your web browser, or on the command-line using Node.js or Python.
|
|
89
89
|
|
|
90
90
|
## Web Browser
|
|
91
91
|
Open [beautifier.io](https://beautifier.io/). Options are available via the UI.
|
|
@@ -101,7 +101,7 @@ When installed globally, the beautifier provides an executable `js-beautify` scr
|
|
|
101
101
|
$ js-beautify foo.js
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
To use `js-beautify` as a `node` library (after install locally), import and call the appropriate beautifier method for
|
|
104
|
+
To use `js-beautify` as a `node` library (after install locally), import and call the appropriate beautifier method for JavaScript (JS), CSS, or HTML. All three method signatures are `beautify(code, options)`. `code` is the string of code to be beautified. options is an object with the settings you would like used to beautify the code.
|
|
105
105
|
|
|
106
106
|
The configuration option names are the same as the CLI names but with underscores instead of dashes. For example, `--indent-size 2 --space-in-empty-paren` would be `{ indent_size: 2, space_in_empty_paren: true }`.
|
|
107
107
|
|
|
@@ -130,7 +130,7 @@ To use `jsbeautifier` as a library is simple:
|
|
|
130
130
|
|
|
131
131
|
```python
|
|
132
132
|
import jsbeautifier
|
|
133
|
-
res = jsbeautifier.beautify('your
|
|
133
|
+
res = jsbeautifier.beautify('your JavaScript string')
|
|
134
134
|
res = jsbeautifier.beautify_file('some_file.js')
|
|
135
135
|
```
|
|
136
136
|
|
|
@@ -140,7 +140,7 @@ res = jsbeautifier.beautify_file('some_file.js')
|
|
|
140
140
|
opts = jsbeautifier.default_options()
|
|
141
141
|
opts.indent_size = 2
|
|
142
142
|
opts.space_in_empty_paren = True
|
|
143
|
-
res = jsbeautifier.beautify('some
|
|
143
|
+
res = jsbeautifier.beautify('some JavaScript', opts)
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
The configuration option names are the same as the CLI names but with underscores instead of dashes. The example above would be set on the command-line as `--indent-size 2 --space-in-empty-paren`.
|
|
@@ -188,7 +188,7 @@ Beautifier Options:
|
|
|
188
188
|
-C, --comma-first Put commas at the beginning of new line instead of end
|
|
189
189
|
-O, --operator-position Set operator position (before-newline|after-newline|preserve-newline) [before-newline]
|
|
190
190
|
--indent-empty-lines Keep indentation on empty lines
|
|
191
|
-
--templating List of templating languages (auto,django,erb,handlebars,php,smarty) ["auto"] auto = none in JavaScript, all in
|
|
191
|
+
--templating List of templating languages (auto,django,erb,handlebars,php,smarty) ["auto"] auto = none in JavaScript, all in HTML
|
|
192
192
|
```
|
|
193
193
|
|
|
194
194
|
Which correspond to the underscored option keys for both library interfaces
|
|
@@ -251,7 +251,7 @@ Configuration sources provided earlier in this stack will override later ones.
|
|
|
251
251
|
|
|
252
252
|
The settings are a shallow tree whose values are inherited for all languages, but
|
|
253
253
|
can be overridden. This works for settings passed directly to the API in either implementation.
|
|
254
|
-
In the
|
|
254
|
+
In the JavaScript implementation, settings loaded from a config file, such as .jsbeautifyrc, can also use inheritance/overriding.
|
|
255
255
|
|
|
256
256
|
Below is an example configuration tree showing all the supported locations
|
|
257
257
|
for language override nodes. We'll use `indent_size` to discuss how this configuration would behave, but any number of settings can be inherited or overridden:
|
|
@@ -397,4 +397,4 @@ Thanks also to Jason Diamond, Patrick Hof, Nochum Sossonko, Andreas Schneider, D
|
|
|
397
397
|
Vasilevsky, Vital Batmanov, Ron Baldwin, Gabriel Harrison, Chris J. Shull,
|
|
398
398
|
Mathias Bynens, Vittorio Gambaletta and others.
|
|
399
399
|
|
|
400
|
-
(README.md: js-beautify@1.14.
|
|
400
|
+
(README.md: js-beautify@1.14.5)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-beautify",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.5",
|
|
4
4
|
"description": "beautifier.io for node",
|
|
5
5
|
"main": "js/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"config-chain": "^1.1.13",
|
|
53
53
|
"editorconfig": "^0.15.3",
|
|
54
|
-
"glob": "^
|
|
55
|
-
"nopt": "^
|
|
54
|
+
"glob": "^8.0.3",
|
|
55
|
+
"nopt": "^6.0.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"ansi-regex": "^6.0.1",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"jquery": "^3.6.0",
|
|
62
62
|
"jshint": "^2.13.4",
|
|
63
63
|
"minimist": "^1.2.6",
|
|
64
|
-
"mocha": "^
|
|
64
|
+
"mocha": "^10.0.0",
|
|
65
65
|
"mustache": "^4.2.0",
|
|
66
66
|
"requirejs": "^2.3.6",
|
|
67
|
-
"serve": "^
|
|
67
|
+
"serve": "^14.0.1",
|
|
68
68
|
"strip-ansi": "^7.0.1",
|
|
69
|
-
"webpack": "^5.
|
|
70
|
-
"webpack-cli": "^4.
|
|
69
|
+
"webpack": "^5.74.0",
|
|
70
|
+
"webpack-cli": "^4.10.0"
|
|
71
71
|
}
|
|
72
72
|
}
|