diff -Nru node-js-beautify-1.11.0+dfsg/azure-pipelines.yml node-js-beautify-1.13.6+dfsg+~0.15.3/azure-pipelines.yml
--- node-js-beautify-1.11.0+dfsg/azure-pipelines.yml 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/azure-pipelines.yml 1970-01-01 00:00:00.000000000 +0000
@@ -1,96 +0,0 @@
-# https://aka.ms/yaml
-jobs:
-- job: 'Windows'
- pool:
- vmImage: 'windows-latest'
- strategy:
- matrix:
- Python36_Node10:
- python.version: '3.6'
- python.architecture: 'x64'
- node_version: 10.x
- Python37_Node12:
- python.version: '3.7'
- python.architecture: 'x64'
- node_version: 12.x
- Python38_Node13:
- python.version: '3.8'
- python.architecture: 'x64'
- node_version: 13.x
- maxParallel: 6
-
- steps:
- - task: UsePythonVersion@0
- inputs:
- versionSpec: '$(python.version)'
- architecture: '$(python.architecture)'
- - task: NodeTool@0
- inputs:
- versionSpec: $(node_version)
-
-# change this to make ci after addressing git CRLF issue
- - task: Bash@3
- inputs:
- targetType: 'inline'
- script: 'make all'
-
-- job: 'Linux'
- pool:
- vmImage: 'ubuntu-latest'
- strategy:
- matrix:
- Python27_Node8:
- python.version: '2.7'
- node_version: 8.x
- Python35_Node10:
- python.version: '3.5'
- node_version: 10.x
- Python37_Node12:
- python.version: '3.7'
- node_version: 12.x
- Python38_Node13:
- python.version: '3.8'
- node_version: 13.x
- maxParallel: 6
-
- steps:
- - task: UsePythonVersion@0
- inputs:
- versionSpec: '$(python.version)'
- architecture: 'x64'
- - task: NodeTool@0
- inputs:
- versionSpec: $(node_version)
-
- - task: Bash@3
- inputs:
- targetType: 'inline'
- script: 'make ci'
-
-- job: 'MacOS'
- pool:
- vmImage: 'macOS-latest'
- strategy:
- matrix:
- Python27_Node8:
- python.version: '2.7'
- node_version: 8.x
- Python37_Node12:
- python.version: '3.7'
- node_version: 12.x
- maxParallel: 6
-
- steps:
- - task: UsePythonVersion@0
- inputs:
- versionSpec: '$(python.version)'
- architecture: 'x64'
- - task: NodeTool@0
- inputs:
- versionSpec: $(node_version)
-
- - task: Bash@3
- inputs:
- targetType: 'inline'
- script: 'make ci'
-
diff -Nru node-js-beautify-1.11.0+dfsg/CHANGELOG.md node-js-beautify-1.13.6+dfsg+~0.15.3/CHANGELOG.md
--- node-js-beautify-1.11.0+dfsg/CHANGELOG.md 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/CHANGELOG.md 2021-01-26 17:37:55.000000000 +0000
@@ -1,4 +1,68 @@
# Changelog
+## v1.13.6
+
+### Description
+
+
+### Closed Issues
+* Fix space-before-conditional: false to work on switch-case statement ([#1881](https://github.com/beautify-web/js-beautify/pull/1881))
+* Optional chaining obj?.[expr] ([#1801](https://github.com/beautify-web/js-beautify/issues/1801))
+
+
+## v1.13.5
+
+### Description
+Placeholder milestone for testing release scripts
+
+### Closed Issues
+
+
+## v1.13.1
+
+### Description
+
+
+### Closed Issues
+* Option 'max_preserve_newlines' not working on beautify_css.js CSS Beautifier ([#1863](https://github.com/beautify-web/js-beautify/issues/1863))
+* React Fragment Short Syntax <>> issue ([#1854](https://github.com/beautify-web/js-beautify/issues/1854))
+* add viewport meta tag to index.html ([#1843](https://github.com/beautify-web/js-beautify/pull/1843))
+* Add basic smarty templating support ([#1820](https://github.com/beautify-web/js-beautify/issues/1820))
+* Tagged Template literals ([#1244](https://github.com/beautify-web/js-beautify/issues/1244))
+
+
+## v1.13.0
+
+### Description
+This release truly fixes the python cssbeautifier installation and updates cssbeautifier cli to use the same general code as jsbeautifier.
+
+Also, as of this release Node.js 8.x is no longer guaranteed to work. Node.js 8.x LTS reached end-of-life in January 2020.
+Parts of our test infrastructure no longer support Node.js 8.x. The js-beautifier should still run on Node.js 8.x, but it is not part of the CI system and so not guaranteed to work.
+
+
+### Closed Issues
+* (internal) Refactor python cssbeautifier to reuse jsbeautifier CLI methods ([#1832](https://github.com/beautify-web/js-beautify/pull/1832))
+* (internal) Switch from node-static to serve ([#1831](https://github.com/beautify-web/js-beautify/pull/1831))
+* Fixed pip install cssbeautifier ([#1830](https://github.com/beautify-web/js-beautify/pull/1830))
+
+
+## v1.12.0
+
+### Description
+
+
+### Closed Issues
+* Python jsbeautifier fails for special chars ([#1809](https://github.com/beautify-web/js-beautify/issues/1809))
+* pip install cssbeautifier fails ([#1808](https://github.com/beautify-web/js-beautify/issues/1808))
+* Add expand brace-style option to css beautifier ([#1796](https://github.com/beautify-web/js-beautify/pull/1796))
+* Support nullish-coalescing ([#1794](https://github.com/beautify-web/js-beautify/issues/1794))
+* Upgrade ga.js to analytics.js ([#1777](https://github.com/beautify-web/js-beautify/issues/1777))
+* Newline rule not working with css-like files ([#1776](https://github.com/beautify-web/js-beautify/issues/1776))
+* no new line after self closing tag ([#1718](https://github.com/beautify-web/js-beautify/issues/1718))
+* HTML format, no break after
',
// -- output --
'----1---------2---------3---------4---------5---------6---------7-----\n' +
- '
-');
+ '
-\n' +
+ '');
bth(
'----1---------2---------3---------4---------5---------6---------7 --------81 ----2---------3---------4---------5---------6---------7-----
',
// -- output --
@@ -8391,9 +8528,63 @@
// unformatted to prevent formatting changes
reset_options();
set_name('unformatted to prevent formatting changes');
- opts.unformatted = ['u', 'span', 'textarea'];
+ opts.unformatted = ['h1', 'br', 'u', 'span', 'textarea'];
bth('Ignore block tags in unformatted regions
');
- bth('Don\'t wrap unformatted regions with extra newlines
');
+ bth('Do not wrap unformatted regions with extra newlines
');
+ bth(
+ '\n' +
+ 'Do not wrap unformatted regions with extra newlines
',
+ // -- output --
+ '\n' +
+ ' Do not wrap unformatted regions with extra newlines\n' +
+ '
');
+ bth('
');
+ bth(
+ '\n' +
+ '
',
+ // -- output --
+ '\n' +
+ '
\n' +
+ '
');
+ bth('');
+ bth(
+ '\n' +
+ '
',
+ // -- output --
+ '\n' +
+ '
\n' +
+ '');
+ bth('
');
+
+ // Inline parent should not add newline unlike block
+ bth(
+ '\n' +
+ '
',
+ // -- output --
+ '\n' +
+ '
');
+
+ // Inline parent with unformatted non-inline child
+ bth('Unformatted non-inline
');
+
+ // Inline parent with unformatted non-inline child
+ bth(
+ '\n' +
+ 'Unformatted non-inline
',
+ // -- output --
+ '\n' +
+ ' Unformatted non-inline
');
+
+ // Inline parent with unformatted non-inline empty child
+ bth('');
+
+ // Inline parent with unformatted non-inline empty child
+ bth(
+ '\n' +
+ '',
+ // -- output --
+ '\n' +
+ ' ');
bth(
' \n' +
'\n' +
@@ -8487,7 +8678,8 @@
'\n' +
'
\n' +
'
\n' +
- '
');
+ '
\n' +
+ '');
// Regression test #1534 - interaction between unformatted, content_unformatted, and inline
bth(
@@ -8724,6 +8916,26 @@
//============================================================
+ // Smarty tests for extra whitespace in nested quotes
+ reset_options();
+ set_name('Smarty tests for extra whitespace in nested quotes');
+ opts.templating = 'smarty';
+ bth('foo
');
+ bth('');
+
+
+ //============================================================
+ // Smarty tests for script
+ reset_options();
+ set_name('Smarty tests for script');
+ opts.templating = 'smarty';
+ bth(
+ '');
+
+
+ //============================================================
// New Test Suite
reset_options();
set_name('New Test Suite');
diff -Nru node-js-beautify-1.11.0+dfsg/js/test/generated/beautify-javascript-tests.js node-js-beautify-1.13.6+dfsg+~0.15.3/js/test/generated/beautify-javascript-tests.js
--- node-js-beautify-1.11.0+dfsg/js/test/generated/beautify-javascript-tests.js 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/js/test/generated/beautify-javascript-tests.js 2021-01-26 17:37:55.000000000 +0000
@@ -3218,17 +3218,24 @@
'} else {\n' +
' c;\n' +
'}');
+ bt('fn`tagged`');
+ bt('fn()`tagged`');
+ bt('fn`${algo} ${`6string`}`');
+ bt('fn`${fn2()} more text ${`${`more text`}`} banana ${fn3`test`} ${fn4()`moretest banana2`}`');
+ bt('`untagged`+`untagged`', '`untagged` + `untagged`');
+ bt('fun() `taggedd`');
+ bt('fn[0]`tagged`', 'fn[0] `tagged`');
//============================================================
- // operator_position option - ensure no neswlines if preserve_newlines is false - (preserve_newlines = "false")
+ // operator_position option - ensure no newlines if preserve_newlines is false - (preserve_newlines = "false")
reset_options();
- set_name('operator_position option - ensure no neswlines if preserve_newlines is false - (preserve_newlines = "false")');
+ set_name('operator_position option - ensure no newlines if preserve_newlines is false - (preserve_newlines = "false")');
opts.preserve_newlines = false;
bt(
'var res = a + b - c / d * e % f;\n' +
'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
+ 'var res = (k && l || m) ? n ?? nn : o;\n' +
'var res = p >> q << r >>> s;\n' +
'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
'ac + -ad');
@@ -3246,6 +3253,7 @@
'l\n' +
'|| m) ?\n' +
'n\n' +
+ '?? nn\n' +
': o\n' +
';\n' +
'var res = p\n' +
@@ -3266,20 +3274,20 @@
// -- output --
'var res = a + b - c / d * e % f;\n' +
'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
+ 'var res = (k && l || m) ? n ?? nn : o;\n' +
'var res = p >> q << r >>> s;\n' +
'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
'ac + -ad');
- // operator_position option - ensure no neswlines if preserve_newlines is false - (operator_position = ""before-newline"", preserve_newlines = "false")
+ // operator_position option - ensure no newlines if preserve_newlines is false - (operator_position = ""before-newline"", preserve_newlines = "false")
reset_options();
- set_name('operator_position option - ensure no neswlines if preserve_newlines is false - (operator_position = ""before-newline"", preserve_newlines = "false")');
+ set_name('operator_position option - ensure no newlines if preserve_newlines is false - (operator_position = ""before-newline"", preserve_newlines = "false")');
opts.operator_position = 'before-newline';
opts.preserve_newlines = false;
bt(
'var res = a + b - c / d * e % f;\n' +
'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
+ 'var res = (k && l || m) ? n ?? nn : o;\n' +
'var res = p >> q << r >>> s;\n' +
'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
'ac + -ad');
@@ -3297,6 +3305,7 @@
'l\n' +
'|| m) ?\n' +
'n\n' +
+ '?? nn\n' +
': o\n' +
';\n' +
'var res = p\n' +
@@ -3317,20 +3326,20 @@
// -- output --
'var res = a + b - c / d * e % f;\n' +
'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
+ 'var res = (k && l || m) ? n ?? nn : o;\n' +
'var res = p >> q << r >>> s;\n' +
'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
'ac + -ad');
- // operator_position option - ensure no neswlines if preserve_newlines is false - (operator_position = ""after-newline"", preserve_newlines = "false")
+ // operator_position option - ensure no newlines if preserve_newlines is false - (operator_position = ""after-newline"", preserve_newlines = "false")
reset_options();
- set_name('operator_position option - ensure no neswlines if preserve_newlines is false - (operator_position = ""after-newline"", preserve_newlines = "false")');
+ set_name('operator_position option - ensure no newlines if preserve_newlines is false - (operator_position = ""after-newline"", preserve_newlines = "false")');
opts.operator_position = 'after-newline';
opts.preserve_newlines = false;
bt(
'var res = a + b - c / d * e % f;\n' +
'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
+ 'var res = (k && l || m) ? n ?? nn : o;\n' +
'var res = p >> q << r >>> s;\n' +
'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
'ac + -ad');
@@ -3348,6 +3357,7 @@
'l\n' +
'|| m) ?\n' +
'n\n' +
+ '?? nn\n' +
': o\n' +
';\n' +
'var res = p\n' +
@@ -3368,20 +3378,20 @@
// -- output --
'var res = a + b - c / d * e % f;\n' +
'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
+ 'var res = (k && l || m) ? n ?? nn : o;\n' +
'var res = p >> q << r >>> s;\n' +
'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
'ac + -ad');
- // operator_position option - ensure no neswlines if preserve_newlines is false - (operator_position = ""preserve-newline"", preserve_newlines = "false")
+ // operator_position option - ensure no newlines if preserve_newlines is false - (operator_position = ""preserve-newline"", preserve_newlines = "false")
reset_options();
- set_name('operator_position option - ensure no neswlines if preserve_newlines is false - (operator_position = ""preserve-newline"", preserve_newlines = "false")');
+ set_name('operator_position option - ensure no newlines if preserve_newlines is false - (operator_position = ""preserve-newline"", preserve_newlines = "false")');
opts.operator_position = 'preserve-newline';
opts.preserve_newlines = false;
bt(
'var res = a + b - c / d * e % f;\n' +
'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
+ 'var res = (k && l || m) ? n ?? nn : o;\n' +
'var res = p >> q << r >>> s;\n' +
'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
'ac + -ad');
@@ -3399,6 +3409,7 @@
'l\n' +
'|| m) ?\n' +
'n\n' +
+ '?? nn\n' +
': o\n' +
';\n' +
'var res = p\n' +
@@ -3419,7 +3430,7 @@
// -- output --
'var res = a + b - c / d * e % f;\n' +
'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
+ 'var res = (k && l || m) ? n ?? nn : o;\n' +
'var res = p >> q << r >>> s;\n' +
'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
'ac + -ad');
@@ -3445,6 +3456,7 @@
'l\n' +
'|| m) ?\n' +
'n\n' +
+ '?? nn\n' +
': o\n' +
';\n' +
'var res = p\n' +
@@ -3474,7 +3486,8 @@
'var res = (k &&\n' +
' l ||\n' +
' m) ?\n' +
- ' n :\n' +
+ ' n ??\n' +
+ ' nn :\n' +
' o;\n' +
'var res = p >>\n' +
' q <<\n' +
@@ -3569,6 +3582,7 @@
'l\n' +
'|| m) ?\n' +
'n\n' +
+ '?? nn\n' +
': o\n' +
';\n' +
'var res = p\n' +
@@ -3598,7 +3612,8 @@
'var res = (k &&\n' +
' l ||\n' +
' m) ?\n' +
- ' n :\n' +
+ ' n ??\n' +
+ ' nn :\n' +
' o;\n' +
'var res = p >>\n' +
' q <<\n' +
@@ -3695,6 +3710,7 @@
'l\n' +
'|| m) ?\n' +
'n\n' +
+ '?? nn\n' +
': o\n' +
';\n' +
'var res = p\n' +
@@ -3725,6 +3741,7 @@
' && l\n' +
' || m)\n' +
' ? n\n' +
+ ' ?? nn\n' +
' : o;\n' +
'var res = p\n' +
' >> q\n' +
@@ -3820,6 +3837,7 @@
'l\n' +
'|| m) ?\n' +
'n\n' +
+ '?? nn\n' +
': o\n' +
';\n' +
'var res = p\n' +
@@ -3851,6 +3869,7 @@
' l\n' +
' || m) ?\n' +
' n\n' +
+ ' ?? nn\n' +
' : o;\n' +
'var res = p\n' +
' >> q <<\n' +
@@ -4406,6 +4425,17 @@
' {children}\n' +
' {a + b}>\n' +
');');
+ bt(
+ 'class Columns extends React.Component {\n' +
+ ' render() {\n' +
+ ' return (\n' +
+ ' <>\n' +
+ ' Hello | \n' +
+ ' World | \n' +
+ ' >\n' +
+ ' );\n' +
+ ' }\n' +
+ '}');
//============================================================
@@ -4451,6 +4481,7 @@
'do\n' +
' c();\n' +
'while(a) b()');
+ bt('switch(a) b()');
bt(
'if(a)\n' +
'b();',
@@ -4471,6 +4502,12 @@
'do\n' +
' c();\n' +
'while(a);');
+ bt(
+ 'switch(a)\n' +
+ 'b()',
+ // -- output --
+ 'switch(a)\n' +
+ ' b()');
bt('return [];');
bt('return ();');
@@ -4484,6 +4521,7 @@
'do\n' +
' c();\n' +
'while (a) b()');
+ bt('switch (a) b()');
bt(
'if(a)\n' +
'b();',
@@ -4504,6 +4542,12 @@
'do\n' +
' c();\n' +
'while (a);');
+ bt(
+ 'switch(a)\n' +
+ 'b()',
+ // -- output --
+ 'switch (a)\n' +
+ ' b()');
bt('return [];');
bt('return ();');
@@ -6945,6 +6989,11 @@
' new Date().getTime()\n' +
'].join("-");');
+ // Issue 1801 - Optional chaining w/ obj?.[expr] syntax
+ bt(
+ 'let nestedProp = obj?.["prop" + "Name"];\n' +
+ 'let arrayItem = arr?.[42];');
+
// Issue 1374 - Parameters starting with ! or [ merged into single line
bt(
'fn(\n' +
@@ -7001,6 +7050,9 @@
' return x;\n' +
' };');
+ // Issue #1794 - support nullish-coalescing
+ bt('a = b ?? c');
+
// Issue #569 - function should not have blank line in a number of cases
bt(
'(function(global) {\n' +
diff -Nru node-js-beautify-1.11.0+dfsg/Makefile node-js-beautify-1.13.6+dfsg+~0.15.3/Makefile
--- node-js-beautify-1.11.0+dfsg/Makefile 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/Makefile 2021-01-26 17:37:55.000000000 +0000
@@ -11,7 +11,7 @@
help:
@echo "make "
@echo " all - build both implementations"
- @echo " static - serve static version of site locally"
+ @echo " serve - serve site locally from localhost:8080"
@echo " js - build javascript"
@echo " py - build python"
@echo " alltest - test both implementations, js and python"
@@ -20,8 +20,8 @@
ci: all git-status-clear
-static: js/lib/*.js
- @./node_modules/.bin/static -H '{"Cache-Control": "no-cache, must-revalidate"}'
+serve: js/lib/*.js
+ @./node_modules/.bin/serve
js: generate-tests js/lib/*.js
@echo Testing node beautify functionality...
@@ -30,6 +30,7 @@
py: generate-tests $(BUILD_DIR)/python
@echo Testing python beautify functionality...
+ $(SCRIPT_DIR)/python-dev3 black --config=python/pyproject.toml python
$(SCRIPT_DIR)/python-dev python python/js-beautify-test.py || exit 1
jstest: depends js build/*.tgz
@@ -78,12 +79,20 @@
# python package generation
-python/dist/*: $(BUILD_DIR)/python $(wildcard python/**/*.py) python/jsbeautifier/*
+python/dist/*: $(BUILD_DIR)/python $(wildcard python/**/*.py) python/jsbeautifier/* python/cssbeautifier/*
@echo Building python package...
- rm -f python/dist/*
+ @rm -f python/dist/*
@cd python && \
- $(PYTHON) setup.py sdist
- $(SCRIPT_DIR)/python-rel pip install -U python/dist/*
+ cp setup-css.py setup.py && \
+ $(PYTHON) setup.py sdist && \
+ rm setup.py
+ @cd python && \
+ cp setup-js.py setup.py && \
+ $(PYTHON) setup.py sdist && \
+ rm setup.py
+ # Order matters here! Install css then js to make sure the local dist version of js is used
+ $(SCRIPT_DIR)/python-rel pip install -U python/dist/cssbeautifier*
+ $(SCRIPT_DIR)/python-rel pip install -U python/dist/jsbeautifier*
# python package generation
build/*.tgz: js/lib/*.js
@@ -120,15 +129,21 @@
$(NPM) --version
@touch $(BUILD_DIR)/node
-$(BUILD_DIR)/python: python/setup.py | $(BUILD_DIR) $(BUILD_DIR)/virtualenv
+$(BUILD_DIR)/python: python/setup-js.py python/setup-css.py | $(BUILD_DIR) $(BUILD_DIR)/virtualenv
@$(PYTHON) --version
+ # Order matters here! Install css then js to make sure the local dist version of js is used
+ @cp ./python/setup-css.py ./python/setup.py
+ $(SCRIPT_DIR)/python-dev pip install -e ./python
+ @cp ./python/setup-js.py ./python/setup.py
$(SCRIPT_DIR)/python-dev pip install -e ./python
+ @rm ./python/setup.py
@touch $(BUILD_DIR)/python
$(BUILD_DIR)/virtualenv: | $(BUILD_DIR)
virtualenv --version || pip install virtualenv
virtualenv build/python-dev
virtualenv build/python-rel
+ $(SCRIPT_DIR)/python-dev3 pip install black
@touch $(BUILD_DIR)/virtualenv
@@ -145,5 +160,5 @@
git clean -xfd
#######################################################
-.PHONY: all beautify clean depends generate-tests git-status-clear help static update
+.PHONY: all beautify clean depends generate-tests git-status-clear help serve update
diff -Nru node-js-beautify-1.11.0+dfsg/package.json node-js-beautify-1.13.6+dfsg+~0.15.3/package.json
--- node-js-beautify-1.11.0+dfsg/package.json 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/package.json 2021-01-26 17:37:55.000000000 +0000
@@ -1,6 +1,6 @@
{
"name": "js-beautify",
- "version": "1.11.0",
+ "version": "1.13.6",
"description": "beautifier.io for node",
"main": "js/index.js",
"bin": {
@@ -44,24 +44,27 @@
"Liam Newman "
],
"license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
"dependencies": {
"config-chain": "^1.1.12",
"editorconfig": "^0.15.3",
"glob": "^7.1.3",
- "mkdirp": "~1.0.3",
- "nopt": "^4.0.3"
+ "mkdirp": "^1.0.4",
+ "nopt": "^5.0.0"
},
"devDependencies": {
"benchmark": "^2.1.4",
- "codemirror": "^5.52.0",
- "jquery": "^3.4.1",
- "jshint": "^2.11.0",
+ "codemirror": "^5.56.0",
+ "jquery": "^3.5.1",
+ "jshint": "^2.12.0",
"minimist": ">=1.2.5",
- "mocha": "^7.1.1",
+ "mocha": "^8.1.1",
"mustache": "^4.0.1",
- "node-static": "^0.7.11",
+ "serve": "^11.3.2",
"requirejs": "^2.3.6",
- "webpack": "^4.42.0",
- "webpack-cli": "^3.3.11"
+ "webpack": "^4.44.1",
+ "webpack-cli": "^3.3.12"
}
}
diff -Nru node-js-beautify-1.11.0+dfsg/package-lock.json node-js-beautify-1.13.6+dfsg+~0.15.3/package-lock.json
--- node-js-beautify-1.11.0+dfsg/package-lock.json 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/package-lock.json 2021-01-26 17:37:55.000000000 +0000
@@ -1,182 +1,181 @@
{
"name": "js-beautify",
- "version": "1.11.0",
+ "version": "1.13.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@webassemblyjs/ast": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz",
- "integrity": "sha512-aJMfngIZ65+t71C3y2nBBg5FFG0Okt9m0XEgWZ7Ywgn1oMAT8cNwx00Uv1cQyHtidq0Xn94R4TAywO+LCQ+ZAQ==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz",
+ "integrity": "sha512-C6wW5L+b7ogSDVqymbkkvuW9kruN//YisMED04xzeBBqjHa2FYnmvOlS6Xj68xWQRgWvI9cIglsjFowH/RJyEA==",
"dev": true,
"requires": {
- "@webassemblyjs/helper-module-context": "1.8.5",
- "@webassemblyjs/helper-wasm-bytecode": "1.8.5",
- "@webassemblyjs/wast-parser": "1.8.5"
+ "@webassemblyjs/helper-module-context": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/wast-parser": "1.9.0"
}
},
"@webassemblyjs/floating-point-hex-parser": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.8.5.tgz",
- "integrity": "sha512-9p+79WHru1oqBh9ewP9zW95E3XAo+90oth7S5Re3eQnECGq59ly1Ri5tsIipKGpiStHsUYmY3zMLqtk3gTcOtQ==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.9.0.tgz",
+ "integrity": "sha512-TG5qcFsS8QB4g4MhrxK5TqfdNe7Ey/7YL/xN+36rRjl/BlGE/NcBvJcqsRgCP6Z92mRE+7N50pRIi8SmKUbcQA==",
"dev": true
},
"@webassemblyjs/helper-api-error": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.8.5.tgz",
- "integrity": "sha512-Za/tnzsvnqdaSPOUXHyKJ2XI7PDX64kWtURyGiJJZKVEdFOsdKUCPTNEVFZq3zJ2R0G5wc2PZ5gvdTRFgm81zA==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.9.0.tgz",
+ "integrity": "sha512-NcMLjoFMXpsASZFxJ5h2HZRcEhDkvnNFOAKneP5RbKRzaWJN36NC4jqQHKwStIhGXu5mUWlUUk7ygdtrO8lbmw==",
"dev": true
},
"@webassemblyjs/helper-buffer": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.8.5.tgz",
- "integrity": "sha512-Ri2R8nOS0U6G49Q86goFIPNgjyl6+oE1abW1pS84BuhP1Qcr5JqMwRFT3Ah3ADDDYGEgGs1iyb1DGX+kAi/c/Q==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.9.0.tgz",
+ "integrity": "sha512-qZol43oqhq6yBPx7YM3m9Bv7WMV9Eevj6kMi6InKOuZxhw+q9hOkvq5e/PpKSiLfyetpaBnogSbNCfBwyB00CA==",
"dev": true
},
"@webassemblyjs/helper-code-frame": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.8.5.tgz",
- "integrity": "sha512-VQAadSubZIhNpH46IR3yWO4kZZjMxN1opDrzePLdVKAZ+DFjkGD/rf4v1jap744uPVU6yjL/smZbRIIJTOUnKQ==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.9.0.tgz",
+ "integrity": "sha512-ERCYdJBkD9Vu4vtjUYe8LZruWuNIToYq/ME22igL+2vj2dQ2OOujIZr3MEFvfEaqKoVqpsFKAGsRdBSBjrIvZA==",
"dev": true,
"requires": {
- "@webassemblyjs/wast-printer": "1.8.5"
+ "@webassemblyjs/wast-printer": "1.9.0"
}
},
"@webassemblyjs/helper-fsm": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.8.5.tgz",
- "integrity": "sha512-kRuX/saORcg8se/ft6Q2UbRpZwP4y7YrWsLXPbbmtepKr22i8Z4O3V5QE9DbZK908dh5Xya4Un57SDIKwB9eow==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.9.0.tgz",
+ "integrity": "sha512-OPRowhGbshCb5PxJ8LocpdX9Kl0uB4XsAjl6jH/dWKlk/mzsANvhwbiULsaiqT5GZGT9qinTICdj6PLuM5gslw==",
"dev": true
},
"@webassemblyjs/helper-module-context": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.8.5.tgz",
- "integrity": "sha512-/O1B236mN7UNEU4t9X7Pj38i4VoU8CcMHyy3l2cV/kIF4U5KoHXDVqcDuOs1ltkac90IM4vZdHc52t1x8Yfs3g==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.9.0.tgz",
+ "integrity": "sha512-MJCW8iGC08tMk2enck1aPW+BE5Cw8/7ph/VGZxwyvGbJwjktKkDK7vy7gAmMDx88D7mhDTCNKAW5tED+gZ0W8g==",
"dev": true,
"requires": {
- "@webassemblyjs/ast": "1.8.5",
- "mamacro": "^0.0.3"
+ "@webassemblyjs/ast": "1.9.0"
}
},
"@webassemblyjs/helper-wasm-bytecode": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.8.5.tgz",
- "integrity": "sha512-Cu4YMYG3Ddl72CbmpjU/wbP6SACcOPVbHN1dI4VJNJVgFwaKf1ppeFJrwydOG3NDHxVGuCfPlLZNyEdIYlQ6QQ==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.9.0.tgz",
+ "integrity": "sha512-R7FStIzyNcd7xKxCZH5lE0Bqy+hGTwS3LJjuv1ZVxd9O7eHCedSdrId/hMOd20I+v8wDXEn+bjfKDLzTepoaUw==",
"dev": true
},
"@webassemblyjs/helper-wasm-section": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.8.5.tgz",
- "integrity": "sha512-VV083zwR+VTrIWWtgIUpqfvVdK4ff38loRmrdDBgBT8ADXYsEZ5mPQ4Nde90N3UYatHdYoDIFb7oHzMncI02tA==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.9.0.tgz",
+ "integrity": "sha512-XnMB8l3ek4tvrKUUku+IVaXNHz2YsJyOOmz+MMkZvh8h1uSJpSen6vYnw3IoQ7WwEuAhL8Efjms1ZWjqh2agvw==",
"dev": true,
"requires": {
- "@webassemblyjs/ast": "1.8.5",
- "@webassemblyjs/helper-buffer": "1.8.5",
- "@webassemblyjs/helper-wasm-bytecode": "1.8.5",
- "@webassemblyjs/wasm-gen": "1.8.5"
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-buffer": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/wasm-gen": "1.9.0"
}
},
"@webassemblyjs/ieee754": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.8.5.tgz",
- "integrity": "sha512-aaCvQYrvKbY/n6wKHb/ylAJr27GglahUO89CcGXMItrOBqRarUMxWLJgxm9PJNuKULwN5n1csT9bYoMeZOGF3g==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.9.0.tgz",
+ "integrity": "sha512-dcX8JuYU/gvymzIHc9DgxTzUUTLexWwt8uCTWP3otys596io0L5aW02Gb1RjYpx2+0Jus1h4ZFqjla7umFniTg==",
"dev": true,
"requires": {
"@xtuc/ieee754": "^1.2.0"
}
},
"@webassemblyjs/leb128": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.8.5.tgz",
- "integrity": "sha512-plYUuUwleLIziknvlP8VpTgO4kqNaH57Y3JnNa6DLpu/sGcP6hbVdfdX5aHAV716pQBKrfuU26BJK29qY37J7A==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.9.0.tgz",
+ "integrity": "sha512-ENVzM5VwV1ojs9jam6vPys97B/S65YQtv/aanqnU7D8aSoHFX8GyhGg0CMfyKNIHBuAVjy3tlzd5QMMINa7wpw==",
"dev": true,
"requires": {
"@xtuc/long": "4.2.2"
}
},
"@webassemblyjs/utf8": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.8.5.tgz",
- "integrity": "sha512-U7zgftmQriw37tfD934UNInokz6yTmn29inT2cAetAsaU9YeVCveWEwhKL1Mg4yS7q//NGdzy79nlXh3bT8Kjw==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.9.0.tgz",
+ "integrity": "sha512-GZbQlWtopBTP0u7cHrEx+73yZKrQoBMpwkGEIqlacljhXCkVM1kMQge/Mf+csMJAjEdSwhOyLAS0AoR3AG5P8w==",
"dev": true
},
"@webassemblyjs/wasm-edit": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.8.5.tgz",
- "integrity": "sha512-A41EMy8MWw5yvqj7MQzkDjU29K7UJq1VrX2vWLzfpRHt3ISftOXqrtojn7nlPsZ9Ijhp5NwuODuycSvfAO/26Q==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.9.0.tgz",
+ "integrity": "sha512-FgHzBm80uwz5M8WKnMTn6j/sVbqilPdQXTWraSjBwFXSYGirpkSWE2R9Qvz9tNiTKQvoKILpCuTjBKzOIm0nxw==",
"dev": true,
"requires": {
- "@webassemblyjs/ast": "1.8.5",
- "@webassemblyjs/helper-buffer": "1.8.5",
- "@webassemblyjs/helper-wasm-bytecode": "1.8.5",
- "@webassemblyjs/helper-wasm-section": "1.8.5",
- "@webassemblyjs/wasm-gen": "1.8.5",
- "@webassemblyjs/wasm-opt": "1.8.5",
- "@webassemblyjs/wasm-parser": "1.8.5",
- "@webassemblyjs/wast-printer": "1.8.5"
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-buffer": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/helper-wasm-section": "1.9.0",
+ "@webassemblyjs/wasm-gen": "1.9.0",
+ "@webassemblyjs/wasm-opt": "1.9.0",
+ "@webassemblyjs/wasm-parser": "1.9.0",
+ "@webassemblyjs/wast-printer": "1.9.0"
}
},
"@webassemblyjs/wasm-gen": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.8.5.tgz",
- "integrity": "sha512-BCZBT0LURC0CXDzj5FXSc2FPTsxwp3nWcqXQdOZE4U7h7i8FqtFK5Egia6f9raQLpEKT1VL7zr4r3+QX6zArWg==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.9.0.tgz",
+ "integrity": "sha512-cPE3o44YzOOHvlsb4+E9qSqjc9Qf9Na1OO/BHFy4OI91XDE14MjFN4lTMezzaIWdPqHnsTodGGNP+iRSYfGkjA==",
"dev": true,
"requires": {
- "@webassemblyjs/ast": "1.8.5",
- "@webassemblyjs/helper-wasm-bytecode": "1.8.5",
- "@webassemblyjs/ieee754": "1.8.5",
- "@webassemblyjs/leb128": "1.8.5",
- "@webassemblyjs/utf8": "1.8.5"
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/ieee754": "1.9.0",
+ "@webassemblyjs/leb128": "1.9.0",
+ "@webassemblyjs/utf8": "1.9.0"
}
},
"@webassemblyjs/wasm-opt": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.8.5.tgz",
- "integrity": "sha512-HKo2mO/Uh9A6ojzu7cjslGaHaUU14LdLbGEKqTR7PBKwT6LdPtLLh9fPY33rmr5wcOMrsWDbbdCHq4hQUdd37Q==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.9.0.tgz",
+ "integrity": "sha512-Qkjgm6Anhm+OMbIL0iokO7meajkzQD71ioelnfPEj6r4eOFuqm4YC3VBPqXjFyyNwowzbMD+hizmprP/Fwkl2A==",
"dev": true,
"requires": {
- "@webassemblyjs/ast": "1.8.5",
- "@webassemblyjs/helper-buffer": "1.8.5",
- "@webassemblyjs/wasm-gen": "1.8.5",
- "@webassemblyjs/wasm-parser": "1.8.5"
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-buffer": "1.9.0",
+ "@webassemblyjs/wasm-gen": "1.9.0",
+ "@webassemblyjs/wasm-parser": "1.9.0"
}
},
"@webassemblyjs/wasm-parser": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.8.5.tgz",
- "integrity": "sha512-pi0SYE9T6tfcMkthwcgCpL0cM9nRYr6/6fjgDtL6q/ZqKHdMWvxitRi5JcZ7RI4SNJJYnYNaWy5UUrHQy998lw==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.9.0.tgz",
+ "integrity": "sha512-9+wkMowR2AmdSWQzsPEjFU7njh8HTO5MqO8vjwEHuM+AMHioNqSBONRdr0NQQ3dVQrzp0s8lTcYqzUdb7YgELA==",
"dev": true,
"requires": {
- "@webassemblyjs/ast": "1.8.5",
- "@webassemblyjs/helper-api-error": "1.8.5",
- "@webassemblyjs/helper-wasm-bytecode": "1.8.5",
- "@webassemblyjs/ieee754": "1.8.5",
- "@webassemblyjs/leb128": "1.8.5",
- "@webassemblyjs/utf8": "1.8.5"
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-api-error": "1.9.0",
+ "@webassemblyjs/helper-wasm-bytecode": "1.9.0",
+ "@webassemblyjs/ieee754": "1.9.0",
+ "@webassemblyjs/leb128": "1.9.0",
+ "@webassemblyjs/utf8": "1.9.0"
}
},
"@webassemblyjs/wast-parser": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.8.5.tgz",
- "integrity": "sha512-daXC1FyKWHF1i11obK086QRlsMsY4+tIOKgBqI1lxAnkp9xe9YMcgOxm9kLe+ttjs5aWV2KKE1TWJCN57/Btsg==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.9.0.tgz",
+ "integrity": "sha512-qsqSAP3QQ3LyZjNC/0jBJ/ToSxfYJ8kYyuiGvtn/8MK89VrNEfwj7BPQzJVHi0jGTRK2dGdJ5PRqhtjzoww+bw==",
"dev": true,
"requires": {
- "@webassemblyjs/ast": "1.8.5",
- "@webassemblyjs/floating-point-hex-parser": "1.8.5",
- "@webassemblyjs/helper-api-error": "1.8.5",
- "@webassemblyjs/helper-code-frame": "1.8.5",
- "@webassemblyjs/helper-fsm": "1.8.5",
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/floating-point-hex-parser": "1.9.0",
+ "@webassemblyjs/helper-api-error": "1.9.0",
+ "@webassemblyjs/helper-code-frame": "1.9.0",
+ "@webassemblyjs/helper-fsm": "1.9.0",
"@xtuc/long": "4.2.2"
}
},
"@webassemblyjs/wast-printer": {
- "version": "1.8.5",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.8.5.tgz",
- "integrity": "sha512-w0U0pD4EhlnvRyeJzBqaVSJAo9w/ce7/WPogeXLzGkO6hzhr4GnQIZ4W4uUt5b9ooAaXPtnXlj0gzsXEOUNYMg==",
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.9.0.tgz",
+ "integrity": "sha512-2J0nE95rHXHyQ24cWjMKJ1tqB/ds8z/cyeOZxJhcb+rW+SQASVjuznUSmdz5GpVJTzU8JkhYut0D3siFDD6wsA==",
"dev": true,
"requires": {
- "@webassemblyjs/ast": "1.8.5",
- "@webassemblyjs/wast-parser": "1.8.5",
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/wast-parser": "1.9.0",
"@xtuc/long": "4.2.2"
}
},
@@ -192,11 +191,27 @@
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
"dev": true
},
+ "@zeit/schemas": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.6.0.tgz",
+ "integrity": "sha512-uUrgZ8AxS+Lio0fZKAipJjAh415JyrOZowliZAzmnJSsf7piVL5w+G0+gFJ0KSu3QRhvui/7zuvpLz03YjXAhg==",
+ "dev": true
+ },
"abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
},
+ "accepts": {
+ "version": "1.3.7",
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
+ "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
+ "dev": true,
+ "requires": {
+ "mime-types": "~2.1.24",
+ "negotiator": "0.6.2"
+ }
+ },
"acorn": {
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
@@ -204,9 +219,9 @@
"dev": true
},
"ajv": {
- "version": "6.12.0",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz",
- "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==",
+ "version": "6.12.4",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.4.tgz",
+ "integrity": "sha512-eienB2c9qVQs2KWexhkrdMLVDoIQCz5KSeLxwg9Lzk4DOfBtIK9PQwwufcsn1jjGuf9WZmqPMbGxOzfcuphJCQ==",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
@@ -222,15 +237,24 @@
"dev": true
},
"ajv-keywords": {
- "version": "3.4.1",
- "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.4.1.tgz",
- "integrity": "sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ==",
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
+ "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
"dev": true
},
+ "ansi-align": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz",
+ "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=",
+ "dev": true,
+ "requires": {
+ "string-width": "^2.0.0"
+ }
+ },
"ansi-colors": {
- "version": "3.2.3",
- "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz",
- "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==",
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
+ "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
"dev": true
},
"ansi-regex": {
@@ -264,6 +288,18 @@
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
"dev": true
},
+ "arch": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/arch/-/arch-2.1.2.tgz",
+ "integrity": "sha512-NTBIIbAfkJeIletyABbVtdPgeKfDafR+1mZV/AyyfC1UkVkp9iUjV+wwmqtUgphHYajbI86jejBJp5e+jkGTiQ==",
+ "dev": true
+ },
+ "arg": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/arg/-/arg-2.0.0.tgz",
+ "integrity": "sha512-XxNTUzKnz1ctK3ZIcI2XUPlD96wbHP2nGqkPKpvk/HNRlPveYrXIVSTk9m3LcqOgDPg3B1nMvdV/K8wZd7PG4w==",
+ "dev": true
+ },
"argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@@ -297,15 +333,36 @@
"integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=",
"dev": true
},
+ "array.prototype.map": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.2.tgz",
+ "integrity": "sha512-Az3OYxgsa1g7xDYp86l0nnN4bcmuEITGe1rbdEBVkrqkzMgDcbdQ2R7r41pNzti+4NMces3H8gMmuioZUilLgw==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.0-next.1",
+ "es-array-method-boxes-properly": "^1.0.0",
+ "is-string": "^1.0.4"
+ }
+ },
"asn1.js": {
- "version": "4.10.1",
- "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz",
- "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==",
+ "version": "5.4.1",
+ "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz",
+ "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==",
"dev": true,
"requires": {
"bn.js": "^4.0.0",
"inherits": "^2.0.1",
- "minimalistic-assert": "^1.0.0"
+ "minimalistic-assert": "^1.0.0",
+ "safer-buffer": "^2.1.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
+ "dev": true
+ }
}
},
"assert": {
@@ -345,7 +402,8 @@
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz",
"integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==",
- "dev": true
+ "dev": true,
+ "optional": true
},
"atob": {
"version": "2.1.2",
@@ -436,9 +494,9 @@
"dev": true
},
"binary-extensions": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz",
- "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==",
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz",
+ "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==",
"dev": true
},
"bindings": {
@@ -458,11 +516,34 @@
"dev": true
},
"bn.js": {
- "version": "4.11.8",
- "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz",
- "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==",
+ "version": "5.1.3",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz",
+ "integrity": "sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==",
"dev": true
},
+ "boxen": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz",
+ "integrity": "sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw==",
+ "dev": true,
+ "requires": {
+ "ansi-align": "^2.0.0",
+ "camelcase": "^4.0.0",
+ "chalk": "^2.0.1",
+ "cli-boxes": "^1.0.0",
+ "string-width": "^2.0.0",
+ "term-size": "^1.2.0",
+ "widest-line": "^2.0.0"
+ },
+ "dependencies": {
+ "camelcase": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
+ "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=",
+ "dev": true
+ }
+ }
+ },
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@@ -538,21 +619,59 @@
"requires": {
"bn.js": "^4.1.0",
"randombytes": "^2.0.1"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
+ "dev": true
+ }
}
},
"browserify-sign": {
- "version": "4.0.4",
- "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz",
- "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=",
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz",
+ "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==",
"dev": true,
"requires": {
- "bn.js": "^4.1.1",
- "browserify-rsa": "^4.0.0",
- "create-hash": "^1.1.0",
- "create-hmac": "^1.1.2",
- "elliptic": "^6.0.0",
- "inherits": "^2.0.1",
- "parse-asn1": "^5.0.0"
+ "bn.js": "^5.1.1",
+ "browserify-rsa": "^4.0.1",
+ "create-hash": "^1.2.0",
+ "create-hmac": "^1.1.7",
+ "elliptic": "^6.5.3",
+ "inherits": "^2.0.4",
+ "parse-asn1": "^5.1.5",
+ "readable-stream": "^3.6.0",
+ "safe-buffer": "^5.2.0"
+ },
+ "dependencies": {
+ "readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "dev": true
+ },
+ "string_decoder": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "~5.2.0"
+ }
+ }
}
},
"browserify-zlib": {
@@ -601,10 +720,16 @@
"integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=",
"dev": true
},
+ "bytes": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
+ "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=",
+ "dev": true
+ },
"cacache": {
- "version": "12.0.3",
- "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.3.tgz",
- "integrity": "sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw==",
+ "version": "12.0.4",
+ "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.4.tgz",
+ "integrity": "sha512-a0tMB40oefvuInr4Cwb3GerbL9xTj1D5yg0T5xrjGCGyfvbxseIXX7BAO/u/hIXdafzOI5JC3wDwHyf24buOAQ==",
"dev": true,
"requires": {
"bluebird": "^3.5.5",
@@ -634,9 +759,9 @@
}
},
"mkdirp": {
- "version": "0.5.3",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
- "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
+ "version": "0.5.5",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
+ "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
@@ -695,22 +820,6 @@
}
}
},
- "chokidar": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz",
- "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==",
- "dev": true,
- "requires": {
- "anymatch": "~3.1.1",
- "braces": "~3.0.2",
- "fsevents": "~2.1.1",
- "glob-parent": "~5.1.0",
- "is-binary-path": "~2.1.0",
- "is-glob": "~4.0.1",
- "normalize-path": "~3.0.0",
- "readdirp": "~3.2.0"
- }
- },
"chownr": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
@@ -769,6 +878,50 @@
"glob": "^7.1.1"
}
},
+ "cli-boxes": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz",
+ "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=",
+ "dev": true
+ },
+ "clipboardy": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-1.2.3.tgz",
+ "integrity": "sha512-2WNImOvCRe6r63Gk9pShfkwXsVtKCroMAevIbiae021mS850UkWPbevxsBz3tnvjZIEGvlwaqCPsw+4ulzNgJA==",
+ "dev": true,
+ "requires": {
+ "arch": "^2.1.0",
+ "execa": "^0.8.0"
+ },
+ "dependencies": {
+ "cross-spawn": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
+ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
+ "dev": true,
+ "requires": {
+ "lru-cache": "^4.0.1",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ }
+ },
+ "execa": {
+ "version": "0.8.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-0.8.0.tgz",
+ "integrity": "sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=",
+ "dev": true,
+ "requires": {
+ "cross-spawn": "^5.0.1",
+ "get-stream": "^3.0.0",
+ "is-stream": "^1.1.0",
+ "npm-run-path": "^2.0.0",
+ "p-finally": "^1.0.0",
+ "signal-exit": "^3.0.0",
+ "strip-eof": "^1.0.0"
+ }
+ }
+ }
+ },
"cliui": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
@@ -809,9 +962,9 @@
}
},
"codemirror": {
- "version": "5.52.0",
- "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.52.0.tgz",
- "integrity": "sha512-K2UB6zjscrfME03HeRe/IuOmCeqNpw7PLKGHThYpLbZEuKf+ZoujJPhxZN4hHJS1O7QyzEsV7JJZGxuQWVaFCg==",
+ "version": "5.56.0",
+ "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.56.0.tgz",
+ "integrity": "sha512-MfKVmYgifXjQpLSgpETuih7A7WTTIsxvKfSLGseTY5+qt0E1UD1wblZGM6WLenORo8sgmf+3X+WTe2WF7mufyw==",
"dev": true
},
"collection-visit": {
@@ -839,12 +992,6 @@
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"dev": true
},
- "colors": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
- "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
- "dev": true
- },
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
@@ -862,6 +1009,47 @@
"integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==",
"dev": true
},
+ "compressible": {
+ "version": "2.0.18",
+ "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz",
+ "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==",
+ "dev": true,
+ "requires": {
+ "mime-db": ">= 1.43.0 < 2"
+ }
+ },
+ "compression": {
+ "version": "1.7.3",
+ "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.3.tgz",
+ "integrity": "sha512-HSjyBG5N1Nnz7tF2+O7A9XUhyjru71/fwgNb7oIsEVHR0WShfs2tIS/EySLgiTe98aOK18YDlMXpzjCXY/n9mg==",
+ "dev": true,
+ "requires": {
+ "accepts": "~1.3.5",
+ "bytes": "3.0.0",
+ "compressible": "~2.0.14",
+ "debug": "2.6.9",
+ "on-headers": "~1.0.1",
+ "safe-buffer": "5.1.2",
+ "vary": "~1.1.2"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ }
+ }
+ },
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -935,6 +1123,12 @@
"integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=",
"dev": true
},
+ "content-disposition": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
+ "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=",
+ "dev": true
+ },
"copy-concurrently": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",
@@ -950,9 +1144,9 @@
},
"dependencies": {
"mkdirp": {
- "version": "0.5.3",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
- "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
+ "version": "0.5.5",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
+ "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
@@ -973,13 +1167,21 @@
"dev": true
},
"create-ecdh": {
- "version": "4.0.3",
- "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz",
- "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==",
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz",
+ "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==",
"dev": true,
"requires": {
"bn.js": "^4.1.0",
- "elliptic": "^6.0.0"
+ "elliptic": "^6.5.3"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
+ "dev": true
+ }
}
},
"create-hash": {
@@ -1074,6 +1276,12 @@
"integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
"dev": true
},
+ "deep-extend": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
+ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
+ "dev": true
+ },
"define-properties": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
@@ -1141,9 +1349,9 @@
"dev": true
},
"diff": {
- "version": "3.5.0",
- "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
- "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
+ "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"dev": true
},
"diffie-hellman": {
@@ -1155,6 +1363,14 @@
"bn.js": "^4.1.0",
"miller-rabin": "^4.0.0",
"randombytes": "^2.0.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
+ "dev": true
+ }
}
},
"dom-serializer": {
@@ -1174,9 +1390,9 @@
"dev": true
},
"entities": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz",
- "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==",
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz",
+ "integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==",
"dev": true
}
}
@@ -1268,9 +1484,9 @@
}
},
"elliptic": {
- "version": "6.5.2",
- "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
- "integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==",
+ "version": "6.5.3",
+ "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
+ "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
"dev": true,
"requires": {
"bn.js": "^4.4.0",
@@ -1280,6 +1496,14 @@
"inherits": "^2.0.1",
"minimalistic-assert": "^1.0.0",
"minimalistic-crypto-utils": "^1.0.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
+ "dev": true
+ }
}
},
"emoji-regex": {
@@ -1304,9 +1528,9 @@
}
},
"enhanced-resolve": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.1.tgz",
- "integrity": "sha512-98p2zE+rL7/g/DzMHMTF4zZlCgeVdJ7yr6xzEpJRYwFYrGi9ANdn5DnJURg6RpBkyk60XYDnWIv51VfIhfNGuA==",
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.3.0.tgz",
+ "integrity": "sha512-3e87LvavsdxyoCfGusJnrZ5G8SLPOFeHSNpZI/ATL9a5leXo2k0w6MKnbqhdBad9qTobSfB20Ld7UmgoNbAZkQ==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
@@ -1372,22 +1596,51 @@
}
},
"es-abstract": {
- "version": "1.17.4",
- "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz",
- "integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==",
+ "version": "1.17.6",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz",
+ "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==",
"dev": true,
"requires": {
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1",
- "is-callable": "^1.1.5",
- "is-regex": "^1.0.5",
+ "is-callable": "^1.2.0",
+ "is-regex": "^1.1.0",
"object-inspect": "^1.7.0",
"object-keys": "^1.1.1",
"object.assign": "^4.1.0",
- "string.prototype.trimleft": "^2.1.1",
- "string.prototype.trimright": "^2.1.1"
+ "string.prototype.trimend": "^1.0.1",
+ "string.prototype.trimstart": "^1.0.1"
+ }
+ },
+ "es-array-method-boxes-properly": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz",
+ "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==",
+ "dev": true
+ },
+ "es-get-iterator": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.0.tgz",
+ "integrity": "sha512-UfrmHuWQlNMTs35e1ypnvikg6jCz3SK8v8ImvmDsh36fCVUR1MqoFDiyn0/k52C8NqO3YsO8Oe0azeesNuqSsQ==",
+ "dev": true,
+ "requires": {
+ "es-abstract": "^1.17.4",
+ "has-symbols": "^1.0.1",
+ "is-arguments": "^1.0.4",
+ "is-map": "^2.0.1",
+ "is-set": "^2.0.1",
+ "is-string": "^1.0.5",
+ "isarray": "^2.0.5"
+ },
+ "dependencies": {
+ "isarray": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
+ "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==",
+ "dev": true
+ }
}
},
"es-to-primitive": {
@@ -1439,9 +1692,9 @@
"dev": true
},
"events": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/events/-/events-3.1.0.tgz",
- "integrity": "sha512-Rv+u8MLHNOdMjTAFeT3nCjHn2aGlx435FP/sDHNaRhDEMwyI/aB22Kj2qIN8R0cw3z28psEQLYwxVKLsKrMgWg==",
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz",
+ "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==",
"dev": true
},
"evp_bytestokey": {
@@ -1455,18 +1708,31 @@
}
},
"execa": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
- "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz",
+ "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=",
"dev": true,
"requires": {
- "cross-spawn": "^6.0.0",
- "get-stream": "^4.0.0",
+ "cross-spawn": "^5.0.1",
+ "get-stream": "^3.0.0",
"is-stream": "^1.1.0",
"npm-run-path": "^2.0.0",
"p-finally": "^1.0.0",
"signal-exit": "^3.0.0",
"strip-eof": "^1.0.0"
+ },
+ "dependencies": {
+ "cross-spawn": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
+ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
+ "dev": true,
+ "requires": {
+ "lru-cache": "^4.0.1",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ }
+ }
}
},
"exit": {
@@ -1621,9 +1887,9 @@
}
},
"fast-deep-equal": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz",
- "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==",
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"dev": true
},
"fast-json-stable-stringify": {
@@ -1632,10 +1898,27 @@
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
"dev": true
},
+ "fast-url-parser": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/fast-url-parser/-/fast-url-parser-1.1.3.tgz",
+ "integrity": "sha1-9K8+qfNNiicc9YrSs3WfQx8LMY0=",
+ "dev": true,
+ "requires": {
+ "punycode": "^1.3.2"
+ },
+ "dependencies": {
+ "punycode": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
+ "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=",
+ "dev": true
+ }
+ }
+ },
"figgy-pudding": {
- "version": "3.5.1",
- "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz",
- "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==",
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz",
+ "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==",
"dev": true
},
"file-uri-to-path": {
@@ -1812,9 +2095,9 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
},
"fsevents": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz",
- "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==",
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz",
+ "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
"dev": true,
"optional": true
},
@@ -1831,13 +2114,10 @@
"dev": true
},
"get-stream": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
- "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
- "dev": true,
- "requires": {
- "pump": "^3.0.0"
- }
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
+ "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=",
+ "dev": true
},
"get-value": {
"version": "2.0.6",
@@ -1859,9 +2139,9 @@
}
},
"glob-parent": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz",
- "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==",
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
+ "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
"dev": true,
"requires": {
"is-glob": "^4.0.1"
@@ -1903,9 +2183,9 @@
}
},
"graceful-fs": {
- "version": "4.2.3",
- "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz",
- "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==",
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
+ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
"dev": true
},
"growl": {
@@ -1994,13 +2274,42 @@
}
},
"hash-base": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz",
- "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=",
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz",
+ "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==",
"dev": true,
"requires": {
- "inherits": "^2.0.1",
- "safe-buffer": "^5.0.1"
+ "inherits": "^2.0.4",
+ "readable-stream": "^3.6.0",
+ "safe-buffer": "^5.2.0"
+ },
+ "dependencies": {
+ "readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "dev": true
+ },
+ "string_decoder": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "~5.2.0"
+ }
+ }
}
},
"hash.js": {
@@ -2107,20 +2416,14 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"ini": {
- "version": "1.3.5",
- "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
- "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
+ "version": "1.3.7",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz",
+ "integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ=="
},
"interpret": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz",
- "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==",
- "dev": true
- },
- "invert-kv": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz",
- "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==",
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz",
+ "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
"dev": true
},
"is-accessor-descriptor": {
@@ -2149,6 +2452,12 @@
}
}
},
+ "is-arguments": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz",
+ "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==",
+ "dev": true
+ },
"is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
@@ -2165,9 +2474,9 @@
"dev": true
},
"is-callable": {
- "version": "1.1.5",
- "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz",
- "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz",
+ "integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==",
"dev": true
},
"is-data-descriptor": {
@@ -2248,12 +2557,24 @@
"is-extglob": "^2.1.1"
}
},
+ "is-map": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.1.tgz",
+ "integrity": "sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw==",
+ "dev": true
+ },
"is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
+ "is-plain-obj": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
+ "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=",
+ "dev": true
+ },
"is-plain-object": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
@@ -2264,20 +2585,32 @@
}
},
"is-regex": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz",
- "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==",
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz",
+ "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==",
"dev": true,
"requires": {
- "has": "^1.0.3"
+ "has-symbols": "^1.0.1"
}
},
+ "is-set": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.1.tgz",
+ "integrity": "sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA==",
+ "dev": true
+ },
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
"dev": true
},
+ "is-string": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz",
+ "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==",
+ "dev": true
+ },
"is-symbol": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz",
@@ -2317,10 +2650,26 @@
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
"dev": true
},
+ "iterate-iterator": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.1.tgz",
+ "integrity": "sha512-3Q6tudGN05kbkDQDI4CqjaBf4qf85w6W6GnuZDtUVYwKgtC1q8yxYX7CZed7N+tLzQqS6roujWvszf13T+n9aw==",
+ "dev": true
+ },
+ "iterate-value": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/iterate-value/-/iterate-value-1.0.2.tgz",
+ "integrity": "sha512-A6fMAio4D2ot2r/TYzr4yUWrmwNdsN5xL7+HUiyACE4DXm+q8HtPcnFTp+NnW3k4N05tZ7FVYFFb2CR13NxyHQ==",
+ "dev": true,
+ "requires": {
+ "es-get-iterator": "^1.0.2",
+ "iterate-iterator": "^1.0.1"
+ }
+ },
"jquery": {
- "version": "3.4.1",
- "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz",
- "integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==",
+ "version": "3.5.1",
+ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz",
+ "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==",
"dev": true
},
"js-yaml": {
@@ -2334,16 +2683,16 @@
}
},
"jshint": {
- "version": "2.11.0",
- "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.11.0.tgz",
- "integrity": "sha512-ooaD/hrBPhu35xXW4gn+o3SOuzht73gdBuffgJzrZBJZPGgGiiTvJEgTyxFvBO2nz0+X1G6etF8SzUODTlLY6Q==",
+ "version": "2.12.0",
+ "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.12.0.tgz",
+ "integrity": "sha512-TwuuaUDmra0JMkuqvqy+WGo2xGHSNjv1BA1nTIgtH2K5z1jHuAEeAgp7laaR+hLRmajRjcrM71+vByBDanCyYA==",
"dev": true,
"requires": {
"cli": "~1.0.0",
"console-browserify": "1.1.x",
"exit": "0.1.x",
"htmlparser2": "3.8.x",
- "lodash": "~4.17.11",
+ "lodash": "~4.17.19",
"minimatch": "~3.0.2",
"shelljs": "0.3.x",
"strip-json-comments": "1.0.x"
@@ -2376,15 +2725,6 @@
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
"dev": true
},
- "lcid": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz",
- "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==",
- "dev": true,
- "requires": {
- "invert-kv": "^2.0.0"
- }
- },
"loader-runner": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz",
@@ -2413,9 +2753,9 @@
}
},
"lodash": {
- "version": "4.17.15",
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
- "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
+ "version": "4.17.19",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
+ "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
"dev": true
},
"log-symbols": {
@@ -2446,21 +2786,6 @@
"semver": "^5.6.0"
}
},
- "mamacro": {
- "version": "0.0.3",
- "resolved": "https://registry.npmjs.org/mamacro/-/mamacro-0.0.3.tgz",
- "integrity": "sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA==",
- "dev": true
- },
- "map-age-cleaner": {
- "version": "0.1.3",
- "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz",
- "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==",
- "dev": true,
- "requires": {
- "p-defer": "^1.0.0"
- }
- },
"map-cache": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
@@ -2487,17 +2812,6 @@
"safe-buffer": "^5.1.2"
}
},
- "mem": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz",
- "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==",
- "dev": true,
- "requires": {
- "map-age-cleaner": "^0.1.1",
- "mimic-fn": "^2.0.0",
- "p-is-promise": "^2.0.0"
- }
- },
"memory-fs": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz",
@@ -2659,19 +2973,30 @@
"requires": {
"bn.js": "^4.0.0",
"brorand": "^1.0.1"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
+ "dev": true
+ }
}
},
- "mime": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
- "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
+ "mime-db": {
+ "version": "1.44.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
+ "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==",
"dev": true
},
- "mimic-fn": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
- "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
- "dev": true
+ "mime-types": {
+ "version": "2.1.27",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
+ "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
+ "dev": true,
+ "requires": {
+ "mime-db": "1.44.0"
+ }
},
"minimalistic-assert": {
"version": "1.0.1",
@@ -2739,70 +3064,116 @@
}
},
"mkdirp": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz",
- "integrity": "sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g=="
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
},
"mocha": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.1.tgz",
- "integrity": "sha512-3qQsu3ijNS3GkWcccT5Zw0hf/rWvu1fTN9sPvEd81hlwsr30GX2GcDSSoBxo24IR8FelmrAydGC6/1J5QQP4WA==",
+ "version": "8.1.1",
+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.1.1.tgz",
+ "integrity": "sha512-p7FuGlYH8t7gaiodlFreseLxEmxTgvyG9RgPHODFPySNhwUehu8NIb0vdSt3WFckSneswZ0Un5typYcWElk7HQ==",
"dev": true,
"requires": {
- "ansi-colors": "3.2.3",
+ "ansi-colors": "4.1.1",
"browser-stdout": "1.3.1",
- "chokidar": "3.3.0",
+ "chokidar": "3.3.1",
"debug": "3.2.6",
- "diff": "3.5.0",
+ "diff": "4.0.2",
"escape-string-regexp": "1.0.5",
- "find-up": "3.0.0",
- "glob": "7.1.3",
+ "find-up": "4.1.0",
+ "glob": "7.1.6",
"growl": "1.10.5",
"he": "1.2.0",
"js-yaml": "3.13.1",
"log-symbols": "3.0.0",
"minimatch": "3.0.4",
- "mkdirp": "0.5.3",
- "ms": "2.1.1",
- "node-environment-flags": "1.0.6",
+ "ms": "2.1.2",
"object.assign": "4.1.0",
- "strip-json-comments": "2.0.1",
- "supports-color": "6.0.0",
- "which": "1.3.1",
+ "promise.allsettled": "1.0.2",
+ "serialize-javascript": "4.0.0",
+ "strip-json-comments": "3.0.1",
+ "supports-color": "7.1.0",
+ "which": "2.0.2",
"wide-align": "1.1.3",
+ "workerpool": "6.0.0",
"yargs": "13.3.2",
"yargs-parser": "13.1.2",
- "yargs-unparser": "1.6.0"
+ "yargs-unparser": "1.6.1"
},
"dependencies": {
- "glob": {
- "version": "7.1.3",
- "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
- "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
+ "chokidar": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.1.tgz",
+ "integrity": "sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg==",
+ "dev": true,
+ "requires": {
+ "anymatch": "~3.1.1",
+ "braces": "~3.0.2",
+ "fsevents": "~2.1.2",
+ "glob-parent": "~5.1.0",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.3.0"
+ }
+ },
+ "find-up": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
+ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
"dev": true,
"requires": {
- "fs.realpath": "^1.0.0",
- "inflight": "^1.0.4",
- "inherits": "2",
- "minimatch": "^3.0.4",
- "once": "^1.3.0",
- "path-is-absolute": "^1.0.0"
+ "locate-path": "^5.0.0",
+ "path-exists": "^4.0.0"
}
},
- "mkdirp": {
- "version": "0.5.3",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
- "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
+ "locate-path": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
+ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
"dev": true,
"requires": {
- "minimist": "^1.2.5"
+ "p-locate": "^4.1.0"
+ }
+ },
+ "p-locate": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
+ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^2.2.0"
+ }
+ },
+ "path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true
+ },
+ "readdirp": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.3.0.tgz",
+ "integrity": "sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ==",
+ "dev": true,
+ "requires": {
+ "picomatch": "^2.0.7"
}
},
"strip-json-comments": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
- "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz",
+ "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==",
"dev": true
+ },
+ "which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
}
}
},
@@ -2821,9 +3192,9 @@
},
"dependencies": {
"mkdirp": {
- "version": "0.5.3",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
- "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
+ "version": "0.5.5",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
+ "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
@@ -2832,9 +3203,9 @@
}
},
"ms": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
- "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"mustache": {
@@ -2844,9 +3215,9 @@
"dev": true
},
"nan": {
- "version": "2.14.0",
- "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
- "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==",
+ "version": "2.14.1",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
+ "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==",
"dev": true,
"optional": true
},
@@ -2869,10 +3240,16 @@
"to-regex": "^3.0.1"
}
},
+ "negotiator": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
+ "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==",
+ "dev": true
+ },
"neo-async": {
- "version": "2.6.1",
- "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz",
- "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==",
+ "version": "2.6.2",
+ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
+ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
"dev": true
},
"nice-try": {
@@ -2881,16 +3258,6 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true
},
- "node-environment-flags": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz",
- "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==",
- "dev": true,
- "requires": {
- "object.getownpropertydescriptors": "^2.0.3",
- "semver": "^5.7.0"
- }
- },
"node-libs-browser": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz",
@@ -2970,33 +3337,21 @@
},
"dependencies": {
"safe-buffer": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
- "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==",
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"dev": true
}
}
}
}
},
- "node-static": {
- "version": "0.7.11",
- "resolved": "https://registry.npmjs.org/node-static/-/node-static-0.7.11.tgz",
- "integrity": "sha512-zfWC/gICcqb74D9ndyvxZWaI1jzcoHmf4UTHWQchBNuNMxdBLJMDiUgZ1tjGLEIe/BMhj2DxKD8HOuc2062pDQ==",
- "dev": true,
- "requires": {
- "colors": ">=0.6.0",
- "mime": "^1.2.9",
- "optimist": ">=0.3.4"
- }
- },
"nopt": {
- "version": "4.0.3",
- "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz",
- "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==",
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
+ "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
"requires": {
- "abbrev": "1",
- "osenv": "^0.1.4"
+ "abbrev": "1"
}
},
"normalize-path": {
@@ -3058,9 +3413,9 @@
}
},
"object-inspect": {
- "version": "1.7.0",
- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz",
- "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==",
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz",
+ "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==",
"dev": true
},
"object-keys": {
@@ -3090,16 +3445,6 @@
"object-keys": "^1.0.11"
}
},
- "object.getownpropertydescriptors": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz",
- "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==",
- "dev": true,
- "requires": {
- "define-properties": "^1.1.3",
- "es-abstract": "^1.17.0-next.1"
- }
- },
"object.pick": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz",
@@ -3109,6 +3454,12 @@
"isobject": "^3.0.1"
}
},
+ "on-headers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
+ "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
+ "dev": true
+ },
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@@ -3117,82 +3468,22 @@
"wrappy": "1"
}
},
- "optimist": {
- "version": "0.6.1",
- "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
- "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=",
- "dev": true,
- "requires": {
- "minimist": "~0.0.1",
- "wordwrap": "~0.0.2"
- },
- "dependencies": {
- "minimist": {
- "version": "0.0.10",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
- "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=",
- "dev": true
- }
- }
- },
"os-browserify": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz",
"integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=",
"dev": true
},
- "os-homedir": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
- "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M="
- },
- "os-locale": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz",
- "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==",
- "dev": true,
- "requires": {
- "execa": "^1.0.0",
- "lcid": "^2.0.0",
- "mem": "^4.0.0"
- }
- },
- "os-tmpdir": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
- "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
- },
- "osenv": {
- "version": "0.1.5",
- "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz",
- "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
- "requires": {
- "os-homedir": "^1.0.0",
- "os-tmpdir": "^1.0.0"
- }
- },
- "p-defer": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz",
- "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=",
- "dev": true
- },
"p-finally": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
"integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
"dev": true
},
- "p-is-promise": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz",
- "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==",
- "dev": true
- },
"p-limit": {
- "version": "2.2.2",
- "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz",
- "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==",
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
+ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
"dev": true,
"requires": {
"p-try": "^2.0.0"
@@ -3263,14 +3554,13 @@
}
},
"parse-asn1": {
- "version": "5.1.5",
- "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz",
- "integrity": "sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ==",
+ "version": "5.1.6",
+ "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz",
+ "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==",
"dev": true,
"requires": {
- "asn1.js": "^4.0.0",
+ "asn1.js": "^5.2.0",
"browserify-aes": "^1.0.0",
- "create-hash": "^1.1.0",
"evp_bytestokey": "^1.0.0",
"pbkdf2": "^3.0.3",
"safe-buffer": "^5.1.1"
@@ -3298,7 +3588,8 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz",
"integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=",
- "dev": true
+ "dev": true,
+ "optional": true
},
"path-exists": {
"version": "3.0.0",
@@ -3311,16 +3602,28 @@
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
},
+ "path-is-inside": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz",
+ "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=",
+ "dev": true
+ },
"path-key": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
"integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
"dev": true
},
+ "path-to-regexp": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.2.1.tgz",
+ "integrity": "sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ==",
+ "dev": true
+ },
"pbkdf2": {
- "version": "3.0.17",
- "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz",
- "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==",
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz",
+ "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==",
"dev": true,
"requires": {
"create-hash": "^1.1.2",
@@ -3331,9 +3634,9 @@
}
},
"picomatch": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.1.tgz",
- "integrity": "sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA==",
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
+ "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
"dev": true
},
"pify": {
@@ -3381,6 +3684,19 @@
"integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=",
"dev": true
},
+ "promise.allsettled": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/promise.allsettled/-/promise.allsettled-1.0.2.tgz",
+ "integrity": "sha512-UpcYW5S1RaNKT6pd+s9jp9K9rlQge1UXKskec0j6Mmuq7UJCvlS2J2/s/yuPN8ehftf9HXMxWlKiPbGGUzpoRg==",
+ "dev": true,
+ "requires": {
+ "array.prototype.map": "^1.0.1",
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.17.0-next.1",
+ "function-bind": "^1.1.1",
+ "iterate-value": "^1.0.0"
+ }
+ },
"proto-list": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz",
@@ -3409,6 +3725,14 @@
"parse-asn1": "^5.0.0",
"randombytes": "^2.0.1",
"safe-buffer": "^5.1.2"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
+ "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==",
+ "dev": true
+ }
}
},
"pump": {
@@ -3481,6 +3805,32 @@
"safe-buffer": "^5.1.0"
}
},
+ "range-parser": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
+ "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=",
+ "dev": true
+ },
+ "rc": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
+ "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
+ "dev": true,
+ "requires": {
+ "deep-extend": "^0.6.0",
+ "ini": "~1.3.0",
+ "minimist": "^1.2.0",
+ "strip-json-comments": "~2.0.1"
+ },
+ "dependencies": {
+ "strip-json-comments": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
+ "dev": true
+ }
+ }
+ },
"readable-stream": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
@@ -3493,15 +3843,6 @@
"string_decoder": "~0.10.x"
}
},
- "readdirp": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz",
- "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==",
- "dev": true,
- "requires": {
- "picomatch": "^2.0.4"
- }
- },
"regex-not": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
@@ -3512,11 +3853,31 @@
"safe-regex": "^1.1.0"
}
},
+ "registry-auth-token": {
+ "version": "3.3.2",
+ "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.2.tgz",
+ "integrity": "sha512-JL39c60XlzCVgNrO+qq68FoNb56w/m7JYvGR2jT5iR1xBrUA3Mfx5Twk5rqTThPmQKMWydGmq8oFtDlxfrmxnQ==",
+ "dev": true,
+ "requires": {
+ "rc": "^1.1.6",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "registry-url": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz",
+ "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=",
+ "dev": true,
+ "requires": {
+ "rc": "^1.0.1"
+ }
+ },
"remove-trailing-separator": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
"integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=",
- "dev": true
+ "dev": true,
+ "optional": true
},
"repeat-element": {
"version": "1.1.3",
@@ -3641,6 +4002,12 @@
"ret": "~0.1.10"
}
},
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "dev": true
+ },
"schema-utils": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
@@ -3658,10 +4025,103 @@
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
},
"serialize-javascript": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz",
- "integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==",
- "dev": true
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
+ "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==",
+ "dev": true,
+ "requires": {
+ "randombytes": "^2.1.0"
+ }
+ },
+ "serve": {
+ "version": "11.3.2",
+ "resolved": "https://registry.npmjs.org/serve/-/serve-11.3.2.tgz",
+ "integrity": "sha512-yKWQfI3xbj/f7X1lTBg91fXBP0FqjJ4TEi+ilES5yzH0iKJpN5LjNb1YzIfQg9Rqn4ECUS2SOf2+Kmepogoa5w==",
+ "dev": true,
+ "requires": {
+ "@zeit/schemas": "2.6.0",
+ "ajv": "6.5.3",
+ "arg": "2.0.0",
+ "boxen": "1.3.0",
+ "chalk": "2.4.1",
+ "clipboardy": "1.2.3",
+ "compression": "1.7.3",
+ "serve-handler": "6.1.3",
+ "update-check": "1.5.2"
+ },
+ "dependencies": {
+ "ajv": {
+ "version": "6.5.3",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.3.tgz",
+ "integrity": "sha512-LqZ9wY+fx3UMiiPd741yB2pj3hhil+hQc8taf4o2QGRFpWgZ2V5C8HA165DY9sS3fJwsk7uT7ZlFEyC3Ig3lLg==",
+ "dev": true,
+ "requires": {
+ "fast-deep-equal": "^2.0.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "chalk": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",
+ "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ }
+ },
+ "fast-deep-equal": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
+ "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "serve-handler": {
+ "version": "6.1.3",
+ "resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.3.tgz",
+ "integrity": "sha512-FosMqFBNrLyeiIDvP1zgO6YoTzFYHxLDEIavhlmQ+knB2Z7l1t+kGLHkZIDN7UVWqQAmKI3D20A6F6jo3nDd4w==",
+ "dev": true,
+ "requires": {
+ "bytes": "3.0.0",
+ "content-disposition": "0.5.2",
+ "fast-url-parser": "1.1.3",
+ "mime-types": "2.1.18",
+ "minimatch": "3.0.4",
+ "path-is-inside": "1.0.2",
+ "path-to-regexp": "2.2.1",
+ "range-parser": "1.2.0"
+ },
+ "dependencies": {
+ "mime-db": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz",
+ "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==",
+ "dev": true
+ },
+ "mime-types": {
+ "version": "2.1.18",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz",
+ "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==",
+ "dev": true,
+ "requires": {
+ "mime-db": "~1.33.0"
+ }
+ }
+ }
},
"set-blocking": {
"version": "2.0.0",
@@ -3735,9 +4195,9 @@
"integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA="
},
"signal-exit": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
- "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
+ "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
"dev": true
},
"snapdragon": {
@@ -3894,9 +4354,9 @@
}
},
"source-map-support": {
- "version": "0.5.16",
- "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz",
- "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==",
+ "version": "0.5.19",
+ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
+ "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
@@ -4075,24 +4535,24 @@
"strip-ansi": "^4.0.0"
}
},
- "string.prototype.trimleft": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz",
- "integrity": "sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag==",
+ "string.prototype.trimend": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz",
+ "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==",
"dev": true,
"requires": {
"define-properties": "^1.1.3",
- "function-bind": "^1.1.1"
+ "es-abstract": "^1.17.5"
}
},
- "string.prototype.trimright": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz",
- "integrity": "sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g==",
+ "string.prototype.trimstart": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz",
+ "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==",
"dev": true,
"requires": {
"define-properties": "^1.1.3",
- "function-bind": "^1.1.1"
+ "es-abstract": "^1.17.5"
}
},
"string_decoder": {
@@ -4123,12 +4583,20 @@
"dev": true
},
"supports-color": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz",
- "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==",
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
"dev": true,
"requires": {
- "has-flag": "^3.0.0"
+ "has-flag": "^4.0.0"
+ },
+ "dependencies": {
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ }
}
},
"tapable": {
@@ -4137,10 +4605,19 @@
"integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==",
"dev": true
},
+ "term-size": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz",
+ "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=",
+ "dev": true,
+ "requires": {
+ "execa": "^0.7.0"
+ }
+ },
"terser": {
- "version": "4.6.7",
- "resolved": "https://registry.npmjs.org/terser/-/terser-4.6.7.tgz",
- "integrity": "sha512-fmr7M1f7DBly5cX2+rFDvmGBAaaZyPrHYK4mMdHEDAdNTqXSZgSOfqsfGq2HqPGT/1V0foZZuCZFx8CHKgAk3g==",
+ "version": "4.8.0",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz",
+ "integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==",
"dev": true,
"requires": {
"commander": "^2.20.0",
@@ -4157,16 +4634,16 @@
}
},
"terser-webpack-plugin": {
- "version": "1.4.3",
- "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz",
- "integrity": "sha512-QMxecFz/gHQwteWwSo5nTc6UaICqN1bMedC5sMtUc7y3Ha3Q8y6ZO0iCR8pq4RJC8Hjf0FEPEHZqcMB/+DFCrA==",
+ "version": "1.4.5",
+ "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.5.tgz",
+ "integrity": "sha512-04Rfe496lN8EYruwi6oPQkG0vo8C+HT49X687FZnpPF0qMAIHONI6HEXYPKDOE8e5HjXTyKfqRd/agHtH0kOtw==",
"dev": true,
"requires": {
"cacache": "^12.0.2",
"find-cache-dir": "^2.1.0",
"is-wsl": "^1.1.0",
"schema-utils": "^1.0.0",
- "serialize-javascript": "^2.1.2",
+ "serialize-javascript": "^4.0.0",
"source-map": "^0.6.1",
"terser": "^4.1.2",
"webpack-sources": "^1.4.0",
@@ -4286,9 +4763,9 @@
}
},
"tslib": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",
- "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==",
+ "version": "1.13.0",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz",
+ "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==",
"dev": true
},
"tty-browserify": {
@@ -4383,7 +4860,18 @@
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz",
"integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==",
- "dev": true
+ "dev": true,
+ "optional": true
+ },
+ "update-check": {
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/update-check/-/update-check-1.5.2.tgz",
+ "integrity": "sha512-1TrmYLuLj/5ZovwUS7fFd1jMH3NnFDN1y1A8dboedIDt7zs/zJMo6TwwlhYKkSeEwzleeiSBV5/3c9ufAQWDaQ==",
+ "dev": true,
+ "requires": {
+ "registry-auth-token": "3.3.2",
+ "registry-url": "3.1.0"
+ }
},
"uri-js": {
"version": "4.2.2",
@@ -4448,9 +4936,15 @@
"dev": true
},
"v8-compile-cache": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz",
- "integrity": "sha512-CNmdbwQMBjwr9Gsmohvm0pbL954tJrNzf6gWL3K+QMQf00PF7ERGrEiLgjuU3mKreLC2MeGhUsNV9ybTbLgd3w==",
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz",
+ "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==",
+ "dev": true
+ },
+ "vary": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+ "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
"dev": true
},
"vm-browserify": {
@@ -4460,31 +4954,73 @@
"dev": true
},
"watchpack": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",
- "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==",
+ "version": "1.7.4",
+ "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.4.tgz",
+ "integrity": "sha512-aWAgTW4MoSJzZPAicljkO1hsi1oKj/RRq/OJQh2PKI2UKL04c2Bs+MBOB+BBABHTXJpf9mCwHN7ANCvYsvY2sg==",
"dev": true,
"requires": {
- "chokidar": "^2.0.2",
+ "chokidar": "^3.4.1",
"graceful-fs": "^4.1.2",
- "neo-async": "^2.5.0"
+ "neo-async": "^2.5.0",
+ "watchpack-chokidar2": "^2.0.0"
},
"dependencies": {
- "anymatch": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz",
- "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==",
+ "chokidar": {
+ "version": "3.4.2",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz",
+ "integrity": "sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==",
"dev": true,
+ "optional": true,
"requires": {
- "micromatch": "^3.1.4",
- "normalize-path": "^2.1.1"
- },
- "dependencies": {
- "normalize-path": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
- "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
- "dev": true,
+ "anymatch": "~3.1.1",
+ "braces": "~3.0.2",
+ "fsevents": "~2.1.2",
+ "glob-parent": "~5.1.0",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.4.0"
+ }
+ },
+ "readdirp": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz",
+ "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "picomatch": "^2.2.1"
+ }
+ }
+ }
+ },
+ "watchpack-chokidar2": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.0.tgz",
+ "integrity": "sha512-9TyfOyN/zLUbA288wZ8IsMZ+6cbzvsNyEzSBp6e/zkifi6xxbl8SmQ/CxQq32k8NNqrdVEVUVSEf56L4rQ/ZxA==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "chokidar": "^2.1.8"
+ },
+ "dependencies": {
+ "anymatch": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz",
+ "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "micromatch": "^3.1.4",
+ "normalize-path": "^2.1.1"
+ },
+ "dependencies": {
+ "normalize-path": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
+ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
+ "dev": true,
+ "optional": true,
"requires": {
"remove-trailing-separator": "^1.0.1"
}
@@ -4495,13 +5031,15 @@
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
"integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==",
- "dev": true
+ "dev": true,
+ "optional": true
},
"braces": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
"integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
"dev": true,
+ "optional": true,
"requires": {
"arr-flatten": "^1.1.0",
"array-unique": "^0.3.2",
@@ -4520,6 +5058,7 @@
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
"integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
"dev": true,
+ "optional": true,
"requires": {
"anymatch": "^2.0.0",
"async-each": "^1.0.1",
@@ -4540,6 +5079,7 @@
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"dev": true,
+ "optional": true,
"requires": {
"is-extendable": "^0.1.0"
}
@@ -4549,6 +5089,7 @@
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
"integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
"dev": true,
+ "optional": true,
"requires": {
"extend-shallow": "^2.0.1",
"is-number": "^3.0.0",
@@ -4557,561 +5098,14 @@
}
},
"fsevents": {
- "version": "1.2.11",
- "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.11.tgz",
- "integrity": "sha512-+ux3lx6peh0BpvY0JebGyZoiR4D+oYzdPZMKJwkZ+sFkNJzpL7tXc/wehS49gUAxg3tmMHPHZkA8JU2rhhgDHw==",
+ "version": "1.2.13",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
+ "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
"optional": true,
"requires": {
"bindings": "^1.5.0",
- "nan": "^2.12.1",
- "node-pre-gyp": "*"
- },
- "dependencies": {
- "abbrev": {
- "version": "1.1.1",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "ansi-regex": {
- "version": "2.1.1",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "aproba": {
- "version": "1.2.0",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "are-we-there-yet": {
- "version": "1.1.5",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "delegates": "^1.0.0",
- "readable-stream": "^2.0.6"
- }
- },
- "balanced-match": {
- "version": "1.0.0",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "brace-expansion": {
- "version": "1.1.11",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "balanced-match": "^1.0.0",
- "concat-map": "0.0.1"
- }
- },
- "chownr": {
- "version": "1.1.3",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "code-point-at": {
- "version": "1.1.0",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "concat-map": {
- "version": "0.0.1",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "console-control-strings": {
- "version": "1.1.0",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "core-util-is": {
- "version": "1.0.2",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "debug": {
- "version": "3.2.6",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "ms": "^2.1.1"
- }
- },
- "deep-extend": {
- "version": "0.6.0",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "delegates": {
- "version": "1.0.0",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "detect-libc": {
- "version": "1.0.3",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "fs-minipass": {
- "version": "1.2.7",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "minipass": "^2.6.0"
- }
- },
- "fs.realpath": {
- "version": "1.0.0",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "gauge": {
- "version": "2.7.4",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "aproba": "^1.0.3",
- "console-control-strings": "^1.0.0",
- "has-unicode": "^2.0.0",
- "object-assign": "^4.1.0",
- "signal-exit": "^3.0.0",
- "string-width": "^1.0.1",
- "strip-ansi": "^3.0.1",
- "wide-align": "^1.1.0"
- }
- },
- "glob": {
- "version": "7.1.6",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "fs.realpath": "^1.0.0",
- "inflight": "^1.0.4",
- "inherits": "2",
- "minimatch": "^3.0.4",
- "once": "^1.3.0",
- "path-is-absolute": "^1.0.0"
- }
- },
- "has-unicode": {
- "version": "2.0.1",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "iconv-lite": {
- "version": "0.4.24",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "safer-buffer": ">= 2.1.2 < 3"
- }
- },
- "ignore-walk": {
- "version": "3.0.3",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "minimatch": "^3.0.4"
- }
- },
- "inflight": {
- "version": "1.0.6",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "once": "^1.3.0",
- "wrappy": "1"
- }
- },
- "inherits": {
- "version": "2.0.4",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "ini": {
- "version": "1.3.5",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "is-fullwidth-code-point": {
- "version": "1.0.0",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "number-is-nan": "^1.0.0"
- }
- },
- "isarray": {
- "version": "1.0.0",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "minimatch": {
- "version": "3.0.4",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "brace-expansion": "^1.1.7"
- }
- },
- "minimist": {
- "version": "0.0.8",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "minipass": {
- "version": "2.9.0",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "safe-buffer": "^5.1.2",
- "yallist": "^3.0.0"
- }
- },
- "minizlib": {
- "version": "1.3.3",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "minipass": "^2.9.0"
- }
- },
- "mkdirp": {
- "version": "0.5.1",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "minimist": "0.0.8"
- }
- },
- "ms": {
- "version": "2.1.2",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "needle": {
- "version": "2.4.0",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "debug": "^3.2.6",
- "iconv-lite": "^0.4.4",
- "sax": "^1.2.4"
- }
- },
- "node-pre-gyp": {
- "version": "0.14.0",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "detect-libc": "^1.0.2",
- "mkdirp": "^0.5.1",
- "needle": "^2.2.1",
- "nopt": "^4.0.1",
- "npm-packlist": "^1.1.6",
- "npmlog": "^4.0.2",
- "rc": "^1.2.7",
- "rimraf": "^2.6.1",
- "semver": "^5.3.0",
- "tar": "^4.4.2"
- }
- },
- "nopt": {
- "version": "4.0.1",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "abbrev": "1",
- "osenv": "^0.1.4"
- }
- },
- "npm-bundled": {
- "version": "1.1.1",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "npm-normalize-package-bin": "^1.0.1"
- }
- },
- "npm-normalize-package-bin": {
- "version": "1.0.1",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "npm-packlist": {
- "version": "1.4.7",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "ignore-walk": "^3.0.1",
- "npm-bundled": "^1.0.1"
- }
- },
- "npmlog": {
- "version": "4.1.2",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "are-we-there-yet": "~1.1.2",
- "console-control-strings": "~1.1.0",
- "gauge": "~2.7.3",
- "set-blocking": "~2.0.0"
- }
- },
- "number-is-nan": {
- "version": "1.0.1",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "object-assign": {
- "version": "4.1.1",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "once": {
- "version": "1.4.0",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "wrappy": "1"
- }
- },
- "os-homedir": {
- "version": "1.0.2",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "os-tmpdir": {
- "version": "1.0.2",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "osenv": {
- "version": "0.1.5",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "os-homedir": "^1.0.0",
- "os-tmpdir": "^1.0.0"
- }
- },
- "path-is-absolute": {
- "version": "1.0.1",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "process-nextick-args": {
- "version": "2.0.1",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "rc": {
- "version": "1.2.8",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "deep-extend": "^0.6.0",
- "ini": "~1.3.0",
- "minimist": "^1.2.0",
- "strip-json-comments": "~2.0.1"
- },
- "dependencies": {
- "minimist": {
- "version": "1.2.0",
- "bundled": true,
- "dev": true,
- "optional": true
- }
- }
- },
- "readable-stream": {
- "version": "2.3.6",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "core-util-is": "~1.0.0",
- "inherits": "~2.0.3",
- "isarray": "~1.0.0",
- "process-nextick-args": "~2.0.0",
- "safe-buffer": "~5.1.1",
- "string_decoder": "~1.1.1",
- "util-deprecate": "~1.0.1"
- }
- },
- "rimraf": {
- "version": "2.7.1",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "glob": "^7.1.3"
- }
- },
- "safe-buffer": {
- "version": "5.1.2",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "safer-buffer": {
- "version": "2.1.2",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "sax": {
- "version": "1.2.4",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "semver": {
- "version": "5.7.1",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "set-blocking": {
- "version": "2.0.0",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "signal-exit": {
- "version": "3.0.2",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "string-width": {
- "version": "1.0.2",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "code-point-at": "^1.0.0",
- "is-fullwidth-code-point": "^1.0.0",
- "strip-ansi": "^3.0.0"
- }
- },
- "string_decoder": {
- "version": "1.1.1",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "safe-buffer": "~5.1.0"
- }
- },
- "strip-ansi": {
- "version": "3.0.1",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "ansi-regex": "^2.0.0"
- }
- },
- "strip-json-comments": {
- "version": "2.0.1",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "tar": {
- "version": "4.4.13",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "chownr": "^1.1.1",
- "fs-minipass": "^1.2.5",
- "minipass": "^2.8.6",
- "minizlib": "^1.2.1",
- "mkdirp": "^0.5.0",
- "safe-buffer": "^5.1.2",
- "yallist": "^3.0.3"
- }
- },
- "util-deprecate": {
- "version": "1.0.2",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "wide-align": {
- "version": "1.1.3",
- "bundled": true,
- "dev": true,
- "optional": true,
- "requires": {
- "string-width": "^1.0.2 || 2"
- }
- },
- "wrappy": {
- "version": "1.0.2",
- "bundled": true,
- "dev": true,
- "optional": true
- },
- "yallist": {
- "version": "3.1.1",
- "bundled": true,
- "dev": true,
- "optional": true
- }
+ "nan": "^2.12.1"
}
},
"glob-parent": {
@@ -5119,6 +5113,7 @@
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
"integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=",
"dev": true,
+ "optional": true,
"requires": {
"is-glob": "^3.1.0",
"path-dirname": "^1.0.0"
@@ -5129,6 +5124,7 @@
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz",
"integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=",
"dev": true,
+ "optional": true,
"requires": {
"is-extglob": "^2.1.0"
}
@@ -5140,6 +5136,7 @@
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz",
"integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=",
"dev": true,
+ "optional": true,
"requires": {
"binary-extensions": "^1.0.0"
}
@@ -5148,13 +5145,15 @@
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
- "dev": true
+ "dev": true,
+ "optional": true
},
"is-number": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
"integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
"dev": true,
+ "optional": true,
"requires": {
"kind-of": "^3.0.2"
}
@@ -5163,13 +5162,15 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
- "dev": true
+ "dev": true,
+ "optional": true
},
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
"dev": true,
+ "optional": true,
"requires": {
"is-buffer": "^1.1.5"
}
@@ -5179,6 +5180,7 @@
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"dev": true,
+ "optional": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
@@ -5194,6 +5196,7 @@
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz",
"integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==",
"dev": true,
+ "optional": true,
"requires": {
"graceful-fs": "^4.1.11",
"micromatch": "^3.1.10",
@@ -5205,6 +5208,7 @@
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
+ "optional": true,
"requires": {
"safe-buffer": "~5.1.0"
}
@@ -5214,6 +5218,7 @@
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz",
"integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=",
"dev": true,
+ "optional": true,
"requires": {
"is-number": "^3.0.0",
"repeat-string": "^1.6.1"
@@ -5222,40 +5227,40 @@
}
},
"webpack": {
- "version": "4.42.0",
- "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.42.0.tgz",
- "integrity": "sha512-EzJRHvwQyBiYrYqhyjW9AqM90dE4+s1/XtCfn7uWg6cS72zH+2VPFAlsnW0+W0cDi0XRjNKUMoJtpSi50+Ph6w==",
+ "version": "4.44.1",
+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.44.1.tgz",
+ "integrity": "sha512-4UOGAohv/VGUNQJstzEywwNxqX417FnjZgZJpJQegddzPmTvph37eBIRbRTfdySXzVtJXLJfbMN3mMYhM6GdmQ==",
"dev": true,
"requires": {
- "@webassemblyjs/ast": "1.8.5",
- "@webassemblyjs/helper-module-context": "1.8.5",
- "@webassemblyjs/wasm-edit": "1.8.5",
- "@webassemblyjs/wasm-parser": "1.8.5",
- "acorn": "^6.2.1",
+ "@webassemblyjs/ast": "1.9.0",
+ "@webassemblyjs/helper-module-context": "1.9.0",
+ "@webassemblyjs/wasm-edit": "1.9.0",
+ "@webassemblyjs/wasm-parser": "1.9.0",
+ "acorn": "^6.4.1",
"ajv": "^6.10.2",
"ajv-keywords": "^3.4.1",
"chrome-trace-event": "^1.0.2",
- "enhanced-resolve": "^4.1.0",
+ "enhanced-resolve": "^4.3.0",
"eslint-scope": "^4.0.3",
"json-parse-better-errors": "^1.0.2",
"loader-runner": "^2.4.0",
"loader-utils": "^1.2.3",
"memory-fs": "^0.4.1",
"micromatch": "^3.1.10",
- "mkdirp": "^0.5.1",
+ "mkdirp": "^0.5.3",
"neo-async": "^2.6.1",
"node-libs-browser": "^2.2.1",
"schema-utils": "^1.0.0",
"tapable": "^1.1.3",
"terser-webpack-plugin": "^1.4.3",
- "watchpack": "^1.6.0",
+ "watchpack": "^1.7.4",
"webpack-sources": "^1.4.1"
},
"dependencies": {
"mkdirp": {
- "version": "0.5.3",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
- "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
+ "version": "0.5.5",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
+ "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
@@ -5264,78 +5269,24 @@
}
},
"webpack-cli": {
- "version": "3.3.11",
- "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.11.tgz",
- "integrity": "sha512-dXlfuml7xvAFwYUPsrtQAA9e4DOe58gnzSxhgrO/ZM/gyXTBowrsYeubyN4mqGhYdpXMFNyQ6emjJS9M7OBd4g==",
- "dev": true,
- "requires": {
- "chalk": "2.4.2",
- "cross-spawn": "6.0.5",
- "enhanced-resolve": "4.1.0",
- "findup-sync": "3.0.0",
- "global-modules": "2.0.0",
- "import-local": "2.0.0",
- "interpret": "1.2.0",
- "loader-utils": "1.2.3",
- "supports-color": "6.1.0",
- "v8-compile-cache": "2.0.3",
- "yargs": "13.2.4"
+ "version": "3.3.12",
+ "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.12.tgz",
+ "integrity": "sha512-NVWBaz9k839ZH/sinurM+HcDvJOTXwSjYp1ku+5XKeOC03z8v5QitnK/x+lAxGXFyhdayoIf/GOpv85z3/xPag==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.2",
+ "cross-spawn": "^6.0.5",
+ "enhanced-resolve": "^4.1.1",
+ "findup-sync": "^3.0.0",
+ "global-modules": "^2.0.0",
+ "import-local": "^2.0.0",
+ "interpret": "^1.4.0",
+ "loader-utils": "^1.4.0",
+ "supports-color": "^6.1.0",
+ "v8-compile-cache": "^2.1.1",
+ "yargs": "^13.3.2"
},
"dependencies": {
- "ansi-regex": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
- "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
- "dev": true
- },
- "emojis-list": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
- "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=",
- "dev": true
- },
- "enhanced-resolve": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz",
- "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==",
- "dev": true,
- "requires": {
- "graceful-fs": "^4.1.2",
- "memory-fs": "^0.4.0",
- "tapable": "^1.0.0"
- }
- },
- "loader-utils": {
- "version": "1.2.3",
- "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz",
- "integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==",
- "dev": true,
- "requires": {
- "big.js": "^5.2.2",
- "emojis-list": "^2.0.0",
- "json5": "^1.0.1"
- }
- },
- "string-width": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
- "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
- "dev": true,
- "requires": {
- "emoji-regex": "^7.0.1",
- "is-fullwidth-code-point": "^2.0.0",
- "strip-ansi": "^5.1.0"
- }
- },
- "strip-ansi": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
- "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
- "dev": true,
- "requires": {
- "ansi-regex": "^4.1.0"
- }
- },
"supports-color": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
@@ -5344,25 +5295,6 @@
"requires": {
"has-flag": "^3.0.0"
}
- },
- "yargs": {
- "version": "13.2.4",
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.4.tgz",
- "integrity": "sha512-HG/DWAJa1PAnHT9JAhNa8AbAv3FPaiLzioSjCcmuXXhP8MlpHO5vwls4g4j6n30Z74GVQj8Xa62dWVx1QCGklg==",
- "dev": true,
- "requires": {
- "cliui": "^5.0.0",
- "find-up": "^3.0.0",
- "get-caller-file": "^2.0.1",
- "os-locale": "^3.1.0",
- "require-directory": "^2.1.1",
- "require-main-filename": "^2.0.0",
- "set-blocking": "^2.0.0",
- "string-width": "^3.0.0",
- "which-module": "^2.0.0",
- "y18n": "^4.0.0",
- "yargs-parser": "^13.1.0"
- }
}
}
},
@@ -5408,11 +5340,14 @@
"string-width": "^1.0.2 || 2"
}
},
- "wordwrap": {
- "version": "0.0.3",
- "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
- "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=",
- "dev": true
+ "widest-line": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.1.tgz",
+ "integrity": "sha512-Ba5m9/Fa4Xt9eb2ELXt77JxVDV8w7qQrH0zS/TWSJdLyAwQjWoOzpzj5lwVftDz6n/EOu3tNACS84v509qwnJA==",
+ "dev": true,
+ "requires": {
+ "string-width": "^2.1.1"
+ }
},
"worker-farm": {
"version": "1.7.0",
@@ -5423,6 +5358,12 @@
"errno": "~0.1.7"
}
},
+ "workerpool": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.0.tgz",
+ "integrity": "sha512-fU2OcNA/GVAJLLyKUoHkAgIhKb0JoCpSjLC/G2vYKxUjVmQwGbRVeoPJ1a8U4pnVofz4AQV5Y/NEw8oKqxEBtA==",
+ "dev": true
+ },
"wrap-ansi": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
@@ -5541,14 +5482,73 @@
}
},
"yargs-unparser": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz",
- "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==",
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.1.tgz",
+ "integrity": "sha512-qZV14lK9MWsGCmcr7u5oXGH0dbGqZAIxTDrWXZDo5zUr6b6iUmelNKO6x6R1dQT24AH3LgRxJpr8meWy2unolA==",
"dev": true,
"requires": {
+ "camelcase": "^5.3.1",
+ "decamelize": "^1.2.0",
"flat": "^4.1.0",
- "lodash": "^4.17.15",
- "yargs": "^13.3.0"
+ "is-plain-obj": "^1.1.0",
+ "yargs": "^14.2.3"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
+ },
+ "string-width": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^7.0.1",
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ }
+ },
+ "yargs": {
+ "version": "14.2.3",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz",
+ "integrity": "sha512-ZbotRWhF+lkjijC/VhmOT9wSgyBQ7+zr13+YLkhfsSiTriYsMzkTUFP18pFhWwBeMa5gUc1MzbhrO6/VB7c9Xg==",
+ "dev": true,
+ "requires": {
+ "cliui": "^5.0.0",
+ "decamelize": "^1.2.0",
+ "find-up": "^3.0.0",
+ "get-caller-file": "^2.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^2.0.0",
+ "set-blocking": "^2.0.0",
+ "string-width": "^3.0.0",
+ "which-module": "^2.0.0",
+ "y18n": "^4.0.0",
+ "yargs-parser": "^15.0.1"
+ }
+ },
+ "yargs-parser": {
+ "version": "15.0.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-15.0.1.tgz",
+ "integrity": "sha512-0OAMV2mAZQrs3FkNpDQcBk1x5HXb8X4twADss4S0Iuk+2dGnLOE/fRHrsYm542GduMveyA77OF4wrNJuanRCWw==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ }
}
}
}
diff -Nru node-js-beautify-1.11.0+dfsg/.pylintrc node-js-beautify-1.13.6+dfsg+~0.15.3/.pylintrc
--- node-js-beautify-1.11.0+dfsg/.pylintrc 1970-01-01 00:00:00.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/.pylintrc 2021-01-26 17:37:55.000000000 +0000
@@ -0,0 +1 @@
+max-line-length=88
\ No newline at end of file
diff -Nru node-js-beautify-1.11.0+dfsg/python/cssbeautifier/css/beautifier.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/css/beautifier.py
--- node-js-beautify-1.11.0+dfsg/python/cssbeautifier/css/beautifier.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/css/beautifier.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,482 +0,0 @@
-from __future__ import print_function
-import sys
-import re
-import copy
-from .options import BeautifierOptions
-from jsbeautifier.core.output import Output
-from jsbeautifier.core.inputscanner import InputScanner
-from jsbeautifier.core.directives import Directives
-from jsbeautifier.__version__ import __version__
-
-# This is not pretty, but given how we did the version import
-# it is the only way to do this without having setup.py fail on a missing
-# six dependency.
-six = __import__("six")
-
-#
-# The MIT License (MIT)
-
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-
-directives_core = Directives(r'/\*', r'\*/')
-
-whitespaceChar = re.compile(r"\s")
-whitespacePattern = re.compile(r"(?:\s|\n)+")
-
-# WORD_RE = re.compile("[\w$\-_]")
-
-
-def default_options():
- return BeautifierOptions()
-
-
-def beautify(string, opts=default_options()):
- b = Beautifier(string, opts)
- return b.beautify()
-
-
-def beautify_file(file_name, opts=default_options()):
- if file_name == '-': # stdin
- stream = sys.stdin
- else:
- stream = open(file_name)
- content = ''.join(stream.readlines())
- b = Beautifier(content, opts)
- return b.beautify()
-
-
-def usage(stream=sys.stdout):
-
- print("cssbeautifier.py@" + __version__ + """
-
-CSS beautifier (https://beautifier.io/)
-
-""", file=stream)
- if stream == sys.stderr:
- return 1
- else:
- return 0
-
-
-
-class Beautifier:
-
- def __init__(self, source_text, opts=default_options()):
- # in javascript, these two differ
- # in python they are the same, different methods are called on them
- # IMPORTANT: This string must be run through six to handle \u chars
- self.lineBreak = re.compile(six.u(r"\r\n|[\n\r]"))
- self.allLineBreaks = self.lineBreak
-
- self.comment_pattern = re.compile(
- six.u(r"\/\/(?:[^\n\r\u2028\u2029]*)"))
- self.block_comment_pattern = re.compile(
- r"\/\*(?:[\s\S]*?)((?:\*\/)|$)")
-
- if not source_text:
- source_text = ''
-
- self.__source_text = source_text
-
- self._options = BeautifierOptions(opts)
- self._input = None
- self._ch = None
-
- self._indentLevel = 0
- self._nestedLevel = 0
- self._output = None
-
- # https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule
- # also in CONDITIONAL_GROUP_RULE below
- self.NESTED_AT_RULE = {
- "@page",
- "@font-face",
- "@keyframes",
- "@media",
- "@supports",
- "@document"}
- self.CONDITIONAL_GROUP_RULE = {
- "@media",
- "@supports",
- "@document"}
-
- def eatString(self, endChars):
- result = ''
- self._ch = self._input.next()
- while self._ch:
- result += self._ch
- if self._ch == "\\":
- result += self._input.next()
- elif self._ch in endChars or self._ch == "\n":
- break
- self._ch = self._input.next()
- return result
-
- # Skips any white space in the source text from the current position.
- # When allowAtLeastOneNewLine is true, will output new lines for each
- # newline character found; if the user has preserve_newlines off, only
- # the first newline will be output
- def eatWhitespace(self, allowAtLeastOneNewLine=False):
- result = whitespaceChar.search(self._input.peek() or '') is not None
- isFirstNewLine = True
-
- while whitespaceChar.search(self._input.peek() or '') is not None:
- self._ch = self._input.next()
- if allowAtLeastOneNewLine and self._ch == "\n":
- if self._options.preserve_newlines or isFirstNewLine:
- isFirstNewLine = False
- self._output.add_new_line(True)
- return result
-
- # Nested pseudo-class if we are insideRule
- # and the next special character found opens
- # a new block
- def foundNestedPseudoClass(self):
- openParen = 0
- i = 1
- ch = self._input.peek(i)
- while ch:
- if ch == "{":
- return True
- elif ch == "(":
- # pseudoclasses can contain ()
- openParen += 1
- elif ch == ")":
- if openParen == 0:
- return False
- openParen -= 1
- elif ch == ";" or ch == "}":
- return False
- i += 1
- ch = self._input.peek(i)
-
- return False
-
-
- def indent(self):
- self._indentLevel += 1
-
- def outdent(self):
- if self._indentLevel > 0:
- self._indentLevel -= 1
-
- def preserveSingleSpace(self, isAfterSpace):
- if isAfterSpace:
- self._output.space_before_token = True
-
- def print_string(self, output_string):
- self._output.set_indent(self._indentLevel)
- self._output.non_breaking_space = True
- self._output.add_token(output_string)
-
-
- def beautify(self):
- if self._options.disabled:
- return self.__source_text
-
- source_text = self.__source_text
-
- if self._options.eol == 'auto':
- self._options.eol = '\n'
- if self.lineBreak.search(source_text or ''):
- self._options.eol = self.lineBreak.search(source_text).group()
-
-
- # HACK: newline parsing inconsistent. This brute force normalizes the
- # input newlines.
- source_text = re.sub(self.allLineBreaks, '\n', source_text)
- baseIndentString = re.search("^[\t ]*", source_text).group(0)
-
- self._output = Output(self._options, baseIndentString)
-
- self._input = InputScanner(source_text)
-
- self._indentLevel = 0
- self._nestedLevel = 0
-
- self._ch = None
- parenLevel = 0
-
- insideRule = False
- insidePropertyValue = False
- enteringConditionalGroup = False
- insideAtExtend = False
- insideAtImport = False
- topCharacter = self._ch
-
- while True:
- whitespace = self._input.read(whitespacePattern)
- isAfterSpace = whitespace != ''
- previous_ch = topCharacter
- self._ch = self._input.next()
- if self._ch == '\\' and self._input.hasNext():
- self._ch += self._input.next()
- topCharacter = self._ch
-
- if not self._ch:
- break
- elif self._ch == '/' and self._input.peek() == '*':
- # /* css comment */
- # Always start block comments on a new line.
- # This handles scenarios where a block comment immediately
- # follows a property definition on the same line or where
- # minified code is being beautified.
- self._output.add_new_line()
- self._input.back()
- comment = self._input.read(self.block_comment_pattern)
-
- # handle ignore directive
- directives = directives_core.get_directives(comment)
- if directives and directives.get('ignore') == 'start':
- comment += directives_core.readIgnored(self._input)
-
- self.print_string(comment)
-
- # Ensures any new lines following the comment are preserved
- self.eatWhitespace(True)
-
- # Block comments are followed by a new line so they don't
- # share a line with other properties
- self._output.add_new_line()
- elif self._ch == '/' and self._input.peek() == '/':
- # // single line comment
- # Preserves the space before a comment
- # on the same line as a rule
- self._output.space_before_token = True
- self._input.back()
- self.print_string(self._input.read(self.comment_pattern))
-
- # Ensures any new lines following the comment are preserved
- self.eatWhitespace(True)
- elif self._ch == '@':
- self.preserveSingleSpace(isAfterSpace)
-
- # deal with less propery mixins @{...}
- if self._input.peek() == '{':
- self.print_string(self._ch + self.eatString('}'))
- else:
- self.print_string(self._ch)
- # strip trailing space, for hash property check
- variableOrRule = self._input.peekUntilAfter(
- re.compile(r"[: ,;{}()[\]\/='\"]"))
-
- if variableOrRule[-1] in ": ":
- # wwe have a variable or pseudo-class, add it and
- # insert one space before continuing
- variableOrRule = self.eatString(": ")
- if variableOrRule[-1].isspace():
- variableOrRule = variableOrRule[:-1]
- self.print_string(variableOrRule)
- self._output.space_before_token = True
-
- if variableOrRule[-1].isspace():
- variableOrRule = variableOrRule[:-1]
-
- if variableOrRule == "extend":
- insideAtExtend = True
- elif variableOrRule == "import":
- insideAtImport = True
-
- # might be a nesting at-rule
- if variableOrRule in self.NESTED_AT_RULE:
- self._nestedLevel += 1
- if variableOrRule in self.CONDITIONAL_GROUP_RULE:
- enteringConditionalGroup = True
- elif not insideRule and parenLevel == 0 and \
- variableOrRule[-1] == ":":
- insidePropertyValue = True
- self.indent()
- elif self._ch == '#' and self._input.peek() == '{':
- self.preserveSingleSpace(isAfterSpace)
- self.print_string(self._ch + self.eatString('}'))
- elif self._ch == '{':
- if insidePropertyValue:
- insidePropertyValue = False
- self.outdent()
- self.indent()
- self._output.space_before_token = True
- self.print_string(self._ch)
-
- # when entering conditional groups, only rulesets are
- # allowed
- if enteringConditionalGroup:
- enteringConditionalGroup = False
- insideRule = self._indentLevel > self._nestedLevel
- else:
- # otherwise, declarations are also allowed
- insideRule = self._indentLevel >= self._nestedLevel
-
- if self._options.newline_between_rules and insideRule:
- if self._output.previous_line and \
- not self._output.previous_line.is_empty() and \
- self._output.previous_line.item(-1) != '{':
- self._output.ensure_empty_line_above('/', ',')
- self.eatWhitespace(True)
- self._output.add_new_line()
- elif self._ch == '}':
- self.outdent()
- self._output.add_new_line()
- if previous_ch == '{':
- self._output.trim(True)
- insideAtExtend = False
- insideAtImport = False
- if insidePropertyValue:
- self.outdent()
- insidePropertyValue = False
- self.print_string(self._ch)
- insideRule = False
- if self._nestedLevel:
- self._nestedLevel -= 1
-
- self.eatWhitespace(True)
- self._output.add_new_line()
-
- if self._options.newline_between_rules and \
- not self._output.just_added_blankline():
- if self._input.peek() != '}':
- self._output.add_new_line(True)
- elif self._ch == ":":
- if (insideRule or enteringConditionalGroup) and \
- not (self._input.lookBack('&') or
- self.foundNestedPseudoClass()) and \
- not self._input.lookBack('(') and not insideAtExtend and \
- parenLevel == 0:
- # 'property: value' delimiter
- # which could be in a conditional group query
- self.print_string(":")
- if not insidePropertyValue:
- insidePropertyValue = True
- self._output.space_before_token = True
- self.eatWhitespace(True)
- self.indent()
-
- else:
- # sass/less parent reference don't use a space
- # sass nested pseudo-class don't use a space
-
- # preserve space before pseudoclasses/pseudoelements,
- # as it means "in any child"
- if self._input.lookBack(' '):
- self._output.space_before_token = True
- if self._input.peek() == ":":
- # pseudo-element
- self._ch = self._input.next()
- self.print_string("::")
- else:
- # pseudo-element
- self.print_string(":")
- elif self._ch == '"' or self._ch == '\'':
- self.preserveSingleSpace(isAfterSpace)
- self.print_string(self._ch + self.eatString(self._ch))
- self.eatWhitespace(True)
- elif self._ch == ';':
- if parenLevel == 0:
- if insidePropertyValue:
- self.outdent()
- insidePropertyValue = False
- insideAtExtend = False
- insideAtImport = False
- self.print_string(self._ch)
- self.eatWhitespace(True)
-
- # This maintains single line comments on the same
- # line. Block comments are also affected, but
- # a new line is always output before one inside
- # that section
- if self._input.peek() is not '/':
- self._output.add_new_line()
- else:
- self.print_string(self._ch)
- self.eatWhitespace(True)
- self._output.space_before_token = True
- elif self._ch == '(':
- # may be a url
- if self._input.lookBack("url"):
- self.print_string(self._ch)
- self.eatWhitespace()
- parenLevel += 1
- self.indent()
- self._ch = self._input.next()
- if self._ch in {')', '"', '\''}:
- self._input.back()
- elif self._ch is not None:
- self.print_string(self._ch + self.eatString(')'))
- if parenLevel:
- parenLevel -= 1
- self.outdent()
- else:
- self.preserveSingleSpace(isAfterSpace)
- self.print_string(self._ch)
- self.eatWhitespace()
- parenLevel += 1
- self.indent()
- elif self._ch == ')':
- if parenLevel:
- parenLevel -= 1
- self.outdent()
- self.print_string(self._ch)
- elif self._ch == ',':
- self.print_string(self._ch)
- self.eatWhitespace(True)
- if self._options.selector_separator_newline and \
- not insidePropertyValue and parenLevel == 0 and \
- not insideAtImport:
- self._output.add_new_line()
- else:
- self._output.space_before_token = True
- elif (self._ch == '>' or self._ch == '+' or self._ch == '~') and \
- not insidePropertyValue and parenLevel == 0:
- # handle combinator spacing
- if self._options.space_around_combinator:
- self._output.space_before_token = True
- self.print_string(self._ch)
- self._output.space_before_token = True
- else:
- self.print_string(self._ch)
- self.eatWhitespace()
- # squash extra whitespace
- if self._ch and bool(whitespaceChar.search(self._ch)):
- self._ch = ''
- elif self._ch == ']':
- self.print_string(self._ch)
- elif self._ch == '[':
- self.preserveSingleSpace(isAfterSpace)
- self.print_string(self._ch)
- elif self._ch == '=':
- # no whitespace before or after
- self.eatWhitespace()
- self.print_string('=')
- if bool(whitespaceChar.search(self._ch)):
- self._ch = ''
- elif self._ch == '!' and not (self._input.lookBack('\\')):
- # !important
- self.print_string(' ')
- self.print_string(self._ch)
- else:
- self.preserveSingleSpace(isAfterSpace)
- self.print_string(self._ch)
-
- sweet_code = self._output.get_code(self._options.eol)
-
- return sweet_code
diff -Nru node-js-beautify-1.11.0+dfsg/python/cssbeautifier/css/__init__.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/css/__init__.py
--- node-js-beautify-1.11.0+dfsg/python/cssbeautifier/css/__init__.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/css/__init__.py 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-# Empty file :)
diff -Nru node-js-beautify-1.11.0+dfsg/python/cssbeautifier/css/options.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/css/options.py
--- node-js-beautify-1.11.0+dfsg/python/cssbeautifier/css/options.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/css/options.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,40 +0,0 @@
-#
-# The MIT License (MIT)
-
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-from jsbeautifier.core.options import Options as BaseOptions
-
-class BeautifierOptions(BaseOptions):
- def __init__(self, options=None):
- BaseOptions.__init__(self, options, 'css')
-
- self.selector_separator_newline = self._get_boolean('selector_separator_newline', True)
- self.newline_between_rules = self._get_boolean('newline_between_rules', True)
-
- # deprecated
- space_around_selector_separator = self._get_boolean('space_around_selector_separator')
-
- # Continue to accept deprecated option
- self.space_around_combinator = self._get_boolean('space_around_combinator') or \
- space_around_selector_separator
diff -Nru node-js-beautify-1.11.0+dfsg/python/cssbeautifier/__init__.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/__init__.py
--- node-js-beautify-1.11.0+dfsg/python/cssbeautifier/__init__.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/__init__.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,206 +0,0 @@
-#
-# The MIT License (MIT)
-
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-from __future__ import print_function
-import sys
-import os
-import io
-import re
-import copy
-import getopt
-from jsbeautifier.__version__ import __version__
-from jsbeautifier import isFileDifferent, mkdir_p
-from cssbeautifier.css.options import BeautifierOptions
-from cssbeautifier.css.beautifier import Beautifier
-
-
-def default_options():
- return BeautifierOptions()
-
-
-def beautify(string, opts=default_options()):
- b = Beautifier(string, opts)
- return b.beautify()
-
-
-def beautify_file(file_name, opts=default_options()):
- if file_name == '-': # stdin
- try:
- if sys.stdin.isatty():
- raise Exception()
-
- stream = sys.stdin
- except Exception:
- print("Must pipe input or define input file.\n", file=sys.stderr)
- usage(sys.stderr)
- raise Exception()
- else:
- stream = open(file_name)
-
- content = ''.join(stream.readlines())
- b = Beautifier(content, opts)
- return b.beautify()
-
-
-def usage(stream=sys.stdout):
-
- print("cssbeautifier.py@" + __version__ + """
-
-CSS beautifier (https://beautifier.io/)
-
-Usage: cssbeautifier.py [options]
-
- can be "-", which means stdin.
-
-Input options:
-
- -i, --stdin Read input from stdin
-
-Output options:
-
- -s, --indent-size=NUMBER Indentation size. (default 4).
- -c, --indent-char=CHAR Character to indent with. (default space).
- -e, --eol=STRING Character(s) to use as line terminators.
- (default first newline in file, otherwise "\\n")
- -t, --indent-with-tabs Indent with tabs, overrides -s and -c
- --preserve-newlines Preserve existing line breaks.
- --disable-selector-separator-newline
- Do not print each selector on a separate line.
- -n, --end-with-newline End output with newline
- --disable-newline-between-rules
- Do not print empty line between rules.
- --space-around-combinator Print spaces around combinator.
- --indent-empty-lines Keep indentation on empty lines
- -r, --replace Write output in-place, replacing input
- -o, --outfile=FILE Specify a file to output to (default stdout)
-
-Rarely needed options:
-
- -h, --help, --usage Prints this help statement.
- -v, --version Show the version
-
-""", file=stream)
- if stream == sys.stderr:
- return 1
- else:
- return 0
-
-
-def main():
-
- argv = sys.argv[1:]
-
- try:
- opts, args = getopt.getopt(argv, "hvio:rs:c:e:tn",
- ['help', 'usage', 'version', 'stdin', 'outfile=', 'replace',
- 'indent-size=', 'indent-char=', 'eol=', 'indent-with-tabs',
- 'preserve-newlines', 'disable-selector-separator-newline',
- 'end-with-newline', 'disable-newline-between-rules',
- 'space-around-combinator', 'indent-empty-lines'])
- except getopt.GetoptError as ex:
- print(ex, file=sys.stderr)
- return usage(sys.stderr)
-
- css_options = default_options()
-
- file = None
- outfile = 'stdout'
- replace = False
- if len(args) == 1:
- file = args[0]
-
- for opt, arg in opts:
- if opt in ('--stdin', '-i'):
- file = '-'
- elif opt in ('--outfile', '-o'):
- outfile = arg
- elif opt in ('--replace', '-r'):
- replace = True
- elif opt in ('--version', '-v'):
- return print(__version__)
- elif opt in ('--help', '--usage', '-h'):
- return usage()
-
- elif opt in ('--indent-size', '-s'):
- css_options.indent_size = int(arg)
- elif opt in ('--indent-char', '-c'):
- css_options.indent_char = arg
- elif opt in ('--eol', '-e'):
- css_options.eol = arg
- elif opt in ('--indent-with-tabs', '-t'):
- css_options.indent_with_tabs = True
- elif opt in ('--preserve-newlines'):
- css_options.preserve_newlines = True
- elif opt in ('--disable-selector-separator-newline'):
- css_options.selector_separator_newline = False
- elif opt in ('--end-with-newline', '-n'):
- css_options.end_with_newline = True
- elif opt in ('--disable-newline-between-rules'):
- css_options.newline_between_rules = False
- elif opt in ('--space-around-combinator'):
- css_options.space_around_combinator = True
- elif opt in ('--indent-empty-lines'):
- css_options.indent_empty_lines = True
-
- if not file:
- file = '-'
-
- try:
- if outfile == 'stdout' and replace and not file == '-':
- outfile = file
-
- pretty = beautify_file(file, css_options)
-
- if outfile == 'stdout':
- # python automatically converts newlines in text to "\r\n" when on windows
- # switch to binary to prevent this
- if sys.platform == "win32":
- import msvcrt
- msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
-
- sys.stdout.write(pretty)
- else:
- if isFileDifferent(outfile, pretty):
- mkdir_p(os.path.dirname(outfile))
-
- # python automatically converts newlines in text to "\r\n" when on windows
- # set newline to empty to prevent this
- with io.open(outfile, 'wt', newline='') as f:
- print('writing ' + outfile, file=sys.stderr)
- try:
- f.write(pretty)
- except TypeError:
- # This is not pretty, but given how we did the version import
- # it is the only way to do this without having setup.py
- # fail on a missing six dependency.
- six = __import__("six")
- f.write(six.u(pretty))
-
- except Exception as ex:
- print(ex, file=sys.stderr)
- return 1
-
- # Success
- return 0
diff -Nru node-js-beautify-1.11.0+dfsg/python/cssbeautifier/tests/generated/__init__.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/tests/generated/__init__.py
--- node-js-beautify-1.11.0+dfsg/python/cssbeautifier/tests/generated/__init__.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/tests/generated/__init__.py 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-# Empty file :)
diff -Nru node-js-beautify-1.11.0+dfsg/python/cssbeautifier/tests/generated/tests.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/tests/generated/tests.py
--- node-js-beautify-1.11.0+dfsg/python/cssbeautifier/tests/generated/tests.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/tests/generated/tests.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,10920 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-'''
- AUTO-GENERATED. DO NOT MODIFY.
- Script: test/generate-tests.js
- Template: test/data/css/python.mustache
- Data: test/data/css/tests.js
-
- The MIT License (MIT)
-
- Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation files
- (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge,
- publish, distribute, sublicense, and/or sell copies of the Software,
- and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-'''
-
-import unittest
-import cssbeautifier
-import copy
-
-class CSSBeautifierTest(unittest.TestCase):
-
- options = None
-
- @classmethod
- def setUpClass(cls):
- pass
-
- def reset_options(self):
- false = False
- true = True
-
- default_options = cssbeautifier.default_options()
- default_options.indent_size = 4
- default_options.indent_char = ' '
- default_options.selector_separator_newline = true
- default_options.end_with_newline = false
- default_options.newline_between_rules = false
-
- default_options.indent_size = 4
- default_options.indent_char = ' '
- default_options.selector_separator_newline = true
- default_options.end_with_newline = false
- default_options.newline_between_rules = false
- default_options.space_around_combinator = false
- default_options.preserve_newlines = false
- default_options.space_around_selector_separator = false
-
- self.options = copy.copy(default_options)
-
- def testGenerated(self):
- self.reset_options()
- test_fragment = self.decodesto
- t = self.decodesto
-
- false = False
- true = True
-
-
- #============================================================
- # End With Newline - (end_with_newline = "true")
- self.reset_options()
- self.options.end_with_newline = true
- test_fragment('', '\n')
- test_fragment(' .tabs{}', ' .tabs {}\n')
- test_fragment(
- ' \n' +
- '\n' +
- '.tabs{}\n' +
- '\n' +
- '\n' +
- '\n',
- # -- output --
- ' .tabs {}\n')
- test_fragment('\n')
-
- # End With Newline - (end_with_newline = "false")
- self.reset_options()
- self.options.end_with_newline = false
- test_fragment('')
- test_fragment(' .tabs{}', ' .tabs {}')
- test_fragment(
- ' \n' +
- '\n' +
- '.tabs{}\n' +
- '\n' +
- '\n' +
- '\n',
- # -- output --
- ' .tabs {}')
- test_fragment('\n', '')
-
-
- #============================================================
- # Support Indent Level Options and Base Indent Autodetection - (indent_size = "4", indent_char = "" "", indent_with_tabs = "false")
- self.reset_options()
- self.options.indent_size = 4
- self.options.indent_char = ' '
- self.options.indent_with_tabs = false
- test_fragment(' a')
- test_fragment(
- ' .a {\n' +
- ' text-align: right;\n' +
- '}',
- # -- output --
- ' .a {\n' +
- ' text-align: right;\n' +
- ' }')
- test_fragment(
- ' // This is a random comment\n' +
- '.a {\n' +
- ' text-align: right;\n' +
- '}',
- # -- output --
- ' // This is a random comment\n' +
- ' .a {\n' +
- ' text-align: right;\n' +
- ' }')
-
- # Support Indent Level Options and Base Indent Autodetection - (indent_size = "4", indent_char = "" "", indent_with_tabs = "false", indent_level = "0")
- self.reset_options()
- self.options.indent_size = 4
- self.options.indent_char = ' '
- self.options.indent_with_tabs = false
- self.options.indent_level = 0
- test_fragment(' a')
- test_fragment(
- ' .a {\n' +
- ' text-align: right;\n' +
- '}',
- # -- output --
- ' .a {\n' +
- ' text-align: right;\n' +
- ' }')
- test_fragment(
- ' // This is a random comment\n' +
- '.a {\n' +
- ' text-align: right;\n' +
- '}',
- # -- output --
- ' // This is a random comment\n' +
- ' .a {\n' +
- ' text-align: right;\n' +
- ' }')
-
- # Support Indent Level Options and Base Indent Autodetection - (indent_size = "4", indent_char = "" "", indent_with_tabs = "false", indent_level = "1")
- self.reset_options()
- self.options.indent_size = 4
- self.options.indent_char = ' '
- self.options.indent_with_tabs = false
- self.options.indent_level = 1
- test_fragment(' a', ' a')
- test_fragment(
- ' .a {\n' +
- ' text-align: right;\n' +
- '}',
- # -- output --
- ' .a {\n' +
- ' text-align: right;\n' +
- ' }')
- test_fragment(
- ' // This is a random comment\n' +
- '.a {\n' +
- ' text-align: right;\n' +
- '}',
- # -- output --
- ' // This is a random comment\n' +
- ' .a {\n' +
- ' text-align: right;\n' +
- ' }')
-
- # Support Indent Level Options and Base Indent Autodetection - (indent_size = "4", indent_char = "" "", indent_with_tabs = "false", indent_level = "2")
- self.reset_options()
- self.options.indent_size = 4
- self.options.indent_char = ' '
- self.options.indent_with_tabs = false
- self.options.indent_level = 2
- test_fragment('a', ' a')
- test_fragment(
- '.a {\n' +
- ' text-align: right;\n' +
- '}',
- # -- output --
- ' .a {\n' +
- ' text-align: right;\n' +
- ' }')
- test_fragment(
- '// This is a random comment\n' +
- '.a {\n' +
- ' text-align: right;\n' +
- '}',
- # -- output --
- ' // This is a random comment\n' +
- ' .a {\n' +
- ' text-align: right;\n' +
- ' }')
-
- # Support Indent Level Options and Base Indent Autodetection - (indent_size = "4", indent_char = "" "", indent_with_tabs = "true", indent_level = "2")
- self.reset_options()
- self.options.indent_size = 4
- self.options.indent_char = ' '
- self.options.indent_with_tabs = true
- self.options.indent_level = 2
- test_fragment('a', '\t\ta')
- test_fragment(
- '.a {\n' +
- ' text-align: right;\n' +
- '}',
- # -- output --
- '\t\t.a {\n' +
- '\t\t\ttext-align: right;\n' +
- '\t\t}')
- test_fragment(
- '// This is a random comment\n' +
- '.a {\n' +
- ' text-align: right;\n' +
- '}',
- # -- output --
- '\t\t// This is a random comment\n' +
- '\t\t.a {\n' +
- '\t\t\ttext-align: right;\n' +
- '\t\t}')
-
- # Support Indent Level Options and Base Indent Autodetection - (indent_size = "4", indent_char = "" "", indent_with_tabs = "false", indent_level = "0")
- self.reset_options()
- self.options.indent_size = 4
- self.options.indent_char = ' '
- self.options.indent_with_tabs = false
- self.options.indent_level = 0
- test_fragment('\t a')
- test_fragment(
- '\t .a {\n' +
- ' text-align: right;\n' +
- '}',
- # -- output --
- '\t .a {\n' +
- '\t text-align: right;\n' +
- '\t }')
- test_fragment(
- '\t // This is a random comment\n' +
- '.a {\n' +
- ' text-align: right;\n' +
- '}',
- # -- output --
- '\t // This is a random comment\n' +
- '\t .a {\n' +
- '\t text-align: right;\n' +
- '\t }')
-
-
- #============================================================
- # Empty braces
- self.reset_options()
- t('.tabs{}', '.tabs {}')
- t('.tabs { }', '.tabs {}')
- t('.tabs { }', '.tabs {}')
- t(
- '.tabs \n' +
- '{\n' +
- ' \n' +
- ' }',
- # -- output --
- '.tabs {}')
-
-
- #============================================================
- #
- self.reset_options()
- t(
- '#cboxOverlay {\n' +
- ' background: url(images/overlay.png) repeat 0 0;\n' +
- ' opacity: 0.9;\n' +
- ' filter: alpha(opacity = 90);\n' +
- '}',
- # -- output --
- '#cboxOverlay {\n' +
- ' background: url(images/overlay.png) repeat 0 0;\n' +
- ' opacity: 0.9;\n' +
- ' filter: alpha(opacity=90);\n' +
- '}')
-
- # simple data uri base64 test
- t(
- 'a { background: url(data:image/gif;base64,R0lGODlhCwALAJEAAAAAAP///xUVFf///yH5BAEAAAMALAAAAAALAAsAAAIPnI+py+0/hJzz0IruwjsVADs=); }',
- # -- output --
- 'a {\n' +
- ' background: url(data:image/gif;base64,R0lGODlhCwALAJEAAAAAAP///xUVFf///yH5BAEAAAMALAAAAAALAAsAAAIPnI+py+0/hJzz0IruwjsVADs=);\n' +
- '}')
-
- # non-base64 data
- t(
- 'a { background: url(data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E); }',
- # -- output --
- 'a {\n' +
- ' background: url(data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E);\n' +
- '}')
-
- # Beautifier does not fix or mitigate bad data uri
- t(
- 'a { background: url(data: image/gif base64,R0lGODlhCwALAJEAAAAAAP///xUVFf///yH5BAEAAAMALAAAAAALAAsAAAIPnI+py+0/hJzz0IruwjsVADs=); }',
- # -- output --
- 'a {\n' +
- ' background: url(data: image/gif base64,R0lGODlhCwALAJEAAAAAAP///xUVFf///yH5BAEAAAMALAAAAAALAAsAAAIPnI+py+0/hJzz0IruwjsVADs=);\n' +
- '}')
-
-
- #============================================================
- # Support simple language specific option inheritance/overriding - (indent_char = "" "", indent_size = "4", js = "{ "indent_size": 3 }", css = "{ "indent_size": 5 }")
- self.reset_options()
- self.options.indent_char = ' '
- self.options.indent_size = 4
- self.options.js = { 'indent_size': 3 }
- self.options.css = { 'indent_size': 5 }
- t(
- '.selector {\n' +
- ' font-size: 12px;\n' +
- '}')
-
- # Support simple language specific option inheritance/overriding - (indent_char = "" "", indent_size = "4", html = "{ "js": { "indent_size": 3 }, "css": { "indent_size": 5 } }")
- self.reset_options()
- self.options.indent_char = ' '
- self.options.indent_size = 4
- self.options.html = { 'js': { 'indent_size': 3 }, 'css': { 'indent_size': 5 } }
- t(
- '.selector {\n' +
- ' font-size: 12px;\n' +
- '}')
-
- # Support simple language specific option inheritance/overriding - (indent_char = "" "", indent_size = "9", html = "{ "js": { "indent_size": 3 }, "css": { "indent_size": 8 }, "indent_size": 2}", js = "{ "indent_size": 5 }", css = "{ "indent_size": 3 }")
- self.reset_options()
- self.options.indent_char = ' '
- self.options.indent_size = 9
- self.options.html = { 'js': { 'indent_size': 3 }, 'css': { 'indent_size': 8 }, 'indent_size': 2}
- self.options.js = { 'indent_size': 5 }
- self.options.css = { 'indent_size': 3 }
- t(
- '.selector {\n' +
- ' font-size: 12px;\n' +
- '}')
-
-
- #============================================================
- # Space Around Combinator - (space_around_combinator = "true")
- self.reset_options()
- self.options.space_around_combinator = true
- t('a>b{}', 'a > b {}')
- t('a~b{}', 'a ~ b {}')
- t('a+b{}', 'a + b {}')
- t('a+b>c{}', 'a + b > c {}')
- t('a > b{}', 'a > b {}')
- t('a ~ b{}', 'a ~ b {}')
- t('a + b{}', 'a + b {}')
- t('a + b > c{}', 'a + b > c {}')
- t(
- 'a > b{width: calc(100% + 45px);}',
- # -- output --
- 'a > b {\n' +
- ' width: calc(100% + 45px);\n' +
- '}')
- t(
- 'a ~ b{width: calc(100% + 45px);}',
- # -- output --
- 'a ~ b {\n' +
- ' width: calc(100% + 45px);\n' +
- '}')
- t(
- 'a + b{width: calc(100% + 45px);}',
- # -- output --
- 'a + b {\n' +
- ' width: calc(100% + 45px);\n' +
- '}')
- t(
- 'a + b > c{width: calc(100% + 45px);}',
- # -- output --
- 'a + b > c {\n' +
- ' width: calc(100% + 45px);\n' +
- '}')
-
- # Space Around Combinator - (space_around_combinator = "false")
- self.reset_options()
- self.options.space_around_combinator = false
- t('a>b{}', 'a>b {}')
- t('a~b{}', 'a~b {}')
- t('a+b{}', 'a+b {}')
- t('a+b>c{}', 'a+b>c {}')
- t('a > b{}', 'a>b {}')
- t('a ~ b{}', 'a~b {}')
- t('a + b{}', 'a+b {}')
- t('a + b > c{}', 'a+b>c {}')
- t(
- 'a > b{width: calc(100% + 45px);}',
- # -- output --
- 'a>b {\n' +
- ' width: calc(100% + 45px);\n' +
- '}')
- t(
- 'a ~ b{width: calc(100% + 45px);}',
- # -- output --
- 'a~b {\n' +
- ' width: calc(100% + 45px);\n' +
- '}')
- t(
- 'a + b{width: calc(100% + 45px);}',
- # -- output --
- 'a+b {\n' +
- ' width: calc(100% + 45px);\n' +
- '}')
- t(
- 'a + b > c{width: calc(100% + 45px);}',
- # -- output --
- 'a+b>c {\n' +
- ' width: calc(100% + 45px);\n' +
- '}')
-
- # Space Around Combinator - (space_around_selector_separator = "true")
- self.reset_options()
- self.options.space_around_selector_separator = true
- t('a>b{}', 'a > b {}')
- t('a~b{}', 'a ~ b {}')
- t('a+b{}', 'a + b {}')
- t('a+b>c{}', 'a + b > c {}')
- t('a > b{}', 'a > b {}')
- t('a ~ b{}', 'a ~ b {}')
- t('a + b{}', 'a + b {}')
- t('a + b > c{}', 'a + b > c {}')
- t(
- 'a > b{width: calc(100% + 45px);}',
- # -- output --
- 'a > b {\n' +
- ' width: calc(100% + 45px);\n' +
- '}')
- t(
- 'a ~ b{width: calc(100% + 45px);}',
- # -- output --
- 'a ~ b {\n' +
- ' width: calc(100% + 45px);\n' +
- '}')
- t(
- 'a + b{width: calc(100% + 45px);}',
- # -- output --
- 'a + b {\n' +
- ' width: calc(100% + 45px);\n' +
- '}')
- t(
- 'a + b > c{width: calc(100% + 45px);}',
- # -- output --
- 'a + b > c {\n' +
- ' width: calc(100% + 45px);\n' +
- '}')
-
-
- #============================================================
- # Issue 1373 -- Correct spacing around [attribute~=value]
- self.reset_options()
- t('header>div[class~="div-all"]')
-
-
- #============================================================
- # Selector Separator - (selector_separator_newline = "false", selector_separator = "" "", newline_between_rules = "true")
- self.reset_options()
- self.options.selector_separator_newline = false
- self.options.selector_separator = " "
- self.options.newline_between_rules = true
- t(
- '#bla, #foo{color:green}',
- # -- output --
- '#bla, #foo {\n' +
- ' color: green\n' +
- '}')
- t(
- '#bla, #foo{color:green}\n' +
- '#bla, #foo{color:green}',
- # -- output --
- '#bla, #foo {\n' +
- ' color: green\n' +
- '}\n' +
- '\n' +
- '#bla, #foo {\n' +
- ' color: green\n' +
- '}')
- t(
- '@media print {.tab{}}',
- # -- output --
- '@media print {\n' +
- ' .tab {}\n' +
- '}')
-
- # This is bug #1489
- t(
- '@media print {.tab,.bat{}}',
- # -- output --
- '@media print {\n' +
- ' .tab, .bat {}\n' +
- '}')
-
- # This is bug #1489
- t(
- '@media print {// comment\n' +
- '//comment 2\n' +
- '.bat{}}',
- # -- output --
- '@media print {\n' +
- '\n' +
- ' // comment\n' +
- ' //comment 2\n' +
- ' .bat {}\n' +
- '}')
- t(
- '#bla, #foo{color:black}',
- # -- output --
- '#bla, #foo {\n' +
- ' color: black\n' +
- '}')
- t(
- 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}\n' +
- 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}',
- # -- output --
- 'a:first-child, a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:first-child, div:hover {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- 'a:first-child, a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:first-child, div:hover {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}')
-
- # Selector Separator - (selector_separator_newline = "false", selector_separator = "" "", newline_between_rules = "false")
- self.reset_options()
- self.options.selector_separator_newline = false
- self.options.selector_separator = " "
- self.options.newline_between_rules = false
- t(
- '#bla, #foo{color:green}',
- # -- output --
- '#bla, #foo {\n' +
- ' color: green\n' +
- '}')
- t(
- '#bla, #foo{color:green}\n' +
- '#bla, #foo{color:green}',
- # -- output --
- '#bla, #foo {\n' +
- ' color: green\n' +
- '}\n' +
- '#bla, #foo {\n' +
- ' color: green\n' +
- '}')
- t(
- '@media print {.tab{}}',
- # -- output --
- '@media print {\n' +
- ' .tab {}\n' +
- '}')
-
- # This is bug #1489
- t(
- '@media print {.tab,.bat{}}',
- # -- output --
- '@media print {\n' +
- ' .tab, .bat {}\n' +
- '}')
-
- # This is bug #1489
- t(
- '@media print {// comment\n' +
- '//comment 2\n' +
- '.bat{}}',
- # -- output --
- '@media print {\n' +
- ' // comment\n' +
- ' //comment 2\n' +
- ' .bat {}\n' +
- '}')
- t(
- '#bla, #foo{color:black}',
- # -- output --
- '#bla, #foo {\n' +
- ' color: black\n' +
- '}')
- t(
- 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}\n' +
- 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}',
- # -- output --
- 'a:first-child, a:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child, div:hover {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- 'a:first-child, a:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child, div:hover {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}')
-
- # Selector Separator - (selector_separator_newline = "false", selector_separator = "" "", newline_between_rules = "false")
- self.reset_options()
- self.options.selector_separator_newline = false
- self.options.selector_separator = " "
- self.options.newline_between_rules = false
- t(
- '#bla, #foo{color:green}',
- # -- output --
- '#bla, #foo {\n' +
- ' color: green\n' +
- '}')
- t(
- '#bla, #foo{color:green}\n' +
- '#bla, #foo{color:green}',
- # -- output --
- '#bla, #foo {\n' +
- ' color: green\n' +
- '}\n' +
- '#bla, #foo {\n' +
- ' color: green\n' +
- '}')
- t(
- '@media print {.tab{}}',
- # -- output --
- '@media print {\n' +
- ' .tab {}\n' +
- '}')
-
- # This is bug #1489
- t(
- '@media print {.tab,.bat{}}',
- # -- output --
- '@media print {\n' +
- ' .tab, .bat {}\n' +
- '}')
-
- # This is bug #1489
- t(
- '@media print {// comment\n' +
- '//comment 2\n' +
- '.bat{}}',
- # -- output --
- '@media print {\n' +
- ' // comment\n' +
- ' //comment 2\n' +
- ' .bat {}\n' +
- '}')
- t(
- '#bla, #foo{color:black}',
- # -- output --
- '#bla, #foo {\n' +
- ' color: black\n' +
- '}')
- t(
- 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}\n' +
- 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}',
- # -- output --
- 'a:first-child, a:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child, div:hover {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- 'a:first-child, a:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child, div:hover {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}')
-
- # Selector Separator - (selector_separator_newline = "true", selector_separator = "" "", newline_between_rules = "true")
- self.reset_options()
- self.options.selector_separator_newline = true
- self.options.selector_separator = " "
- self.options.newline_between_rules = true
- t(
- '#bla, #foo{color:green}',
- # -- output --
- '#bla,\n#foo {\n' +
- ' color: green\n' +
- '}')
- t(
- '#bla, #foo{color:green}\n' +
- '#bla, #foo{color:green}',
- # -- output --
- '#bla,\n#foo {\n' +
- ' color: green\n' +
- '}\n' +
- '\n' +
- '#bla,\n#foo {\n' +
- ' color: green\n' +
- '}')
- t(
- '@media print {.tab{}}',
- # -- output --
- '@media print {\n' +
- ' .tab {}\n' +
- '}')
-
- # This is bug #1489
- t(
- '@media print {.tab,.bat{}}',
- # -- output --
- '@media print {\n' +
- '\n' +
- ' .tab,\n .bat {}\n' +
- '}')
-
- # This is bug #1489
- t(
- '@media print {// comment\n' +
- '//comment 2\n' +
- '.bat{}}',
- # -- output --
- '@media print {\n' +
- '\n' +
- ' // comment\n' +
- ' //comment 2\n' +
- ' .bat {}\n' +
- '}')
- t(
- '#bla, #foo{color:black}',
- # -- output --
- '#bla,\n#foo {\n' +
- ' color: black\n' +
- '}')
- t(
- 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}\n' +
- 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}',
- # -- output --
- 'a:first-child,\na:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:first-child,\n div:hover {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- 'a:first-child,\na:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:first-child,\n div:hover {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}')
-
- # Selector Separator - (selector_separator_newline = "true", selector_separator = "" "", newline_between_rules = "false")
- self.reset_options()
- self.options.selector_separator_newline = true
- self.options.selector_separator = " "
- self.options.newline_between_rules = false
- t(
- '#bla, #foo{color:green}',
- # -- output --
- '#bla,\n#foo {\n' +
- ' color: green\n' +
- '}')
- t(
- '#bla, #foo{color:green}\n' +
- '#bla, #foo{color:green}',
- # -- output --
- '#bla,\n#foo {\n' +
- ' color: green\n' +
- '}\n' +
- '#bla,\n#foo {\n' +
- ' color: green\n' +
- '}')
- t(
- '@media print {.tab{}}',
- # -- output --
- '@media print {\n' +
- ' .tab {}\n' +
- '}')
-
- # This is bug #1489
- t(
- '@media print {.tab,.bat{}}',
- # -- output --
- '@media print {\n' +
- ' .tab,\n .bat {}\n' +
- '}')
-
- # This is bug #1489
- t(
- '@media print {// comment\n' +
- '//comment 2\n' +
- '.bat{}}',
- # -- output --
- '@media print {\n' +
- ' // comment\n' +
- ' //comment 2\n' +
- ' .bat {}\n' +
- '}')
- t(
- '#bla, #foo{color:black}',
- # -- output --
- '#bla,\n#foo {\n' +
- ' color: black\n' +
- '}')
- t(
- 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}\n' +
- 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}',
- # -- output --
- 'a:first-child,\na:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child,\n div:hover {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- 'a:first-child,\na:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child,\n div:hover {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}')
-
- # Selector Separator - (selector_separator_newline = "true", selector_separator = "" "", newline_between_rules = "false")
- self.reset_options()
- self.options.selector_separator_newline = true
- self.options.selector_separator = " "
- self.options.newline_between_rules = false
- t(
- '#bla, #foo{color:green}',
- # -- output --
- '#bla,\n#foo {\n' +
- ' color: green\n' +
- '}')
- t(
- '#bla, #foo{color:green}\n' +
- '#bla, #foo{color:green}',
- # -- output --
- '#bla,\n#foo {\n' +
- ' color: green\n' +
- '}\n' +
- '#bla,\n#foo {\n' +
- ' color: green\n' +
- '}')
- t(
- '@media print {.tab{}}',
- # -- output --
- '@media print {\n' +
- ' .tab {}\n' +
- '}')
-
- # This is bug #1489
- t(
- '@media print {.tab,.bat{}}',
- # -- output --
- '@media print {\n' +
- ' .tab,\n .bat {}\n' +
- '}')
-
- # This is bug #1489
- t(
- '@media print {// comment\n' +
- '//comment 2\n' +
- '.bat{}}',
- # -- output --
- '@media print {\n' +
- ' // comment\n' +
- ' //comment 2\n' +
- ' .bat {}\n' +
- '}')
- t(
- '#bla, #foo{color:black}',
- # -- output --
- '#bla,\n#foo {\n' +
- ' color: black\n' +
- '}')
- t(
- 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}\n' +
- 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}',
- # -- output --
- 'a:first-child,\na:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child,\n div:hover {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- 'a:first-child,\na:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child,\n div:hover {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # Preserve Newlines - (preserve_newlines = "true")
- self.reset_options()
- self.options.preserve_newlines = true
- t('.div {}\n\n.span {}')
- t(
- '#bla, #foo{\n' +
- ' color:black;\n\n font-size: 12px;\n' +
- '}',
- # -- output --
- '#bla,\n' +
- '#foo {\n' +
- ' color: black;\n\n font-size: 12px;\n' +
- '}')
-
- # Preserve Newlines - (preserve_newlines = "false")
- self.reset_options()
- self.options.preserve_newlines = false
- t('.div {}\n\n.span {}', '.div {}\n.span {}')
- t(
- '#bla, #foo{\n' +
- ' color:black;\n\n font-size: 12px;\n' +
- '}',
- # -- output --
- '#bla,\n' +
- '#foo {\n' +
- ' color: black;\n font-size: 12px;\n' +
- '}')
-
-
- #============================================================
- # Preserve Newlines and newline_between_rules
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.newline_between_rules = true
- t(
- '.div {}.span {}',
- # -- output --
- '.div {}\n' +
- '\n' +
- '.span {}')
- t(
- '#bla, #foo{\n' +
- ' color:black;\n' +
- ' font-size: 12px;\n' +
- '}',
- # -- output --
- '#bla,\n' +
- '#foo {\n' +
- ' color: black;\n' +
- ' font-size: 12px;\n' +
- '}')
- t(
- '#bla, #foo{\n' +
- ' color:black;\n' +
- '\n' +
- '\n' +
- ' font-size: 12px;\n' +
- '}',
- # -- output --
- '#bla,\n' +
- '#foo {\n' +
- ' color: black;\n' +
- '\n' +
- '\n' +
- ' font-size: 12px;\n' +
- '}')
- t(
- '#bla,\n' +
- '\n' +
- '#foo {\n' +
- ' color: black;\n' +
- ' font-size: 12px;\n' +
- '}')
- t(
- 'a {\n' +
- ' b: c;\n' +
- '\n' +
- '\n' +
- ' d: {\n' +
- ' e: f;\n' +
- ' }\n' +
- '}')
- t(
- '.div {}\n' +
- '\n' +
- '.span {}')
- t(
- 'html {}\n' +
- '\n' +
- '/*this is a comment*/')
- t(
- '.div {\n' +
- ' a: 1;\n' +
- '\n' +
- '\n' +
- ' b: 2;\n' +
- '}\n' +
- '\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- ' a: 1;\n' +
- '}')
- t(
- '.div {\n' +
- '\n' +
- '\n' +
- ' a: 1;\n' +
- '\n' +
- '\n' +
- ' b: 2;\n' +
- '}\n' +
- '\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- ' a: 1;\n' +
- '}')
- t(
- '@media screen {\n' +
- ' .div {\n' +
- ' a: 1;\n' +
- '\n' +
- '\n' +
- ' b: 2;\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '\n' +
- ' .span {\n' +
- ' a: 1;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {}\n' +
- '\n' +
- '.span {}')
-
-
- #============================================================
- # Preserve Newlines and add tabs
- self.reset_options()
- self.options.preserve_newlines = true
- t(
- '.tool-tip {\n' +
- ' position: relative;\n' +
- '\n' +
- ' \n' +
- ' .tool-tip-content {\n' +
- ' &>* {\n' +
- ' margin-top: 0;\n' +
- ' }\n' +
- ' \n' +
- '\n' +
- ' .mixin-box-shadow(.2rem .2rem .5rem rgba(0, 0, 0, .15));\n' +
- ' padding: 1rem;\n' +
- ' position: absolute;\n' +
- ' z-index: 10;\n' +
- ' }\n' +
- '}',
- # -- output --
- '.tool-tip {\n' +
- ' position: relative;\n' +
- '\n' +
- '\n' +
- ' .tool-tip-content {\n' +
- ' &>* {\n' +
- ' margin-top: 0;\n' +
- ' }\n' +
- '\n\n .mixin-box-shadow(.2rem .2rem .5rem rgba(0, 0, 0, .15));\n' +
- ' padding: 1rem;\n' +
- ' position: absolute;\n' +
- ' z-index: 10;\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # Issue #1338 -- Preserve Newlines within CSS rules
- self.reset_options()
- self.options.preserve_newlines = true
- t(
- 'body {\n' +
- ' grid-template-areas:\n' +
- ' "header header"\n' +
- ' "main sidebar"\n' +
- ' "footer footer";\n' +
- '}')
-
-
- #============================================================
- # Newline Between Rules - (newline_between_rules = "true")
- self.reset_options()
- self.options.newline_between_rules = true
- t(
- '.div {}\n' +
- '.span {}',
- # -- output --
- '.div {}\n' +
- '\n' +
- '.span {}')
- t(
- '.div{}\n' +
- ' \n' +
- '.span{}',
- # -- output --
- '.div {}\n' +
- '\n' +
- '.span {}')
- t(
- '.div {} \n' +
- ' \n' +
- '.span { } \n',
- # -- output --
- '.div {}\n' +
- '\n' +
- '.span {}')
- t(
- '.div {\n' +
- ' \n' +
- '} \n' +
- ' .span {\n' +
- ' } ',
- # -- output --
- '.div {}\n' +
- '\n' +
- '.span {}')
- t(
- '.selector1 {\n' +
- ' margin: 0; /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '.div{height:15px;}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;//another\n' +
- '}\n' +
- '.div{height:15px;}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div{height:15px;}',
- # -- output --
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div{height:15px;}',
- # -- output --
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- '\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue"\n' +
- ' }\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}',
- # -- output --
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- '\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue"\n' +
- ' }\n' +
- '\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}')
- t(
- 'a:first-child{color:red;div:first-child{color:black;}}\n' +
- '.div{height:15px;}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:first-child {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- 'a:first-child{color:red;div:not(.peq){color:black;}}\n' +
- '.div{height:15px;}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:not(.peq) {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.list-group {\n' +
- ' .list-group-item {\n' +
- ' }\n' +
- '\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.list-group-condensed {\n' +
- '}',
- # -- output --
- '.list-group {\n' +
- ' .list-group-item {}\n' +
- '\n' +
- ' .list-group-icon {}\n' +
- '}\n' +
- '\n' +
- '.list-group-condensed {}')
- t(
- '.list-group {\n' +
- ' .list-group-item {\n' +
- ' a:1\n' +
- ' }\n' +
- ' .list-group-item {\n' +
- ' a:1\n' +
- ' }\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- '}\n' +
- '.list-group-condensed {\n' +
- '}',
- # -- output --
- '.list-group {\n' +
- ' .list-group-item {\n' +
- ' a: 1\n' +
- ' }\n' +
- '\n' +
- ' .list-group-item {\n' +
- ' a: 1\n' +
- ' }\n' +
- '\n' +
- ' .list-group-icon {}\n' +
- '\n' +
- ' .list-group-icon {}\n' +
- '}\n' +
- '\n' +
- '.list-group-condensed {}')
- t(
- '.list-group {\n' +
- ' .list-group-item {\n' +
- ' a:1\n' +
- ' }\n' +
- ' //this is my pre-comment\n' +
- ' .list-group-item {\n' +
- ' a:1\n' +
- ' }\n' +
- ' //this is a comment\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- ' //this is also a comment\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- '}\n' +
- '.list-group-condensed {\n' +
- '}',
- # -- output --
- '.list-group {\n' +
- ' .list-group-item {\n' +
- ' a: 1\n' +
- ' }\n' +
- '\n' +
- ' //this is my pre-comment\n' +
- ' .list-group-item {\n' +
- ' a: 1\n' +
- ' }\n' +
- '\n' +
- ' //this is a comment\n' +
- ' .list-group-icon {}\n' +
- '\n' +
- ' //this is also a comment\n' +
- ' .list-group-icon {}\n' +
- '}\n' +
- '\n' +
- '.list-group-condensed {}')
- t(
- '.list-group {\n' +
- ' color: #38a0e5;\n' +
- ' .list-group-item {\n' +
- ' a:1\n' +
- ' }\n' +
- ' color: #38a0e5;\n' +
- ' .list-group-item {\n' +
- ' a:1\n' +
- ' }\n' +
- 'color: #38a0e5;\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- ' color: #38a0e5;\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- '}\n' +
- 'color: #38a0e5;\n' +
- '.list-group-condensed {\n' +
- '}',
- # -- output --
- '.list-group {\n' +
- ' color: #38a0e5;\n' +
- '\n' +
- ' .list-group-item {\n' +
- ' a: 1\n' +
- ' }\n' +
- '\n' +
- ' color: #38a0e5;\n' +
- '\n' +
- ' .list-group-item {\n' +
- ' a: 1\n' +
- ' }\n' +
- '\n' +
- ' color: #38a0e5;\n' +
- '\n' +
- ' .list-group-icon {}\n' +
- '\n' +
- ' color: #38a0e5;\n' +
- '\n' +
- ' .list-group-icon {}\n' +
- '}\n' +
- '\n' +
- 'color: #38a0e5;\n' +
- '\n' +
- '.list-group-condensed {}')
- t(
- '@media only screen and (max-width: 40em) {\n' +
- 'header {\n' +
- ' margin: 0 auto;\n' +
- ' padding: 10px;\n' +
- ' background: red;\n' +
- ' }\n' +
- 'main {\n' +
- ' margin: 20px auto;\n' +
- ' padding: 4px;\n' +
- ' background: blue;\n' +
- ' }\n' +
- '}',
- # -- output --
- '@media only screen and (max-width: 40em) {\n' +
- ' header {\n' +
- ' margin: 0 auto;\n' +
- ' padding: 10px;\n' +
- ' background: red;\n' +
- ' }\n' +
- '\n' +
- ' main {\n' +
- ' margin: 20px auto;\n' +
- ' padding: 4px;\n' +
- ' background: blue;\n' +
- ' }\n' +
- '}')
- t(
- '.preloader {\n' +
- ' height: 20px;\n' +
- ' .line {\n' +
- ' width: 1px;\n' +
- ' height: 12px;\n' +
- ' background: #38a0e5;\n' +
- ' margin: 0 1px;\n' +
- ' display: inline-block;\n' +
- ' &.line-1 {\n' +
- ' animation-delay: 800ms;\n' +
- ' }\n' +
- ' &.line-2 {\n' +
- ' animation-delay: 600ms;\n' +
- ' }\n' +
- ' }\n' +
- ' div {\n' +
- ' color: #38a0e5;\n' +
- ' font-family: "Arial", sans-serif;\n' +
- ' font-size: 10px;\n' +
- ' margin: 5px 0;\n' +
- ' }\n' +
- '}',
- # -- output --
- '.preloader {\n' +
- ' height: 20px;\n' +
- '\n' +
- ' .line {\n' +
- ' width: 1px;\n' +
- ' height: 12px;\n' +
- ' background: #38a0e5;\n' +
- ' margin: 0 1px;\n' +
- ' display: inline-block;\n' +
- '\n' +
- ' &.line-1 {\n' +
- ' animation-delay: 800ms;\n' +
- ' }\n' +
- '\n' +
- ' &.line-2 {\n' +
- ' animation-delay: 600ms;\n' +
- ' }\n' +
- ' }\n' +
- '\n' +
- ' div {\n' +
- ' color: #38a0e5;\n' +
- ' font-family: "Arial", sans-serif;\n' +
- ' font-size: 10px;\n' +
- ' margin: 5px 0;\n' +
- ' }\n' +
- '}')
-
- # Newline Between Rules - (newline_between_rules = "false")
- self.reset_options()
- self.options.newline_between_rules = false
- t(
- '.div {}\n' +
- '.span {}')
- t(
- '.div{}\n' +
- ' \n' +
- '.span{}',
- # -- output --
- '.div {}\n' +
- '.span {}')
- t(
- '.div {} \n' +
- ' \n' +
- '.span { } \n',
- # -- output --
- '.div {}\n' +
- '.span {}')
- t(
- '.div {\n' +
- ' \n' +
- '} \n' +
- ' .span {\n' +
- ' } ',
- # -- output --
- '.div {}\n' +
- '.span {}')
- t(
- '.selector1 {\n' +
- ' margin: 0; /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '.div{height:15px;}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;//another\n' +
- '}\n' +
- '.div{height:15px;}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div{height:15px;}',
- # -- output --
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div{height:15px;}',
- # -- output --
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue"\n' +
- ' }\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}')
- t(
- 'a:first-child{color:red;div:first-child{color:black;}}\n' +
- '.div{height:15px;}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- 'a:first-child{color:red;div:not(.peq){color:black;}}\n' +
- '.div{height:15px;}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- ' div:not(.peq) {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.list-group {\n' +
- ' .list-group-item {\n' +
- ' }\n' +
- '\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.list-group-condensed {\n' +
- '}',
- # -- output --
- '.list-group {\n' +
- ' .list-group-item {}\n' +
- ' .list-group-icon {}\n' +
- '}\n' +
- '.list-group-condensed {}')
- t(
- '.list-group {\n' +
- ' .list-group-item {\n' +
- ' a:1\n' +
- ' }\n' +
- ' .list-group-item {\n' +
- ' a:1\n' +
- ' }\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- '}\n' +
- '.list-group-condensed {\n' +
- '}',
- # -- output --
- '.list-group {\n' +
- ' .list-group-item {\n' +
- ' a: 1\n' +
- ' }\n' +
- ' .list-group-item {\n' +
- ' a: 1\n' +
- ' }\n' +
- ' .list-group-icon {}\n' +
- ' .list-group-icon {}\n' +
- '}\n' +
- '.list-group-condensed {}')
- t(
- '.list-group {\n' +
- ' .list-group-item {\n' +
- ' a:1\n' +
- ' }\n' +
- ' //this is my pre-comment\n' +
- ' .list-group-item {\n' +
- ' a:1\n' +
- ' }\n' +
- ' //this is a comment\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- ' //this is also a comment\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- '}\n' +
- '.list-group-condensed {\n' +
- '}',
- # -- output --
- '.list-group {\n' +
- ' .list-group-item {\n' +
- ' a: 1\n' +
- ' }\n' +
- ' //this is my pre-comment\n' +
- ' .list-group-item {\n' +
- ' a: 1\n' +
- ' }\n' +
- ' //this is a comment\n' +
- ' .list-group-icon {}\n' +
- ' //this is also a comment\n' +
- ' .list-group-icon {}\n' +
- '}\n' +
- '.list-group-condensed {}')
- t(
- '.list-group {\n' +
- ' color: #38a0e5;\n' +
- ' .list-group-item {\n' +
- ' a:1\n' +
- ' }\n' +
- ' color: #38a0e5;\n' +
- ' .list-group-item {\n' +
- ' a:1\n' +
- ' }\n' +
- 'color: #38a0e5;\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- ' color: #38a0e5;\n' +
- ' .list-group-icon {\n' +
- ' }\n' +
- '}\n' +
- 'color: #38a0e5;\n' +
- '.list-group-condensed {\n' +
- '}',
- # -- output --
- '.list-group {\n' +
- ' color: #38a0e5;\n' +
- ' .list-group-item {\n' +
- ' a: 1\n' +
- ' }\n' +
- ' color: #38a0e5;\n' +
- ' .list-group-item {\n' +
- ' a: 1\n' +
- ' }\n' +
- ' color: #38a0e5;\n' +
- ' .list-group-icon {}\n' +
- ' color: #38a0e5;\n' +
- ' .list-group-icon {}\n' +
- '}\n' +
- 'color: #38a0e5;\n' +
- '.list-group-condensed {}')
- t(
- '@media only screen and (max-width: 40em) {\n' +
- 'header {\n' +
- ' margin: 0 auto;\n' +
- ' padding: 10px;\n' +
- ' background: red;\n' +
- ' }\n' +
- 'main {\n' +
- ' margin: 20px auto;\n' +
- ' padding: 4px;\n' +
- ' background: blue;\n' +
- ' }\n' +
- '}',
- # -- output --
- '@media only screen and (max-width: 40em) {\n' +
- ' header {\n' +
- ' margin: 0 auto;\n' +
- ' padding: 10px;\n' +
- ' background: red;\n' +
- ' }\n' +
- ' main {\n' +
- ' margin: 20px auto;\n' +
- ' padding: 4px;\n' +
- ' background: blue;\n' +
- ' }\n' +
- '}')
- t(
- '.preloader {\n' +
- ' height: 20px;\n' +
- ' .line {\n' +
- ' width: 1px;\n' +
- ' height: 12px;\n' +
- ' background: #38a0e5;\n' +
- ' margin: 0 1px;\n' +
- ' display: inline-block;\n' +
- ' &.line-1 {\n' +
- ' animation-delay: 800ms;\n' +
- ' }\n' +
- ' &.line-2 {\n' +
- ' animation-delay: 600ms;\n' +
- ' }\n' +
- ' }\n' +
- ' div {\n' +
- ' color: #38a0e5;\n' +
- ' font-family: "Arial", sans-serif;\n' +
- ' font-size: 10px;\n' +
- ' margin: 5px 0;\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # Functions braces
- self.reset_options()
- t('.tabs(){}', '.tabs() {}')
- t('.tabs (){}', '.tabs () {}')
- t(
- '.tabs (pa, pa(1,2)), .cols { }',
- # -- output --
- '.tabs (pa, pa(1, 2)),\n' +
- '.cols {}')
- t(
- '.tabs(pa, pa(1,2)), .cols { }',
- # -- output --
- '.tabs(pa, pa(1, 2)),\n' +
- '.cols {}')
- t('.tabs ( ) { }', '.tabs () {}')
- t('.tabs( ) { }', '.tabs() {}')
- t(
- '.tabs (t, t2) \n' +
- '{\n' +
- ' key: val(p1 ,p2); \n' +
- ' }',
- # -- output --
- '.tabs (t, t2) {\n' +
- ' key: val(p1, p2);\n' +
- '}')
- t(
- '.box-shadow(@shadow: 0 1px 3px rgba(0, 0, 0, .25)) {\n' +
- ' -webkit-box-shadow: @shadow;\n' +
- ' -moz-box-shadow: @shadow;\n' +
- ' box-shadow: @shadow;\n' +
- '}')
-
-
- #============================================================
- # Beautify preserve formatting
- self.reset_options()
- self.options.indent_size = 4
- self.options.indent_char = ' '
- self.options.preserve_newlines = true
-
- # Directive: ignore
- t(
- '/* beautify ignore:start */\n' +
- '/* beautify ignore:end */')
- t(
- '/* beautify ignore:start */\n' +
- ' var a,,,{ 1;\n' +
- ' .div {}/* beautify ignore:end */')
- t(
- '.div {}\n' +
- '\n' +
- '/* beautify ignore:start */\n' +
- ' .div {}var a = 1;\n' +
- '/* beautify ignore:end */')
-
- # ignore starts _after_ the start comment, ends after the end comment
- t('/* beautify ignore:start */ {asdklgh;y;+++;dd2d}/* beautify ignore:end */')
- t('/* beautify ignore:start */ {asdklgh;y;+++;dd2d} /* beautify ignore:end */')
- t(
- '.div {}/* beautify ignore:start */\n' +
- ' .div {}var a,,,{ 1;\n' +
- '/*beautify ignore:end*/',
- # -- output --
- '.div {}\n' +
- '/* beautify ignore:start */\n' +
- ' .div {}var a,,,{ 1;\n' +
- '/*beautify ignore:end*/')
- t(
- '.div {}\n' +
- ' /* beautify ignore:start */\n' +
- ' .div {}var a,,,{ 1;\n' +
- '/* beautify ignore:end */',
- # -- output --
- '.div {}\n' +
- '/* beautify ignore:start */\n' +
- ' .div {}var a,,,{ 1;\n' +
- '/* beautify ignore:end */')
- t(
- '.div {\n' +
- ' /* beautify ignore:start */\n' +
- ' one : 1\n' +
- ' two : 2,\n' +
- ' three : {\n' +
- ' ten : 10\n' +
- ' /* beautify ignore:end */\n' +
- '}')
- t(
- '.div {\n' +
- '/* beautify ignore:start */\n' +
- ' one : 1\n' +
- ' two : 2,\n' +
- ' three : {\n' +
- ' ten : 10\n' +
- '/* beautify ignore:end */\n' +
- '}',
- # -- output --
- '.div {\n' +
- ' /* beautify ignore:start */\n' +
- ' one : 1\n' +
- ' two : 2,\n' +
- ' three : {\n' +
- ' ten : 10\n' +
- '/* beautify ignore:end */\n' +
- '}')
- t(
- '.div {\n' +
- '/* beautify ignore:start */\n' +
- ' one : 1\n' +
- ' /* beautify ignore:end */\n' +
- ' two : 2,\n' +
- '/* beautify ignore:start */\n' +
- ' three : {\n' +
- ' ten : 10\n' +
- '/* beautify ignore:end */\n' +
- '}',
- # -- output --
- '.div {\n' +
- ' /* beautify ignore:start */\n' +
- ' one : 1\n' +
- ' /* beautify ignore:end */\n' +
- ' two : 2,\n' +
- ' /* beautify ignore:start */\n' +
- ' three : {\n' +
- ' ten : 10\n' +
- '/* beautify ignore:end */\n' +
- '}')
-
-
- #============================================================
- # Comments - (preserve_newlines = "false", newline_between_rules = "false")
- self.reset_options()
- self.options.preserve_newlines = false
- self.options.newline_between_rules = false
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '.rule {}')
- t(
- '.tabs{/* test */}',
- # -- output --
- '.tabs {\n' +
- ' /* test */\n' +
- '}')
-
- # #1185
- t(
- '/* header */.tabs{}',
- # -- output --
- '/* header */\n' +
- '.tabs {}')
- t(
- '.tabs {/* non-header */width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' /* non-header */\n' +
- ' width: 10px;\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {margin: 0;/* This is a comment including an url http://domain.com/path/to/file.ext */}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{// comment\n' +
- 'width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{// comment\n' +
- 'width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '//comment\n' +
- '.tabs{width:10px;}',
- # -- output --
- '//comment\n' +
- '.tabs {\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{//comment\n' +
- '//2nd single line comment\n' +
- 'width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' //comment\n' +
- ' //2nd single line comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;//another nl\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another nl\n' +
- '}')
- t(
- '.tabs{width: 10px; // comment follows rule\n' +
- '// another comment new line\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #1165
- t(
- '.tabs{width: 10px;\n' +
- ' // comment follows rule\n' +
- '// another comment new line\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px;\n' +
- ' // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' *//* another comment */body{}',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '/* another comment */\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- '}.demob {text-align: right;}',
- # -- output --
- '.demoa1 {\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '}\n' +
- '.demob {\n' +
- ' text-align: right;\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {text-align:left;}//demob instructions for LESS note visibility only\n' +
- '.demob {text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- ' text-align: left;\n' +
- '}\n' +
- '//demob instructions for LESS note visibility only\n' +
- '.demob {\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- '.span {}',
- # -- output --
- '.div {}\n' +
- '.span {}')
- t(
- '/**//**///\n' +
- '/**/.div{}/**//**///\n' +
- '/**/.span {}',
- # -- output --
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.div {}\n' +
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.span {}')
- t(
- '//\n' +
- '.div{}//\n' +
- '.span {}',
- # -- output --
- '//\n' +
- '.div {}\n' +
- '//\n' +
- '.span {}')
- t(
- '.selector1 {margin: 0; /* This is a comment including an url http://domain.com/path/to/file.ext */}\n' +
- '.div{height:15px;}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;//another\n' +
- '}.div{height:15px;}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '#foo {background-image: url(foo@2x.png); @font-face { font-family: "Bitstream Vera Serif Bold"; src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf"); }}.div{height:15px;}',
- # -- output --
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@media screen { #foo:hover { background-image: url(foo@2x.png); } @font-face { font-family: "Bitstream Vera Serif Bold"; src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf"); }}.div{height:15px;}',
- # -- output --
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@font-face { font-family: "Bitstream Vera Serif Bold"; src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");}\n' +
- '@media screen { #foo:hover { background-image: url(foo.png); } @media screen and (min-device-pixel-ratio: 2) { @font-face { font-family: "Helvetica Neue"; } #foo:hover { background-image: url(foo@2x.png); } }}',
- # -- output --
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue";\n' +
- ' }\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}')
- t(
- 'a:first-child{color:red;div:first-child{color:black;}}.div{height:15px;}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- 'a:first-child{color:red;div:not(.peq){color:black;}}.div{height:15px;}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- ' div:not(.peq) {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
-
- # Comments - (preserve_newlines = "false", newline_between_rules = "false")
- self.reset_options()
- self.options.preserve_newlines = false
- self.options.newline_between_rules = false
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";\n' +
- '\n' +
- '\n' +
- '.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '.rule {}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '/* test */\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' /* test */\n' +
- '}')
-
- # #1185
- t(
- '/* header */\n' +
- '\n' +
- '\n' +
- '.tabs{}',
- # -- output --
- '/* header */\n' +
- '.tabs {}')
- t(
- '.tabs {\n' +
- '\n' +
- '\n' +
- '/* non-header */\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' /* non-header */\n' +
- ' width: 10px;\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {\n' +
- '\n' +
- '\n' +
- 'margin: 0;\n' +
- '\n' +
- '\n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '// comment\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '// comment\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '//comment\n' +
- '\n' +
- '\n' +
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '//comment\n' +
- '.tabs {\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '//comment\n' +
- '\n' +
- '\n' +
- '//2nd single line comment\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' //comment\n' +
- ' //2nd single line comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- 'height:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- 'height:10px;//another nl\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another nl\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width: 10px; // comment follows rule\n' +
- '\n' +
- '\n' +
- '// another comment new line\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #1165
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width: 10px;\n' +
- '\n' +
- '\n' +
- ' // comment follows rule\n' +
- '\n' +
- '\n' +
- '// another comment new line\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px;\n' +
- ' // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '\n' +
- '\n' +
- '/* another comment */\n' +
- '\n' +
- '\n' +
- 'body{}\n' +
- '\n' +
- '\n',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '/* another comment */\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {\n' +
- '\n' +
- '\n' +
- 'text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- 'text-align: right;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.demoa1 {\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '}\n' +
- '.demob {\n' +
- ' text-align: right;\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {\n' +
- '\n' +
- '\n' +
- 'text-align:left;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '//demob instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- 'text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- ' text-align: left;\n' +
- '}\n' +
- '//demob instructions for LESS note visibility only\n' +
- '.demob {\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.div {}\n' +
- '.span {}')
- t(
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.div{}\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.div {}\n' +
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.span {}')
- t(
- '//\n' +
- '\n' +
- '\n' +
- '.div{}\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '//\n' +
- '.div {}\n' +
- '//\n' +
- '.span {}')
- t(
- '.selector1 {\n' +
- '\n' +
- '\n' +
- 'margin: 0; \n' +
- '\n' +
- '\n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- 'height:10px;//another\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '#foo {\n' +
- '\n' +
- '\n' +
- 'background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Helvetica Neue";\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue";\n' +
- ' }\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}')
- t(
- 'a:first-child{\n' +
- '\n' +
- '\n' +
- 'color:red;\n' +
- '\n' +
- '\n' +
- 'div:first-child{\n' +
- '\n' +
- '\n' +
- 'color:black;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- 'a:first-child{\n' +
- '\n' +
- '\n' +
- 'color:red;\n' +
- '\n' +
- '\n' +
- 'div:not(.peq){\n' +
- '\n' +
- '\n' +
- 'color:black;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- ' div:not(.peq) {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
-
- # Comments - (preserve_newlines = "false", newline_between_rules = "false")
- self.reset_options()
- self.options.preserve_newlines = false
- self.options.newline_between_rules = false
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";\n' +
- ' \n' +
- ' \n' +
- '.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '.rule {}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '/* test */\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' /* test */\n' +
- '}')
-
- # #1185
- t(
- '/* header */\n' +
- ' \n' +
- ' \n' +
- '.tabs{}',
- # -- output --
- '/* header */\n' +
- '.tabs {}')
- t(
- '.tabs {\n' +
- ' \n' +
- ' \n' +
- '/* non-header */\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' /* non-header */\n' +
- ' width: 10px;\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {\n' +
- ' \n' +
- ' \n' +
- 'margin: 0;\n' +
- ' \n' +
- ' \n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '// comment\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '// comment\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '//comment\n' +
- ' \n' +
- ' \n' +
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '//comment\n' +
- '.tabs {\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '//comment\n' +
- ' \n' +
- ' \n' +
- '//2nd single line comment\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' //comment\n' +
- ' //2nd single line comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- 'height:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- 'height:10px;//another nl\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another nl\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width: 10px; // comment follows rule\n' +
- ' \n' +
- ' \n' +
- '// another comment new line\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #1165
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width: 10px;\n' +
- ' \n' +
- ' \n' +
- ' // comment follows rule\n' +
- ' \n' +
- ' \n' +
- '// another comment new line\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px;\n' +
- ' // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- ' \n' +
- ' \n' +
- '/* another comment */\n' +
- ' \n' +
- ' \n' +
- 'body{}\n' +
- ' \n' +
- ' \n',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '/* another comment */\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {\n' +
- ' \n' +
- ' \n' +
- 'text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.demob {\n' +
- ' \n' +
- ' \n' +
- 'text-align: right;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.demoa1 {\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '}\n' +
- '.demob {\n' +
- ' text-align: right;\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {\n' +
- ' \n' +
- ' \n' +
- 'text-align:left;\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '//demob instructions for LESS note visibility only\n' +
- ' \n' +
- ' \n' +
- '.demob {\n' +
- ' \n' +
- ' \n' +
- 'text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- ' text-align: left;\n' +
- '}\n' +
- '//demob instructions for LESS note visibility only\n' +
- '.demob {\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- ' \n' +
- ' \n' +
- '.span {\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.div {}\n' +
- '.span {}')
- t(
- '/**/\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '//\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '.div{}\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '//\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '.span {\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.div {}\n' +
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.span {}')
- t(
- '//\n' +
- ' \n' +
- ' \n' +
- '.div{}\n' +
- ' \n' +
- ' \n' +
- '//\n' +
- ' \n' +
- ' \n' +
- '.span {\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '//\n' +
- '.div {}\n' +
- '//\n' +
- '.span {}')
- t(
- '.selector1 {\n' +
- ' \n' +
- ' \n' +
- 'margin: 0; \n' +
- ' \n' +
- ' \n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- 'height:10px;//another\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '#foo {\n' +
- ' \n' +
- ' \n' +
- 'background-image: url(foo@2x.png);\n' +
- ' \n' +
- ' \n' +
- ' @font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' \n' +
- ' \n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@media screen {\n' +
- ' \n' +
- ' \n' +
- ' #foo:hover {\n' +
- ' \n' +
- ' \n' +
- ' background-image: url(foo@2x.png);\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' @font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' \n' +
- ' \n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' \n' +
- ' \n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '@media screen {\n' +
- ' \n' +
- ' \n' +
- ' #foo:hover {\n' +
- ' \n' +
- ' \n' +
- ' background-image: url(foo.png);\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' \n' +
- ' \n' +
- ' @font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Helvetica Neue";\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' #foo:hover {\n' +
- ' \n' +
- ' \n' +
- ' background-image: url(foo@2x.png);\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue";\n' +
- ' }\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}')
- t(
- 'a:first-child{\n' +
- ' \n' +
- ' \n' +
- 'color:red;\n' +
- ' \n' +
- ' \n' +
- 'div:first-child{\n' +
- ' \n' +
- ' \n' +
- 'color:black;\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- 'a:first-child{\n' +
- ' \n' +
- ' \n' +
- 'color:red;\n' +
- ' \n' +
- ' \n' +
- 'div:not(.peq){\n' +
- ' \n' +
- ' \n' +
- 'color:black;\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- ' div:not(.peq) {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
-
- # Comments - (preserve_newlines = "true", newline_between_rules = "false")
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.newline_between_rules = false
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '.rule {}')
- t(
- '.tabs{/* test */}',
- # -- output --
- '.tabs {\n' +
- ' /* test */\n' +
- '}')
-
- # #1185
- t(
- '/* header */.tabs{}',
- # -- output --
- '/* header */\n' +
- '.tabs {}')
- t(
- '.tabs {/* non-header */width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' /* non-header */\n' +
- ' width: 10px;\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {margin: 0;/* This is a comment including an url http://domain.com/path/to/file.ext */}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{// comment\n' +
- 'width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{// comment\n' +
- 'width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '//comment\n' +
- '.tabs{width:10px;}',
- # -- output --
- '//comment\n' +
- '.tabs {\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{//comment\n' +
- '//2nd single line comment\n' +
- 'width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' //comment\n' +
- ' //2nd single line comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;//another nl\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another nl\n' +
- '}')
- t(
- '.tabs{width: 10px; // comment follows rule\n' +
- '// another comment new line\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #1165
- t(
- '.tabs{width: 10px;\n' +
- ' // comment follows rule\n' +
- '// another comment new line\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px;\n' +
- ' // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' *//* another comment */body{}',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '/* another comment */\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- '}.demob {text-align: right;}',
- # -- output --
- '.demoa1 {\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '}\n' +
- '.demob {\n' +
- ' text-align: right;\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {text-align:left;}//demob instructions for LESS note visibility only\n' +
- '.demob {text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- ' text-align: left;\n' +
- '}\n' +
- '//demob instructions for LESS note visibility only\n' +
- '.demob {\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- '.span {}',
- # -- output --
- '.div {}\n' +
- '.span {}')
- t(
- '/**//**///\n' +
- '/**/.div{}/**//**///\n' +
- '/**/.span {}',
- # -- output --
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.div {}\n' +
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.span {}')
- t(
- '//\n' +
- '.div{}//\n' +
- '.span {}',
- # -- output --
- '//\n' +
- '.div {}\n' +
- '//\n' +
- '.span {}')
- t(
- '.selector1 {margin: 0; /* This is a comment including an url http://domain.com/path/to/file.ext */}\n' +
- '.div{height:15px;}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;//another\n' +
- '}.div{height:15px;}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '#foo {background-image: url(foo@2x.png); @font-face { font-family: "Bitstream Vera Serif Bold"; src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf"); }}.div{height:15px;}',
- # -- output --
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@media screen { #foo:hover { background-image: url(foo@2x.png); } @font-face { font-family: "Bitstream Vera Serif Bold"; src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf"); }}.div{height:15px;}',
- # -- output --
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@font-face { font-family: "Bitstream Vera Serif Bold"; src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");}\n' +
- '@media screen { #foo:hover { background-image: url(foo.png); } @media screen and (min-device-pixel-ratio: 2) { @font-face { font-family: "Helvetica Neue"; } #foo:hover { background-image: url(foo@2x.png); } }}',
- # -- output --
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue";\n' +
- ' }\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}')
- t(
- 'a:first-child{color:red;div:first-child{color:black;}}.div{height:15px;}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- 'a:first-child{color:red;div:not(.peq){color:black;}}.div{height:15px;}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- ' div:not(.peq) {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
-
- # Comments - (preserve_newlines = "true", newline_between_rules = "false")
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.newline_between_rules = false
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";\n' +
- '.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '.rule {}')
- t(
- '.tabs{\n' +
- '/* test */\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' /* test */\n' +
- '}')
-
- # #1185
- t(
- '/* header */\n' +
- '.tabs{}',
- # -- output --
- '/* header */\n' +
- '.tabs {}')
- t(
- '.tabs {\n' +
- '/* non-header */\n' +
- 'width:10px;\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' /* non-header */\n' +
- ' width: 10px;\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {\n' +
- 'margin: 0;\n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{\n' +
- '// comment\n' +
- 'width:10px;\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '// comment\n' +
- 'width:10px;\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '//comment\n' +
- '.tabs{\n' +
- 'width:10px;\n' +
- '}',
- # -- output --
- '//comment\n' +
- '.tabs {\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '//comment\n' +
- '//2nd single line comment\n' +
- 'width:10px;\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' //comment\n' +
- ' //2nd single line comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- 'width:10px;//end of line comment\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- '}')
- t(
- '.tabs{\n' +
- 'width:10px;//end of line comment\n' +
- 'height:10px;\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- 'width:10px;//end of line comment\n' +
- 'height:10px;//another nl\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another nl\n' +
- '}')
- t(
- '.tabs{\n' +
- 'width: 10px; // comment follows rule\n' +
- '// another comment new line\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #1165
- t(
- '.tabs{\n' +
- 'width: 10px;\n' +
- ' // comment follows rule\n' +
- '// another comment new line\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px;\n' +
- ' // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '/* another comment */\n' +
- 'body{}\n',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '/* another comment */\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {\n' +
- 'text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- '}\n' +
- '.demob {\n' +
- 'text-align: right;\n' +
- '}',
- # -- output --
- '.demoa1 {\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '}\n' +
- '.demob {\n' +
- ' text-align: right;\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {\n' +
- 'text-align:left;\n' +
- '}\n' +
- '//demob instructions for LESS note visibility only\n' +
- '.demob {\n' +
- 'text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- ' text-align: left;\n' +
- '}\n' +
- '//demob instructions for LESS note visibility only\n' +
- '.demob {\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- '.span {\n' +
- '}',
- # -- output --
- '.div {}\n' +
- '.span {}')
- t(
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.div{}\n' +
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.span {\n' +
- '}',
- # -- output --
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.div {}\n' +
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.span {}')
- t(
- '//\n' +
- '.div{}\n' +
- '//\n' +
- '.span {\n' +
- '}',
- # -- output --
- '//\n' +
- '.div {}\n' +
- '//\n' +
- '.span {}')
- t(
- '.selector1 {\n' +
- 'margin: 0; \n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '.div{\n' +
- 'height:15px;\n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.tabs{\n' +
- 'width:10px;//end of line comment\n' +
- 'height:10px;//another\n' +
- '}\n' +
- '.div{\n' +
- 'height:15px;\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '#foo {\n' +
- 'background-image: url(foo@2x.png);\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div{\n' +
- 'height:15px;\n' +
- '}',
- # -- output --
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div{\n' +
- 'height:15px;\n' +
- '}',
- # -- output --
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue";\n' +
- ' }\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}')
- t(
- 'a:first-child{\n' +
- 'color:red;\n' +
- 'div:first-child{\n' +
- 'color:black;\n' +
- '}\n' +
- '}\n' +
- '.div{\n' +
- 'height:15px;\n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- ' div:first-child {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- 'a:first-child{\n' +
- 'color:red;\n' +
- 'div:not(.peq){\n' +
- 'color:black;\n' +
- '}\n' +
- '}\n' +
- '.div{\n' +
- 'height:15px;\n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- ' div:not(.peq) {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
-
- # Comments - (preserve_newlines = "true", newline_between_rules = "false")
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.newline_between_rules = false
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";\n' +
- ' \n' +
- ' \n' +
- '.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '\n' +
- '\n' +
- '.rule {}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '/* test */\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' /* test */\n' +
- '\n' +
- '\n' +
- '}')
-
- # #1185
- t(
- '/* header */\n' +
- ' \n' +
- ' \n' +
- '.tabs{}',
- # -- output --
- '/* header */\n' +
- '\n' +
- '\n' +
- '.tabs {}')
- t(
- '.tabs {\n' +
- ' \n' +
- ' \n' +
- '/* non-header */\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' /* non-header */\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {\n' +
- ' \n' +
- ' \n' +
- 'margin: 0;\n' +
- ' \n' +
- ' \n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- '\n' +
- '\n' +
- ' margin: 0;\n' +
- '\n' +
- '\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '// comment\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' // comment\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '// comment\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' // comment\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '//comment\n' +
- ' \n' +
- ' \n' +
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '//comment\n' +
- '\n' +
- '\n' +
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '//comment\n' +
- ' \n' +
- ' \n' +
- '//2nd single line comment\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' //comment\n' +
- '\n' +
- '\n' +
- ' //2nd single line comment\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- 'height:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- ' height: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- 'height:10px;//another nl\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- ' height: 10px; //another nl\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width: 10px; // comment follows rule\n' +
- ' \n' +
- ' \n' +
- '// another comment new line\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; // comment follows rule\n' +
- '\n' +
- '\n' +
- ' // another comment new line\n' +
- '\n' +
- '\n' +
- '}')
-
- # #1165
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width: 10px;\n' +
- ' \n' +
- ' \n' +
- ' // comment follows rule\n' +
- ' \n' +
- ' \n' +
- '// another comment new line\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- ' // comment follows rule\n' +
- '\n' +
- '\n' +
- ' // another comment new line\n' +
- '\n' +
- '\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- ' \n' +
- ' \n' +
- '/* another comment */\n' +
- ' \n' +
- ' \n' +
- 'body{}\n' +
- ' \n' +
- ' \n',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '\n' +
- '\n' +
- '/* another comment */\n' +
- '\n' +
- '\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {\n' +
- ' \n' +
- ' \n' +
- 'text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.demob {\n' +
- ' \n' +
- ' \n' +
- 'text-align: right;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.demoa1 {\n' +
- '\n' +
- '\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- ' text-align: right;\n' +
- '\n' +
- '\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {\n' +
- ' \n' +
- ' \n' +
- 'text-align:left;\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '//demob instructions for LESS note visibility only\n' +
- ' \n' +
- ' \n' +
- '.demob {\n' +
- ' \n' +
- ' \n' +
- 'text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- '\n' +
- '\n' +
- ' text-align: left;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '//demob instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- ' \n' +
- ' \n' +
- '.span {\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.div {}\n' +
- '\n' +
- '\n' +
- '.span {}')
- t(
- '/**/\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '//\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '.div{}\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '//\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '.span {\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.div {}\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.span {}')
- t(
- '//\n' +
- ' \n' +
- ' \n' +
- '.div{}\n' +
- ' \n' +
- ' \n' +
- '//\n' +
- ' \n' +
- ' \n' +
- '.span {\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '//\n' +
- '\n' +
- '\n' +
- '.div {}\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '.span {}')
- t(
- '.selector1 {\n' +
- ' \n' +
- ' \n' +
- 'margin: 0; \n' +
- ' \n' +
- ' \n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- '\n' +
- '\n' +
- ' margin: 0;\n' +
- '\n' +
- '\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- 'height:10px;//another\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- ' height: 10px; //another\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '#foo {\n' +
- ' \n' +
- ' \n' +
- 'background-image: url(foo@2x.png);\n' +
- ' \n' +
- ' \n' +
- ' @font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' \n' +
- ' \n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '#foo {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '@media screen {\n' +
- ' \n' +
- ' \n' +
- ' #foo:hover {\n' +
- ' \n' +
- ' \n' +
- ' background-image: url(foo@2x.png);\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' @font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' \n' +
- ' \n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '@font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' \n' +
- ' \n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '@media screen {\n' +
- ' \n' +
- ' \n' +
- ' #foo:hover {\n' +
- ' \n' +
- ' \n' +
- ' background-image: url(foo.png);\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' \n' +
- ' \n' +
- ' @font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Helvetica Neue";\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' #foo:hover {\n' +
- ' \n' +
- ' \n' +
- ' background-image: url(foo@2x.png);\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '@font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Helvetica Neue";\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}')
- t(
- 'a:first-child{\n' +
- ' \n' +
- ' \n' +
- 'color:red;\n' +
- ' \n' +
- ' \n' +
- 'div:first-child{\n' +
- ' \n' +
- ' \n' +
- 'color:black;\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- '\n' +
- '\n' +
- ' color: red;\n' +
- '\n' +
- '\n' +
- ' div:first-child {\n' +
- '\n' +
- '\n' +
- ' color: black;\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- 'a:first-child{\n' +
- ' \n' +
- ' \n' +
- 'color:red;\n' +
- ' \n' +
- ' \n' +
- 'div:not(.peq){\n' +
- ' \n' +
- ' \n' +
- 'color:black;\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- '\n' +
- '\n' +
- ' color: red;\n' +
- '\n' +
- '\n' +
- ' div:not(.peq) {\n' +
- '\n' +
- '\n' +
- ' color: black;\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
-
- # Comments - (preserve_newlines = "true", newline_between_rules = "false")
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.newline_between_rules = false
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";\n' +
- '\n' +
- '\n' +
- '.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '\n' +
- '\n' +
- '.rule {}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '/* test */\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' /* test */\n' +
- '\n' +
- '\n' +
- '}')
-
- # #1185
- t(
- '/* header */\n' +
- '\n' +
- '\n' +
- '.tabs{}',
- # -- output --
- '/* header */\n' +
- '\n' +
- '\n' +
- '.tabs {}')
- t(
- '.tabs {\n' +
- '\n' +
- '\n' +
- '/* non-header */\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' /* non-header */\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {\n' +
- '\n' +
- '\n' +
- 'margin: 0;\n' +
- '\n' +
- '\n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- '\n' +
- '\n' +
- ' margin: 0;\n' +
- '\n' +
- '\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '// comment\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' // comment\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '// comment\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' // comment\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '//comment\n' +
- '\n' +
- '\n' +
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '//comment\n' +
- '\n' +
- '\n' +
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '//comment\n' +
- '\n' +
- '\n' +
- '//2nd single line comment\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' //comment\n' +
- '\n' +
- '\n' +
- ' //2nd single line comment\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- 'height:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- ' height: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- 'height:10px;//another nl\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- ' height: 10px; //another nl\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width: 10px; // comment follows rule\n' +
- '\n' +
- '\n' +
- '// another comment new line\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; // comment follows rule\n' +
- '\n' +
- '\n' +
- ' // another comment new line\n' +
- '\n' +
- '\n' +
- '}')
-
- # #1165
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width: 10px;\n' +
- '\n' +
- '\n' +
- ' // comment follows rule\n' +
- '\n' +
- '\n' +
- '// another comment new line\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- ' // comment follows rule\n' +
- '\n' +
- '\n' +
- ' // another comment new line\n' +
- '\n' +
- '\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '\n' +
- '\n' +
- '/* another comment */\n' +
- '\n' +
- '\n' +
- 'body{}\n' +
- '\n' +
- '\n',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '\n' +
- '\n' +
- '/* another comment */\n' +
- '\n' +
- '\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {\n' +
- '\n' +
- '\n' +
- 'text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- 'text-align: right;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.demoa1 {\n' +
- '\n' +
- '\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- ' text-align: right;\n' +
- '\n' +
- '\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {\n' +
- '\n' +
- '\n' +
- 'text-align:left;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '//demob instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- 'text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- '\n' +
- '\n' +
- ' text-align: left;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '//demob instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.div {}\n' +
- '\n' +
- '\n' +
- '.span {}')
- t(
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.div{}\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.div {}\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.span {}')
- t(
- '//\n' +
- '\n' +
- '\n' +
- '.div{}\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '//\n' +
- '\n' +
- '\n' +
- '.div {}\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '.span {}')
- t(
- '.selector1 {\n' +
- '\n' +
- '\n' +
- 'margin: 0; \n' +
- '\n' +
- '\n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- '\n' +
- '\n' +
- ' margin: 0;\n' +
- '\n' +
- '\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- 'height:10px;//another\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- ' height: 10px; //another\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '#foo {\n' +
- '\n' +
- '\n' +
- 'background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '#foo {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '@font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Helvetica Neue";\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}')
- t(
- 'a:first-child{\n' +
- '\n' +
- '\n' +
- 'color:red;\n' +
- '\n' +
- '\n' +
- 'div:first-child{\n' +
- '\n' +
- '\n' +
- 'color:black;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- '\n' +
- '\n' +
- ' color: red;\n' +
- '\n' +
- '\n' +
- ' div:first-child {\n' +
- '\n' +
- '\n' +
- ' color: black;\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- 'a:first-child{\n' +
- '\n' +
- '\n' +
- 'color:red;\n' +
- '\n' +
- '\n' +
- 'div:not(.peq){\n' +
- '\n' +
- '\n' +
- 'color:black;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- '\n' +
- '\n' +
- ' color: red;\n' +
- '\n' +
- '\n' +
- ' div:not(.peq) {\n' +
- '\n' +
- '\n' +
- ' color: black;\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
-
- # Comments - (preserve_newlines = "false", newline_between_rules = "true")
- self.reset_options()
- self.options.preserve_newlines = false
- self.options.newline_between_rules = true
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '\n' +
- '.rule {}')
- t(
- '.tabs{/* test */}',
- # -- output --
- '.tabs {\n' +
- ' /* test */\n' +
- '}')
-
- # #1185
- t(
- '/* header */.tabs{}',
- # -- output --
- '/* header */\n' +
- '.tabs {}')
- t(
- '.tabs {/* non-header */width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' /* non-header */\n' +
- ' width: 10px;\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {margin: 0;/* This is a comment including an url http://domain.com/path/to/file.ext */}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{// comment\n' +
- 'width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{// comment\n' +
- 'width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '//comment\n' +
- '.tabs{width:10px;}',
- # -- output --
- '//comment\n' +
- '.tabs {\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{//comment\n' +
- '//2nd single line comment\n' +
- 'width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' //comment\n' +
- ' //2nd single line comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;//another nl\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another nl\n' +
- '}')
- t(
- '.tabs{width: 10px; // comment follows rule\n' +
- '// another comment new line\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #1165
- t(
- '.tabs{width: 10px;\n' +
- ' // comment follows rule\n' +
- '// another comment new line\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px;\n' +
- ' // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' *//* another comment */body{}',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '/* another comment */\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- '}.demob {text-align: right;}',
- # -- output --
- '.demoa1 {\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '}\n' +
- '\n' +
- '.demob {\n' +
- ' text-align: right;\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {text-align:left;}//demob instructions for LESS note visibility only\n' +
- '.demob {text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- ' text-align: left;\n' +
- '}\n' +
- '\n' +
- '//demob instructions for LESS note visibility only\n' +
- '.demob {\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- '.span {}',
- # -- output --
- '.div {}\n' +
- '\n' +
- '.span {}')
- t(
- '/**//**///\n' +
- '/**/.div{}/**//**///\n' +
- '/**/.span {}',
- # -- output --
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.div {}\n' +
- '\n' +
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.span {}')
- t(
- '//\n' +
- '.div{}//\n' +
- '.span {}',
- # -- output --
- '//\n' +
- '.div {}\n' +
- '\n' +
- '//\n' +
- '.span {}')
- t(
- '.selector1 {margin: 0; /* This is a comment including an url http://domain.com/path/to/file.ext */}\n' +
- '.div{height:15px;}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;//another\n' +
- '}.div{height:15px;}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '#foo {background-image: url(foo@2x.png); @font-face { font-family: "Bitstream Vera Serif Bold"; src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf"); }}.div{height:15px;}',
- # -- output --
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@media screen { #foo:hover { background-image: url(foo@2x.png); } @font-face { font-family: "Bitstream Vera Serif Bold"; src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf"); }}.div{height:15px;}',
- # -- output --
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- '\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@font-face { font-family: "Bitstream Vera Serif Bold"; src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");}\n' +
- '@media screen { #foo:hover { background-image: url(foo.png); } @media screen and (min-device-pixel-ratio: 2) { @font-face { font-family: "Helvetica Neue"; } #foo:hover { background-image: url(foo@2x.png); } }}',
- # -- output --
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- '\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue";\n' +
- ' }\n' +
- '\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}')
- t(
- 'a:first-child{color:red;div:first-child{color:black;}}.div{height:15px;}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:first-child {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- 'a:first-child{color:red;div:not(.peq){color:black;}}.div{height:15px;}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:not(.peq) {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
-
- # Comments - (preserve_newlines = "false", newline_between_rules = "true")
- self.reset_options()
- self.options.preserve_newlines = false
- self.options.newline_between_rules = true
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";\n' +
- '\n' +
- '\n' +
- '.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '\n' +
- '.rule {}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '/* test */\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' /* test */\n' +
- '}')
-
- # #1185
- t(
- '/* header */\n' +
- '\n' +
- '\n' +
- '.tabs{}',
- # -- output --
- '/* header */\n' +
- '.tabs {}')
- t(
- '.tabs {\n' +
- '\n' +
- '\n' +
- '/* non-header */\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' /* non-header */\n' +
- ' width: 10px;\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {\n' +
- '\n' +
- '\n' +
- 'margin: 0;\n' +
- '\n' +
- '\n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '// comment\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '// comment\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '//comment\n' +
- '\n' +
- '\n' +
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '//comment\n' +
- '.tabs {\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '//comment\n' +
- '\n' +
- '\n' +
- '//2nd single line comment\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' //comment\n' +
- ' //2nd single line comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- 'height:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- 'height:10px;//another nl\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another nl\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width: 10px; // comment follows rule\n' +
- '\n' +
- '\n' +
- '// another comment new line\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #1165
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width: 10px;\n' +
- '\n' +
- '\n' +
- ' // comment follows rule\n' +
- '\n' +
- '\n' +
- '// another comment new line\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px;\n' +
- ' // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '\n' +
- '\n' +
- '/* another comment */\n' +
- '\n' +
- '\n' +
- 'body{}\n' +
- '\n' +
- '\n',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '/* another comment */\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {\n' +
- '\n' +
- '\n' +
- 'text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- 'text-align: right;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.demoa1 {\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '}\n' +
- '\n' +
- '.demob {\n' +
- ' text-align: right;\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {\n' +
- '\n' +
- '\n' +
- 'text-align:left;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '//demob instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- 'text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- ' text-align: left;\n' +
- '}\n' +
- '\n' +
- '//demob instructions for LESS note visibility only\n' +
- '.demob {\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.div {}\n' +
- '\n' +
- '.span {}')
- t(
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.div{}\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.div {}\n' +
- '\n' +
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.span {}')
- t(
- '//\n' +
- '\n' +
- '\n' +
- '.div{}\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '//\n' +
- '.div {}\n' +
- '\n' +
- '//\n' +
- '.span {}')
- t(
- '.selector1 {\n' +
- '\n' +
- '\n' +
- 'margin: 0; \n' +
- '\n' +
- '\n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- 'height:10px;//another\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '#foo {\n' +
- '\n' +
- '\n' +
- 'background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- '\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Helvetica Neue";\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- '\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue";\n' +
- ' }\n' +
- '\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}')
- t(
- 'a:first-child{\n' +
- '\n' +
- '\n' +
- 'color:red;\n' +
- '\n' +
- '\n' +
- 'div:first-child{\n' +
- '\n' +
- '\n' +
- 'color:black;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:first-child {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- 'a:first-child{\n' +
- '\n' +
- '\n' +
- 'color:red;\n' +
- '\n' +
- '\n' +
- 'div:not(.peq){\n' +
- '\n' +
- '\n' +
- 'color:black;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:not(.peq) {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
-
- # Comments - (preserve_newlines = "false", newline_between_rules = "true")
- self.reset_options()
- self.options.preserve_newlines = false
- self.options.newline_between_rules = true
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";\n' +
- ' \n' +
- ' \n' +
- '.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '\n' +
- '.rule {}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '/* test */\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' /* test */\n' +
- '}')
-
- # #1185
- t(
- '/* header */\n' +
- ' \n' +
- ' \n' +
- '.tabs{}',
- # -- output --
- '/* header */\n' +
- '.tabs {}')
- t(
- '.tabs {\n' +
- ' \n' +
- ' \n' +
- '/* non-header */\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' /* non-header */\n' +
- ' width: 10px;\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {\n' +
- ' \n' +
- ' \n' +
- 'margin: 0;\n' +
- ' \n' +
- ' \n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '// comment\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '// comment\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '//comment\n' +
- ' \n' +
- ' \n' +
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '//comment\n' +
- '.tabs {\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '//comment\n' +
- ' \n' +
- ' \n' +
- '//2nd single line comment\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' //comment\n' +
- ' //2nd single line comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- 'height:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- 'height:10px;//another nl\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another nl\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width: 10px; // comment follows rule\n' +
- ' \n' +
- ' \n' +
- '// another comment new line\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #1165
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width: 10px;\n' +
- ' \n' +
- ' \n' +
- ' // comment follows rule\n' +
- ' \n' +
- ' \n' +
- '// another comment new line\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px;\n' +
- ' // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- ' \n' +
- ' \n' +
- '/* another comment */\n' +
- ' \n' +
- ' \n' +
- 'body{}\n' +
- ' \n' +
- ' \n',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '/* another comment */\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {\n' +
- ' \n' +
- ' \n' +
- 'text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.demob {\n' +
- ' \n' +
- ' \n' +
- 'text-align: right;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.demoa1 {\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '}\n' +
- '\n' +
- '.demob {\n' +
- ' text-align: right;\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {\n' +
- ' \n' +
- ' \n' +
- 'text-align:left;\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '//demob instructions for LESS note visibility only\n' +
- ' \n' +
- ' \n' +
- '.demob {\n' +
- ' \n' +
- ' \n' +
- 'text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- ' text-align: left;\n' +
- '}\n' +
- '\n' +
- '//demob instructions for LESS note visibility only\n' +
- '.demob {\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- ' \n' +
- ' \n' +
- '.span {\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.div {}\n' +
- '\n' +
- '.span {}')
- t(
- '/**/\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '//\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '.div{}\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '//\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '.span {\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.div {}\n' +
- '\n' +
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.span {}')
- t(
- '//\n' +
- ' \n' +
- ' \n' +
- '.div{}\n' +
- ' \n' +
- ' \n' +
- '//\n' +
- ' \n' +
- ' \n' +
- '.span {\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '//\n' +
- '.div {}\n' +
- '\n' +
- '//\n' +
- '.span {}')
- t(
- '.selector1 {\n' +
- ' \n' +
- ' \n' +
- 'margin: 0; \n' +
- ' \n' +
- ' \n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- 'height:10px;//another\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '#foo {\n' +
- ' \n' +
- ' \n' +
- 'background-image: url(foo@2x.png);\n' +
- ' \n' +
- ' \n' +
- ' @font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' \n' +
- ' \n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@media screen {\n' +
- ' \n' +
- ' \n' +
- ' #foo:hover {\n' +
- ' \n' +
- ' \n' +
- ' background-image: url(foo@2x.png);\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' @font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' \n' +
- ' \n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- '\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' \n' +
- ' \n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '@media screen {\n' +
- ' \n' +
- ' \n' +
- ' #foo:hover {\n' +
- ' \n' +
- ' \n' +
- ' background-image: url(foo.png);\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' \n' +
- ' \n' +
- ' @font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Helvetica Neue";\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' #foo:hover {\n' +
- ' \n' +
- ' \n' +
- ' background-image: url(foo@2x.png);\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- '\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue";\n' +
- ' }\n' +
- '\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}')
- t(
- 'a:first-child{\n' +
- ' \n' +
- ' \n' +
- 'color:red;\n' +
- ' \n' +
- ' \n' +
- 'div:first-child{\n' +
- ' \n' +
- ' \n' +
- 'color:black;\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:first-child {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- 'a:first-child{\n' +
- ' \n' +
- ' \n' +
- 'color:red;\n' +
- ' \n' +
- ' \n' +
- 'div:not(.peq){\n' +
- ' \n' +
- ' \n' +
- 'color:black;\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:not(.peq) {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
-
- # Comments - (preserve_newlines = "true", newline_between_rules = "true")
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.newline_between_rules = true
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '\n' +
- '.rule {}')
- t(
- '.tabs{/* test */}',
- # -- output --
- '.tabs {\n' +
- ' /* test */\n' +
- '}')
-
- # #1185
- t(
- '/* header */.tabs{}',
- # -- output --
- '/* header */\n' +
- '.tabs {}')
- t(
- '.tabs {/* non-header */width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' /* non-header */\n' +
- ' width: 10px;\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {margin: 0;/* This is a comment including an url http://domain.com/path/to/file.ext */}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{// comment\n' +
- 'width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{// comment\n' +
- 'width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '//comment\n' +
- '.tabs{width:10px;}',
- # -- output --
- '//comment\n' +
- '.tabs {\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{//comment\n' +
- '//2nd single line comment\n' +
- 'width:10px;}',
- # -- output --
- '.tabs {\n' +
- ' //comment\n' +
- ' //2nd single line comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;//another nl\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another nl\n' +
- '}')
- t(
- '.tabs{width: 10px; // comment follows rule\n' +
- '// another comment new line\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #1165
- t(
- '.tabs{width: 10px;\n' +
- ' // comment follows rule\n' +
- '// another comment new line\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px;\n' +
- ' // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' *//* another comment */body{}',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '/* another comment */\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- '}.demob {text-align: right;}',
- # -- output --
- '.demoa1 {\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '}\n' +
- '\n' +
- '.demob {\n' +
- ' text-align: right;\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {text-align:left;}//demob instructions for LESS note visibility only\n' +
- '.demob {text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- ' text-align: left;\n' +
- '}\n' +
- '\n' +
- '//demob instructions for LESS note visibility only\n' +
- '.demob {\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- '.span {}',
- # -- output --
- '.div {}\n' +
- '\n' +
- '.span {}')
- t(
- '/**//**///\n' +
- '/**/.div{}/**//**///\n' +
- '/**/.span {}',
- # -- output --
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.div {}\n' +
- '\n' +
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.span {}')
- t(
- '//\n' +
- '.div{}//\n' +
- '.span {}',
- # -- output --
- '//\n' +
- '.div {}\n' +
- '\n' +
- '//\n' +
- '.span {}')
- t(
- '.selector1 {margin: 0; /* This is a comment including an url http://domain.com/path/to/file.ext */}\n' +
- '.div{height:15px;}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.tabs{width:10px;//end of line comment\n' +
- 'height:10px;//another\n' +
- '}.div{height:15px;}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '#foo {background-image: url(foo@2x.png); @font-face { font-family: "Bitstream Vera Serif Bold"; src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf"); }}.div{height:15px;}',
- # -- output --
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@media screen { #foo:hover { background-image: url(foo@2x.png); } @font-face { font-family: "Bitstream Vera Serif Bold"; src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf"); }}.div{height:15px;}',
- # -- output --
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- '\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@font-face { font-family: "Bitstream Vera Serif Bold"; src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");}\n' +
- '@media screen { #foo:hover { background-image: url(foo.png); } @media screen and (min-device-pixel-ratio: 2) { @font-face { font-family: "Helvetica Neue"; } #foo:hover { background-image: url(foo@2x.png); } }}',
- # -- output --
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- '\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue";\n' +
- ' }\n' +
- '\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}')
- t(
- 'a:first-child{color:red;div:first-child{color:black;}}.div{height:15px;}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:first-child {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- 'a:first-child{color:red;div:not(.peq){color:black;}}.div{height:15px;}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:not(.peq) {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
-
- # Comments - (preserve_newlines = "true", newline_between_rules = "true")
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.newline_between_rules = true
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";\n' +
- '.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '\n' +
- '.rule {}')
- t(
- '.tabs{\n' +
- '/* test */\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' /* test */\n' +
- '}')
-
- # #1185
- t(
- '/* header */\n' +
- '.tabs{}',
- # -- output --
- '/* header */\n' +
- '.tabs {}')
- t(
- '.tabs {\n' +
- '/* non-header */\n' +
- 'width:10px;\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' /* non-header */\n' +
- ' width: 10px;\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {\n' +
- 'margin: 0;\n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{\n' +
- '// comment\n' +
- 'width:10px;\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '// comment\n' +
- 'width:10px;\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' // comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '//comment\n' +
- '.tabs{\n' +
- 'width:10px;\n' +
- '}',
- # -- output --
- '//comment\n' +
- '.tabs {\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- '//comment\n' +
- '//2nd single line comment\n' +
- 'width:10px;\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' //comment\n' +
- ' //2nd single line comment\n' +
- ' width: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- 'width:10px;//end of line comment\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- '}')
- t(
- '.tabs{\n' +
- 'width:10px;//end of line comment\n' +
- 'height:10px;\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px;\n' +
- '}')
- t(
- '.tabs{\n' +
- 'width:10px;//end of line comment\n' +
- 'height:10px;//another nl\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another nl\n' +
- '}')
- t(
- '.tabs{\n' +
- 'width: 10px; // comment follows rule\n' +
- '// another comment new line\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #1165
- t(
- '.tabs{\n' +
- 'width: 10px;\n' +
- ' // comment follows rule\n' +
- '// another comment new line\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px;\n' +
- ' // comment follows rule\n' +
- ' // another comment new line\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '/* another comment */\n' +
- 'body{}\n',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '/* another comment */\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {\n' +
- 'text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- '}\n' +
- '.demob {\n' +
- 'text-align: right;\n' +
- '}',
- # -- output --
- '.demoa1 {\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '}\n' +
- '\n' +
- '.demob {\n' +
- ' text-align: right;\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {\n' +
- 'text-align:left;\n' +
- '}\n' +
- '//demob instructions for LESS note visibility only\n' +
- '.demob {\n' +
- 'text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- ' text-align: left;\n' +
- '}\n' +
- '\n' +
- '//demob instructions for LESS note visibility only\n' +
- '.demob {\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- '.span {\n' +
- '}',
- # -- output --
- '.div {}\n' +
- '\n' +
- '.span {}')
- t(
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.div{}\n' +
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.span {\n' +
- '}',
- # -- output --
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.div {}\n' +
- '\n' +
- '/**/\n' +
- '/**/\n' +
- '//\n' +
- '/**/\n' +
- '.span {}')
- t(
- '//\n' +
- '.div{}\n' +
- '//\n' +
- '.span {\n' +
- '}',
- # -- output --
- '//\n' +
- '.div {}\n' +
- '\n' +
- '//\n' +
- '.span {}')
- t(
- '.selector1 {\n' +
- 'margin: 0; \n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '.div{\n' +
- 'height:15px;\n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- ' margin: 0;\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '.tabs{\n' +
- 'width:10px;//end of line comment\n' +
- 'height:10px;//another\n' +
- '}\n' +
- '.div{\n' +
- 'height:15px;\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- ' width: 10px; //end of line comment\n' +
- ' height: 10px; //another\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '#foo {\n' +
- 'background-image: url(foo@2x.png);\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div{\n' +
- 'height:15px;\n' +
- '}',
- # -- output --
- '#foo {\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '.div{\n' +
- 'height:15px;\n' +
- '}',
- # -- output --
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- '\n' +
- ' @font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue";\n' +
- ' }\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}',
- # -- output --
- '@font-face {\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '}\n' +
- '\n' +
- '@media screen {\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo.png);\n' +
- ' }\n' +
- '\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' @font-face {\n' +
- ' font-family: "Helvetica Neue";\n' +
- ' }\n' +
- '\n' +
- ' #foo:hover {\n' +
- ' background-image: url(foo@2x.png);\n' +
- ' }\n' +
- ' }\n' +
- '}')
- t(
- 'a:first-child{\n' +
- 'color:red;\n' +
- 'div:first-child{\n' +
- 'color:black;\n' +
- '}\n' +
- '}\n' +
- '.div{\n' +
- 'height:15px;\n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:first-child {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
- t(
- 'a:first-child{\n' +
- 'color:red;\n' +
- 'div:not(.peq){\n' +
- 'color:black;\n' +
- '}\n' +
- '}\n' +
- '.div{\n' +
- 'height:15px;\n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- ' color: red;\n' +
- '\n' +
- ' div:not(.peq) {\n' +
- ' color: black;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.div {\n' +
- ' height: 15px;\n' +
- '}')
-
- # Comments - (preserve_newlines = "true", newline_between_rules = "true")
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.newline_between_rules = true
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";\n' +
- '\n' +
- '\n' +
- '.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '\n' +
- '\n' +
- '.rule {}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '/* test */\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' /* test */\n' +
- '\n' +
- '\n' +
- '}')
-
- # #1185
- t(
- '/* header */\n' +
- '\n' +
- '\n' +
- '.tabs{}',
- # -- output --
- '/* header */\n' +
- '\n' +
- '\n' +
- '.tabs {}')
- t(
- '.tabs {\n' +
- '\n' +
- '\n' +
- '/* non-header */\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' /* non-header */\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {\n' +
- '\n' +
- '\n' +
- 'margin: 0;\n' +
- '\n' +
- '\n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- '\n' +
- '\n' +
- ' margin: 0;\n' +
- '\n' +
- '\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '// comment\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' // comment\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '// comment\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' // comment\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '//comment\n' +
- '\n' +
- '\n' +
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '//comment\n' +
- '\n' +
- '\n' +
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- '//comment\n' +
- '\n' +
- '\n' +
- '//2nd single line comment\n' +
- '\n' +
- '\n' +
- 'width:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' //comment\n' +
- '\n' +
- '\n' +
- ' //2nd single line comment\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- 'height:10px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- ' height: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- 'height:10px;//another nl\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- ' height: 10px; //another nl\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width: 10px; // comment follows rule\n' +
- '\n' +
- '\n' +
- '// another comment new line\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; // comment follows rule\n' +
- '\n' +
- '\n' +
- ' // another comment new line\n' +
- '\n' +
- '\n' +
- '}')
-
- # #1165
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width: 10px;\n' +
- '\n' +
- '\n' +
- ' // comment follows rule\n' +
- '\n' +
- '\n' +
- '// another comment new line\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- ' // comment follows rule\n' +
- '\n' +
- '\n' +
- ' // another comment new line\n' +
- '\n' +
- '\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '\n' +
- '\n' +
- '/* another comment */\n' +
- '\n' +
- '\n' +
- 'body{}\n' +
- '\n' +
- '\n',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '\n' +
- '\n' +
- '/* another comment */\n' +
- '\n' +
- '\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {\n' +
- '\n' +
- '\n' +
- 'text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- 'text-align: right;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.demoa1 {\n' +
- '\n' +
- '\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- ' text-align: right;\n' +
- '\n' +
- '\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {\n' +
- '\n' +
- '\n' +
- 'text-align:left;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '//demob instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- 'text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- '\n' +
- '\n' +
- ' text-align: left;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '//demob instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.div {}\n' +
- '\n' +
- '\n' +
- '.span {}')
- t(
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.div{}\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.div {}\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.span {}')
- t(
- '//\n' +
- '\n' +
- '\n' +
- '.div{}\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '.span {\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '//\n' +
- '\n' +
- '\n' +
- '.div {}\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '.span {}')
- t(
- '.selector1 {\n' +
- '\n' +
- '\n' +
- 'margin: 0; \n' +
- '\n' +
- '\n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- '\n' +
- '\n' +
- ' margin: 0;\n' +
- '\n' +
- '\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- '\n' +
- '\n' +
- 'width:10px;//end of line comment\n' +
- '\n' +
- '\n' +
- 'height:10px;//another\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- ' height: 10px; //another\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '#foo {\n' +
- '\n' +
- '\n' +
- 'background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '#foo {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '@font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Helvetica Neue";\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}')
- t(
- 'a:first-child{\n' +
- '\n' +
- '\n' +
- 'color:red;\n' +
- '\n' +
- '\n' +
- 'div:first-child{\n' +
- '\n' +
- '\n' +
- 'color:black;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- '\n' +
- '\n' +
- ' color: red;\n' +
- '\n' +
- '\n' +
- ' div:first-child {\n' +
- '\n' +
- '\n' +
- ' color: black;\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- 'a:first-child{\n' +
- '\n' +
- '\n' +
- 'color:red;\n' +
- '\n' +
- '\n' +
- 'div:not(.peq){\n' +
- '\n' +
- '\n' +
- 'color:black;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div{\n' +
- '\n' +
- '\n' +
- 'height:15px;\n' +
- '\n' +
- '\n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- '\n' +
- '\n' +
- ' color: red;\n' +
- '\n' +
- '\n' +
- ' div:not(.peq) {\n' +
- '\n' +
- '\n' +
- ' color: black;\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
-
- # Comments - (preserve_newlines = "true", newline_between_rules = "true")
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.newline_between_rules = true
- t('/* header comment newlines on */')
- t(
- '@import "custom.css";\n' +
- ' \n' +
- ' \n' +
- '.rule{}',
- # -- output --
- '@import "custom.css";\n' +
- '\n' +
- '\n' +
- '.rule {}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '/* test */\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' /* test */\n' +
- '\n' +
- '\n' +
- '}')
-
- # #1185
- t(
- '/* header */\n' +
- ' \n' +
- ' \n' +
- '.tabs{}',
- # -- output --
- '/* header */\n' +
- '\n' +
- '\n' +
- '.tabs {}')
- t(
- '.tabs {\n' +
- ' \n' +
- ' \n' +
- '/* non-header */\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' /* non-header */\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t('/* header')
- t('// comment')
- t('/*')
- t('//')
- t(
- '.selector1 {\n' +
- ' \n' +
- ' \n' +
- 'margin: 0;\n' +
- ' \n' +
- ' \n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- '\n' +
- '\n' +
- ' margin: 0;\n' +
- '\n' +
- '\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}')
-
- # single line comment support (less/sass)
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '// comment\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' // comment\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '// comment\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' // comment\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '//comment\n' +
- ' \n' +
- ' \n' +
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '//comment\n' +
- '\n' +
- '\n' +
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- '//comment\n' +
- ' \n' +
- ' \n' +
- '//2nd single line comment\n' +
- ' \n' +
- ' \n' +
- 'width:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' //comment\n' +
- '\n' +
- '\n' +
- ' //2nd single line comment\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- 'height:10px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- ' height: 10px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- 'height:10px;//another nl\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- ' height: 10px; //another nl\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width: 10px; // comment follows rule\n' +
- ' \n' +
- ' \n' +
- '// another comment new line\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; // comment follows rule\n' +
- '\n' +
- '\n' +
- ' // another comment new line\n' +
- '\n' +
- '\n' +
- '}')
-
- # #1165
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width: 10px;\n' +
- ' \n' +
- ' \n' +
- ' // comment follows rule\n' +
- ' \n' +
- ' \n' +
- '// another comment new line\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px;\n' +
- '\n' +
- '\n' +
- ' // comment follows rule\n' +
- '\n' +
- '\n' +
- ' // another comment new line\n' +
- '\n' +
- '\n' +
- '}')
-
- # #736
- t(
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- ' \n' +
- ' \n' +
- '/* another comment */\n' +
- ' \n' +
- ' \n' +
- 'body{}\n' +
- ' \n' +
- ' \n',
- # -- output --
- '/*\n' +
- ' * comment\n' +
- ' */\n' +
- '\n' +
- '\n' +
- '/* another comment */\n' +
- '\n' +
- '\n' +
- 'body {}')
-
- # #1348
- t(
- '.demoa1 {\n' +
- ' \n' +
- ' \n' +
- 'text-align:left; //demoa1 instructions for LESS note visibility only\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.demob {\n' +
- ' \n' +
- ' \n' +
- 'text-align: right;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.demoa1 {\n' +
- '\n' +
- '\n' +
- ' text-align: left; //demoa1 instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- ' text-align: right;\n' +
- '\n' +
- '\n' +
- '}')
-
- # #1440
- t(
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}',
- # -- output --
- '#search-text {\n' +
- ' width: 43%;\n' +
- ' // height: 100%;\n' +
- ' border: none;\n' +
- '}')
- t(
- '.demoa2 {\n' +
- ' \n' +
- ' \n' +
- 'text-align:left;\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '//demob instructions for LESS note visibility only\n' +
- ' \n' +
- ' \n' +
- '.demob {\n' +
- ' \n' +
- ' \n' +
- 'text-align: right}',
- # -- output --
- '.demoa2 {\n' +
- '\n' +
- '\n' +
- ' text-align: left;\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '//demob instructions for LESS note visibility only\n' +
- '\n' +
- '\n' +
- '.demob {\n' +
- '\n' +
- '\n' +
- ' text-align: right\n' +
- '}')
-
- # new lines between rules - #531 and #857
- t(
- '.div{}\n' +
- ' \n' +
- ' \n' +
- '.span {\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.div {}\n' +
- '\n' +
- '\n' +
- '.span {}')
- t(
- '/**/\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '//\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '.div{}\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '//\n' +
- ' \n' +
- ' \n' +
- '/**/\n' +
- ' \n' +
- ' \n' +
- '.span {\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.div {}\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '/**/\n' +
- '\n' +
- '\n' +
- '.span {}')
- t(
- '//\n' +
- ' \n' +
- ' \n' +
- '.div{}\n' +
- ' \n' +
- ' \n' +
- '//\n' +
- ' \n' +
- ' \n' +
- '.span {\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '//\n' +
- '\n' +
- '\n' +
- '.div {}\n' +
- '\n' +
- '\n' +
- '//\n' +
- '\n' +
- '\n' +
- '.span {}')
- t(
- '.selector1 {\n' +
- ' \n' +
- ' \n' +
- 'margin: 0; \n' +
- ' \n' +
- ' \n' +
- '/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.selector1 {\n' +
- '\n' +
- '\n' +
- ' margin: 0;\n' +
- '\n' +
- '\n' +
- ' /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '.tabs{\n' +
- ' \n' +
- ' \n' +
- 'width:10px;//end of line comment\n' +
- ' \n' +
- ' \n' +
- 'height:10px;//another\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '.tabs {\n' +
- '\n' +
- '\n' +
- ' width: 10px; //end of line comment\n' +
- '\n' +
- '\n' +
- ' height: 10px; //another\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '#foo {\n' +
- ' \n' +
- ' \n' +
- 'background-image: url(foo@2x.png);\n' +
- ' \n' +
- ' \n' +
- ' @font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' \n' +
- ' \n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '#foo {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '@media screen {\n' +
- ' \n' +
- ' \n' +
- ' #foo:hover {\n' +
- ' \n' +
- ' \n' +
- ' background-image: url(foo@2x.png);\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' @font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' \n' +
- ' \n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- '@font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- ' \n' +
- ' \n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '@media screen {\n' +
- ' \n' +
- ' \n' +
- ' #foo:hover {\n' +
- ' \n' +
- ' \n' +
- ' background-image: url(foo.png);\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- ' \n' +
- ' \n' +
- ' @font-face {\n' +
- ' \n' +
- ' \n' +
- ' font-family: "Helvetica Neue";\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' #foo:hover {\n' +
- ' \n' +
- ' \n' +
- ' background-image: url(foo@2x.png);\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- '@font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Bitstream Vera Serif Bold";\n' +
- '\n' +
- '\n' +
- ' src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '@media screen {\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' @media screen and (min-device-pixel-ratio: 2) {\n' +
- '\n' +
- '\n' +
- ' @font-face {\n' +
- '\n' +
- '\n' +
- ' font-family: "Helvetica Neue";\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' #foo:hover {\n' +
- '\n' +
- '\n' +
- ' background-image: url(foo@2x.png);\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}')
- t(
- 'a:first-child{\n' +
- ' \n' +
- ' \n' +
- 'color:red;\n' +
- ' \n' +
- ' \n' +
- 'div:first-child{\n' +
- ' \n' +
- ' \n' +
- 'color:black;\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- '\n' +
- '\n' +
- ' color: red;\n' +
- '\n' +
- '\n' +
- ' div:first-child {\n' +
- '\n' +
- '\n' +
- ' color: black;\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
- t(
- 'a:first-child{\n' +
- ' \n' +
- ' \n' +
- 'color:red;\n' +
- ' \n' +
- ' \n' +
- 'div:not(.peq){\n' +
- ' \n' +
- ' \n' +
- 'color:black;\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '}\n' +
- ' \n' +
- ' \n' +
- '.div{\n' +
- ' \n' +
- ' \n' +
- 'height:15px;\n' +
- ' \n' +
- ' \n' +
- '}',
- # -- output --
- 'a:first-child {\n' +
- '\n' +
- '\n' +
- ' color: red;\n' +
- '\n' +
- '\n' +
- ' div:not(.peq) {\n' +
- '\n' +
- '\n' +
- ' color: black;\n' +
- '\n' +
- '\n' +
- ' }\n' +
- '\n' +
- '\n' +
- '}\n' +
- '\n' +
- '\n' +
- '.div {\n' +
- '\n' +
- '\n' +
- ' height: 15px;\n' +
- '\n' +
- '\n' +
- '}')
-
-
- #============================================================
- # Handle LESS property name interpolation
- self.reset_options()
- t(
- 'tag {\n' +
- ' @{prop}: none;\n' +
- '}')
- t(
- 'tag{@{prop}:none;}',
- # -- output --
- 'tag {\n' +
- ' @{prop}: none;\n' +
- '}')
- t(
- 'tag{ @{prop}: none;}',
- # -- output --
- 'tag {\n' +
- ' @{prop}: none;\n' +
- '}')
-
- # can also be part of property name
- t(
- 'tag {\n' +
- ' dynamic-@{prop}: none;\n' +
- '}')
- t(
- 'tag{dynamic-@{prop}:none;}',
- # -- output --
- 'tag {\n' +
- ' dynamic-@{prop}: none;\n' +
- '}')
- t(
- 'tag{ dynamic-@{prop}: none;}',
- # -- output --
- 'tag {\n' +
- ' dynamic-@{prop}: none;\n' +
- '}')
-
-
- #============================================================
- # Handle LESS property name interpolation, test #631
- self.reset_options()
- t(
- '.generate-columns(@n, @i: 1) when (@i =< @n) {\n' +
- ' .column-@{i} {\n' +
- ' width: (@i * 100% / @n);\n' +
- ' }\n' +
- ' .generate-columns(@n, (@i + 1));\n' +
- '}')
- t(
- '.generate-columns(@n,@i:1) when (@i =< @n){.column-@{i}{width:(@i * 100% / @n);}.generate-columns(@n,(@i + 1));}',
- # -- output --
- '.generate-columns(@n, @i: 1) when (@i =< @n) {\n' +
- ' .column-@{i} {\n' +
- ' width: (@i * 100% / @n);\n' +
- ' }\n' +
- ' .generate-columns(@n, (@i + 1));\n' +
- '}')
-
-
- #============================================================
- # Handle LESS function parameters
- self.reset_options()
- t(
- 'div{.px2rem(width,12);}',
- # -- output --
- 'div {\n' +
- ' .px2rem(width, 12);\n' +
- '}')
- t(
- 'div {\n' +
- ' background: url("//test.com/dummy.png");\n' +
- ' .px2rem(width, 12);\n' +
- '}')
-
-
- #============================================================
- # Psuedo-classes vs Variables
- self.reset_options()
- t('@page :first {}')
-
- # Assume the colon goes with the @name. If we're in LESS, this is required regardless of the at-string.
- t('@page:first {}', '@page: first {}')
- t('@page: first {}')
-
-
- #============================================================
- # Issue 1411 -- LESS Variable Assignment Spacing
- self.reset_options()
- t(
- '@set: {\n' +
- ' one: blue;\n' +
- ' two: green;\n' +
- ' three: red;\n' +
- '}\n' +
- '.set {\n' +
- ' each(@set, {\n' +
- ' @{key}-@{index}: @value;\n' +
- ' }\n' +
- ' );\n' +
- '}')
- t('@light-blue: @nice-blue + #111;')
-
-
- #============================================================
- # SASS/SCSS
- self.reset_options()
-
- # Basic Interpolation
- t(
- 'p {\n' +
- ' $font-size: 12px;\n' +
- ' $line-height: 30px;\n' +
- ' font: #{$font-size}/#{$line-height};\n' +
- '}')
- t('p.#{$name} {}')
- t(
- '@mixin itemPropertiesCoverItem($items, $margin) {\n' +
- ' width: calc((100% - ((#{$items} - 1) * #{$margin}rem)) / #{$items});\n' +
- ' margin: 1.6rem #{$margin}rem 1.6rem 0;\n' +
- '}')
-
- # Multiple filed issues in LESS due to not(:blah)
- t('&:first-of-type:not(:last-child) {}')
- t(
- 'div {\n' +
- ' &:not(:first-of-type) {\n' +
- ' background: red;\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # Proper handling of colon in selectors
- self.reset_options()
- self.options.selector_separator_newline = false
- t('a :b {}')
- t('a ::b {}')
- t('a:b {}')
- t('a::b {}')
- t(
- 'a {}, a::b {}, a ::b {}, a:b {}, a :b {}',
- # -- output --
- 'a {}\n' +
- ', a::b {}\n' +
- ', a ::b {}\n' +
- ', a:b {}\n' +
- ', a :b {}')
- t(
- '.card-blue ::-webkit-input-placeholder {\n' +
- ' color: #87D1FF;\n' +
- '}')
- t(
- 'div [attr] :not(.class) {\n' +
- ' color: red;\n' +
- '}')
-
- # Issue #1233
- t(
- '.one {\n' +
- ' color: #FFF;\n' +
- ' // pseudo-element\n' +
- ' span:not(*::selection) {\n' +
- ' margin-top: 0;\n' +
- ' }\n' +
- '}\n' +
- '.two {\n' +
- ' color: #000;\n' +
- ' // pseudo-class\n' +
- ' span:not(*:active) {\n' +
- ' margin-top: 0;\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # Regresssion Tests
- self.reset_options()
- self.options.selector_separator_newline = false
- t(
- '@media(min-width:768px) {\n' +
- ' .selector::after {\n' +
- ' /* property: value */\n' +
- ' }\n' +
- ' .other-selector {\n' +
- ' /* property: value */\n' +
- ' }\n' +
- '}')
- t(
- '.fa-rotate-270 {\n' +
- ' filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);\n' +
- '}')
-
-
- #============================================================
- # Issue #645, #1233
- self.reset_options()
- self.options.selector_separator_newline = true
- self.options.preserve_newlines = true
- self.options.newline_between_rules = true
- t(
- '/* Comment above first rule */\n' +
- '\n' +
- 'body {\n' +
- ' display: none;\n' +
- '}\n' +
- '\n' +
- '/* Comment between rules */\n' +
- '\n' +
- 'ul,\n' +
- '\n' +
- '/* Comment between selectors */\n' +
- '\n' +
- 'li {\n' +
- ' display: none;\n' +
- '}\n' +
- '\n' +
- '/* Comment after last rule */')
- t(
- '.one {\n' +
- ' color: #FFF;\n' +
- ' // pseudo-element\n' +
- ' span:not(*::selection) {\n' +
- ' margin-top: 0;\n' +
- ' }\n' +
- '}\n' +
- '.two {\n' +
- ' color: #000;\n' +
- ' // pseudo-class\n' +
- ' span:not(*:active) {\n' +
- ' margin-top: 0;\n' +
- ' }\n' +
- '}',
- # -- output --
- '.one {\n' +
- ' color: #FFF;\n' +
- '\n' +
- ' // pseudo-element\n' +
- ' span:not(*::selection) {\n' +
- ' margin-top: 0;\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- '.two {\n' +
- ' color: #000;\n' +
- '\n' +
- ' // pseudo-class\n' +
- ' span:not(*:active) {\n' +
- ' margin-top: 0;\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # Extend Tests
- self.reset_options()
- t(
- '.btn-group-radios {\n' +
- ' .btn:hover {\n' +
- ' &:hover,\n' +
- ' &:focus {\n' +
- ' @extend .btn-blue:hover;\n' +
- ' }\n' +
- ' }\n' +
- '}')
- t(
- '.item-warning {\n' +
- ' @extend btn-warning:hover;\n' +
- '}\n' +
- '.item-warning-wrong {\n' +
- ' @extend btn-warning: hover;\n' +
- '}')
-
-
- #============================================================
- # Import Tests
- self.reset_options()
- t(
- '@import "custom.css";.rule{}\n' +
- 'a, p {}',
- # -- output --
- '@import "custom.css";\n' +
- '.rule {}\n' +
- 'a,\n' +
- 'p {}')
- t(
- '@import url("bluish.css") projection,tv;.rule{}\n' +
- 'a, p {}',
- # -- output --
- '@import url("bluish.css") projection, tv;\n' +
- '.rule {}\n' +
- 'a,\n' +
- 'p {}')
-
-
- #============================================================
- # Important
- self.reset_options()
- t(
- 'a {\n' +
- ' color: blue !important;\n' +
- '}',
- # -- output --
- 'a {\n' +
- ' color: blue !important;\n' +
- '}')
- t(
- 'a {\n' +
- ' color: blue!important;\n' +
- '}',
- # -- output --
- 'a {\n' +
- ' color: blue !important;\n' +
- '}')
- t(
- 'a {\n' +
- ' color: blue !important;\n' +
- '}')
- t(
- '.blue\\! {\n' +
- ' color: blue !important;\n' +
- '}')
-
-
- #============================================================
- # Escape
- self.reset_options()
- t(
- 'a:not(.color\\:blue) {\n' +
- ' color: blue !important;\n' +
- '}')
- t(
- '.blue\\:very {\n' +
- ' color: blue !important;\n' +
- '}')
- test_fragment('a:not(.color\\')
- test_fragment('a:not\\')
-
-
- #============================================================
- # indent_empty_lines true
- self.reset_options()
- self.options.indent_empty_lines = true
- self.options.preserve_newlines = true
- test_fragment(
- 'a {\n' +
- '\n' +
- 'width: auto;\n' +
- '\n' +
- 'height: auto;\n' +
- '\n' +
- '}',
- # -- output --
- 'a {\n' +
- ' \n' +
- ' width: auto;\n' +
- ' \n' +
- ' height: auto;\n' +
- ' \n' +
- '}')
-
-
- #============================================================
- # indent_empty_lines false
- self.reset_options()
- self.options.indent_empty_lines = false
- self.options.preserve_newlines = true
- test_fragment(
- 'a {\n' +
- '\n' +
- ' width: auto;\n' +
- '\n' +
- ' height: auto;\n' +
- '\n' +
- '}')
-
-
- #============================================================
- # LESS mixins
- self.reset_options()
- t(
- '.btn {\n' +
- ' .generate-animation(@mykeyframes, 1.4s, .5s, 1, ease-out);\n' +
- '}\n' +
- '.mymixin(@color: #ccc; @border-width: 1px) {\n' +
- ' border: @border-width solid @color;\n' +
- '}\n' +
- 'strong {\n' +
- ' &:extend(a:hover);\n' +
- '}')
-
- # Ensure simple closing parens do not break behavior
- t(
- 'strong {\n' +
- ' &:extend(a:hover));\n' +
- '}\n' +
- '.btn {\n' +
- ' .generate-animation(@mykeyframes, 1.4s, .5s, 1, ease-out);\n' +
- '}\n' +
- '.mymixin(@color: #ccc; @border-width: 1px) {\n' +
- ' border: @border-width solid @color;\n' +
- '}\n' +
- 'strong {\n' +
- ' &:extend(a:hover);\n' +
- '}')
-
- # indent multi-line parens
- t(
- '.btn {\n' +
- ' .generate-animation(@mykeyframes, 1.4s,\n' +
- ' .5s, 1, ease-out);\n' +
- '}\n' +
- '.mymixin(@color: #ccc;\n' +
- ' @border-width: 1px) {\n' +
- ' border: @border-width solid @color;\n' +
- '}')
-
- # format inside mixin parens
- t(
- '.btn {\n' +
- ' .generate-animation(@mykeyframes,1.4s,.5s,1,ease-out);\n' +
- '}\n' +
- '.mymixin(@color:#ccc;@border-width:1px) {\n' +
- ' border:@border-width solid @color;\n' +
- '}',
- # -- output --
- '.btn {\n' +
- ' .generate-animation(@mykeyframes, 1.4s, .5s, 1, ease-out);\n' +
- '}\n' +
- '.mymixin(@color: #ccc; @border-width: 1px) {\n' +
- ' border: @border-width solid @color;\n' +
- '}')
-
-
- #============================================================
- #
- self.reset_options()
-
-
-
- def testNewline(self):
- self.reset_options()
- t = self.decodesto
-
- self.options.end_with_newline = True
- t("", "\n")
- t("\n", "\n")
- t(".tabs{}\n", ".tabs {}\n")
- t(".tabs{}", ".tabs {}\n")
-
- def testBasics(self):
- self.reset_options()
- t = self.decodesto
-
- self.reset_options()
- #============================================================
- t(None, "")
-
- self.reset_options()
- #============================================================
- # Test user pebkac protection, converts dash names to underscored names
- setattr(self.options, 'end-with-newline', True)
- t(None, '\n')
-
- self.reset_options()
- #============================================================
-
- t("", "")
- t("\n", "")
- t(".tabs{}\n", ".tabs {}")
- t(".tabs{}", ".tabs {}")
- t(".tabs{color:red}", ".tabs {\n color: red\n}")
- t(".tabs{color:rgb(255, 255, 0)}", ".tabs {\n color: rgb(255, 255, 0)\n}")
- t(".tabs{background:url('back.jpg')}", ".tabs {\n background: url('back.jpg')\n}")
- t("#bla, #foo{color:red}", "#bla,\n#foo {\n color: red\n}")
- t("@media print {.tab{}}", "@media print {\n .tab {}\n}")
- t("@media print {.tab{background-image:url(foo@2x.png)}}", "@media print {\n .tab {\n background-image: url(foo@2x.png)\n }\n}")
-
- t("a:before {\n" +
- " content: 'a{color:black;}\"\"\\'\\'\"\\n\\n\\na{color:black}\';\n" +
- "}")
-
- # may not eat the space before "["
- t('html.js [data-custom="123"] {\n opacity: 1.00;\n}')
- t('html.js *[data-custom="123"] {\n opacity: 1.00;\n}')
-
- # lead-in whitespace determines base-indent.
- # lead-in newlines are stripped.
- t("\n\na, img {padding: 0.2px}", "a,\nimg {\n padding: 0.2px\n}")
- t(" a, img {padding: 0.2px}", " a,\n img {\n padding: 0.2px\n }")
- t(" \na, img {padding: 0.2px}", " a,\n img {\n padding: 0.2px\n }")
- t("\n\n a, img {padding: 0.2px}", "a,\nimg {\n padding: 0.2px\n}")
-
- def testSeperateSelectors(self):
- self.reset_options()
- t = self.decodesto
-
- t("#bla, #foo{color:red}", "#bla,\n#foo {\n color: red\n}")
- t("a, img {padding: 0.2px}", "a,\nimg {\n padding: 0.2px\n}")
-
-
- def testBlockNesting(self):
- self.reset_options()
- t = self.decodesto
-
- t("#foo {\n background-image: url(foo@2x.png);\n @font-face {\n font-family: 'Bitstream Vera Serif Bold';\n src: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');\n }\n}")
- t("@media screen {\n #foo:hover {\n background-image: url(foo@2x.png);\n }\n @font-face {\n font-family: 'Bitstream Vera Serif Bold';\n src: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');\n }\n}")
-
-# @font-face {
-# font-family: 'Bitstream Vera Serif Bold';
-# src: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');
-# }
-# @media screen {
-# #foo:hover {
-# background-image: url(foo.png);
-# }
-# @media screen and (min-device-pixel-ratio: 2) {
-# @font-face {
-# font-family: 'Helvetica Neue'
-# }
-# #foo:hover {
-# background-image: url(foo@2x.png);
-# }
-# }
-# }
- t("@font-face {\n font-family: 'Bitstream Vera Serif Bold';\n src: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');\n}\n@media screen {\n #foo:hover {\n background-image: url(foo.png);\n }\n @media screen and (min-device-pixel-ratio: 2) {\n @font-face {\n font-family: 'Helvetica Neue'\n }\n #foo:hover {\n background-image: url(foo@2x.png);\n }\n }\n}")
-
-
- def testOptions(self):
- self.reset_options()
- self.options.indent_size = 2
- self.options.indent_char = ' '
- self.options.selector_separator_newline = False
- t = self.decodesto
-
- # pseudo-classes and pseudo-elements
- t("#foo:hover {\n background-image: url(foo@2x.png)\n}")
- t("#foo *:hover {\n color: purple\n}")
- t("::selection {\n color: #ff0000;\n}")
-
- # TODO: don't break nested pseduo-classes
- t("@media screen {.tab,.bat:hover {color:red}}", "@media screen {\n .tab, .bat:hover {\n color: red\n }\n}")
-
- # particular edge case with braces and semicolons inside tags that allows custom text
- t( "a:not(\"foobar\\\";{}omg\"){\ncontent: 'example\\';{} text';\ncontent: \"example\\\";{} text\";}",
- "a:not(\"foobar\\\";{}omg\") {\n content: 'example\\';{} text';\n content: \"example\\\";{} text\";\n}")
-
- def testLessCss(self):
- self.reset_options()
- t = self.decodesto
-
- t('.well{ \n @well-bg:@bg-color;@well-fg:@fg-color;}','.well {\n @well-bg: @bg-color;\n @well-fg: @fg-color;\n}')
- t('.well {&.active {\nbox-shadow: 0 1px 1px @border-color, 1px 0 1px @border-color;}}',
- '.well {\n' +
- ' &.active {\n' +
- ' box-shadow: 0 1px 1px @border-color, 1px 0 1px @border-color;\n' +
- ' }\n' +
- '}')
- t('a {\n' +
- ' color: blue;\n' +
- ' &:hover {\n' +
- ' color: green;\n' +
- ' }\n' +
- ' & & &&&.active {\n' +
- ' color: green;\n' +
- ' }\n' +
- '}')
-
- # Not sure if this is sensible
- # but I believe it is correct to not remove the space in "&: hover".
- t('a {\n' +
- ' &: hover {\n' +
- ' color: green;\n' +
- ' }\n' +
- '}')
-
- # import
- t('@import "test";')
-
- # don't break nested pseudo-classes
- t("a:first-child{color:red;div:first-child{color:black;}}",
- "a:first-child {\n color: red;\n div:first-child {\n color: black;\n }\n}")
-
- # handle SASS/LESS parent reference
- t("div{&:first-letter {text-transform: uppercase;}}",
- "div {\n &:first-letter {\n text-transform: uppercase;\n }\n}")
-
- # nested modifiers (&:hover etc)
- t(".tabs{&:hover{width:10px;}}", ".tabs {\n &:hover {\n width: 10px;\n }\n}")
- t(".tabs{&.big{width:10px;}}", ".tabs {\n &.big {\n width: 10px;\n }\n}")
- t(".tabs{&>big{width:10px;}}", ".tabs {\n &>big {\n width: 10px;\n }\n}")
- t(".tabs{&+.big{width:10px;}}", ".tabs {\n &+.big {\n width: 10px;\n }\n}")
-
- # nested rules
- t(".tabs{.child{width:10px;}}", ".tabs {\n .child {\n width: 10px;\n }\n}")
-
- # variables
- t("@myvar:10px;.tabs{width:10px;}", "@myvar: 10px;\n.tabs {\n width: 10px;\n}")
- t("@myvar:10px; .tabs{width:10px;}", "@myvar: 10px;\n.tabs {\n width: 10px;\n}")
-
- def decodesto(self, input, expectation=None):
- if expectation == None:
- expectation = input
-
- self.assertMultiLineEqual(
- cssbeautifier.beautify(input, self.options), expectation)
-
- # if the expected is different from input, run it again
- # expected output should be unchanged when run twice.
- if not expectation != input:
- self.assertMultiLineEqual(
- cssbeautifier.beautify(expectation, self.options), expectation)
-
- # Everywhere we do newlines, they should be replaced with opts.eol
- self.options.eol = '\r\\n'
- expectation = expectation.replace('\n', '\r\n')
- self.options.disabled = True
- self.assertMultiLineEqual(
- cssbeautifier.beautify(input, self.options), input or '')
- self.assertMultiLineEqual(
- cssbeautifier.beautify('\n\n' + expectation, self.options), '\n\n' + expectation)
- self.options.disabled = False;
- self.assertMultiLineEqual(
- cssbeautifier.beautify(input, self.options), expectation)
- if input and input.find('\n') != -1:
- input = input.replace('\n', '\r\n')
- self.assertMultiLineEqual(
- cssbeautifier.beautify(input, self.options), expectation)
- # Ensure support for auto eol detection
- self.options.eol = 'auto'
- self.assertMultiLineEqual(
- cssbeautifier.beautify(input, self.options), expectation)
- self.options.eol = '\n'
-
-if __name__ == '__main__':
- unittest.main()
diff -Nru node-js-beautify-1.11.0+dfsg/python/cssbeautifier/tests/__init__.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/tests/__init__.py
--- node-js-beautify-1.11.0+dfsg/python/cssbeautifier/tests/__init__.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/cssbeautifier/tests/__init__.py 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-# Empty file :)
diff -Nru node-js-beautify-1.11.0+dfsg/python/css-beautify node-js-beautify-1.13.6+dfsg+~0.15.3/python/css-beautify
--- node-js-beautify-1.11.0+dfsg/python/css-beautify 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/css-beautify 1970-01-01 00:00:00.000000000 +0000
@@ -1,7 +0,0 @@
-#! /usr/bin/env python
-#
-# Stub script to run cssbeautifier
-#
-import sys
-from cssbeautifier import main
-sys.exit(main())
diff -Nru node-js-beautify-1.11.0+dfsg/python/debian/changelog node-js-beautify-1.13.6+dfsg+~0.15.3/python/debian/changelog
--- node-js-beautify-1.11.0+dfsg/python/debian/changelog 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/debian/changelog 1970-01-01 00:00:00.000000000 +0000
@@ -1,5 +0,0 @@
-jsbeautifier (1.5.10-1) smurf; urgency=low
-
- * source package automatically created by stdeb 0.8.2
-
- -- Matthias Urlichs Sun, 13 Dec 2015 17:36:34 +0100
diff -Nru node-js-beautify-1.11.0+dfsg/python/debian/compat node-js-beautify-1.13.6+dfsg+~0.15.3/python/debian/compat
--- node-js-beautify-1.11.0+dfsg/python/debian/compat 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/debian/compat 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-9
diff -Nru node-js-beautify-1.11.0+dfsg/python/debian/control node-js-beautify-1.13.6+dfsg+~0.15.3/python/debian/control
--- node-js-beautify-1.11.0+dfsg/python/debian/control 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/debian/control 1970-01-01 00:00:00.000000000 +0000
@@ -1,13 +0,0 @@
-Source: jsbeautifier
-Maintainer: Matthias Urlichs
-Section: python
-Priority: optional
-Build-Depends: python3-all, debhelper (>= 9)
-Standards-Version: 3.9.1
-
-Package: python3-jsbeautifier
-Architecture: all
-Depends: ${misc:Depends}, ${python3:Depends}
-Description: JavaScript unobfuscator and beautifier.
- Beautify, unpack or deobfuscate JavaScript. Handles popular online obfuscators.
-
diff -Nru node-js-beautify-1.11.0+dfsg/python/debian/.gitignore node-js-beautify-1.13.6+dfsg+~0.15.3/python/debian/.gitignore
--- node-js-beautify-1.11.0+dfsg/python/debian/.gitignore 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/debian/.gitignore 1970-01-01 00:00:00.000000000 +0000
@@ -1,5 +0,0 @@
-/files
-/*.log
-/*.debhelper
-/*.substvars
-/python3-jsbeautifier
diff -Nru node-js-beautify-1.11.0+dfsg/python/debian/rules node-js-beautify-1.13.6+dfsg+~0.15.3/python/debian/rules
--- node-js-beautify-1.11.0+dfsg/python/debian/rules 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/debian/rules 1970-01-01 00:00:00.000000000 +0000
@@ -1,8 +0,0 @@
-#!/usr/bin/make -f
-
-# This file was automatically generated by stdeb 0.8.2 at
-# Sun, 13 Dec 2015 17:36:34 +0100
-export PYBUILD_NAME=jsbeautifier
-%:
- dh $@ --with python3 --buildsystem=pybuild
-
diff -Nru node-js-beautify-1.11.0+dfsg/python/debian/source/format node-js-beautify-1.13.6+dfsg+~0.15.3/python/debian/source/format
--- node-js-beautify-1.11.0+dfsg/python/debian/source/format 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/debian/source/format 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-3.0 (quilt)
diff -Nru node-js-beautify-1.11.0+dfsg/python/__init__.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/__init__.py
--- node-js-beautify-1.11.0+dfsg/python/__init__.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/__init__.py 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-# Empty file :)
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/directives.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/directives.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/directives.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/directives.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,53 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-import re
-
-
-class Directives:
-
- def __init__(self, start_block_pattern, end_block_pattern):
-
- self.__directives_block_pattern = re.compile(start_block_pattern + r' beautify( \w+[:]\w+)+ ' + end_block_pattern)
- self.__directive_pattern = re.compile(r' (\w+)[:](\w+)')
-
- self.__directives_end_ignore_pattern = re.compile(start_block_pattern + r'\sbeautify\signore:end\s' + end_block_pattern)
-
- def get_directives(self, text):
- if not self.__directives_block_pattern.match(text):
- return None
-
- directives = {}
- directive_match = self.__directive_pattern.search(text)
-
- while directive_match:
- directives[directive_match.group(1)] = directive_match.group(2)
- directive_match = self.__directive_pattern.search(
- text, directive_match.end())
-
-
- return directives
-
- def readIgnored(self, input):
- return input.readUntilAfter(self.__directives_end_ignore_pattern)
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/__init__.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/__init__.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/__init__.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/__init__.py 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-# Empty file :)
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/inputscanner.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/inputscanner.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/inputscanner.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/inputscanner.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,136 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-import re
-
-
-class InputScanner:
- def __init__(self, input_string):
- self.__six = __import__("six")
- if input_string is None:
- input_string = ''
- self.__input = input_string
- self.__input_length = len(self.__input)
- self.__position = 0
-
- def restart(self):
- self.__position = 0
-
- def back(self):
- if self.__position > 0:
- self.__position -= 1
-
- def hasNext(self):
- return self.__position < self.__input_length
-
- def next(self):
- val = None
- if self.hasNext():
- val = self.__input[self.__position]
- self.__position += 1
-
- return val
-
- def peek(self, index=0):
- val = None
- index += self.__position
- if index >= 0 and index < self.__input_length:
- val = self.__input[index]
-
- return val
-
- def test(self, pattern, index=0):
- index += self.__position
- return index >= 0 and index < self.__input_length and bool(
- pattern.match(self.__input, index))
-
- def testChar(self, pattern, index=0):
- # test one character regex match
- val = self.peek(index)
- return val is not None and bool(pattern.match(val))
-
- def match(self, pattern):
- pattern_match = None
- if self.hasNext():
- pattern_match = pattern.match(self.__input, self.__position)
- if bool(pattern_match):
- self.__position = pattern_match.end(0)
- return pattern_match
-
- def read(self, starting_pattern, until_pattern=None, until_after=False):
- val = ''
- pattern_match = None
- if bool(starting_pattern):
- pattern_match = self.match(starting_pattern)
- if bool(pattern_match):
- val = pattern_match.group(0)
-
- if bool(until_pattern) and \
- (bool(pattern_match) or not bool(starting_pattern)):
- val += self.readUntil(until_pattern, until_after)
-
- return val
-
- def readUntil(self, pattern, include_match=False):
- val = ''
- pattern_match = None
- match_index = self.__position
- if self.hasNext():
- pattern_match = pattern.search(self.__input, self.__position)
- if bool(pattern_match):
- if include_match:
- match_index = pattern_match.end(0)
- else:
- match_index = pattern_match.start(0)
- else:
- match_index = self.__input_length
-
- val = self.__input[self.__position:match_index]
- self.__position = match_index
-
- return val
-
- def readUntilAfter(self, pattern):
- return self.readUntil(pattern, True)
-
- def get_regexp(self, pattern, match_from=False):
- result = None
- # strings are converted to regexp
- if isinstance(pattern, self.__six.string_types) and pattern != '':
- result = re.compile(pattern)
- elif pattern is not None:
- result = re.compile(pattern.pattern)
- return result
-
- # css beautifier legacy helpers
- def peekUntilAfter(self, pattern):
- start = self.__position
- val = self.readUntilAfter(pattern)
- self.__position = start
- return val
-
- def lookBack(self, testVal):
- start = self.__position - 1
- return start >= len(testVal) and \
- self.__input[start - len(testVal):start].lower() == testVal
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/options.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/options.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/options.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/options.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,216 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-import copy
-import re
-from collections import namedtuple
-
-
-class Options:
- def __init__(self, options=None, merge_child_field=None):
- self.css = None
- self.js = None
- self.html = None
-
- self.raw_options = _mergeOpts(options, merge_child_field)
-
- # Support passing the source text back with no change
- self.disabled = self._get_boolean('disabled')
-
- self.eol = self._get_characters('eol', 'auto')
- self.end_with_newline = self._get_boolean('end_with_newline')
- self.indent_size = self._get_number('indent_size', 4)
- self.indent_char = self._get_characters('indent_char', ' ')
- self.indent_level = self._get_number('indent_level')
-
- self.preserve_newlines = self._get_boolean('preserve_newlines', True)
- self.max_preserve_newlines = self._get_number(
- 'max_preserve_newlines', 32786)
-
- if not self.preserve_newlines:
- self.max_preserve_newlines = 0
-
- self.indent_with_tabs = self._get_boolean(
- 'indent_with_tabs', self.indent_char == '\t')
- if self.indent_with_tabs:
- self.indent_char = '\t'
-
- # indent_size behavior changed after 1.8.6
- # It used to be that indent_size would be
- # set to 1 for indent_with_tabs. That is no longer needed and
- # actually doesn't make sense - why not use spaces? Further,
- # that might produce unexpected behavior - tabs being used
- # for single-column alignment. So, when indent_with_tabs is true
- # and indent_size is 1, reset indent_size to 4.
- if self.indent_size == 1:
- self.indent_size = 4
-
- # Backwards compat with 1.3.x
- self.wrap_line_length = self._get_number(
- 'wrap_line_length', self._get_number('max_char'))
-
- self.indent_empty_lines = self._get_boolean('indent_empty_lines')
-
-
- # valid templating languages ['django', 'erb', 'handlebars', 'php']
- # For now, 'auto' = all off for javascript, all on for html (and inline javascript).
- # other values ignored
- self.templating = self._get_selection_list('templating',
- ['auto', 'none', 'django', 'erb', 'handlebars', 'php'], ['auto'])
-
-
- def _get_array(self, name, default_value=[]):
- option_value = getattr(self.raw_options, name, default_value)
- result = []
- if isinstance(option_value, list):
- result = copy.copy(option_value)
- elif isinstance(option_value, str):
- result = re.compile(r"[^a-zA-Z0-9_/\-]+").split(option_value)
-
- return result
-
- def _get_boolean(self, name, default_value=False):
- option_value = getattr(self.raw_options, name, default_value)
- result = False
- try:
- result = bool(option_value)
- except ValueError:
- pass
-
- return result
-
- def _get_characters(self, name, default_value=''):
- option_value = getattr(self.raw_options, name, default_value)
- result = ''
- if isinstance(option_value, str):
- result = option_value.replace('\\r', '\r').replace(
- '\\n', '\n').replace('\\t', '\t')
-
- return result
-
- def _get_number(self, name, default_value=0):
- option_value = getattr(self.raw_options, name, default_value)
- result = 0
- try:
- result = int(option_value)
- except ValueError:
- pass
-
- return result
-
- def _get_selection(self, name, selection_list, default_value=None):
- result = self._get_selection_list(name, selection_list, default_value)
- if len(result) != 1:
- raise ValueError(
- "Invalid Option Value: The option '" + name + "' can only be one of the following values:\n" +
- str(selection_list) +
- "\nYou passed in: '" +
- str(getattr(self.raw_options, name, None)) +
- "'")
-
- return result[0]
-
- def _get_selection_list(self, name, selection_list, default_value=None):
- if not selection_list:
- raise ValueError("Selection list cannot be empty.")
-
- default_value = default_value or [selection_list[0]]
-
- if not self._is_valid_selection(default_value, selection_list):
- raise ValueError("Invalid Default Value!")
-
- result = self._get_array(name, default_value)
- if not self._is_valid_selection(result, selection_list):
- raise ValueError(
- "Invalid Option Value: The option '" + name + "' can contain only the following values:\n" +
- str(selection_list) +
- "\nYou passed in: '" +
- str(getattr(self.raw_options, name, None)) +
- "'")
-
- return result
-
- def _is_valid_selection(self, result, selection_list):
- if len(result) == 0 or len(selection_list) == 0:
- return False
-
- for item in result:
- if item not in selection_list:
- return False
-
- return True
-
-
-# merges child options up with the parent options object
-# Example: obj = {a: 1, b: {a: 2}}
-# mergeOpts(obj, 'b')
-#
-# Returns: {a: 2}
-
-
-def _mergeOpts(options, childFieldName):
- if options is None:
- options = {}
-
- if isinstance(options, tuple):
- options = dict(options)
-
- options = _normalizeOpts(options)
- finalOpts = copy.copy(options)
- if isinstance(options, dict):
- local = finalOpts.get(childFieldName, None)
- if local:
- del(finalOpts[childFieldName])
- for key in local:
- finalOpts[key] = local[key]
- finalOpts = namedtuple("CustomOptions", finalOpts.keys())(
- *finalOpts.values())
-
- if isinstance(options, Options):
- local = getattr(finalOpts, childFieldName, None)
- if local:
- delattr(finalOpts, childFieldName)
- for key in local:
- setattr(finalOpts, key, local[key])
-
- return finalOpts
-
-
-def _normalizeOpts(options):
- convertedOpts = copy.copy(options)
- if isinstance(convertedOpts, dict):
- option_keys = list(convertedOpts.keys())
- for key in option_keys:
- if '-' in key:
- del convertedOpts[key]
- convertedOpts[key.replace('-', '_')] = options[key]
- else:
- option_keys = list(getattr(convertedOpts, '__dict__', {}))
- for key in option_keys:
- if '-' in key:
- delattr(convertedOpts, key)
- setattr(convertedOpts, key.replace(
- '-', '_'), getattr(options, key, None))
-
- return convertedOpts
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/output.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/output.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/output.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/output.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,348 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-import re
-import math
-
-# Using object instead of string to allow for later expansion of info
-# about each line
-
-__all__ = ["Output"]
-
-
-class OutputLine:
- def __init__(self, parent):
- self.__parent = parent
- self.__character_count = 0
- self.__indent_count = -1
- self.__alignment_count = 0
- self.__wrap_point_index = 0
- self.__wrap_point_character_count = 0
- self.__wrap_point_indent_count = -1
- self.__wrap_point_alignment_count = 0
-
- self.__items = []
-
- def clone_empty(self):
- line = OutputLine(self.__parent)
- line.set_indent(self.__indent_count, self.__alignment_count)
- return line
-
- def item(self, index):
- return self.__items[index]
-
- def is_empty(self):
- return len(self.__items) == 0
-
- def set_indent(self, indent=0, alignment=0):
- if self.is_empty():
- self.__indent_count = indent
- self.__alignment_count = alignment
- self.__character_count = self.__parent.get_indent_size(
- self.__indent_count, self.__alignment_count)
-
- def _set_wrap_point(self):
- if self.__parent.wrap_line_length:
- self.__wrap_point_index = len(self.__items)
- self.__wrap_point_character_count = self.__character_count
- self.__wrap_point_indent_count = \
- self.__parent.next_line.__indent_count
- self.__wrap_point_alignment_count = \
- self.__parent.next_line.__alignment_count
-
- def _should_wrap(self):
- return self.__wrap_point_index and \
- self.__character_count > \
- self.__parent.wrap_line_length and \
- self.__wrap_point_character_count > \
- self.__parent.next_line.__character_count
-
-
- def _allow_wrap(self):
- if self._should_wrap():
- self.__parent.add_new_line()
- next = self.__parent.current_line
- next.set_indent(self.__wrap_point_indent_count,
- self.__wrap_point_alignment_count)
- next.__items = self.__items[self.__wrap_point_index:]
- self.__items = self.__items[:self.__wrap_point_index]
-
- next.__character_count += self.__character_count - \
- self.__wrap_point_character_count
- self.__character_count = self.__wrap_point_character_count
-
- if next.__items[0] == " ":
- next.__items.pop(0)
- next.__character_count -= 1
-
- return True
-
- return False
-
- def last(self):
- if not self.is_empty():
- return self.__items[-1]
-
- return None
-
- def push(self, item):
- self.__items.append(item)
- last_newline_index = item.rfind('\n')
- if last_newline_index != -1:
- self.__character_count = len(item) - last_newline_index
- else:
- self.__character_count += len(item)
-
- def pop(self):
- item = None
- if not self.is_empty():
- item = self.__items.pop()
- self.__character_count -= len(item)
- return item
-
- def _remove_indent(self):
- if self.__indent_count > 0:
- self.__indent_count -= 1
- self.__character_count -= self.__parent.indent_size
-
- def _remove_wrap_indent(self):
- if self.__wrap_point_indent_count > 0:
- self.__wrap_point_indent_count -= 1
-
- def trim(self):
- while self.last() == ' ':
- self.__items.pop()
- self.__character_count -= 1
-
- def toString(self):
- result = ''
- if self.is_empty():
- if self.__parent.indent_empty_lines:
- result = self.__parent.get_indent_string(self.__indent_count)
- else:
- result = self.__parent.get_indent_string(
- self.__indent_count, self.__alignment_count)
- result += ''.join(self.__items)
- return result
-
-
-class IndentStringCache:
- def __init__(self, options, base_string):
- self.__cache = ['']
- self.__indent_size = options.indent_size
- self.__indent_string = options.indent_char
- if not options.indent_with_tabs:
- self.__indent_string = options.indent_char * options.indent_size
-
- # Set to null to continue support of auto detection of base indent
- base_string = base_string or ''
- if options.indent_level > 0:
- base_string = options.indent_level * self.__indent_string
-
- self.__base_string = base_string
- self.__base_string_length = len(base_string)
-
- def get_indent_size(self, indent, column=0):
- result = self.__base_string_length
- if indent < 0:
- result = 0
- result += indent * self.__indent_size
- result += column
- return result
-
- def get_indent_string(self, indent_level, column=0):
- result = self.__base_string
- if indent_level < 0:
- indent_level = 0
- result = ''
- column += indent_level * self.__indent_size
- self.__ensure_cache(column)
- result += self.__cache[column]
- return result
-
- def __ensure_cache(self, column):
- while column >= len(self.__cache):
- self.__add_column()
-
- def __add_column(self):
- column = len(self.__cache)
- indent = 0
- result = ''
- if self.__indent_size and column >= self.__indent_size:
- indent = int(math.floor(column / self.__indent_size))
- column -= indent * self.__indent_size
- result = indent * self.__indent_string
- if column:
- result += column * ' '
- self.__cache.append(result)
-
-
-class Output:
- def __init__(self, options, baseIndentString=''):
-
- self.__indent_cache = IndentStringCache(options, baseIndentString)
- self.raw = False
- self._end_with_newline = options.end_with_newline
- self.indent_size = options.indent_size
- self.wrap_line_length = options.wrap_line_length
- self.indent_empty_lines = options.indent_empty_lines
- self.__lines = []
- self.previous_line = None
- self.current_line = None
- self.next_line = OutputLine(self)
- self.space_before_token = False
- self.non_breaking_space = False
- self.previous_token_wrapped = False
- # initialize
- self.__add_outputline()
-
- def __add_outputline(self):
- self.previous_line = self.current_line
- self.current_line = self.next_line.clone_empty()
- self.__lines.append(self.current_line)
-
- def get_line_number(self):
- return len(self.__lines)
-
- def get_indent_string(self, indent, column=0):
- return self.__indent_cache.get_indent_string(indent, column)
-
- def get_indent_size(self, indent, column=0):
- return self.__indent_cache.get_indent_size(indent, column)
-
- def is_empty(self):
- return self.previous_line is None and self.current_line.is_empty()
-
- def add_new_line(self, force_newline=False):
- # never newline at the start of file
- # otherwise, newline only if we didn't just add one or we're forced
- if self.is_empty() or \
- (not force_newline and self.just_added_newline()):
- return False
-
- # if raw output is enabled, don't print additional newlines,
- # but still return True as though you had
- if not self.raw:
- self.__add_outputline()
- return True
-
- def get_code(self, eol):
- self.trim(True)
-
- # handle some edge cases where the last tokens
- # has text that ends with newline(s)
- last_item = self.current_line.pop()
- if last_item:
- if last_item[-1] == '\n':
- last_item = re.sub(r'[\n]+$', '', last_item)
- self.current_line.push(last_item)
-
- if self._end_with_newline:
- self.__add_outputline()
-
- sweet_code = "\n".join(line.toString() for line in self.__lines)
-
- if not eol == '\n':
- sweet_code = sweet_code.replace('\n', eol)
-
- return sweet_code
-
- def set_wrap_point(self):
- self.current_line._set_wrap_point()
-
- def set_indent(self, indent=0, alignment=0):
- # Next line stores alignment values
- self.next_line.set_indent(indent, alignment)
-
- # Never indent your first output indent at the start of the file
- if len(self.__lines) > 1:
- self.current_line.set_indent(indent, alignment)
- return True
- self.current_line.set_indent()
- return False
-
- def add_raw_token(self, token):
- for _ in range(token.newlines):
- self.__add_outputline()
-
- self.current_line.set_indent(-1)
- self.current_line.push(token.whitespace_before)
- self.current_line.push(token.text)
- self.space_before_token = False
- self.non_breaking_space = False
- self.previous_token_wrapped = False
-
- def add_token(self, printable_token):
- self.__add_space_before_token()
- self.current_line.push(printable_token)
- self.space_before_token = False
- self.non_breaking_space = False
- self.previous_token_wrapped = self.current_line._allow_wrap()
-
- def __add_space_before_token(self):
- if self.space_before_token and not self.just_added_newline():
- if not self.non_breaking_space:
- self.set_wrap_point()
- self.current_line.push(' ')
- self.space_before_token = False
-
- def remove_indent(self, index):
- while index < len(self.__lines):
- self.__lines[index]._remove_indent()
- index += 1
- self.current_line._remove_wrap_indent()
-
- def trim(self, eat_newlines=False):
- self.current_line.trim()
-
- while eat_newlines and len(
- self.__lines) > 1 and self.current_line.is_empty():
- self.__lines.pop()
- self.current_line = self.__lines[-1]
- self.current_line.trim()
-
- if len(self.__lines) > 1:
- self.previous_line = self.__lines[-2]
- else:
- self.previous_line = None
-
- def just_added_newline(self):
- return self.current_line.is_empty()
-
- def just_added_blankline(self):
- return self.is_empty() or \
- (self.current_line.is_empty() and self.previous_line.is_empty())
-
- def ensure_empty_line_above(self, starts_with, ends_with):
- index = len(self.__lines) - 2
- while index >= 0:
- potentialEmptyLine = self.__lines[index]
- if potentialEmptyLine.is_empty():
- break
- elif not potentialEmptyLine.item(0).startswith(starts_with) and \
- potentialEmptyLine.item(-1) != ends_with:
- self.__lines.insert(index + 1, OutputLine(self))
- self.previous_line = self.__lines[-2]
- break
- index -= 1
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/pattern.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/pattern.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/pattern.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/pattern.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,82 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-__all__ = ["Pattern"]
-
-class Pattern:
- def __init__(self, input_scanner, parent=None):
- self._input = input_scanner
- self._starting_pattern = None
- self._match_pattern = None
- self._until_pattern = None
- self._until_after = False
-
- if parent is not None:
- self._starting_pattern = self._input.get_regexp(parent._starting_pattern)
- self._match_pattern = self._input.get_regexp(parent._match_pattern)
- self._until_pattern = self._input.get_regexp(parent._until_pattern)
- self._until_after = parent._until_after
-
- def read(self):
- result = self._input.read(self._starting_pattern)
- if (self._starting_pattern is None) or result:
- result += self._input.read(self._match_pattern,
- self._until_pattern, self._until_after)
- return result
-
- def read_match(self):
- return self._input.match(self._match_pattern)
-
- def until_after(self, pattern):
- result = self._create()
- result._until_after = True
- result._until_pattern = self._input.get_regexp(pattern)
- result._update()
- return result
-
- def until(self, pattern):
- result = self._create()
- result._until_after = False
- result._until_pattern = self._input.get_regexp(pattern)
- result._update()
- return result
-
- def starting_with(self, pattern):
- result = self._create()
- result._starting_pattern = self._input.get_regexp(pattern)
- result._update()
- return result
-
- def matching(self, pattern):
- result = self._create()
- result._match_pattern = self._input.get_regexp(pattern)
- result._update()
- return result
-
- def _create(self):
- return Pattern(self._input, self)
-
- def _update(self):
- pass
-
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/templatablepattern.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/templatablepattern.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/templatablepattern.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/templatablepattern.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,177 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-import copy
-from ..core.pattern import Pattern
-
-__all__ = ["TemplatablePattern"]
-
-class TemplateNames:
- def __init__(self):
- self.django = False
- self.erb = False
- self.handlebars = False
- self.php = False
-
-class TemplatePatterns:
- def __init__(self, input_scanner):
- pattern = Pattern(input_scanner)
- self.handlebars_comment = pattern.starting_with(r'{{!--').until_after(r'--}}')
- self.handlebars_unescaped = pattern.starting_with(r'{{{').until_after(r'}}}')
- self.handlebars = pattern.starting_with(r'{{').until_after(r'}}')
- self.php = pattern.starting_with(r'<\?(?:[=]|php)').until_after(r'\?>')
- self.erb = pattern.starting_with(r'<%[^%]').until_after(r'[^%]%>')
- # django coflicts with handlebars a bit.
- self.django = pattern.starting_with(r'{%').until_after(r'%}')
- self.django_value = pattern.starting_with(r'{{').until_after(r'}}')
- self.django_comment = pattern.starting_with(r'{#').until_after(r'#}')
-
-class TemplatablePattern(Pattern):
-
- def __init__(self, input_scanner, parent=None):
- Pattern.__init__(self, input_scanner, parent)
- self.__template_pattern = None
- self._disabled = TemplateNames()
- self._excluded = TemplateNames()
-
- if parent is not None:
- self.__template_pattern = \
- self._input.get_regexp(parent.__template_pattern)
- self._disabled = copy.copy(parent._disabled)
- self._excluded = copy.copy(parent._excluded)
-
- self.__patterns = TemplatePatterns(input_scanner)
-
- def _create(self):
- return TemplatablePattern(self._input, self)
-
- def _update(self):
- self.__set_templated_pattern()
-
- def read_options(self, options):
- result = self._create()
- for language in ['django', 'erb', 'handlebars', 'php']:
- setattr(result._disabled, language,
- not (language in options.templating))
- result._update()
- return result
-
- def disable(self, language):
- result = self._create()
- setattr(result._disabled, language, True)
- result._update()
- return result
-
- def exclude(self, language):
- result = self._create()
- setattr(result._excluded, language, True)
- result._update()
- return result
-
- def read(self):
- result = ''
- if bool(self._match_pattern):
- result = self._input.read(self._starting_pattern)
- else:
- result = self._input.read(self._starting_pattern,
- self.__template_pattern)
-
- next = self._read_template()
-
- while (bool(next)):
- if self._match_pattern is not None:
- next += self._input.read(self._match_pattern)
- else:
- next += self._input.readUntil(self.__template_pattern)
-
- result += next
- next = self._read_template()
-
- if self._until_after:
- result += self._input.readUntilAfter(self._until_after)
-
- return result
-
- def __set_templated_pattern(self):
- items = list()
-
- if not self._disabled.php:
- items.append(self.__patterns.php._starting_pattern.pattern)
-
- if not self._disabled.handlebars:
- items.append(self.__patterns.handlebars._starting_pattern.pattern)
-
- if not self._disabled.erb:
- items.append(self.__patterns.erb._starting_pattern.pattern)
-
- if not self._disabled.django:
- items.append(self.__patterns.django._starting_pattern.pattern)
- items.append(self.__patterns.django_value._starting_pattern.pattern)
- items.append(self.__patterns.django_comment._starting_pattern.pattern)
-
- if self._until_pattern:
- items.append(self._until_pattern.pattern)
-
- self.__template_pattern = self._input.get_regexp(
- r'(?:' + '|'.join(items) + ')')
-
- def _read_template(self):
- resulting_string = ''
- c = self._input.peek()
- if c == '<':
- peek1 = self._input.peek(1)
- if not self._disabled.php and \
- not self._excluded.php and \
- peek1 == '?':
- resulting_string = resulting_string or \
- self.__patterns.php.read()
-
- if not self._disabled.erb and \
- not self._excluded.erb and \
- peek1 == '%':
- resulting_string = resulting_string or \
- self.__patterns.erb.read()
- elif c == '{':
- if not self._disabled.handlebars and \
- not self._excluded.handlebars:
- resulting_string = resulting_string or \
- self.__patterns.handlebars_comment.read()
- resulting_string = resulting_string or \
- self.__patterns.handlebars_unescaped.read()
- resulting_string = resulting_string or \
- self.__patterns.handlebars.read()
- if not self._disabled.django:
- # django coflicts with handlebars a bit.
- if not self._excluded.django and \
- not self._excluded.handlebars:
- resulting_string = resulting_string or \
- self.__patterns.django_value.read()
- if not self._excluded.django:
-
- resulting_string = resulting_string or \
- self.__patterns.django_comment.read()
- resulting_string = resulting_string or \
- self.__patterns.django.read()
-
- return resulting_string
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/tokenizer.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/tokenizer.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/tokenizer.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/tokenizer.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,135 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-import re
-from ..core.inputscanner import InputScanner
-from ..core.token import Token
-from ..core.tokenstream import TokenStream
-from ..core.pattern import Pattern
-from ..core.whitespacepattern import WhitespacePattern
-
-__all__ = ["TOKEN", "Tokenizer", "TokenizerPatterns", "TokenTypes"]
-
-class TokenTypes:
- START = 'TK_START'
- RAW = 'TK_RAW'
- EOF = 'TK_EOF'
-
- def __init__(self):
- pass
-
-TOKEN = TokenTypes()
-
-class TokenizerPatterns:
- def __init__(self, input_scanner):
- self.whitespace = WhitespacePattern(input_scanner)
-
-
-
-class Tokenizer:
-
- def __init__(self, input_string, options):
- self._input = InputScanner(input_string)
- self._options = options
- self.__tokens = None
-
- self._patterns = TokenizerPatterns(self._input)
-
- def tokenize(self):
- self._input.restart()
- self.__tokens = TokenStream()
-
- current = None
- previous = Token(TOKEN.START,'')
- open_token = None
- open_stack = []
- comments = TokenStream()
-
- while previous.type != TOKEN.EOF:
- current = self.__get_next_token_with_comments(previous, open_token)
-
- if self._is_opening(current):
- open_stack.append(open_token)
- open_token = current
- elif open_token is not None and \
- self._is_closing(current, open_token):
- current.opened = open_token
- open_token.closed = current
- open_token = open_stack.pop()
- current.parent = open_token
-
- self.__tokens.add(current)
- previous = current
- return self.__tokens
-
- def __get_next_token_with_comments(self, previous, open_token):
- current = self._get_next_token(previous, open_token)
-
- if self._is_comment(current):
- comments = TokenStream()
- while self._is_comment(current):
- comments.add(current)
- current = self._get_next_token(previous, open_token)
-
- if not comments.isEmpty():
- current.comments_before = comments
- comments = TokenStream()
-
- current.parent = open_token
- current.previous = previous
- previous.next = current
-
- return current
-
- def _is_first_token(self):
- return self.__tokens.isEmpty()
-
- def _reset(self):
- pass
-
- def _get_next_token(self, previous_token, open_token):
- self._readWhitespace()
- resulting_string = self._input.read(re.compile(r'.+'))
- if resulting_string:
- return self._create_token(TOKEN.RAW, resulting_string)
- else:
- return self._create_token(TOKEN.EOF, '')
-
- def _is_comment(self, current_token):
- return False
-
- def _is_opening(self, current_token):
- return False
-
- def _is_closing(self, current_token, open_token):
- return False
-
- def _create_token(self, token_type, text):
- token = Token(token_type, text,
- self._patterns.whitespace.newline_count,
- self._patterns.whitespace.whitespace_before_token)
- return token
-
- def _readWhitespace(self):
- return self._patterns.whitespace.read()
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/token.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/token.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/token.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/token.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,43 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-
-class Token:
- def __init__(
- self,
- type,
- text,
- newlines=0,
- whitespace_before=''):
- self.type = type
- self.text = text
- self.comments_before = None
- self.newlines = newlines
- self.whitespace_before = whitespace_before
- self.parent = None
- self.next = None
- self.previous = None
- self.opened = None
- self.closed = None
- self.directives = None
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/tokenstream.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/tokenstream.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/tokenstream.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/tokenstream.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,74 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-import re
-from ..core.inputscanner import InputScanner
-from ..core.token import Token
-
-class TokenStream:
-
- def __init__(self, parent_token=None):
- self.__tokens = []
- self.__tokens_length = len(self.__tokens)
- self.__position = 0
- self.__parent_token = parent_token
-
- def restart(self):
- self.__position = 0
-
- def isEmpty(self):
- return self.__tokens_length == 0
-
- def hasNext(self):
- return self.__position < self.__tokens_length
-
- def next(self):
- if self.hasNext():
- val = self.__tokens[self.__position]
- self.__position += 1
- return val
- else:
- raise StopIteration
-
- def peek(self, index=0):
- val = None
- index += self.__position
- if index >= 0 and index < self.__tokens_length:
- val = self.__tokens[index]
-
- return val
-
- def add(self, token):
- if self.__parent_token:
- token.parent = self.__parent_token
-
- self.__tokens.append(token)
- self.__tokens_length += 1
-
- def __iter__(self):
- self.restart()
- return self
-
- def __next__(self):
- return self.next()
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/whitespacepattern.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/whitespacepattern.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/core/whitespacepattern.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/core/whitespacepattern.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,78 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-import re
-from ..core.pattern import Pattern
-
-__all__ = ["WhitespacePattern"]
-
-
-class WhitespacePattern(Pattern):
- def __init__(self, input_scanner, parent=None):
- Pattern.__init__(self, input_scanner, parent)
-
- if parent is not None:
- self._newline_regexp = \
- self._input.get_regexp(parent._newline_regexp)
- else:
- self.__set_whitespace_patterns('', '')
-
- self.newline_count = 0
- self.whitespace_before_token = ''
-
- def __set_whitespace_patterns(self, whitespace_chars, newline_chars):
- whitespace_chars += '\\t '
- newline_chars += '\\n\\r'
-
- self._match_pattern = self._input.get_regexp(
- '[' + whitespace_chars + newline_chars + ']+')
- self._newline_regexp = self._input.get_regexp(
- '\\r\\n|[' + newline_chars + ']')
-
-
- def read(self):
- self.newline_count = 0
- self.whitespace_before_token = ''
-
- resulting_string = self._input.read(self._match_pattern)
- if resulting_string == ' ':
- self.whitespace_before_token = ' '
- elif bool(resulting_string):
- lines = self._newline_regexp.split(resulting_string)
- self.newline_count = len(lines) - 1
- self.whitespace_before_token = lines[-1]
-
- return resulting_string
-
-
- def matching(self, whitespace_chars, newline_chars):
- result = self._create()
- result.__set_whitespace_patterns(whitespace_chars, newline_chars)
- result._update()
- return result
-
- def _create(self):
- return WhitespacePattern(self._input, self)
-
-
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/__init__.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/__init__.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/__init__.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/__init__.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,440 +0,0 @@
-from __future__ import print_function
-import sys
-import os
-import platform
-import io
-import getopt
-import re
-import string
-import errno
-import copy
-import glob
-from jsbeautifier.__version__ import __version__
-from jsbeautifier.javascript.options import BeautifierOptions
-from jsbeautifier.javascript.beautifier import Beautifier
-
-#
-# The MIT License (MIT)
-
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-#
-# Originally written by Einar Lielmanis et al.,
-# Conversion to python by Einar Lielmanis, einar@beautifier.io,
-# Parsing improvement for brace-less and semicolon-less statements
-# by Liam Newman
-# Python is not my native language, feel free to push things around.
-#
-# Use either from command line (script displays its usage when run
-# without any parameters),
-#
-#
-# or, alternatively, use it as a module:
-#
-# import jsbeautifier
-# res = jsbeautifier.beautify('your javascript string')
-# res = jsbeautifier.beautify_file('some_file.js')
-#
-# you may specify some options:
-#
-# opts = jsbeautifier.default_options()
-# opts.indent_size = 2
-# res = jsbeautifier.beautify('some javascript', opts)
-#
-#
-# Here are the available options: (read source)
-
-
-class MissingInputStreamError(Exception):
- pass
-
-def default_options():
- return BeautifierOptions()
-
-
-def beautify(string, opts=default_options()):
- b = Beautifier()
- return b.beautify(string, opts)
-
-
-def set_file_editorconfig_opts(filename, js_options):
- from editorconfig import get_properties, EditorConfigError
- try:
- _ecoptions = get_properties(os.path.abspath(filename))
-
- if _ecoptions.get("indent_style") == "tab":
- js_options.indent_with_tabs = True
- elif _ecoptions.get("indent_style") == "space":
- js_options.indent_with_tabs = False
-
- if _ecoptions.get("indent_size"):
- js_options.indent_size = int(_ecoptions["indent_size"])
-
- if _ecoptions.get("max_line_length"):
- if _ecoptions.get("max_line_length") == "off":
- js_options.wrap_line_length = 0
- else:
- js_options.wrap_line_length = int(
- _ecoptions["max_line_length"])
-
- if _ecoptions.get("insert_final_newline") == 'true':
- js_options.end_with_newline = True
- elif _ecoptions.get("insert_final_newline") == 'false':
- js_options.end_with_newline = False
-
- if _ecoptions.get("end_of_line"):
- if _ecoptions["end_of_line"] == "cr":
- js_options.eol = '\r'
- elif _ecoptions["end_of_line"] == "lf":
- js_options.eol = '\n'
- elif _ecoptions["end_of_line"] == "crlf":
- js_options.eol = '\r\n'
-
- except EditorConfigError:
- # do not error on bad editor config
- print("Error loading EditorConfig. Ignoring.", file=sys.stderr)
-
-def beautify_file(file_name, opts=default_options()):
- input_string = ''
- if file_name == '-': # stdin
- if sys.stdin.isatty():
- raise MissingInputStreamError()
-
- stream = sys.stdin
- if platform.platform().lower().startswith('windows'):
- if sys.version_info.major >= 3:
- # for python 3 on windows this prevents conversion
- stream = io.TextIOWrapper(sys.stdin.buffer, newline='')
- elif platform.architecture()[0] == '32bit':
- # for python 2 x86 on windows this prevents conversion
- import msvcrt
- msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
- else:
- raise Exception('Pipe to stdin not supported on Windows with Python 2.x 64-bit.')
-
- input_string = stream.read()
-
- # if you pipe an empty string, that is a failure
- if input_string == '':
- raise MissingInputStreamError()
- else:
- stream = io.open(file_name, 'rt', newline='', encoding='UTF-8')
- input_string = stream.read()
-
- return beautify(input_string, opts)
-
-
-def usage(stream=sys.stdout):
-
- print("jsbeautifier.py@" + __version__ + """
-
-Javascript beautifier (https://beautifier.io/)
-
-Usage: jsbeautifier.py [options]
-
- can be "-", which means stdin.
-
-Input options:
-
- -i, --stdin Read input from stdin
-
-Output options:
-
- -s, --indent-size=NUMBER Indentation size. (default 4).
- -c, --indent-char=CHAR Character to indent with. (default space).
- -e, --eol=STRING Character(s) to use as line terminators.
- (default first newline in file, otherwise "\\n")
- -t, --indent-with-tabs Indent with tabs, overrides -s and -c
- -d, --disable-preserve-newlines Do not preserve existing line breaks.
- -P, --space-in-paren Add padding spaces within paren, ie. f( a, b )
- -E, --space-in-empty-paren Add a single space inside empty paren, ie. f( )
- -j, --jslint-happy More jslint-compatible output
- -a, --space-after-anon-function Add a space before an anonymous function's parens, ie. function ()
- --space-after-named-function Add a space before a named function's parens, i.e. function example ()
- -b, --brace-style=collapse Brace style (collapse, expand, end-expand, none)(,preserve-inline)
- -k, --keep-array-indentation Keep array indentation.
- -r, --replace Write output in-place, replacing input
- -o, --outfile=FILE Specify a file to output to (default stdout)
- -f, --keep-function-indentation Do not re-indent function bodies defined in var lines.
- -x, --unescape-strings Decode printable chars encoded in \\xNN notation.
- -X, --e4x Pass E4X xml literals through untouched
- -C, --comma-first Put commas at the beginning of new line instead of end.
- -O, --operator-position=STRING Set operator position (before-newline, after-newline, preserve-newline)
- -w, --wrap-line-length Attempt to wrap line when it exceeds this length.
- NOTE: Line continues until next wrap point is found.
- -n, --end-with-newline End output with newline
- --indent-empty-lines Keep indentation on empty lines
- --templating List of templating languages (auto,none,django,erb,handlebars,php) ["auto"] auto = none in JavaScript, all in html
- --editorconfig Enable setting configuration from EditorConfig
-
-Rarely needed options:
-
- --eval-code evaluate code if a JS interpreter is
- installed. May be useful with some obfuscated
- script but poses a potential security issue.
-
- -l, --indent-level=NUMBER Initial indentation level. (default 0).
-
- -h, --help, --usage Prints this help statement.
- -v, --version Show the version
-
-""", file=stream)
- if stream == sys.stderr:
- return 1
- else:
- return 0
-
-
-def mkdir_p(path):
- try:
- if path:
- os.makedirs(path)
- except OSError as exc: # Python >2.5
- if exc.errno == errno.EEXIST and os.path.isdir(path):
- pass
- else:
- raise Exception()
-
-
-def isFileDifferent(filepath, expected):
- try:
- return (
- ''.join(
- io.open(
- filepath,
- 'rt',
- newline='').readlines()) != expected)
- except BaseException:
- return True
-
-
-def main():
-
- argv = sys.argv[1:]
-
- try:
- opts, args = getopt.getopt(argv, "f:s:c:e:o:rdEPjab:kil:xhtvXnCO:w:m:",
- ['file=', 'indent-size=', 'indent-char=', 'eol=', 'outfile=', 'replace', 'disable-preserve-newlines',
- 'space-in-paren', 'space-in-empty-paren', 'jslint-happy', 'space-after-anon-function',
- 'brace-style=', 'indent-level=', 'unescape-strings',
- 'help', 'usage', 'stdin', 'eval-code', 'indent-with-tabs', 'keep-function-indentation', 'version',
- 'e4x', 'end-with-newline', 'comma-first', 'operator-position=', 'wrap-line-length', 'editorconfig', 'space-after-named-function',
- 'keep-array-indentation', 'indent-empty-lines', 'templating'])
- except getopt.GetoptError as ex:
- print(ex, file=sys.stderr)
- return usage(sys.stderr)
-
- js_options = default_options()
-
- filepath_params = []
- filepath_params.extend(args)
-
- outfile_param = 'stdout'
- replace = False
-
- for opt, arg in opts:
- if opt in ('--file', '-f'):
- filepath_params.append(arg)
- elif opt in ('--keep-array-indentation', '-k'):
- js_options.keep_array_indentation = True
- elif opt in ('--keep-function-indentation'):
- js_options.keep_function_indentation = True
- elif opt in ('--outfile', '-o'):
- outfile_param = arg
- elif opt in ('--replace', '-r'):
- replace = True
- elif opt in ('--indent-size', '-s'):
- js_options.indent_size = int(arg)
- elif opt in ('--indent-char', '-c'):
- js_options.indent_char = arg
- elif opt in ('--eol', '-e'):
- js_options.eol = arg
- elif opt in ('--indent-with-tabs', '-t'):
- js_options.indent_with_tabs = True
- elif opt in ('--disable-preserve-newlines', '-d'):
- js_options.preserve_newlines = False
- elif opt in ('--max-preserve-newlines', '-m'):
- js_options.max_preserve_newlines = int(arg)
- elif opt in ('--space-in-paren', '-P'):
- js_options.space_in_paren = True
- elif opt in ('--space-in-empty-paren', '-E'):
- js_options.space_in_empty_paren = True
- elif opt in ('--jslint-happy', '-j'):
- js_options.jslint_happy = True
- elif opt in ('--space-after-anon-function', '-a'):
- js_options.space_after_anon_function = True
- elif opt in ('--space-after-named-function'):
- js_options.space_after_named_function = True
- elif opt in ('--eval-code'):
- js_options.eval_code = True
- elif opt in ('--brace-style', '-b'):
- js_options.brace_style = arg
- elif opt in ('--unescape-strings', '-x'):
- js_options.unescape_strings = True
- elif opt in ('--e4x', '-X'):
- js_options.e4x = True
- elif opt in ('--end-with-newline', '-n'):
- js_options.end_with_newline = True
- elif opt in ('--comma-first', '-C'):
- js_options.comma_first = True
- elif opt in ('--operator-position', '-O'):
- js_options.operator_position = arg
- elif opt in ('--wrap-line-length ', '-w'):
- js_options.wrap_line_length = int(arg)
- elif opt in ('--indent-empty-lines'):
- js_options.indent_empty_lines = True
- elif opt in ('--templating'):
- js_options.templating = arg.split(',')
- elif opt in ('--stdin', '-i'):
- # stdin is the default if no files are passed
- filepath_params = []
- elif opt in ('--editorconfig'):
- js_options.editorconfig = True
- elif opt in ('--version', '-v'):
- return print(__version__)
- elif opt in ('--help', '--usage', '-h'):
- return usage()
-
- try:
- filepaths = []
- if not filepath_params or (
- len(filepath_params) == 1 and filepath_params[0] == '-'):
- # default to stdin
- filepath_params = []
- filepaths.append('-')
-
-
- for filepath_param in filepath_params:
- # ignore stdin setting if files are specified
- if '-' == filepath_param:
- continue
-
- # Check if each literal filepath exists
- if os.path.isfile(filepath_param):
- filepaths.append(filepath_param)
- elif '*' in filepath_param or '?' in filepath_param:
- # handle globs
- # empty result is okay
- if sys.version_info.major == 2 or (
- sys.version_info.major == 3 and
- sys.version_info.minor <= 4):
- if '**' in filepath_param:
- raise Exception('Recursive globs not supported on Python <= 3.4.')
- filepaths.extend(glob.glob(filepath_param))
- else:
- filepaths.extend(glob.glob(filepath_param, recursive=True))
- else:
- # not a glob and not a file
- raise OSError(errno.ENOENT, os.strerror(errno.ENOENT),
- filepath_param)
-
- if len(filepaths) > 1:
- replace = True
- elif filepaths and filepaths[0] == '-':
- replace = False
-
- # remove duplicates
- filepaths = set(filepaths)
-
- for filepath in filepaths:
- if not replace:
- outfile = outfile_param
- else:
- outfile = filepath
-
- # Editorconfig used only on files, not stdin
- if getattr(js_options, 'editorconfig'):
- editorconfig_filepath = filepath
-
- if editorconfig_filepath == '-':
- if outfile != 'stdout':
- editorconfig_filepath = outfile
- else:
- fileType = 'js'
- editorconfig_filepath = 'stdin.' + fileType
-
- # debug("EditorConfig is enabled for ", editorconfig_filepath);
- js_options = copy.copy(js_options)
- set_file_editorconfig_opts(editorconfig_filepath, js_options)
-
- pretty = beautify_file(filepath, js_options)
-
- if outfile == 'stdout':
- stream = sys.stdout
-
- # python automatically converts newlines in text to "\r\n" when on windows
- # switch to binary to prevent this
- if platform.platform().lower().startswith('windows'):
- if sys.version_info.major >= 3:
- # for python 3 on windows this prevents conversion
- stream = io.TextIOWrapper(sys.stdout.buffer, newline='')
- elif platform.architecture()[0] == '32bit':
- # for python 2 x86 on windows this prevents conversion
- import msvcrt
- msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
- else:
- raise Exception('Pipe to stdout not supported on Windows with Python 2.x 64-bit.')
-
- stream.write(pretty)
- else:
- if isFileDifferent(outfile, pretty):
- mkdir_p(os.path.dirname(outfile))
-
- # python automatically converts newlines in text to "\r\n" when on windows
- # set newline to empty to prevent this
- with io.open(outfile, 'wt', newline='', encoding='UTF-8') as f:
- print('beautified ' + outfile, file=sys.stdout)
- try:
- f.write(pretty)
- except TypeError:
- # This is not pretty, but given how we did the version import
- # it is the only way to do this without having setup.py
- # fail on a missing six dependency.
- six = __import__("six")
- f.write(six.u(pretty))
- else:
- print('beautified ' + outfile + ' - unchanged', file=sys.stdout)
-
-
- except MissingInputStreamError:
- print(
- "Must pipe input or define at least one file.\n",
- file=sys.stderr)
- usage(sys.stderr)
- return 1
-
- except UnicodeError as ex:
- print("Error while decoding input or encoding output:",
- file=sys.stderr)
- print(ex, file=sys.stderr)
- return 1
-
- except Exception as ex:
- print(ex, file=sys.stderr)
- return 1
-
- # Success
- return 0
-
-
-if __name__ == "__main__":
- main()
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/javascript/acorn.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/javascript/acorn.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/javascript/acorn.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/javascript/acorn.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,75 +0,0 @@
-import re
-
-# This section of code was translated to python from acorn (javascript).
-#
-# Acorn was written by Marijn Haverbeke and released under an MIT
-# license. The Unicode regexps (for identifiers and whitespace) were
-# taken from [Esprima](http://esprima.org) by Ariya Hidayat.
-#
-# Git repositories for Acorn are available at
-#
-# http://marijnhaverbeke.nl/git/acorn
-# https://github.com/marijnh/acorn.git
-
-# This is not pretty, but given how we did the version import
-# it is the only way to do this without having setup.py fail on a missing
-# six dependency.
-six = __import__("six")
-
-# ## Character categories
-
-# acorn used char codes to squeeze the last bit of performance out
-# Beautifier is okay without that, so we're using regex
-# permit #(23), $ (36), and @ (64). @ is used in ES7 decorators.
-# 65 through 91 are uppercase letters.
-# permit _ (95).
-# 97 through 123 are lowercase letters.
-_baseASCIIidentifierStartChars = six.u(r"\x23\x24\x40\x41-\x5a\x5f\x61-\x7a")
-
-# inside an identifier @ is not allowed but 0-9 are.
-_baseASCIIidentifierChars = six.u(r"\x24\x30-\x39\x41-\x5a\x5f\x61-\x7a")
-
-# Big ugly regular expressions that match characters in the
-# whitespace, identifier, and identifier-start categories. These
-# are only applied when a character is found to actually have a
-# code point above 128.
-# IMPORTANT: These strings must be run through six to handle \u chars
-_nonASCIIidentifierStartChars = six.u(r"\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc")
-_nonASCIIidentifierChars = six.u(r"\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u0620-\u0649\u0672-\u06d3\u06e7-\u06e8\u06fb-\u06fc\u0730-\u074a\u0800-\u0814\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0840-\u0857\u08e4-\u08fe\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962-\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09d7\u09df-\u09e0\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5f-\u0b60\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2-\u0ce3\u0ce6-\u0cef\u0d02\u0d03\u0d46-\u0d48\u0d57\u0d62-\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e34-\u0e3a\u0e40-\u0e45\u0e50-\u0e59\u0eb4-\u0eb9\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f41-\u0f47\u0f71-\u0f84\u0f86-\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1029\u1040-\u1049\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u170e-\u1710\u1720-\u1730\u1740-\u1750\u1772\u1773\u1780-\u17b2\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1920-\u192b\u1930-\u193b\u1951-\u196d\u19b0-\u19c0\u19c8-\u19c9\u19d0-\u19d9\u1a00-\u1a15\u1a20-\u1a53\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1b46-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1bb0-\u1bb9\u1be6-\u1bf3\u1c00-\u1c22\u1c40-\u1c49\u1c5b-\u1c7d\u1cd0-\u1cd2\u1d00-\u1dbe\u1e01-\u1f15\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2d81-\u2d96\u2de0-\u2dff\u3021-\u3028\u3099\u309a\ua640-\ua66d\ua674-\ua67d\ua69f\ua6f0-\ua6f1\ua7f8-\ua800\ua806\ua80b\ua823-\ua827\ua880-\ua881\ua8b4-\ua8c4\ua8d0-\ua8d9\ua8f3-\ua8f7\ua900-\ua909\ua926-\ua92d\ua930-\ua945\ua980-\ua983\ua9b3-\ua9c0\uaa00-\uaa27\uaa40-\uaa41\uaa4c-\uaa4d\uaa50-\uaa59\uaa7b\uaae0-\uaae9\uaaf2-\uaaf3\uabc0-\uabe1\uabec\uabed\uabf0-\uabf9\ufb20-\ufb28\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f")
-#_nonASCIIidentifierStart = re.compile("[" + _nonASCIIidentifierStartChars + "]")
-#_nonASCIIidentifier = re.compile("[" + _nonASCIIidentifierStartChars + _nonASCIIidentifierChars + "]")
-
-_identifierStart = six.u(r"(?:\\u[0-9a-fA-F]{4}|[") + \
- _baseASCIIidentifierStartChars + \
- _nonASCIIidentifierStartChars + \
- six.u("])")
-_identifierChars = six.u(r"(?:\\u[0-9a-fA-F]{4}|[") + \
- _baseASCIIidentifierChars + \
- _nonASCIIidentifierStartChars + \
- _nonASCIIidentifierChars + \
- six.u("])*")
-
-identifier = re.compile(_identifierStart + _identifierChars)
-
-identifierStart = re.compile(_identifierStart)
-identifierMatch = re.compile(six.u(r"(?:\\u[0-9a-fA-F]{4}|[") + \
- _baseASCIIidentifierChars + \
- _nonASCIIidentifierStartChars + \
- _nonASCIIidentifierChars + \
- six.u("])+"))
-
-_nonASCIIwhitespace = re.compile(
- six.u(r"[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]"))
-
-# Whether a single character denotes a newline.
-# IMPORTANT: This string must be run through six to handle \u chars
-newline = re.compile(six.u(r"[\n\r\u2028\u2029]"))
-
-# Matches a whole line break (where CRLF is considered a single
-# line break). Used to count lines.
-
-# in javascript, these two differ
-# in python they are the same, different methods are called on them
-# IMPORTANT: This string must be run through six to handle \u chars
-lineBreak = re.compile(six.u(r"\r\n|[\n\r\u2028\u2029]"))
-allLineBreaks = lineBreak
\ No newline at end of file
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/javascript/beautifier.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/javascript/beautifier.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/javascript/beautifier.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/javascript/beautifier.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,1339 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-import re
-import string
-import copy
-from ..core.token import Token
-from .tokenizer import Tokenizer
-from .tokenizer import TOKEN
-from .options import BeautifierOptions
-from ..core.output import Output
-
-
-def default_options():
- return BeautifierOptions()
-
-
-class BeautifierFlags:
- def __init__(self, mode):
- self.mode = mode
- self.parent = None
- self.last_token = Token(TOKEN.START_BLOCK, '')
- self.last_word = ''
- self.declaration_statement = False
- self.declaration_assignment = False
- self.multiline_frame = False
- self.inline_frame = False
- self.if_block = False
- self.else_block = False
- self.do_block = False
- self.do_while = False
- self.import_block = False
- self.in_case = False
- self.in_case_statement = False
- self.case_body = False
- self.indentation_level = 0
- self.alignment = 0
- self.line_indent_level = 0
- self.start_line_index = 0
- self.ternary_depth = 0
-
- def apply_base(self, flags_base, added_newline):
- next_indent_level = flags_base.indentation_level
- if not added_newline and \
- flags_base.line_indent_level > next_indent_level:
- next_indent_level = flags_base.line_indent_level
-
- self.parent = flags_base
- self.last_token = flags_base.last_token
- self.last_word = flags_base.last_word
- self.indentation_level = next_indent_level
-
-
-OPERATOR_POSITION = {
- 'before_newline': 'before-newline',
- 'after_newline': 'after-newline',
- 'preserve_newline': 'preserve-newline'
-}
-OPERATOR_POSITION_BEFORE_OR_PRESERVE = [
- OPERATOR_POSITION['before_newline'],
- OPERATOR_POSITION['preserve_newline']]
-
-
-class MODE:
- BlockStatement, Statement, ObjectLiteral, ArrayLiteral, \
- ForInitializer, Conditional, Expression = range(7)
-
-
-def remove_redundant_indentation(output, frame):
- # This implementation is effective but has some issues:
- # - can cause line wrap to happen too soon due to indent removal
- # after wrap points are calculated
- # These issues are minor compared to ugly indentation.
-
- if frame.multiline_frame or \
- frame.mode == MODE.ForInitializer or \
- frame.mode == MODE.Conditional:
- return
-
- # remove one indent from each line inside this section
- output.remove_indent(frame.start_line_index)
-
-
-def reserved_word(token, word):
- return token and token.type == TOKEN.RESERVED and token.text == word
-
-
-def reserved_array(token, words):
- return token and token.type == TOKEN.RESERVED and token.text in words
-
-
-_special_word_set = frozenset([
- 'case',
- 'return',
- 'do',
- 'if',
- 'throw',
- 'else',
- 'await',
- 'break',
- 'continue',
- 'async'])
-
-
-class Beautifier:
-
- def __init__(self, opts=None):
- import jsbeautifier.javascript.acorn as acorn
- self.acorn = acorn
- self._options = BeautifierOptions(opts)
-
- self._blank_state()
-
- def _blank_state(self, js_source_text=None):
- if js_source_text is None:
- js_source_text = ''
-
- # internal flags
- self._flags = None
- self._previous_flags = None
- self._flag_store = []
- self._tokens = None
-
- if self._options.eol == 'auto':
- self._options.eol = '\n'
- if self.acorn.lineBreak.search(js_source_text or ''):
- self._options.eol = self.acorn.lineBreak.search(
- js_source_text).group()
-
-
- baseIndentString = re.search("^[\t ]*", js_source_text).group(0)
- self._last_last_text = '' # pre-last token text
-
-
- self._output = Output(self._options, baseIndentString)
- # If testing the ignore directive, start with output disable set to
- # true
- self._output.raw = self._options.test_output_raw
-
- self.set_mode(MODE.BlockStatement)
- return js_source_text
-
- def beautify(self, source_text='', opts=None):
- if opts is not None:
- self._options = BeautifierOptions(opts)
-
-
- source_text = source_text or ''
- if self._options.disabled:
- return source_text
-
- source_text = self._blank_state(source_text)
-
- source_text = self.unpack(source_text, self._options.eval_code)
-
- self._tokens = Tokenizer(source_text, self._options).tokenize()
-
- for current_token in self._tokens:
- self.handle_token(current_token)
-
- self._last_last_text = self._flags.last_token.text
- self._flags.last_token = current_token
-
- sweet_code = self._output.get_code(self._options.eol)
-
- return sweet_code
-
- def handle_token(self, current_token, preserve_statement_flags=False):
- if current_token.type == TOKEN.START_EXPR:
- self.handle_start_expr(current_token)
- elif current_token.type == TOKEN.END_EXPR:
- self.handle_end_expr(current_token)
- elif current_token.type == TOKEN.START_BLOCK:
- self.handle_start_block(current_token)
- elif current_token.type == TOKEN.END_BLOCK:
- self.handle_end_block(current_token)
- elif current_token.type == TOKEN.WORD:
- self.handle_word(current_token)
- elif current_token.type == TOKEN.RESERVED:
- self.handle_word(current_token)
- elif current_token.type == TOKEN.SEMICOLON:
- self.handle_semicolon(current_token)
- elif current_token.type == TOKEN.STRING:
- self.handle_string(current_token)
- elif current_token.type == TOKEN.EQUALS:
- self.handle_equals(current_token)
- elif current_token.type == TOKEN.OPERATOR:
- self.handle_operator(current_token)
- elif current_token.type == TOKEN.COMMA:
- self.handle_comma(current_token)
- elif current_token.type == TOKEN.BLOCK_COMMENT:
- self.handle_block_comment(current_token, preserve_statement_flags)
- elif current_token.type == TOKEN.COMMENT:
- self.handle_comment(current_token, preserve_statement_flags)
- elif current_token.type == TOKEN.DOT:
- self.handle_dot(current_token)
- elif current_token.type == TOKEN.EOF:
- self.handle_eof(current_token)
- elif current_token.type == TOKEN.UNKNOWN:
- self.handle_unknown(current_token, preserve_statement_flags)
- else:
- self.handle_unknown(current_token, preserve_statement_flags)
-
- def handle_whitespace_and_comments(
- self, current_token, preserve_statement_flags=False):
- newlines = current_token.newlines
- keep_whitespace = self._options.keep_array_indentation and self.is_array(
- self._flags.mode)
-
- if current_token.comments_before is not None:
- for comment_token in current_token.comments_before:
- # The cleanest handling of inline comments is to treat them
- # as though they aren't there.
- # Just continue formatting and the behavior should be logical.
- # Also ignore unknown tokens. Again, this should result in better
- # behavior.
- self.handle_whitespace_and_comments(
- comment_token, preserve_statement_flags)
- self.handle_token(comment_token, preserve_statement_flags)
-
- if keep_whitespace:
- for i in range(newlines):
- self.print_newline(i > 0, preserve_statement_flags)
- else: # not keep_whitespace
- if self._options.max_preserve_newlines != 0 and newlines > self._options.max_preserve_newlines:
- newlines = self._options.max_preserve_newlines
-
- if self._options.preserve_newlines and newlines > 1:
- self.print_newline(False, preserve_statement_flags)
- for i in range(1, newlines):
- self.print_newline(True, preserve_statement_flags)
-
- def unpack(self, source, evalcode=False):
- import jsbeautifier.unpackers as unpackers
- try:
- return unpackers.run(source, evalcode)
- except unpackers.UnpackingError:
- return source
-
- def is_array(self, mode):
- return mode == MODE.ArrayLiteral
-
- def is_expression(self, mode):
- return mode == MODE.Expression or mode == MODE.ForInitializer or mode == MODE.Conditional
-
- _newline_restricted_tokens = frozenset([
- 'async',
- 'break',
- 'continue',
- 'return',
- 'throw',
- 'yield'])
-
- def allow_wrap_or_preserved_newline(
- self, current_token, force_linewrap=False):
- # never wrap the first token of a line.
- if self._output.just_added_newline():
- return
-
- shouldPreserveOrForce = (
- self._options.preserve_newlines and current_token.newlines) or force_linewrap
- operatorLogicApplies = self._flags.last_token.text in Tokenizer.positionable_operators or current_token.text in Tokenizer.positionable_operators
-
- if operatorLogicApplies:
- shouldPrintOperatorNewline = (self._flags.last_token.text in Tokenizer.positionable_operators and self._options.operator_position in OPERATOR_POSITION_BEFORE_OR_PRESERVE) \
- or current_token.text in Tokenizer.positionable_operators
- shouldPreserveOrForce = shouldPreserveOrForce and shouldPrintOperatorNewline
-
- if shouldPreserveOrForce:
- self.print_newline(preserve_statement_flags=True)
- elif self._options.wrap_line_length > 0:
- if reserved_array(self._flags.last_token, self._newline_restricted_tokens):
- # These tokens should never have a newline inserted between
- # them and the following expression.
- return
- self._output.set_wrap_point()
-
- def print_newline(
- self,
- force_newline=False,
- preserve_statement_flags=False):
- if not preserve_statement_flags:
- if self._flags.last_token.text != ';' and self._flags.last_token.text != ',' and self._flags.last_token.text != '=' and (
- self._flags.last_token.type != TOKEN.OPERATOR or self._flags.last_token.text == '--' or self._flags.last_token.text == '++'):
- next_token = self._tokens.peek()
- while (self._flags.mode == MODE.Statement and \
- not (self._flags.if_block and reserved_word(next_token, 'else')) and \
- not self._flags.do_block):
- self.restore_mode()
-
- if self._output.add_new_line(force_newline):
- self._flags.multiline_frame = True
-
- def print_token_line_indentation(self, current_token):
- if self._output.just_added_newline():
- line = self._output.current_line
- if self._options.keep_array_indentation and \
- current_token.newlines and \
- (self.is_array(self._flags.mode) or
- current_token.text == '['):
- line.set_indent(-1)
- line.push(current_token.whitespace_before)
- self._output.space_before_token = False
- elif self._output.set_indent(self._flags.indentation_level,
- self._flags.alignment):
- self._flags.line_indent_level = self._flags.indentation_level
-
- def print_token(self, current_token, s=None):
- if self._output.raw:
- self._output.add_raw_token(current_token)
- return
-
- if self._options.comma_first and current_token.previous and \
- current_token.previous.type == TOKEN.COMMA and \
- self._output.just_added_newline():
- if self._output.previous_line.last() == ',':
- # if the comma was already at the start of the line,
- # pull back onto that line and reprint the indentation
- popped = self._output.previous_line.pop()
- if self._output.previous_line.is_empty():
- self._output.previous_line.push(popped)
- self._output.trim(True)
- self._output.current_line.pop()
- self._output.trim()
-
- # add the comma in front of the next token
- self.print_token_line_indentation(current_token)
- self._output.add_token(',')
- self._output.space_before_token = True
-
- if s is None:
- s = current_token.text
-
- self.print_token_line_indentation(current_token)
- self._output.non_breaking_space = True
- self._output.add_token(s)
- if self._output.previous_token_wrapped:
- self._flags.multiline_frame = True
-
- def indent(self):
- self._flags.indentation_level += 1
- self._output.set_indent(self._flags.indentation_level,
- self._flags.alignment)
-
- def deindent(self):
- allow_deindent = self._flags.indentation_level > 0 and (
- (self._flags.parent is None) or self._flags.indentation_level > self._flags.parent.indentation_level)
-
- if allow_deindent:
- self._flags.indentation_level -= 1
-
- self._output.set_indent(self._flags.indentation_level,
- self._flags.alignment)
-
-
- def set_mode(self, mode):
- if self._flags:
- self._flag_store.append(self._flags)
- self._previous_flags = self._flags
- else:
- self._previous_flags = BeautifierFlags(mode)
-
- self._flags = BeautifierFlags(mode)
- self._flags.apply_base(
- self._previous_flags,
- self._output.just_added_newline())
- self._flags.start_line_index = self._output.get_line_number()
-
- self._output.set_indent(self._flags.indentation_level,
- self._flags.alignment)
-
- def restore_mode(self):
- if len(self._flag_store) > 0:
- self._previous_flags = self._flags
- self._flags = self._flag_store.pop()
- if self._previous_flags.mode == MODE.Statement:
- remove_redundant_indentation(self._output, self._previous_flags)
-
- self._output.set_indent(self._flags.indentation_level,
- self._flags.alignment)
-
- def start_of_object_property(self):
- return self._flags.parent.mode == MODE.ObjectLiteral and self._flags.mode == MODE.Statement and (
- (self._flags.last_token.text == ':' and self._flags.ternary_depth == 0) or (
- reserved_array(self._flags.last_token, ['get', 'set'])))
-
- def start_of_statement(self, current_token):
- start = False
- start = start or (
- reserved_array(self._flags.last_token, ['var', 'let', 'const']) and
- current_token.type == TOKEN.WORD)
- start = start or reserved_word(self._flags.last_token, 'do')
- start = start or (
- not (self._flags.parent.mode == MODE.ObjectLiteral and self._flags.mode == MODE.Statement) and
- reserved_array(self._flags.last_token, self._newline_restricted_tokens) and
- not current_token.newlines)
- start = start or (
- reserved_word(self._flags.last_token, 'else') and not (
- reserved_word(current_token, 'if') and \
- current_token.comments_before is None))
- start = start or (self._flags.last_token.type == TOKEN.END_EXPR and (
- self._previous_flags.mode == MODE.ForInitializer or self._previous_flags.mode == MODE.Conditional))
- start = start or (self._flags.last_token.type == TOKEN.WORD and self._flags.mode == MODE.BlockStatement
- and not self._flags.in_case
- and not (current_token.text == '--' or current_token.text == '++')
- and self._last_last_text != 'function'
- and current_token.type != TOKEN.WORD and current_token.type != TOKEN.RESERVED)
- start = start or (
- self._flags.mode == MODE.ObjectLiteral and (
- (self._flags.last_token.text == ':' and self._flags.ternary_depth == 0) or (
- reserved_array(self._flags.last_token, ['get', 'set']))))
-
- if (start):
- self.set_mode(MODE.Statement)
- self.indent()
-
- self.handle_whitespace_and_comments(current_token, True)
-
- # Issue #276:
- # If starting a new statement with [if, for, while, do], push to a new line.
- # if (a) if (b) if(c) d(); else e(); else f();
- if not self.start_of_object_property():
- self.allow_wrap_or_preserved_newline(
- current_token, reserved_array(current_token, ['do', 'for', 'if', 'while']))
- return True
- else:
- return False
-
- def handle_start_expr(self, current_token):
- if self.start_of_statement(current_token):
- # The conditional starts the statement if appropriate.
- pass
- else:
- self.handle_whitespace_and_comments(current_token)
-
- next_mode = MODE.Expression
-
- if current_token.text == '[':
- if self._flags.last_token.type == TOKEN.WORD or self._flags.last_token.text == ')':
- if reserved_array(self._flags.last_token, Tokenizer.line_starters):
- self._output.space_before_token = True
- self.print_token(current_token)
- self.set_mode(next_mode)
- self.indent()
- if self._options.space_in_paren:
- self._output.space_before_token = True
- return
-
- next_mode = MODE.ArrayLiteral
-
- if self.is_array(self._flags.mode):
- if self._flags.last_token.text == '[' or (
- self._flags.last_token.text == ',' and (
- self._last_last_text == ']' or self._last_last_text == '}')):
- # ], [ goes to a new line
- # }, [ goes to a new line
- if not self._options.keep_array_indentation:
- self.print_newline()
-
- if self._flags.last_token.type not in [
- TOKEN.START_EXPR,
- TOKEN.END_EXPR,
- TOKEN.WORD,
- TOKEN.OPERATOR]:
- self._output.space_before_token = True
-
- else:
- if self._flags.last_token.type == TOKEN.RESERVED:
- if self._flags.last_token.text == 'for':
- self._output.space_before_token = self._options.space_before_conditional
- next_mode = MODE.ForInitializer
- elif self._flags.last_token.text in ['if', 'while']:
- self._output.space_before_token = self._options.space_before_conditional
- next_mode = MODE.Conditional
- elif self._flags.last_word in ['await', 'async']:
- # Should be a space between await and an IIFE, or async and
- # an arrow function
- self._output.space_before_token = True
- elif self._flags.last_token.text == 'import' and current_token.whitespace_before == '':
- self._output.space_before_token = False
- elif self._flags.last_token.text in Tokenizer.line_starters or self._flags.last_token.text == 'catch':
- self._output.space_before_token = True
-
- elif self._flags.last_token.type in [TOKEN.EQUALS, TOKEN.OPERATOR]:
- # Support of this kind of newline preservation:
- # a = (b &&
- # (c || d));
- if not self.start_of_object_property():
- self.allow_wrap_or_preserved_newline(current_token)
- elif self._flags.last_token.type == TOKEN.WORD:
- self._output.space_before_token = False
- # function name() vs function name ()
- # function* name() vs function* name ()
- # async name() vs async name ()
- # In ES6, you can also define the method properties of an object
- # var obj = {a: function() {}}
- # It can be abbreviated
- # var obj = {a() {}}
- # var obj = { a() {}} vs var obj = { a () {}}
- # var obj = { * a() {}} vs var obj = { * a () {}}
- peek_back_two = self._tokens.peek(-3)
- if self._options.space_after_named_function and peek_back_two:
- # peek starts at next character so -1 is current token
- peek_back_three = self._tokens.peek(-4)
- if reserved_array(peek_back_two, ['async', 'function']) or (
- peek_back_two.text == '*' and
- reserved_array(peek_back_three, ['async', 'function'])):
- self._output.space_before_token = True
- elif self._flags.mode == MODE.ObjectLiteral:
- if (peek_back_two.text == '{' or peek_back_two.text == ',') or (
- peek_back_two.text == '*' and (
- peek_back_three.text == '{' or peek_back_three.text == ',')):
- self._output.space_before_token = True
- else:
- # Support preserving wrapped arrow function expressions
- # a.b('c',
- # () => d.e
- # )
- self.allow_wrap_or_preserved_newline(current_token)
-
- # function() vs function (), typeof() vs typeof ()
- # function*() vs function* (), yield*() vs yield* ()
- if (
- self._flags.last_token.type == TOKEN.RESERVED and (
- self._flags.last_word == 'function' or self._flags.last_word == 'typeof')) or (
- self._flags.last_token.text == '*' and (
- self._last_last_text in [
- 'function', 'yield'] or (
- self._flags.mode == MODE.ObjectLiteral and self._last_last_text in [
- '{', ',']))):
- self._output.space_before_token = self._options.space_after_anon_function
-
- if self._flags.last_token.text == ';' or self._flags.last_token.type == TOKEN.START_BLOCK:
- self.print_newline()
- elif self._flags.last_token.type in [TOKEN.END_EXPR, TOKEN.START_EXPR, TOKEN.END_BLOCK, TOKEN.COMMA] or self._flags.last_token.text == '.':
- # do nothing on (( and )( and ][ and ]( and .(
- # TODO: Consider whether forcing this is required. Review failing
- # tests when removed.
- self.allow_wrap_or_preserved_newline(
- current_token, current_token.newlines)
-
- self.print_token(current_token)
- self.set_mode(next_mode)
-
- if self._options.space_in_paren:
- self._output.space_before_token = True
-
- # In all cases, if we newline while inside an expression it should be
- # indented.
- self.indent()
-
- def handle_end_expr(self, current_token):
- # statements inside expressions are not valid syntax, but...
- # statements must all be closed when their container closes
- while self._flags.mode == MODE.Statement:
- self.restore_mode()
-
- self.handle_whitespace_and_comments(current_token)
-
- if self._flags.multiline_frame:
- self.allow_wrap_or_preserved_newline(
- current_token, current_token.text == ']' and self.is_array(
- self._flags.mode) and not self._options.keep_array_indentation)
-
- if self._options.space_in_paren:
- if self._flags.last_token.type == TOKEN.START_EXPR and not self._options.space_in_empty_paren:
- # empty parens are always "()" and "[]", not "( )" or "[ ]"
- self._output.space_before_token = False
- self._output.trim()
- else:
- self._output.space_before_token = True
-
- self.deindent()
- self.print_token(current_token)
- self.restore_mode()
-
- remove_redundant_indentation(self._output, self._previous_flags)
-
- # do {} while () // no statement required after
- if self._flags.do_while and self._previous_flags.mode == MODE.Conditional:
- self._previous_flags.mode = MODE.Expression
- self._flags.do_block = False
- self._flags.do_while = False
-
- def handle_start_block(self, current_token):
- self.handle_whitespace_and_comments(current_token)
-
- # Check if this is a BlockStatement that should be treated as a
- # ObjectLiteral
- next_token = self._tokens.peek()
- second_token = self._tokens.peek(1)
- if self._flags.last_word == 'switch' and \
- self._flags.last_token.type == TOKEN.END_EXPR:
- self.set_mode(MODE.BlockStatement)
- self._flags.in_case_statement = True
- elif self._flags.case_body:
- self.set_mode(MODE.BlockStatement)
- elif second_token is not None and (
- (second_token.text in [
- ':',
- ','] and next_token.type in [
- TOKEN.STRING,
- TOKEN.WORD,
- TOKEN.RESERVED]) or (
- next_token.text in [
- 'get',
- 'set',
- '...'] and second_token.type in [
- TOKEN.WORD,
- TOKEN.RESERVED])):
- # We don't support TypeScript,but we didn't break it for a very long time.
- # We'll try to keep not breaking it.
- if self._last_last_text not in ['class', 'interface']:
- self.set_mode(MODE.ObjectLiteral)
- else:
- self.set_mode(MODE.BlockStatement)
- elif self._flags.last_token.type == TOKEN.OPERATOR and self._flags.last_token.text == '=>':
- # arrow function: (param1, paramN) => { statements }
- self.set_mode(MODE.BlockStatement)
- elif self._flags.last_token.type in [TOKEN.EQUALS, TOKEN.START_EXPR, TOKEN.COMMA, TOKEN.OPERATOR] or \
- reserved_array(self._flags.last_token, ['return', 'throw', 'import', 'default']):
- # Detecting shorthand function syntax is difficult by scanning forward,
- # so check the surrounding context.
- # If the block is being returned, imported, export default, passed as arg,
- # assigned with = or assigned in a nested object, treat as an
- # ObjectLiteral.
- self.set_mode(MODE.ObjectLiteral)
- else:
- self.set_mode(MODE.BlockStatement)
-
- empty_braces = (next_token is not None) and \
- next_token.comments_before is None and next_token.text == '}'
- empty_anonymous_function = empty_braces and self._flags.last_word == 'function' and \
- self._flags.last_token.type == TOKEN.END_EXPR
-
- if self._options.brace_preserve_inline: # check for inline, set inline_frame if so
- # search forward for newline wanted inside this block
- index = 0
- check_token = None
- self._flags.inline_frame = True
- do_loop = True
- while (do_loop):
- index += 1
- check_token = self._tokens.peek(index - 1)
- if check_token.newlines:
- self._flags.inline_frame = False
-
- do_loop = (
- check_token.type != TOKEN.EOF and not (
- check_token.type == TOKEN.END_BLOCK and check_token.opened == current_token))
-
- if (self._options.brace_style == 'expand' or (self._options.brace_style ==
- 'none' and current_token.newlines)) and not self._flags.inline_frame:
- if self._flags.last_token.type != TOKEN.OPERATOR and (
- empty_anonymous_function or self._flags.last_token.type == TOKEN.EQUALS or (
- reserved_array(self._flags.last_token, _special_word_set) and self._flags.last_token.text != 'else')):
- self._output.space_before_token = True
- else:
- self.print_newline(preserve_statement_flags=True)
- else: # collapse || inline_frame
- if self.is_array(
- self._previous_flags.mode) and (
- self._flags.last_token.type == TOKEN.START_EXPR or self._flags.last_token.type == TOKEN.COMMA):
- # if we're preserving inline,
- # allow newline between comma and next brace.
- if self._flags.inline_frame:
- self.allow_wrap_or_preserved_newline(current_token)
- self._flags.inline_frame = True
- self._previous_flags.multiline_frame = self._previous_flags.multiline_frame or self._flags.multiline_frame
- self._flags.multiline_frame = False
- elif self._flags.last_token.type == TOKEN.COMMA:
- self._output.space_before_token = True
-
- elif self._flags.last_token.type not in [TOKEN.OPERATOR, TOKEN.START_EXPR]:
- if self._flags.last_token.type == TOKEN.START_BLOCK and not self._flags.inline_frame:
- self.print_newline()
- else:
- self._output.space_before_token = True
-
- self.print_token(current_token)
- self.indent()
-
- # Except for specific cases, open braces are followed by a new line.
- if not empty_braces and not (
- self._options.brace_preserve_inline and
- self._flags.inline_frame):
- self.print_newline()
-
-
- def handle_end_block(self, current_token):
- # statements must all be closed when their container closes
- self.handle_whitespace_and_comments(current_token)
-
- while self._flags.mode == MODE.Statement:
- self.restore_mode()
-
- empty_braces = self._flags.last_token.type == TOKEN.START_BLOCK
-
- # try inline_frame (only set if opt.braces-preserve-inline) first
- if self._flags.inline_frame and not empty_braces:
- self._output.space_before_token = True
- elif self._options.brace_style == 'expand':
- if not empty_braces:
- self.print_newline()
- else:
- # skip {}
- if not empty_braces:
- if self.is_array(
- self._flags.mode) and self._options.keep_array_indentation:
- self._options.keep_array_indentation = False
- self.print_newline()
- self._options.keep_array_indentation = True
- else:
- self.print_newline()
-
- self.restore_mode()
- self.print_token(current_token)
-
- def handle_word(self, current_token):
- if current_token.type == TOKEN.RESERVED:
- if current_token.text in [
- 'set', 'get'] and self._flags.mode != MODE.ObjectLiteral:
- current_token.type = TOKEN.WORD
- elif current_token.text == 'import' and self._tokens.peek().text == '(':
- current_token.type = TOKEN.WORD
- elif current_token.text in ['as', 'from'] and not self._flags.import_block:
- current_token.type = TOKEN.WORD
- elif self._flags.mode == MODE.ObjectLiteral:
- next_token = self._tokens.peek()
- if next_token.text == ':':
- current_token.type = TOKEN.WORD
-
- if self.start_of_statement(current_token):
- # The conditional starts the statement if appropriate.
- if reserved_array(self._flags.last_token, ['var', 'let', 'const']) and \
- current_token.type == TOKEN.WORD:
- self._flags.declaration_statement = True
-
- elif current_token.newlines and \
- not self.is_expression(self._flags.mode) and \
- (self._flags.last_token.type != TOKEN.OPERATOR or (self._flags.last_token.text == '--' or self._flags.last_token.text == '++')) and \
- self._flags.last_token.type != TOKEN.EQUALS and \
- (self._options.preserve_newlines or not reserved_array(self._flags.last_token, ['var', 'let', 'const', 'set', 'get'])):
- self.handle_whitespace_and_comments(current_token)
- self.print_newline()
- else:
- self.handle_whitespace_and_comments(current_token)
-
- if self._flags.do_block and not self._flags.do_while:
- if reserved_word(current_token, 'while'):
- # do {} ## while ()
- self._output.space_before_token = True
- self.print_token(current_token)
- self._output.space_before_token = True
- self._flags.do_while = True
- return
- else:
- # do {} should always have while as the next word.
- # if we don't see the expected while, recover
- self.print_newline()
- self._flags.do_block = False
-
- # if may be followed by else, or not
- # Bare/inline ifs are tricky
- # Need to unwind the modes correctly: if (a) if (b) c(); else d(); else
- # e();
- if self._flags.if_block:
- if (not self._flags.else_block) and reserved_word(current_token, 'else'):
- self._flags.else_block = True
- else:
- while self._flags.mode == MODE.Statement:
- self.restore_mode()
-
- self._flags.if_block = False
-
- if self._flags.in_case_statement and reserved_array(current_token, ['case', 'default']):
- self.print_newline()
- if self._flags.last_token.type != TOKEN.END_BLOCK and (
- self._flags.case_body or self._options.jslint_happy):
- self.deindent()
- self._flags.case_body = False
- self.print_token(current_token)
- self._flags.in_case = True
- return
-
- if self._flags.last_token.type in [
- TOKEN.COMMA,
- TOKEN.START_EXPR,
- TOKEN.EQUALS,
- TOKEN.OPERATOR]:
- if not self.start_of_object_property():
- self.allow_wrap_or_preserved_newline(current_token)
-
- if reserved_word(current_token, 'function'):
- if (self._flags.last_token.text in ['}', ';'] or (self._output.just_added_newline() and not (
- self._flags.last_token.text in ['(', '[', '{', ':', '=', ','] or self._flags.last_token.type == TOKEN.OPERATOR))):
- # make sure there is a nice clean space of at least one blank line
- # before a new function definition, except in arrays
- if not self._output.just_added_blankline() and \
- current_token.comments_before is None:
- self.print_newline()
- self.print_newline(True)
-
- if self._flags.last_token.type == TOKEN.RESERVED or self._flags.last_token.type == TOKEN.WORD:
- if reserved_array(self._flags.last_token, ['get', 'set', 'new', 'export']) or \
- reserved_array(self._flags.last_token, self._newline_restricted_tokens):
- self._output.space_before_token = True
- elif reserved_word(self._flags.last_token, 'default') and self._last_last_text == 'export':
- self._output.space_before_token = True
- elif self._flags.last_token.text == 'declare':
- # accomodates Typescript declare function formatting
- self._output.space_before_token = True
- else:
- self.print_newline()
- elif self._flags.last_token.type == TOKEN.OPERATOR or self._flags.last_token.text == '=':
- # foo = function
- self._output.space_before_token = True
- elif not self._flags.multiline_frame and (self.is_expression(self._flags.mode) or self.is_array(self._flags.mode)):
- # (function
- pass
- else:
- self.print_newline()
-
- self.print_token(current_token)
- self._flags.last_word = current_token.text
- return
-
- prefix = 'NONE'
-
- if self._flags.last_token.type == TOKEN.END_BLOCK:
- if self._previous_flags.inline_frame:
- prefix = 'SPACE'
- elif not reserved_array(current_token, ['else', 'catch', 'finally', 'from']):
- prefix = 'NEWLINE'
- else:
- if self._options.brace_style in ['expand', 'end-expand'] or (
- self._options.brace_style == 'none' and current_token.newlines):
- prefix = 'NEWLINE'
- else:
- prefix = 'SPACE'
- self._output.space_before_token = True
- elif self._flags.last_token.type == TOKEN.SEMICOLON and self._flags.mode == MODE.BlockStatement:
- # TODO: Should this be for STATEMENT as well?
- prefix = 'NEWLINE'
- elif self._flags.last_token.type == TOKEN.SEMICOLON and self.is_expression(self._flags.mode):
- prefix = 'SPACE'
- elif self._flags.last_token.type == TOKEN.STRING:
- prefix = 'NEWLINE'
- elif self._flags.last_token.type == TOKEN.RESERVED or self._flags.last_token.type == TOKEN.WORD or \
- (self._flags.last_token.text == '*' and (
- self._last_last_text in ['function', 'yield'] or
- (self._flags.mode == MODE.ObjectLiteral and self._last_last_text in ['{', ',']))):
- prefix = 'SPACE'
- elif self._flags.last_token.type == TOKEN.START_BLOCK:
- if self._flags.inline_frame:
- prefix = 'SPACE'
- else:
- prefix = 'NEWLINE'
- elif self._flags.last_token.type == TOKEN.END_EXPR:
- self._output.space_before_token = True
- prefix = 'NEWLINE'
-
- if reserved_array(current_token, Tokenizer.line_starters) and self._flags.last_token.text != ')':
- if self._flags.inline_frame or self._flags.last_token.text == 'else ' or self._flags.last_token.text == 'export':
- prefix = 'SPACE'
- else:
- prefix = 'NEWLINE'
-
- if reserved_array(current_token, ['else', 'catch', 'finally']):
- if ((not (self._flags.last_token.type == TOKEN.END_BLOCK and self._previous_flags.mode == MODE.BlockStatement))
- or self._options.brace_style == 'expand'
- or self._options.brace_style == 'end-expand'
- or (self._options.brace_style == 'none' and current_token.newlines)) \
- and not self._flags.inline_frame:
- self.print_newline()
- else:
- self._output.trim(True)
- # If we trimmed and there's something other than a close block before us
- # put a newline back in. Handles '} // comment' scenario.
- if self._output.current_line.last() != '}':
- self.print_newline()
-
- self._output.space_before_token = True
-
- elif prefix == 'NEWLINE':
- if reserved_array(self._flags.last_token, _special_word_set):
- # no newline between return nnn
- self._output.space_before_token = True
- elif self._flags.last_token.text == 'declare' and reserved_array(current_token, [
- 'var',
- 'let',
- 'const']):
- # accomodates Typescript declare formatting
- self._output.space_before_token = True
- elif self._flags.last_token.type != TOKEN.END_EXPR:
- if (
- self._flags.last_token.type != TOKEN.START_EXPR or not (
- reserved_array(current_token, [
- 'var',
- 'let',
- 'const']))) and self._flags.last_token.text != ':':
- # no need to force newline on VAR -
- # for (var x = 0...
- if reserved_word(current_token, 'if') and self._flags.last_token.text == 'else':
- self._output.space_before_token = True
- else:
- self.print_newline()
- elif reserved_array(current_token, Tokenizer.line_starters) and self._flags.last_token.text != ')':
- self.print_newline()
- elif self._flags.multiline_frame and self.is_array(self._flags.mode) and self._flags.last_token.text == ',' and self._last_last_text == '}':
- self.print_newline() # }, in lists get a newline
- elif prefix == 'SPACE':
- self._output.space_before_token = True
-
- if current_token.previous and (current_token.previous.type == TOKEN.WORD or
- current_token.previous.type == TOKEN.RESERVED):
- self._output.space_before_token = True
-
- self.print_token(current_token)
- self._flags.last_word = current_token.text
-
- if current_token.type == TOKEN.RESERVED:
- if current_token.text == 'do':
- self._flags.do_block = True
- elif current_token.text == 'if':
- self._flags.if_block = True
- elif current_token.text == 'import':
- self._flags.import_block = True
- elif current_token.text == 'from' and self._flags.import_block:
- self._flags.import_block = False
-
- def handle_semicolon(self, current_token):
- if self.start_of_statement(current_token):
- # The conditional starts the statement if appropriate.
- # Semicolon can be the start (and end) of a statement
- self._output.space_before_token = False
- else:
- self.handle_whitespace_and_comments(current_token)
-
- next_token = self._tokens.peek()
- while (self._flags.mode == MODE.Statement and
- not (self._flags.if_block and reserved_word(next_token, 'else')) and
- not self._flags.do_block):
- self.restore_mode()
-
- if self._flags.import_block:
- self._flags.import_block = False
-
- self.print_token(current_token)
-
- def handle_string(self, current_token):
- if self.start_of_statement(current_token):
- # The conditional starts the statement if appropriate.
- # One difference - strings want at least a space before
- self._output.space_before_token = True
- else:
- self.handle_whitespace_and_comments(current_token)
-
- if self._flags.last_token.type == TOKEN.RESERVED or self._flags.last_token.type == TOKEN.WORD or self._flags.inline_frame:
- self._output.space_before_token = True
- elif self._flags.last_token.type in [TOKEN.COMMA, TOKEN.START_EXPR, TOKEN.EQUALS, TOKEN.OPERATOR]:
- if not self.start_of_object_property():
- self.allow_wrap_or_preserved_newline(current_token)
- else:
- self.print_newline()
-
- self.print_token(current_token)
-
- def handle_equals(self, current_token):
- if self.start_of_statement(current_token):
- # The conditional starts the statement if appropriate.
- pass
- else:
- self.handle_whitespace_and_comments(current_token)
-
- if self._flags.declaration_statement:
- # just got an '=' in a var-line, different line breaking rules will
- # apply
- self._flags.declaration_assignment = True
-
- self._output.space_before_token = True
- self.print_token(current_token)
- self._output.space_before_token = True
-
- def handle_comma(self, current_token):
- self.handle_whitespace_and_comments(current_token, True)
-
- self.print_token(current_token)
- self._output.space_before_token = True
-
- if self._flags.declaration_statement:
- if self.is_expression(self._flags.parent.mode):
- # do not break on comma, for ( var a = 1, b = 2
- self._flags.declaration_assignment = False
-
- if self._flags.declaration_assignment:
- self._flags.declaration_assignment = False
- self.print_newline(preserve_statement_flags=True)
- elif self._options.comma_first:
- # for comma-first, we want to allow a newline before the comma
- # to turn into a newline after the comma, which we will fixup
- # later
- self.allow_wrap_or_preserved_newline(current_token)
-
- elif self._flags.mode == MODE.ObjectLiteral \
- or (self._flags.mode == MODE.Statement and self._flags.parent.mode == MODE.ObjectLiteral):
- if self._flags.mode == MODE.Statement:
- self.restore_mode()
-
- if not self._flags.inline_frame:
- self.print_newline()
- elif self._options.comma_first:
- # EXPR or DO_BLOCK
- # for comma-first, we want to allow a newline before the comma
- # to turn into a newline after the comma, which we will fixup later
- self.allow_wrap_or_preserved_newline(current_token)
-
- def handle_operator(self, current_token):
- isGeneratorAsterisk = current_token.text == '*' and \
- (reserved_array(self._flags.last_token, ['function', 'yield']) or
- (self._flags.last_token.type in [TOKEN.START_BLOCK, TOKEN.COMMA, TOKEN.END_BLOCK, TOKEN.SEMICOLON]))
- isUnary = current_token.text in ['+', '-'] \
- and (self._flags.last_token.type in [TOKEN.START_BLOCK, TOKEN.START_EXPR, TOKEN.EQUALS, TOKEN.OPERATOR]
- or self._flags.last_token.text in Tokenizer.line_starters or self._flags.last_token.text == ',')
-
- if self.start_of_statement(current_token):
- # The conditional starts the statement if appropriate.
- pass
- else:
- preserve_statement_flags = not isGeneratorAsterisk
- self.handle_whitespace_and_comments(
- current_token, preserve_statement_flags)
-
- if reserved_array(self._flags.last_token, _special_word_set):
- # return had a special handling in TK_WORD
- self._output.space_before_token = True
- self.print_token(current_token)
- return
-
- # hack for actionscript's import .*;
- if current_token.text == '*' and self._flags.last_token.type == TOKEN.DOT:
- self.print_token(current_token)
- return
-
- if current_token.text == '::':
- # no spaces around the exotic namespacing syntax operator
- self.print_token(current_token)
- return
-
- # Allow line wrapping between operators when operator_position is
- # set to before or preserve
- if self._flags.last_token.type == TOKEN.OPERATOR and self._options.operator_position in OPERATOR_POSITION_BEFORE_OR_PRESERVE:
- self.allow_wrap_or_preserved_newline(current_token)
-
- if current_token.text == ':' and self._flags.in_case:
- self.print_token(current_token)
- self._flags.in_case = False
- self._flags.case_body = True
- if self._tokens.peek().type != TOKEN.START_BLOCK:
- self.indent()
- self.print_newline()
- else:
- self._output.space_before_token = True
-
- return
-
- space_before = True
- space_after = True
- in_ternary = False
-
- if current_token.text == ':':
- if self._flags.ternary_depth == 0:
- # Colon is invalid javascript outside of ternary and object,
- # but do our best to guess what was meant.
- space_before = False
- else:
- self._flags.ternary_depth -= 1
- in_ternary = True
- elif current_token.text == '?':
- self._flags.ternary_depth += 1
-
- # let's handle the operator_position option prior to any conflicting
- # logic
- if (not isUnary) and (not isGeneratorAsterisk) and \
- self._options.preserve_newlines and current_token.text in Tokenizer.positionable_operators:
-
- isColon = current_token.text == ':'
- isTernaryColon = isColon and in_ternary
- isOtherColon = isColon and not in_ternary
-
- if self._options.operator_position == OPERATOR_POSITION['before_newline']:
- # if the current token is : and it's not a ternary statement
- # then we set space_before to false
- self._output.space_before_token = not isOtherColon
-
- self.print_token(current_token)
-
- if (not isColon) or isTernaryColon:
- self.allow_wrap_or_preserved_newline(current_token)
-
- self._output.space_before_token = True
-
- return
-
- elif self._options.operator_position == OPERATOR_POSITION['after_newline']:
- # if the current token is anything but colon, or (via deduction) it's a colon and in a ternary statement,
- # then print a newline.
- self._output.space_before_token = True
-
- if (not isColon) or isTernaryColon:
- if self._tokens.peek().newlines:
- self.print_newline(preserve_statement_flags=True)
- else:
- self.allow_wrap_or_preserved_newline(current_token)
- else:
- self._output.space_before_token = False
-
- self.print_token(current_token)
-
- self._output.space_before_token = True
- return
-
- elif self._options.operator_position == OPERATOR_POSITION['preserve_newline']:
- if not isOtherColon:
- self.allow_wrap_or_preserved_newline(current_token)
-
- # if we just added a newline, or the current token is : and it's not a ternary statement,
- # then we set space_before to false
- self._output.space_before_token = not (
- self._output.just_added_newline() or isOtherColon)
-
- self.print_token(current_token)
-
- self._output.space_before_token = True
- return
-
- if isGeneratorAsterisk:
- self.allow_wrap_or_preserved_newline(current_token)
- space_before = False
- next_token = self._tokens.peek()
- space_after = next_token and next_token.type in [
- TOKEN.WORD, TOKEN.RESERVED]
- elif current_token.text == '...':
- self.allow_wrap_or_preserved_newline(current_token)
- space_before = self._flags.last_token.type == TOKEN.START_BLOCK
- space_after = False
- elif current_token.text in ['--', '++', '!', '~'] or isUnary:
- if self._flags.last_token.type == TOKEN.COMMA or self._flags.last_token.type == TOKEN.START_EXPR:
- self.allow_wrap_or_preserved_newline(current_token)
-
- space_before = False
- space_after = False
-
- # http://www.ecma-international.org/ecma-262/5.1/#sec-7.9.1
- # if there is a newline between -- or ++ and anything else we
- # should preserve it.
- if current_token.newlines and (
- current_token.text == '--' or current_token.text == '++'):
- self.print_newline(preserve_statement_flags=True)
-
- if self._flags.last_token.text == ';' and self.is_expression(
- self._flags.mode):
- # for (;; ++i)
- # ^^
- space_before = True
-
- if self._flags.last_token.type == TOKEN.RESERVED:
- space_before = True
- elif self._flags.last_token.type == TOKEN.END_EXPR:
- space_before = not (
- self._flags.last_token.text == ']' and current_token.text in [
- '--', '++'])
- elif self._flags.last_token.type == TOKEN.OPERATOR:
- # a++ + ++b
- # a - -b
- space_before = current_token.text in [
- '--', '-', '++', '+'] and self._flags.last_token.text in ['--', '-', '++', '+']
- # + and - are not unary when preceeded by -- or ++ operator
- # a-- + b
- # a * +b
- # a - -b
- if current_token.text in [
- '-', '+'] and self._flags.last_token.text in ['--', '++']:
- space_after = True
-
- if (((self._flags.mode == MODE.BlockStatement and not self._flags.inline_frame)
- or self._flags.mode == MODE.Statement) and self._flags.last_token.text in ['{', ';']):
- # { foo: --i }
- # foo(): --bar
- self.print_newline()
-
- if space_before:
- self._output.space_before_token = True
-
- self.print_token(current_token)
-
- if space_after:
- self._output.space_before_token = True
-
- def handle_block_comment(self, current_token, preserve_statement_flags):
- if self._output.raw:
- self._output.add_raw_token(current_token)
- if current_token.directives and current_token.directives.get(
- 'preserve') == 'end':
- # If we're testing the raw output behavior, do not allow a
- # directive to turn it off.
- self._output.raw = self._options.test_output_raw
- return
-
- if current_token.directives:
- self.print_newline(
- preserve_statement_flags=preserve_statement_flags)
- self.print_token(current_token)
- if current_token.directives.get('preserve') == 'start':
- self._output.raw = True
-
- self.print_newline(preserve_statement_flags=True)
- return
-
- # inline block
- if not self.acorn.newline.search(
- current_token.text) and not current_token.newlines:
- self._output.space_before_token = True
- self.print_token(current_token)
- self._output.space_before_token = True
- return
-
- lines = self.acorn.allLineBreaks.split(current_token.text)
- javadoc = False
- starless = False
- last_indent = current_token.whitespace_before
- last_indent_length = len(last_indent)
-
- # block comment starts with a new line
- self.print_newline(preserve_statement_flags=preserve_statement_flags)
-
- # first line always indented
- self.print_token(current_token, lines[0])
- self.print_newline(preserve_statement_flags=preserve_statement_flags)
-
- if len(lines) > 1:
- lines = lines[1:]
- javadoc = not any(l for l in lines if (
- l.strip() == '' or (l.lstrip())[0] != '*'))
- starless = all(l.startswith(last_indent)
- or l.strip() == '' for l in lines)
-
- if javadoc:
- self._flags.alignment = 1
-
- for line in lines:
- if javadoc:
- # javadoc: reformat and re-indent
- self.print_token(current_token, line.lstrip())
- elif starless and len(line) > last_indent_length:
- # starless: re-indent non-empty content, avoiding trim
- self.print_token(current_token, line[last_indent_length:])
- else:
- # normal comments output raw
- self._output.current_line.set_indent(-1)
- self._output.add_token(line)
-
- # for comments on their own line or more than one line,
- # make sure there's a new line after
- self.print_newline(preserve_statement_flags=preserve_statement_flags)
-
- self._flags.alignment = 0
-
- def handle_comment(self, current_token, preserve_statement_flags):
- if current_token.newlines:
- self.print_newline(
- preserve_statement_flags=preserve_statement_flags)
-
- if not current_token.newlines:
- self._output.trim(True)
-
- self._output.space_before_token = True
- self.print_token(current_token)
- self.print_newline(preserve_statement_flags=preserve_statement_flags)
-
- def handle_dot(self, current_token):
- if self.start_of_statement(current_token):
- # The conditional starts the statement if appropriate.
- pass
- else:
- self.handle_whitespace_and_comments(current_token, True)
-
- if reserved_array(self._flags.last_token, _special_word_set):
- self._output.space_before_token = False
- else:
- # allow preserved newlines before dots in general
- # force newlines on dots after close paren when break_chained - for
- # bar().baz()
- self.allow_wrap_or_preserved_newline(
- current_token, self._flags.last_token.text == ')' and
- self._options.break_chained_methods)
-
- # Only unindent chained method dot if this dot starts a new line.
- # Otherwise the automatic extra indentation removal
- # will handle any over indent
- if self._options.unindent_chained_methods and \
- self._output.just_added_newline():
- self.deindent()
-
- self.print_token(current_token)
-
- def handle_unknown(self, current_token, preserve_statement_flags):
- self.print_token(current_token)
- if current_token.text[-1] == '\n':
- self.print_newline(
- preserve_statement_flags=preserve_statement_flags)
-
- def handle_eof(self, current_token):
- # Unwind any open statements
- while self._flags.mode == MODE.Statement:
- self.restore_mode()
-
- self.handle_whitespace_and_comments(current_token)
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/javascript/__init__.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/javascript/__init__.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/javascript/__init__.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/javascript/__init__.py 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-# Empty file :)
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/javascript/options.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/javascript/options.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/javascript/options.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/javascript/options.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,94 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-
-from ..core.options import Options as BaseOptions
-
-OPERATOR_POSITION = [
- 'before-newline',
- 'after-newline',
- 'preserve-newline'
-]
-
-class BeautifierOptions(BaseOptions):
- def __init__(self, options=None):
- BaseOptions.__init__(self, options, 'js')
-
- self.css = None
- self.js = None
- self.html = None
-
- # compatibility, re
-
- raw_brace_style = getattr(self.raw_options, 'brace_style', None)
- if raw_brace_style == "expand-strict": # graceful handling of deprecated option
- setattr(self.raw_options, 'brace_style', "expand")
- elif raw_brace_style == "collapse-preserve-inline": # graceful handling of deprecated option
- setattr(self.raw_options, 'brace_style', "collapse,preserve-inline")
- # elif bool(self.raw_options.braces_on_own_line): # graceful handling of deprecated option
- # raw_brace_style = "expand": "collapse"
- # elif raw_brace_style is None: # Nothing exists to set it
- # setattr(self.raw_options, 'brace_style', "collapse")
-
- # preserve-inline in delimited string will trigger brace_preserve_inline, everything
- # else is considered a brace_style and the last one only will have an effect
-
- brace_style_split = self._get_selection_list('brace_style', ['collapse', 'expand', 'end-expand', 'none', 'preserve-inline'])
-
- # preserve-inline in delimited string will trigger brace_preserve_inline
- # Everything else is considered a brace_style and the last one only will
- # have an effect
- # specify defaults in case one half of meta-option is missing
- self.brace_preserve_inline = False
- self.brace_style = "collapse"
-
- for bs in brace_style_split:
- if bs == "preserve-inline":
- self.brace_preserve_inline = True
- else:
- self.brace_style = bs
-
- self.unindent_chained_methods = self._get_boolean('unindent_chained_methods')
- self.break_chained_methods = self._get_boolean('break_chained_methods')
- self.space_in_paren = self._get_boolean('space_in_paren')
- self.space_in_empty_paren = self._get_boolean('space_in_empty_paren')
- self.jslint_happy = self._get_boolean('jslint_happy')
- self.space_after_anon_function = self._get_boolean('space_after_anon_function')
- self.space_after_named_function = self._get_boolean('space_after_named_function')
- self.keep_array_indentation = self._get_boolean('keep_array_indentation')
- self.space_before_conditional = self._get_boolean('space_before_conditional', True)
- self.unescape_strings = self._get_boolean('unescape_strings')
- self.e4x = self._get_boolean('e4x')
- self.comma_first = self._get_boolean('comma_first')
- self.operator_position = self._get_selection('operator_position', OPERATOR_POSITION)
-
- # For testing of beautify preserve:start directive
- self.test_output_raw = False
- self.editorconfig = False
-
- # force opts.space_after_anon_function to true if opts.jslint_happy
- if self.jslint_happy:
- self.space_after_anon_function = True
-
- self.eval_code = False
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/javascript/tokenizer.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/javascript/tokenizer.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/javascript/tokenizer.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/javascript/tokenizer.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,562 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-import re
-from ..core.inputscanner import InputScanner
-from ..core.tokenizer import TokenTypes as BaseTokenTypes
-from ..core.tokenizer import Tokenizer as BaseTokenizer
-from ..core.tokenizer import TokenizerPatterns as BaseTokenizerPatterns
-from ..core.directives import Directives
-
-from ..core.pattern import Pattern
-from ..core.templatablepattern import TemplatablePattern
-
-
-__all__ = ["TOKEN", "Tokenizer", "TokenTypes"]
-
-class TokenTypes(BaseTokenTypes):
- START_EXPR = 'TK_START_EXPR'
- END_EXPR = 'TK_END_EXPR'
- START_BLOCK = 'TK_START_BLOCK'
- END_BLOCK = 'TK_END_BLOCK'
- WORD = 'TK_WORD'
- RESERVED = 'TK_RESERVED'
- SEMICOLON = 'TK_SEMICOLON'
- STRING = 'TK_STRING'
- EQUALS = 'TK_EQUALS'
- OPERATOR = 'TK_OPERATOR'
- COMMA = 'TK_COMMA'
- BLOCK_COMMENT = 'TK_BLOCK_COMMENT'
- COMMENT = 'TK_COMMENT'
- DOT = 'TK_DOT'
- UNKNOWN = 'TK_UNKNOWN'
-
- def __init__(self):
- pass
-
-
-TOKEN = TokenTypes()
-
-dot_pattern = re.compile(r'[^\d\.]')
-
-number_pattern = re.compile(
- r'0[xX][0123456789abcdefABCDEF]*|0[oO][01234567]*|0[bB][01]*|\d+n|(?:\.\d+|\d+\.?\d*)(?:[eE][+-]?\d+)?')
-digit = re.compile(r'[0-9]')
-
-
-positionable_operators = frozenset(
- (">>> === !== " +
- "<< && >= ** != == <= >> || |> " +
- "< / - + > : & % ? ^ | *").split(' '))
-
-punct = (">>>= " +
- "... >>= <<= === >>> !== **= " +
- "=> ^= :: /= << <= == && -= >= >> != -- += ** || ++ %= &= *= |= |> " +
- "= ! ? > < : / ^ - + * & % ~ |")
-
-punct = re.compile(r'([-[\]{}()*+?.,\\^$|#])').sub(r'\\\1', punct)
-# ?. but not if followed by a number
-punct = '\\?\\.(?!\\d) ' + punct
-punct = punct.replace(' ', '|')
-
-punct_pattern = re.compile(punct)
-
-# Words which always should start on a new line
-line_starters = frozenset(
- ('continue,try,throw,return,var,let,const,if,switch,case,default,for,' +
- 'while,break,function,import,export').split(','))
-reserved_words = line_starters | frozenset(['do',
- 'in',
- 'of',
- 'else',
- 'get',
- 'set',
- 'new',
- 'catch',
- 'finally',
- 'typeof',
- 'yield',
- 'async',
- 'await',
- 'from',
- 'as'])
-
-reserved_word_pattern = re.compile(r'^(?:' + '|'.join(reserved_words) + r')$')
-
-directives_core = Directives(r'/\*', r'\*/')
-
-xmlRegExp = re.compile(
- r'[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[\s\S]+?}|!\[CDATA\[[\s\S]*?\]\])(\s+{[\s\S]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*(\'[^\']*\'|"[^"]*"|{[\s\S]+?}))*\s*(/?)\s*>')
-
-class TokenizerPatterns(BaseTokenizerPatterns):
- def __init__(self, input_scanner, acorn, options):
- BaseTokenizerPatterns.__init__(self, input_scanner)
-
- # This is not pretty, but given how we did the version import
- # it is the only way to do this without having setup.py fail on a missing
- # six dependency.
- six = __import__("six")
-
- # IMPORTANT: This string must be run through six to handle \u chars
- self.whitespace = self.whitespace.matching(
- six.u(r'\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff'),
- six.u(r'\u2028\u2029'))
-
- pattern = Pattern(input_scanner)
- templatable = TemplatablePattern(input_scanner) \
- .read_options(options)
-
- self.identifier = templatable.starting_with(acorn.identifier \
- ).matching(acorn.identifierMatch)
- self.number = pattern.matching(number_pattern)
- self.punct = pattern.matching(punct_pattern)
- self.comment = pattern.starting_with(r'//').until(
- six.u(r'[\n\r\u2028\u2029]'))
- self.block_comment = pattern.starting_with(r'/\*').until_after(r'\*/')
- self.html_comment_start = pattern.matching(r'')
- self.include = pattern.starting_with(r'#include' \
- ).until_after(acorn.lineBreak)
- self.shebang = pattern.starting_with(r'#!' \
- ).until_after(acorn.lineBreak)
-
- self.xml = pattern.matching(xmlRegExp)
-
- self.single_quote = templatable.until(six.u(r"['\\\n\r\u2028\u2029]"))
- self.double_quote = templatable.until(six.u(r'["\\\n\r\u2028\u2029]'))
- self.template_text = templatable.until(r'[`\\$]')
- self.template_expression = templatable.until(r'[`}\\]')
-
-
-
-class Tokenizer(BaseTokenizer):
- positionable_operators = positionable_operators
- line_starters = line_starters
-
- def __init__(self, input_string, opts):
- BaseTokenizer.__init__(self, input_string, opts)
-
- import jsbeautifier.javascript.acorn as acorn
- self.acorn = acorn
-
- self.in_html_comment = False
- self.has_char_escapes = False
-
- self._patterns = TokenizerPatterns(self._input, self.acorn, opts)
-
-
- def _reset(self):
- self.in_html_comment = False
-
- def _is_comment(self, current_token):
- return current_token.type == TOKEN.COMMENT or \
- current_token.type == TOKEN.BLOCK_COMMENT or \
- current_token.type == TOKEN.UNKNOWN
-
-
- def _is_opening(self, current_token):
- return current_token.type == TOKEN.START_BLOCK or current_token.type == TOKEN.START_EXPR
-
- def _is_closing(self, current_token, open_token):
- return (current_token.type == TOKEN.END_BLOCK or current_token.type == TOKEN.END_EXPR) and \
- (open_token is not None and (
- (current_token.text == ']' and open_token.text == '[') or
- (current_token.text == ')' and open_token.text == '(') or
- (current_token.text == '}' and open_token.text == '{')))
-
- def _get_next_token(self, previous_token, open_token):
- token = None
- self._readWhitespace()
-
- c = self._input.peek()
- if c is None:
- token = self._create_token(TOKEN.EOF, '')
-
- token = token or self._read_non_javascript(c)
- token = token or self._read_string(c)
- token = token or self._read_word(previous_token)
- token = token or self._read_singles(c)
- token = token or self._read_comment(c)
- token = token or self._read_regexp(c, previous_token)
- token = token or self._read_xml(c, previous_token)
- token = token or self._read_punctuation()
- token = token or self._create_token(TOKEN.UNKNOWN, self._input.next())
-
- return token
-
- def _read_singles(self, c):
- token = None
-
- if c == '(' or c == '[':
- token = self._create_token(TOKEN.START_EXPR, c)
- elif c == ')' or c == ']':
- token = self._create_token(TOKEN.END_EXPR, c)
- elif c == '{':
- token = self._create_token(TOKEN.START_BLOCK, c)
- elif c == '}':
- token = self._create_token(TOKEN.END_BLOCK, c)
- elif c == ';':
- token = self._create_token(TOKEN.SEMICOLON, c)
- elif c == '.' and self._input.peek(1) is not None and \
- bool(dot_pattern.match(self._input.peek(1))):
- token = self._create_token(TOKEN.DOT, c)
- elif c == ',':
- token = self._create_token(TOKEN.COMMA, c)
-
- if token is not None:
- self._input.next()
-
- return token
-
- def _read_word(self, previous_token):
- resulting_string = self._patterns.identifier.read()
-
- if bool(resulting_string):
- resulting_string = re.sub(self.acorn.allLineBreaks, '\n', resulting_string)
- if not (previous_token.type == TOKEN.DOT or (
- previous_token.type == TOKEN.RESERVED and (
- previous_token.text == 'set' or previous_token.text == 'get')
- )) and reserved_word_pattern.match(resulting_string):
- if resulting_string == 'in' or resulting_string == 'of':
- # in and of are operators, need to hack
- return self._create_token(TOKEN.OPERATOR, resulting_string)
-
- return self._create_token(TOKEN.RESERVED, resulting_string)
-
- return self._create_token(TOKEN.WORD, resulting_string)
-
- resulting_string = self._patterns.number.read()
- if resulting_string != '':
- return self._create_token(TOKEN.WORD, resulting_string)
-
- def _read_comment(self, c):
- token = None
- if c == '/':
- comment = ''
- if self._input.peek(1) == '*': # peek /* .. */ comment
- comment = self._patterns.block_comment.read()
-
- directives = directives_core.get_directives(comment)
- if directives and directives.get('ignore') == 'start':
- comment += directives_core.readIgnored(self._input)
- comment = re.sub(self.acorn.allLineBreaks, '\n', comment)
- token = self._create_token(TOKEN.BLOCK_COMMENT, comment)
- token.directives = directives
-
- elif self._input.peek(1) == '/': # peek // comment
- comment = self._patterns.comment.read()
- token = self._create_token(TOKEN.COMMENT, comment)
-
- return token
-
-
- def _read_string(self, c):
- if c == '`' or c == "'" or c == '"':
- resulting_string = self._input.next()
- self.has_char_escapes = False
-
- if c == '`':
- resulting_string += self.parse_string('`', True, '${')
- else:
- resulting_string += self.parse_string(c)
-
- if self.has_char_escapes and self._options.unescape_strings:
- resulting_string = self.unescape_string(resulting_string)
-
- if self._input.peek() == c:
- resulting_string += self._input.next()
-
- resulting_string = re.sub(
- self.acorn.allLineBreaks, '\n', resulting_string)
-
- return self._create_token(TOKEN.STRING, resulting_string)
-
- return None
-
- def _read_regexp(self, c, previous_token):
-
- if c == '/' and self.allowRegExOrXML(previous_token):
- # handle regexp
- resulting_string = self._input.next()
- esc = False
-
- in_char_class = False
- while self._input.hasNext() and \
- (esc or in_char_class or self._input.peek() != c) and \
- not self._input.testChar(self.acorn.newline):
- resulting_string += self._input.peek()
- if not esc:
- esc = self._input.peek() == '\\'
- if self._input.peek() == '[':
- in_char_class = True
- elif self._input.peek() == ']':
- in_char_class = False
- else:
- esc = False
- self._input.next()
-
- if self._input.peek() == c:
- resulting_string += self._input.next()
-
- if c == '/':
- # regexps may have modifiers /regexp/MOD, so fetch those too
- # Only [gim] are valid, but if the user puts in garbage, do
- # what we can to take it.
- resulting_string += self._input.read(
- self.acorn.identifier)
-
- return self._create_token(TOKEN.STRING, resulting_string)
-
- return None
-
-
- def _read_xml(self, c, previous_token):
- if self._options.e4x and c == "<" and self.allowRegExOrXML(previous_token):
- # handle e4x xml literals
- xmlStr = ""
- match = self._patterns.xml.read_match()
- if match and not match.group(1):
- rootTag = match.group(2)
- rootTag = re.sub(r'^{\s+', '{', re.sub(r'\s+}$', '}', rootTag))
- isCurlyRoot = rootTag.startswith('{')
- depth = 0
- while bool(match):
- isEndTag = match.group(1)
- tagName = match.group(2)
- isSingletonTag = (
- match.groups()[-1] != "") or (match.group(2)[0:8] == "![CDATA[")
- if not isSingletonTag and (tagName == rootTag or (
- isCurlyRoot and re.sub(r'^{\s+', '{', re.sub(r'\s+}$', '}', tagName)))):
- if isEndTag:
- depth -= 1
- else:
- depth += 1
-
- xmlStr += match.group(0)
- if depth <= 0:
- break
-
- match = self._patterns.xml.read_match()
-
- # if we didn't close correctly, keep unformatted.
- if not match:
- xmlStr += self._input.match(re.compile(r'[\s\S]*')).group(0)
-
- xmlStr = re.sub(self.acorn.allLineBreaks, '\n', xmlStr)
- return self._create_token(TOKEN.STRING, xmlStr)
-
- return None
-
- def _read_non_javascript(self, c):
- resulting_string = ''
-
- if c == '#':
-
- # she-bang
- if self._is_first_token():
- resulting_string = self._patterns.shebang.read()
- if resulting_string:
- return self._create_token(TOKEN.UNKNOWN, resulting_string.strip() + '\n')
-
- # handles extendscript #includes
- resulting_string = self._patterns.include.read()
-
- if resulting_string:
- return self._create_token(TOKEN.UNKNOWN, resulting_string.strip() + '\n')
-
- c = self._input.next()
-
- # Spidermonkey-specific sharp variables for circular references
- # https://developer.mozilla.org/En/Sharp_variables_in_JavaScript
- # http://mxr.mozilla.org/mozilla-central/source/js/src/jsscan.cpp
- # around line 1935
- sharp = '#'
- if self._input.hasNext() and self._input.testChar(digit):
- while True:
- c = self._input.next()
- sharp += c
- if (not self._input.hasNext()) or c == '#' or c == '=':
- break
- if c == '#':
- pass
- elif self._input.peek() == '[' and self._input.peek(1) == ']':
- sharp += '[]'
- self._input.next()
- self._input.next()
- elif self._input.peek() == '{' and self._input.peek(1) == '}':
- sharp += '{}'
- self._input.next()
- self._input.next()
-
- return self._create_token(TOKEN.WORD, sharp)
-
- self._input.back()
-
- elif c == '<' and self._is_first_token():
-
- if self._patterns.html_comment_start.read():
- c = '')
-
- return None
-
- def _read_punctuation(self):
- token = None
- resulting_string = self._patterns.punct.read()
- if resulting_string != '':
- if resulting_string == '=':
- token = self._create_token(TOKEN.EQUALS, resulting_string)
- elif resulting_string == '?.':
- token = self._create_token(TOKEN.DOT, resulting_string)
- else:
- token = self._create_token(TOKEN.OPERATOR, resulting_string)
-
- return token
-
- __regexTokens = { TOKEN.COMMENT, TOKEN.START_EXPR, TOKEN.START_BLOCK,
- TOKEN.START, TOKEN.END_BLOCK, TOKEN.OPERATOR,
- TOKEN.EQUALS, TOKEN.EOF, TOKEN.SEMICOLON, TOKEN.COMMA }
- def allowRegExOrXML(self, previous_token):
- return (previous_token.type == TOKEN.RESERVED and previous_token.text in {'return', 'case', 'throw', 'else', 'do', 'typeof', 'yield'}) or \
- (previous_token.type == TOKEN.END_EXPR and previous_token.text == ')' and
- previous_token.opened.previous.type == TOKEN.RESERVED and previous_token.opened.previous.text in {'if', 'while', 'for'}) or \
- (previous_token.type in self.__regexTokens )
-
- def parse_string(
- self,
- delimiter,
- allow_unescaped_newlines=False,
- start_sub=None):
- if delimiter == '\'':
- pattern = self._patterns.single_quote
- elif delimiter == '"':
- pattern = self._patterns.double_quote
- elif delimiter == '`':
- pattern = self._patterns.template_text
- elif delimiter == '}':
- pattern = self._patterns.template_expression
- resulting_string = pattern.read()
- next = ''
- while self._input.hasNext():
- next = self._input.next()
- if next == delimiter or \
- (not allow_unescaped_newlines and
- self.acorn.newline.match(next)):
- self._input.back()
- break
- elif next == '\\' and self._input.hasNext():
- current_char = self._input.peek()
- if current_char == 'x' or current_char == 'u':
- self.has_char_escapes = True
- elif current_char == '\r' and self._input.peek(1) == '\n':
- self._input.next()
-
- next += self._input.next()
- elif start_sub is not None:
- if start_sub == '${' and next == '$' and \
- self._input.peek() == '{':
- next += self._input.next()
-
- if start_sub == next:
- if delimiter == '`':
- next += self.parse_string(
- '}', allow_unescaped_newlines, '`')
- else:
- next += self.parse_string(
- '`', allow_unescaped_newlines, '${')
-
- if self._input.hasNext():
- next += self._input.next()
-
- next += pattern.read()
- resulting_string += next
- return resulting_string
-
-
- def unescape_string(self, s):
- # You think that a regex would work for this
- # return s.replace(/\\x([0-9a-f]{2})/gi, function(match, val) {
- # return String.fromCharCode(parseInt(val, 16));
- # })
- # However, dealing with '\xff', '\\xff', '\\\xff' makes this more fun.
- out = self.acorn.six.u('')
- escaped = 0
-
- input_scan = InputScanner(s)
- matched = None
-
- while input_scan.hasNext():
- # Keep any whitespace, non-slash characters
- # also keep slash pairs.
- matched = input_scan.match(re.compile(r'([\s]|[^\\]|\\\\)+'))
-
- if matched:
- out += matched.group(0)
-
- if input_scan.peek() != '\\':
- continue
-
- input_scan.next()
- if input_scan.peek() == 'x':
- matched = input_scan.match(re.compile(r'x([0-9A-Fa-f]{2})'))
- elif input_scan.peek() == 'u':
- matched = input_scan.match(re.compile(r'u([0-9A-Fa-f]{4})'))
- else:
- out += '\\'
- if input_scan.hasNext():
- out += input_scan.next()
- continue
-
- # If there's some error decoding, return the original string
- if not matched:
- return s
-
- escaped = int(matched.group(1), 16)
-
- if escaped > 0x7e and escaped <= 0xff and matched.group(
- 0).startswith('x'):
- # we bail out on \x7f..\xff,
- # leaving whole string escaped,
- # as it's probably completely binary
- return s
- elif escaped >= 0x00 and escaped < 0x20:
- # leave 0x00...0x1f escaped
- out += '\\' + matched.group(0)
- continue
- elif escaped == 0x22 or escaped == 0x27 or escaped == 0x5c:
- # single-quote, apostrophe, backslash - escape these
- out += ('\\' + chr(escaped))
- else:
- out += self.acorn.six.unichr(escaped)
-
- return out
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/core/__init__.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/core/__init__.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/core/__init__.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/core/__init__.py 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-# Empty file :)
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/core/test_inputscanner.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/core/test_inputscanner.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/core/test_inputscanner.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/core/test_inputscanner.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,48 +0,0 @@
-import re
-import unittest
-from ...core.inputscanner import InputScanner
-
-
-class TestInputScanner(unittest.TestCase):
-
- @classmethod
- def setUpClass(cls):
- pass
-
- def setUp(self):
- self.value = 'howdy'
- self.inputscanner = InputScanner(self.value)
-
- def test_new(self):
- inputscanner = InputScanner(None)
- self.assertEqual(inputscanner.hasNext(), False)
-
- def test_next(self):
- self.assertEqual(self.inputscanner.next(), self.value[0])
- self.assertEqual(self.inputscanner.next(), self.value[1])
-
- def test_peek(self):
- self.assertEqual(self.inputscanner.peek(3), self.value[3])
- self.inputscanner.next()
- self.assertEqual(self.inputscanner.peek(3), self.value[4])
-
- def test_no_param(self):
- self.assertEqual(self.inputscanner.peek(), self.value[0])
- self.inputscanner.next()
- self.assertEqual(self.inputscanner.peek(), self.value[1])
-
- def test_pattern(self):
- pattern = re.compile(r'how')
- index = 0
- self.assertEqual(self.inputscanner.test(pattern, index), True)
- self.inputscanner.next()
- self.assertEqual(self.inputscanner.test(pattern, index), False)
-
- def test_Char(self):
- pattern = re.compile(r'o')
- index = 1
- self.assertEqual(self.inputscanner.testChar(pattern, index), True)
-
-
-if __name__ == '__main__':
- unittest.main()
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/core/test_options.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/core/test_options.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/core/test_options.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/core/test_options.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,140 +0,0 @@
-import re
-import unittest
-from ...core.options import _mergeOpts, _normalizeOpts, Options
-
-
-class TestOptions(unittest.TestCase):
-
- @classmethod
- def setUpClass(cls):
- pass
-
- def test_mergeOpts(self):
- # should convert tuple to dict and merge child with parent
- result = _mergeOpts((('a', 1), ('b', {'a': 2})), 'b')
- self.assertEqual(result.a, 2)
- self.assertNotIn('b', result)
- # should merge child option a with the parent options (dict)
- result = _mergeOpts({'a': 1, 'b': {'a': 2}}, 'b')
- self.assertEqual(result.a, 2)
- self.assertNotIn('b', result)
- # should include child option c and d with the parent options (dict)
- result = _mergeOpts({'a': 1, 'b': {'c': 2, 'd': 3}}, 'b')
- self.assertEqual(result.a, 1)
- self.assertEqual(result.c, 2)
- self.assertEqual(result.d, 3)
- self.assertNotIn('b', result)
- # should merge child option a and include c as parent options (dict)
- result = _mergeOpts({'a': 1, 'b': {'a': 2, 'c': 3}}, 'b')
- self.assertEqual(result.a, 2)
- self.assertEqual(result.c, 3)
- self.assertNotIn('b', result)
- # should merge Options instance with child dict key
- instance = Options()
- instance.a = {'disabled': True}
- result = _mergeOpts(instance, 'a')
- self.assertEqual(result.disabled, True)
- self.assertNotIn('a', list(getattr(result, '__dict__', {})))
-
- def test_normalizeOpts(self):
- # should replace key with - to _ in dict
- result = _normalizeOpts({
- 'a-b': 1
- })
- self.assertEqual(result['a_b'], 1)
- self.assertNotIn('a-b', result)
- # should replace key with - to _ in Options instance
- instance = Options()
- setattr(instance, 'a-b', 1)
- result = _normalizeOpts(instance)
- self.assertEqual(result.a_b, 1)
- self.assertNotIn('a-b', list(getattr(result, '__dict__', {})))
- # should do nothing
- result = _normalizeOpts({
- 'a_b': 1
- })
- self.assertEqual(result['a_b'], 1)
-
- def test__get_boolean(self):
- # should return default value since no option
- self.assertEqual(Options()._get_boolean('a'), False)
- # should return true as default since no option
- self.assertEqual(Options()._get_boolean('a', True), True)
- # should return false as in option
- self.assertEqual(Options({'a': False})._get_boolean('a', True), False)
-
- def test__get_characters(self):
- # should return default value since no option
- self.assertEqual(Options()._get_characters('a'), '')
- # should return \'character\' as default since no option
- self.assertEqual(Options()._get_characters(
- 'a', 'character'), 'character')
- # should return \'char\' as in option
- self.assertEqual(Options({'a': 'char'})._get_characters(
- 'a', 'character'), 'char')
-
- def test__get_number(self):
- # should return default value since no option
- self.assertEqual(Options()._get_number('a'), 0)
- # should return 1 as default since no option
- self.assertEqual(Options()._get_number('a', 1), 1)
- # should return 10 as in option
- self.assertEqual(Options({'a': 10})._get_number('a', 1), 10)
- # should return 0 for NaN as in option
- self.assertEqual(Options({'a': 'abc'})._get_number('a'), 0)
- # should return 0 for NaN as in default
- self.assertEqual(Options()._get_number('a', 'abc'), 0)
-
- def test__get_array(self):
- # should return [] with no option
- self.assertEqual(Options()._get_array('a'), [])
- # should return [\'a\',\'b\'] as default since no option
- self.assertEqual(Options()._get_array('a', ['a', 'b']), ['a', 'b'])
- # should return [\'c\',\'d\'] as in option
- self.assertEqual(Options({'a': ['c', 'd']})._get_array(
- 'a', ['a', 'b']), ['c', 'd'])
- # should return [\'c\',\'d\'] as in option comma separated
- self.assertEqual(Options({'a': 'c,d'})._get_array(
- 'a', ['a', 'b']), ['c', 'd'])
-
- def test__is_valid_selection(self):
- # should return false with empty selection
- self.assertEqual(Options()._is_valid_selection(['a', 'b'], []), False)
- # should return false with selection inexistent
- self.assertEqual(Options()._is_valid_selection(
- ['a', 'b'], ['c']), False)
- # should return true with selection existent
- self.assertEqual(Options()._is_valid_selection(
- ['a', 'b'], ['a', 'b']), True)
-
- def test__get_selection_list(self):
- # should raise error with empty selection
- with self.assertRaisesRegexp(ValueError, 'Selection list cannot'
- + ' be empty.'):
- Options()._get_selection_list('a', [])
- # should raise error with invalid default
- with self.assertRaisesRegexp(ValueError, 'Invalid Default Value!'):
- Options()._get_selection_list('a', ['a', 'b'], ['c'])
- # should raise error with invalid option
- with self.assertRaisesRegexp(ValueError, '^Invalid Option Value:'
- + ' The option'):
- Options({'a': ['c', 'd']})._get_selection_list(
- 'a', ['a', 'b'], ['a', 'b'])
- # should return [\'c\'] as in option
- opts = Options({'c': ['c']})
- self.assertEqual(opts._get_selection_list(
- 'c', ['c', 'd'], ['c']), ['c'])
-
- def test__get_selection(self):
- # should raise error with multiple selection
- with self.assertRaisesRegexp(ValueError, '^Invalid Option'
- + ' Value: The option'):
- Options({'a': ['a', 'b']})._get_selection('a', ['a', 'b'], ['a'])
- # should return [\'a\'] as in option
- options = Options({'a': ['a']})
- self.assertEqual(options._get_selection(
- 'a', ['a', 'b'], ['a']), 'a')
-
-
-if __name__ == '__main__':
- unittest.main()
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/generated/__init__.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/generated/__init__.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/generated/__init__.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/generated/__init__.py 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-# Empty file :)
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/generated/tests.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/generated/tests.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/generated/tests.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/generated/tests.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,9591 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-'''
- AUTO-GENERATED. DO NOT MODIFY.
- Script: test/generate-tests.js
- Template: test/data/javascript/python.mustache
- Data: test/data/javascript/tests.js
-
- The MIT License (MIT)
-
- Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation files
- (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge,
- publish, distribute, sublicense, and/or sell copies of the Software,
- and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-'''
-
-import re
-import unittest
-import jsbeautifier
-import six
-import copy
-
-class TestJSBeautifier(unittest.TestCase):
- options = None
-
- @classmethod
- def setUpClass(cls):
- pass
- cls.wrapregex = re.compile('^(.+)$', re.MULTILINE)
-
- def reset_options(self):
- true = True
- false = False
-
- default_options = jsbeautifier.default_options()
- default_options.indent_size = 4
- default_options.indent_char = ' '
- default_options.preserve_newlines = true
- default_options.jslint_happy = false
- default_options.indent_level = 0
- default_options.break_chained_methods = false
- default_options.eol = '\n'
-
- default_options.indent_size = 4
- default_options.indent_char = ' '
- default_options.preserve_newlines = true
- default_options.jslint_happy = false
-
- self.options = copy.copy(default_options)
-
- def test_unescape(self):
- # Test cases contributed by
- test_fragment = self.decodesto
- self.reset_options()
- bt = self.bt
-
- def unicode_char(value):
- return six.unichr(value)
-
- bt('"\\\\s"') # == "\\s" in the js source
- bt("'\\\\s'") # == '\\s' in the js source
- bt("'\\\\\\s'") # == '\\\s' in the js source
- bt("'\\s'") # == '\s' in the js source
- bt('"•"')
- bt('"—"')
- bt('"\\x41\\x42\\x43\\x01"', '"\\x41\\x42\\x43\\x01"')
- bt('"\\u2022"', '"\\u2022"')
- bt('a = /\s+/')
- #bt('a = /\\x41/','a = /A/')
- bt('"\\u2022";a = /\s+/;"\\x41\\x42\\x43\\x01".match(/\\x41/);','"\\u2022";\na = /\s+/;\n"\\x41\\x42\\x43\\x01".match(/\\x41/);')
- test_fragment('"\\x22\\x27",\'\\x22\\x27\',"\\x5c",\'\\x5c\',"\\xff and \\xzz","unicode \\u0000 \\u0022 \\u0027 \\u005c \\uffff \\uzzzz"', '"\\x22\\x27", \'\\x22\\x27\', "\\x5c", \'\\x5c\', "\\xff and \\xzz", "unicode \\u0000 \\u0022 \\u0027 \\u005c \\uffff \\uzzzz"')
-
- self.options.unescape_strings = True
-
- bt('"\\x41\\x42\\x43\\x01"', '"ABC\\x01"')
- test_fragment('"\\x20\\x40\\x4a"', '" @J"')
- test_fragment('"\\xff\\x40\\x4a"')
- test_fragment('"\\u0072\\u016B\\u0137\\u012B\\u0074\\u0069\\u0073"', six.u('"\u0072\u016B\u0137\u012B\u0074\u0069\u0073"'))
-
- bt('a = /\s+/')
- test_fragment('"\\x22\\x27",\'\\x22\\x27\',"\\x5c",\'\\x5c\',"\\xff","unicode \\u0000 \\u0022 \\u0027 \\u005c \\uffff"',
- '"\\"\\\'", \'\\"\\\'\', "\\\\", \'\\\\\', "\\xff", "unicode \\u0000 \\" \\\' \\\\ ' + unicode_char(0xffff) + '"')
-
- # For error case, return the string unchanged
- test_fragment('"\\x22\\x27",\'\\x22\\x27\',"\\x5c",\'\\x5c\',"\\xff and \\xzz","unicode \\u0000 \\u0022 \\u0027 \\u005c \\uffff \\uzzzz"',
- '"\\"\\\'", \'\\"\\\'\', "\\\\", \'\\\\\', "\\xff and \\xzz", "unicode \\u0000 \\u0022 \\u0027 \\u005c \\uffff \\uzzzz"')
-
- self.options.unescape_strings = False
-
- def test_beautifier(self):
- test_fragment = self.decodesto
- bt = self.bt
-
- true = True
- false = False
-
- def unicode_char(value):
- return six.unichr(value)
-
- ##============================================================
- # Line wrap test inputs
- #....---------1---------2---------3---------4---------5---------6---------7
- #....1234567890123456789012345678901234567890123456789012345678901234567890
- wrap_input_1=(
- 'foo.bar().baz().cucumber((f && "sass") || (leans && mean));\n' +
- 'Test_very_long_variable_name_this_should_never_wrap\n.but_this_can\n' +
- 'return between_return_and_expression_should_never_wrap.but_this_can\n' +
- 'throw between_throw_and_expression_should_never_wrap.but_this_can\n' +
- 'if (wraps_can_occur && inside_an_if_block) that_is_\n.okay();\n' +
- 'object_literal = {\n' +
- ' propertx: first_token + 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap + but_this_can,\n' +
- ' propertz: first_token_should_never_wrap + !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" + "but_this_can"\n' +
- '}');
-
- #....---------1---------2---------3---------4---------5---------6---------7
- #....1234567890123456789012345678901234567890123456789012345678901234567890
- wrap_input_2=(
- '{\n' +
- ' foo.bar().baz().cucumber((f && "sass") || (leans && mean));\n' +
- ' Test_very_long_variable_name_this_should_never_wrap\n.but_this_can\n' +
- ' return between_return_and_expression_should_never_wrap.but_this_can\n' +
- ' throw between_throw_and_expression_should_never_wrap.but_this_can\n' +
- ' if (wraps_can_occur && inside_an_if_block) that_is_\n.okay();\n' +
- ' object_literal = {\n' +
- ' propertx: first_token + 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap + but_this_can,\n' +
- ' propertz: first_token_should_never_wrap + !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" + "but_this_can"\n' +
- ' }' +
- '}');
-
-
- #============================================================
- # Unicode Support
- self.reset_options()
- bt('var ' + unicode_char(3232) + '_' + unicode_char(3232) + ' = "hi";')
- bt(
- 'var ' + unicode_char(228) + 'x = {\n' +
- ' ' + unicode_char(228) + 'rgerlich: true\n' +
- '};')
- bt(
- 'var \\u00E4\\u0ca0\\u0cA0\\u0Ca0 = {\n' +
- ' \\u0ca0rgerlich: true\n' +
- '};')
- bt(
- 'var \\u00E4add\\u0025 = {\n' +
- ' \\u0044rgerlich\\u0ca0: true\n' +
- '};')
- bt(
- 'var' + unicode_char(160) + unicode_char(3232) + '_' + unicode_char(3232) + ' = "hi";',
- # -- output --
- 'var ' + unicode_char(3232) + '_' + unicode_char(3232) + ' = "hi";')
-
-
- #============================================================
- # Test template and continuation strings
- self.reset_options()
- bt('`This is a ${template} string.`')
- bt(
- '`This\n' +
- ' is\n' +
- ' a\n' +
- ' ${template}\n' +
- ' string.`')
- bt(
- 'a = `This is a continuation\\\n' +
- 'string.`')
- bt(
- 'a = "This is a continuation\\\n' +
- 'string."')
- bt(
- '`SELECT\n' +
- ' nextval(\'${this.options.schema ? `${this.options.schema}.` : \'\'}"${this.tableName}_${this.autoIncrementField}_seq"\'::regclass\n' +
- ' ) nextval;`')
-
- # Tests for #1030
- bt(
- 'const composeUrl = (host) => {\n' +
- ' return `${host `test`}`;\n' +
- '};')
- bt(
- 'const composeUrl = (host, api, key, data) => {\n' +
- ' switch (api) {\n' +
- ' case "Init":\n' +
- ' return `${host}/vwapi/Init?VWID=${key}&DATA=${encodeURIComponent(\n' +
- ' Object.keys(data).map((k) => `${k}=${ data[k]}` ).join(";")\n' +
- ' )}`;\n' +
- ' case "Pay":\n' +
- ' return `${host}/vwapi/Pay?SessionId=${par}`;\n' +
- ' };\n' +
- '};')
-
-
- #============================================================
- # Private Class Fields
- self.reset_options()
- bt('#foo')
- bt(
- 'class X {\n' +
- ' #foo = null;\n' +
- ' get foo() {\n' +
- ' return this.#foo;\n' +
- ' }\n' +
- '}')
- bt(
- 'class X {#foo=null;}',
- # -- output --
- 'class X {\n' +
- ' #foo = null;\n' +
- '}')
-
-
- #============================================================
- # ES7 Decorators
- self.reset_options()
- bt('@foo')
- bt('@foo(bar)')
- bt(
- '@foo(function(k, v) {\n' +
- ' implementation();\n' +
- '})')
-
-
- #============================================================
- # ES7 exponential
- self.reset_options()
- bt('x ** 2')
- bt('x ** -2')
-
-
- #============================================================
- # Spread operator
- self.reset_options()
- self.options.brace_style = "collapse,preserve-inline"
- bt('const m = { ...item, c: 3 };')
- bt(
- 'const m = {\n' +
- ' ...item,\n' +
- ' c: 3\n' +
- '};')
- bt('const m = { c: 3, ...item };')
- bt('const m = [...item, 3];')
- bt('const m = [3, ...item];')
-
-
- #============================================================
- # Object literal shorthand functions
- self.reset_options()
- bt(
- 'return {\n' +
- ' foo() {\n' +
- ' return 42;\n' +
- ' }\n' +
- '}')
- bt(
- 'var foo = {\n' +
- ' * bar() {\n' +
- ' yield 42;\n' +
- ' }\n' +
- '};')
- bt(
- 'var foo = {bar(){return 42;},*barGen(){yield 42;}};',
- # -- output --
- 'var foo = {\n' +
- ' bar() {\n' +
- ' return 42;\n' +
- ' },\n' +
- ' * barGen() {\n' +
- ' yield 42;\n' +
- ' }\n' +
- '};')
-
- # also handle generator shorthand in class - #1013
- bt(
- 'class A {\n' +
- ' fn() {\n' +
- ' return true;\n' +
- ' }\n' +
- '\n' +
- ' * gen() {\n' +
- ' return true;\n' +
- ' }\n' +
- '}')
- bt(
- 'class A {\n' +
- ' * gen() {\n' +
- ' return true;\n' +
- ' }\n' +
- '\n' +
- ' fn() {\n' +
- ' return true;\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # End With Newline - (end_with_newline = "true")
- self.reset_options()
- self.options.end_with_newline = true
- test_fragment('', '\n')
- test_fragment(' return .5', ' return .5\n')
- test_fragment(
- ' \n' +
- '\n' +
- 'return .5\n' +
- '\n' +
- '\n' +
- '\n',
- # -- output --
- ' return .5\n')
- test_fragment('\n')
-
- # End With Newline - (end_with_newline = "false")
- self.reset_options()
- self.options.end_with_newline = false
- test_fragment('')
- test_fragment(' return .5')
- test_fragment(
- ' \n' +
- '\n' +
- 'return .5\n' +
- '\n' +
- '\n' +
- '\n',
- # -- output --
- ' return .5')
- test_fragment('\n', '')
-
-
- #============================================================
- # Support Indent Level Options and Base Indent Autodetection - ()
- self.reset_options()
- test_fragment(' a')
- test_fragment(
- ' function test(){\n' +
- ' console.log("this is a test");\n' +
- '}',
- # -- output --
- ' function test() {\n' +
- ' console.log("this is a test");\n' +
- ' }')
- test_fragment(
- ' // This is a random comment\n' +
- 'function test(){\n' +
- ' console.log("this is a test");\n' +
- '}',
- # -- output --
- ' // This is a random comment\n' +
- ' function test() {\n' +
- ' console.log("this is a test");\n' +
- ' }')
-
- # Support Indent Level Options and Base Indent Autodetection - (indent_level = "0")
- self.reset_options()
- self.options.indent_level = 0
- test_fragment(' a')
- test_fragment(
- ' function test(){\n' +
- ' console.log("this is a test");\n' +
- '}',
- # -- output --
- ' function test() {\n' +
- ' console.log("this is a test");\n' +
- ' }')
- test_fragment(
- ' // This is a random comment\n' +
- 'function test(){\n' +
- ' console.log("this is a test");\n' +
- '}',
- # -- output --
- ' // This is a random comment\n' +
- ' function test() {\n' +
- ' console.log("this is a test");\n' +
- ' }')
-
- # Support Indent Level Options and Base Indent Autodetection - (indent_level = "1")
- self.reset_options()
- self.options.indent_level = 1
- test_fragment(' a', ' a')
- test_fragment(
- ' function test(){\n' +
- ' console.log("this is a test");\n' +
- '}',
- # -- output --
- ' function test() {\n' +
- ' console.log("this is a test");\n' +
- ' }')
- test_fragment(
- ' // This is a random comment\n' +
- 'function test(){\n' +
- ' console.log("this is a test");\n' +
- '}',
- # -- output --
- ' // This is a random comment\n' +
- ' function test() {\n' +
- ' console.log("this is a test");\n' +
- ' }')
-
- # Support Indent Level Options and Base Indent Autodetection - (indent_level = "2")
- self.reset_options()
- self.options.indent_level = 2
- test_fragment('a', ' a')
- test_fragment(
- 'function test(){\n' +
- ' console.log("this is a test");\n' +
- '}',
- # -- output --
- ' function test() {\n' +
- ' console.log("this is a test");\n' +
- ' }')
- test_fragment(
- '// This is a random comment\n' +
- 'function test(){\n' +
- ' console.log("this is a test");\n' +
- '}',
- # -- output --
- ' // This is a random comment\n' +
- ' function test() {\n' +
- ' console.log("this is a test");\n' +
- ' }')
-
- # Support Indent Level Options and Base Indent Autodetection - (indent_with_tabs = "true", indent_level = "2")
- self.reset_options()
- self.options.indent_with_tabs = true
- self.options.indent_level = 2
- test_fragment('a', '\t\ta')
- test_fragment(
- 'function test(){\n' +
- ' console.log("this is a test");\n' +
- '}',
- # -- output --
- '\t\tfunction test() {\n' +
- '\t\t\tconsole.log("this is a test");\n' +
- '\t\t}')
- test_fragment(
- '// This is a random comment\n' +
- 'function test(){\n' +
- ' console.log("this is a test");\n' +
- '}',
- # -- output --
- '\t\t// This is a random comment\n' +
- '\t\tfunction test() {\n' +
- '\t\t\tconsole.log("this is a test");\n' +
- '\t\t}')
-
- # Support Indent Level Options and Base Indent Autodetection - (indent_level = "0")
- self.reset_options()
- self.options.indent_level = 0
- test_fragment('\t a')
- test_fragment(
- '\t function test(){\n' +
- ' console.log("this is a test");\n' +
- '}',
- # -- output --
- '\t function test() {\n' +
- '\t console.log("this is a test");\n' +
- '\t }')
- test_fragment(
- '\t // This is a random comment\n' +
- 'function test(){\n' +
- ' console.log("this is a test");\n' +
- '}',
- # -- output --
- '\t // This is a random comment\n' +
- '\t function test() {\n' +
- '\t console.log("this is a test");\n' +
- '\t }')
-
-
- #============================================================
- # Support simple language specific option inheritance/overriding - (js = "{ "indent_size": 3 }", css = "{ "indent_size": 5 }")
- self.reset_options()
- self.options.js = { 'indent_size': 3 }
- self.options.css = { 'indent_size': 5 }
- bt(
- 'if (a == b) {\n' +
- ' test();\n' +
- '}')
-
- # Support simple language specific option inheritance/overriding - (html = "{ "js": { "indent_size": 3 }, "css": { "indent_size": 5 } }")
- self.reset_options()
- self.options.html = { 'js': { 'indent_size': 3 }, 'css': { 'indent_size': 5 } }
- bt(
- 'if (a == b) {\n' +
- ' test();\n' +
- '}')
-
- # Support simple language specific option inheritance/overriding - (indent_size = "9", html = "{ "js": { "indent_size": 3 }, "css": { "indent_size": 5 }, "indent_size": 2}", js = "{ "indent_size": 4 }", css = "{ "indent_size": 3 }")
- self.reset_options()
- self.options.indent_size = 9
- self.options.html = { 'js': { 'indent_size': 3 }, 'css': { 'indent_size': 5 }, 'indent_size': 2}
- self.options.js = { 'indent_size': 4 }
- self.options.css = { 'indent_size': 3 }
- bt(
- 'if (a == b) {\n' +
- ' test();\n' +
- '}')
-
-
- #============================================================
- # Brace style permutations - (brace_style = ""collapse,preserve-inline"")
- self.reset_options()
- self.options.brace_style = 'collapse,preserve-inline'
- bt(
- 'var a ={a: 2};\n' +
- 'var a ={a: 2};',
- # -- output --
- 'var a = { a: 2 };\n' +
- 'var a = { a: 2 };')
- bt(
- '//case 1\n' +
- 'if (a == 1){}\n' +
- '//case 2\n' +
- 'else if (a == 2){}',
- # -- output --
- '//case 1\n' +
- 'if (a == 1) {}\n' +
- '//case 2\n' +
- 'else if (a == 2) {}')
- bt('if(1){2}else{3}', 'if (1) { 2 } else { 3 }')
- bt('try{a();}catch(b){c();}catch(d){}finally{e();}', 'try { a(); } catch (b) { c(); } catch (d) {} finally { e(); }')
-
- # Brace style permutations - (brace_style = ""collapse,preserve-inline"")
- self.reset_options()
- self.options.brace_style = 'collapse,preserve-inline'
- bt(
- 'var a =\n' +
- '{\n' +
- 'a: 2\n' +
- '}\n' +
- ';\n' +
- 'var a =\n' +
- '{\n' +
- 'a: 2\n' +
- '}\n' +
- ';',
- # -- output --
- 'var a = {\n' +
- ' a: 2\n' +
- '};\n' +
- 'var a = {\n' +
- ' a: 2\n' +
- '};')
- bt(
- '//case 1\n' +
- 'if (a == 1)\n' +
- '{}\n' +
- '//case 2\n' +
- 'else if (a == 2)\n' +
- '{}',
- # -- output --
- '//case 1\n' +
- 'if (a == 1) {}\n' +
- '//case 2\n' +
- 'else if (a == 2) {}')
- bt(
- 'if(1)\n' +
- '{\n' +
- '2\n' +
- '}\n' +
- 'else\n' +
- '{\n' +
- '3\n' +
- '}',
- # -- output --
- 'if (1) {\n' +
- ' 2\n' +
- '} else {\n' +
- ' 3\n' +
- '}')
- bt(
- 'try\n' +
- '{\n' +
- 'a();\n' +
- '}\n' +
- 'catch(b)\n' +
- '{\n' +
- 'c();\n' +
- '}\n' +
- 'catch(d)\n' +
- '{}\n' +
- 'finally\n' +
- '{\n' +
- 'e();\n' +
- '}',
- # -- output --
- 'try {\n' +
- ' a();\n' +
- '} catch (b) {\n' +
- ' c();\n' +
- '} catch (d) {} finally {\n' +
- ' e();\n' +
- '}')
-
- # Brace style permutations - ()
- self.reset_options()
- bt(
- 'var a ={a: 2};\n' +
- 'var a ={a: 2};',
- # -- output --
- 'var a = {\n' +
- ' a: 2\n' +
- '};\n' +
- 'var a = {\n' +
- ' a: 2\n' +
- '};')
- bt(
- '//case 1\n' +
- 'if (a == 1){}\n' +
- '//case 2\n' +
- 'else if (a == 2){}',
- # -- output --
- '//case 1\n' +
- 'if (a == 1) {}\n' +
- '//case 2\n' +
- 'else if (a == 2) {}')
- bt(
- 'if(1){2}else{3}',
- # -- output --
- 'if (1) {\n' +
- ' 2\n' +
- '} else {\n' +
- ' 3\n' +
- '}')
- bt(
- 'try{a();}catch(b){c();}catch(d){}finally{e();}',
- # -- output --
- 'try {\n' +
- ' a();\n' +
- '} catch (b) {\n' +
- ' c();\n' +
- '} catch (d) {} finally {\n' +
- ' e();\n' +
- '}')
-
- # Brace style permutations - (brace_style = ""collapse"")
- self.reset_options()
- self.options.brace_style = 'collapse'
- bt(
- 'var a ={a: 2};\n' +
- 'var a ={a: 2};',
- # -- output --
- 'var a = {\n' +
- ' a: 2\n' +
- '};\n' +
- 'var a = {\n' +
- ' a: 2\n' +
- '};')
- bt(
- '//case 1\n' +
- 'if (a == 1){}\n' +
- '//case 2\n' +
- 'else if (a == 2){}',
- # -- output --
- '//case 1\n' +
- 'if (a == 1) {}\n' +
- '//case 2\n' +
- 'else if (a == 2) {}')
- bt(
- 'if(1){2}else{3}',
- # -- output --
- 'if (1) {\n' +
- ' 2\n' +
- '} else {\n' +
- ' 3\n' +
- '}')
- bt(
- 'try{a();}catch(b){c();}catch(d){}finally{e();}',
- # -- output --
- 'try {\n' +
- ' a();\n' +
- '} catch (b) {\n' +
- ' c();\n' +
- '} catch (d) {} finally {\n' +
- ' e();\n' +
- '}')
-
- # Brace style permutations - (brace_style = ""collapse"")
- self.reset_options()
- self.options.brace_style = 'collapse'
- bt(
- 'var a =\n' +
- '{\n' +
- 'a: 2\n' +
- '}\n' +
- ';\n' +
- 'var a =\n' +
- '{\n' +
- 'a: 2\n' +
- '}\n' +
- ';',
- # -- output --
- 'var a = {\n' +
- ' a: 2\n' +
- '};\n' +
- 'var a = {\n' +
- ' a: 2\n' +
- '};')
- bt(
- '//case 1\n' +
- 'if (a == 1)\n' +
- '{}\n' +
- '//case 2\n' +
- 'else if (a == 2)\n' +
- '{}',
- # -- output --
- '//case 1\n' +
- 'if (a == 1) {}\n' +
- '//case 2\n' +
- 'else if (a == 2) {}')
- bt(
- 'if(1)\n' +
- '{\n' +
- '2\n' +
- '}\n' +
- 'else\n' +
- '{\n' +
- '3\n' +
- '}',
- # -- output --
- 'if (1) {\n' +
- ' 2\n' +
- '} else {\n' +
- ' 3\n' +
- '}')
- bt(
- 'try\n' +
- '{\n' +
- 'a();\n' +
- '}\n' +
- 'catch(b)\n' +
- '{\n' +
- 'c();\n' +
- '}\n' +
- 'catch(d)\n' +
- '{}\n' +
- 'finally\n' +
- '{\n' +
- 'e();\n' +
- '}',
- # -- output --
- 'try {\n' +
- ' a();\n' +
- '} catch (b) {\n' +
- ' c();\n' +
- '} catch (d) {} finally {\n' +
- ' e();\n' +
- '}')
-
-
- #============================================================
- # Comma-first option - (comma_first = "false")
- self.reset_options()
- self.options.comma_first = false
- bt(
- '{a:1, b:2}',
- # -- output --
- '{\n' +
- ' a: 1,\n' +
- ' b: 2\n' +
- '}')
- bt(
- 'var a=1, b=c[d], e=6;',
- # -- output --
- 'var a = 1,\n' +
- ' b = c[d],\n' +
- ' e = 6;')
- bt(
- 'for(var a=1,b=2,c=3;d<3;d++)\n' +
- 'e',
- # -- output --
- 'for (var a = 1, b = 2, c = 3; d < 3; d++)\n' +
- ' e')
- bt(
- 'for(var a=1,b=2,\n' +
- 'c=3;d<3;d++)\n' +
- 'e',
- # -- output --
- 'for (var a = 1, b = 2,\n' +
- ' c = 3; d < 3; d++)\n' +
- ' e')
- bt(
- 'function foo() {\n' +
- ' return [\n' +
- ' "one",\n' +
- ' "two"\n' +
- ' ];\n' +
- '}')
- bt(
- 'a=[[1,2],[4,5],[7,8]]',
- # -- output --
- 'a = [\n' +
- ' [1, 2],\n' +
- ' [4, 5],\n' +
- ' [7, 8]\n' +
- ']')
- bt(
- 'a=[[1,2],[4,5],[7,8],]',
- # -- output --
- 'a = [\n' +
- ' [1, 2],\n' +
- ' [4, 5],\n' +
- ' [7, 8],\n' +
- ']')
- bt(
- 'a=[[1,2],[4,5],function(){},[7,8]]',
- # -- output --
- 'a = [\n' +
- ' [1, 2],\n' +
- ' [4, 5],\n' +
- ' function() {},\n' +
- ' [7, 8]\n' +
- ']')
- bt(
- 'a=[[1,2],[4,5],function(){},function(){},[7,8]]',
- # -- output --
- 'a = [\n' +
- ' [1, 2],\n' +
- ' [4, 5],\n' +
- ' function() {},\n' +
- ' function() {},\n' +
- ' [7, 8]\n' +
- ']')
- bt(
- 'a=[[1,2],[4,5],function(){},[7,8]]',
- # -- output --
- 'a = [\n' +
- ' [1, 2],\n' +
- ' [4, 5],\n' +
- ' function() {},\n' +
- ' [7, 8]\n' +
- ']')
- bt('a=[b,c,function(){},function(){},d]', 'a = [b, c, function() {}, function() {}, d]')
- bt(
- 'a=[b,c,\n' +
- 'function(){},function(){},d]',
- # -- output --
- 'a = [b, c,\n' +
- ' function() {},\n' +
- ' function() {},\n' +
- ' d\n' +
- ']')
- bt('a=[a[1],b[4],c[d[7]]]', 'a = [a[1], b[4], c[d[7]]]')
- bt('[1,2,[3,4,[5,6],7],8]', '[1, 2, [3, 4, [5, 6], 7], 8]')
- bt(
- '[[["1","2"],["3","4"]],[["5","6","7"],["8","9","0"]],[["1","2","3"],["4","5","6","7"],["8","9","0"]]]',
- # -- output --
- '[\n' +
- ' [\n' +
- ' ["1", "2"],\n' +
- ' ["3", "4"]\n' +
- ' ],\n' +
- ' [\n' +
- ' ["5", "6", "7"],\n' +
- ' ["8", "9", "0"]\n' +
- ' ],\n' +
- ' [\n' +
- ' ["1", "2", "3"],\n' +
- ' ["4", "5", "6", "7"],\n' +
- ' ["8", "9", "0"]\n' +
- ' ]\n' +
- ']')
- bt(
- 'changeCollection.add({\n' +
- ' name: "Jonathan" // New line inserted after this line on every save\n' +
- ' , age: 25\n' +
- '});',
- # -- output --
- 'changeCollection.add({\n' +
- ' name: "Jonathan" // New line inserted after this line on every save\n' +
- ' ,\n' +
- ' age: 25\n' +
- '});')
- bt(
- 'changeCollection.add(\n' +
- ' function() {\n' +
- ' return true;\n' +
- ' },\n' +
- ' function() {\n' +
- ' return true;\n' +
- ' }\n' +
- ');')
-
- # Comma-first option - (comma_first = "true")
- self.reset_options()
- self.options.comma_first = true
- bt(
- '{a:1, b:2}',
- # -- output --
- '{\n' +
- ' a: 1\n' +
- ' , b: 2\n' +
- '}')
- bt(
- 'var a=1, b=c[d], e=6;',
- # -- output --
- 'var a = 1\n' +
- ' , b = c[d]\n' +
- ' , e = 6;')
- bt(
- 'for(var a=1,b=2,c=3;d<3;d++)\n' +
- 'e',
- # -- output --
- 'for (var a = 1, b = 2, c = 3; d < 3; d++)\n' +
- ' e')
- bt(
- 'for(var a=1,b=2,\n' +
- 'c=3;d<3;d++)\n' +
- 'e',
- # -- output --
- 'for (var a = 1, b = 2\n' +
- ' , c = 3; d < 3; d++)\n' +
- ' e')
- bt(
- 'function foo() {\n' +
- ' return [\n' +
- ' "one"\n' +
- ' , "two"\n' +
- ' ];\n' +
- '}')
- bt(
- 'a=[[1,2],[4,5],[7,8]]',
- # -- output --
- 'a = [\n' +
- ' [1, 2]\n' +
- ' , [4, 5]\n' +
- ' , [7, 8]\n' +
- ']')
- bt(
- 'a=[[1,2],[4,5],[7,8],]',
- # -- output --
- 'a = [\n' +
- ' [1, 2]\n' +
- ' , [4, 5]\n' +
- ' , [7, 8]\n' +
- ', ]')
- bt(
- 'a=[[1,2],[4,5],function(){},[7,8]]',
- # -- output --
- 'a = [\n' +
- ' [1, 2]\n' +
- ' , [4, 5]\n' +
- ' , function() {}\n' +
- ' , [7, 8]\n' +
- ']')
- bt(
- 'a=[[1,2],[4,5],function(){},function(){},[7,8]]',
- # -- output --
- 'a = [\n' +
- ' [1, 2]\n' +
- ' , [4, 5]\n' +
- ' , function() {}\n' +
- ' , function() {}\n' +
- ' , [7, 8]\n' +
- ']')
- bt(
- 'a=[[1,2],[4,5],function(){},[7,8]]',
- # -- output --
- 'a = [\n' +
- ' [1, 2]\n' +
- ' , [4, 5]\n' +
- ' , function() {}\n' +
- ' , [7, 8]\n' +
- ']')
- bt('a=[b,c,function(){},function(){},d]', 'a = [b, c, function() {}, function() {}, d]')
- bt(
- 'a=[b,c,\n' +
- 'function(){},function(){},d]',
- # -- output --
- 'a = [b, c\n' +
- ' , function() {}\n' +
- ' , function() {}\n' +
- ' , d\n' +
- ']')
- bt('a=[a[1],b[4],c[d[7]]]', 'a = [a[1], b[4], c[d[7]]]')
- bt('[1,2,[3,4,[5,6],7],8]', '[1, 2, [3, 4, [5, 6], 7], 8]')
- bt(
- '[[["1","2"],["3","4"]],[["5","6","7"],["8","9","0"]],[["1","2","3"],["4","5","6","7"],["8","9","0"]]]',
- # -- output --
- '[\n' +
- ' [\n' +
- ' ["1", "2"]\n' +
- ' , ["3", "4"]\n' +
- ' ]\n' +
- ' , [\n' +
- ' ["5", "6", "7"]\n' +
- ' , ["8", "9", "0"]\n' +
- ' ]\n' +
- ' , [\n' +
- ' ["1", "2", "3"]\n' +
- ' , ["4", "5", "6", "7"]\n' +
- ' , ["8", "9", "0"]\n' +
- ' ]\n' +
- ']')
- bt(
- 'changeCollection.add({\n' +
- ' name: "Jonathan" // New line inserted after this line on every save\n' +
- ' , age: 25\n' +
- '});')
- bt(
- 'changeCollection.add(\n' +
- ' function() {\n' +
- ' return true;\n' +
- ' },\n' +
- ' function() {\n' +
- ' return true;\n' +
- ' }\n' +
- ');',
- # -- output --
- 'changeCollection.add(\n' +
- ' function() {\n' +
- ' return true;\n' +
- ' }\n' +
- ' , function() {\n' +
- ' return true;\n' +
- ' }\n' +
- ');')
-
-
- #============================================================
- # Unindent chained functions - (unindent_chained_methods = "true")
- self.reset_options()
- self.options.unindent_chained_methods = true
- bt(
- 'f().f().f()\n' +
- ' .f().f();',
- # -- output --
- 'f().f().f()\n' +
- '.f().f();')
- bt(
- 'f()\n' +
- ' .f()\n' +
- ' .f();',
- # -- output --
- 'f()\n' +
- '.f()\n' +
- '.f();')
- bt(
- 'f(function() {\n' +
- ' f()\n' +
- ' .f()\n' +
- ' .f();\n' +
- '});',
- # -- output --
- 'f(function() {\n' +
- ' f()\n' +
- ' .f()\n' +
- ' .f();\n' +
- '});')
-
- # regression test for fix #1378
- bt(
- 'f(function() {\n' +
- ' if(g === 1)\n' +
- ' g = 0;\n' +
- ' else\n' +
- ' g = 1;\n' +
- '\n' +
- ' f()\n' +
- ' .f()\n' +
- ' .f();\n' +
- '});',
- # -- output --
- 'f(function() {\n' +
- ' if (g === 1)\n' +
- ' g = 0;\n' +
- ' else\n' +
- ' g = 1;\n' +
- '\n' +
- ' f()\n' +
- ' .f()\n' +
- ' .f();\n' +
- '});')
-
- # regression test for fix #1533
- bt(
- 'angular.module("test").controller("testCtrl", function($scope) {\n' +
- ' $scope.tnew;\n' +
- ' $scope.toggle_tnew = function() {\n' +
- ' $scope.mode = 0;\n' +
- ' if (!$scope.tnew) {\n' +
- ' $scope.tnew = {};\n' +
- ' } else $scope.tnew = null;\n' +
- ' }\n' +
- ' $scope.fn = function() {\n' +
- ' return null;\n' +
- ' }\n' +
- '});')
-
-
- #============================================================
- # Space in parens tests - (space_in_paren = "false", space_in_empty_paren = "false")
- self.reset_options()
- self.options.space_in_paren = false
- self.options.space_in_empty_paren = false
- bt('if(p) foo(a,b);', 'if (p) foo(a, b);')
- bt(
- 'try{while(true){willThrow()}}catch(result)switch(result){case 1:++result }',
- # -- output --
- 'try {\n' +
- ' while (true) {\n' +
- ' willThrow()\n' +
- ' }\n' +
- '} catch (result) switch (result) {\n' +
- ' case 1:\n' +
- ' ++result\n' +
- '}')
- bt('((e/((a+(b)*c)-d))^2)*5;', '((e / ((a + (b) * c) - d)) ^ 2) * 5;')
- bt(
- 'function f(a,b) {if(a) b()}function g(a,b) {if(!a) b()}',
- # -- output --
- 'function f(a, b) {\n' +
- ' if (a) b()\n' +
- '}\n' +
- '\n' +
- 'function g(a, b) {\n' +
- ' if (!a) b()\n' +
- '}')
- bt('a=[][ ]( );', 'a = [][]();')
- bt('a=()( )[ ];', 'a = ()()[];')
- bt('a=[b,c,d];', 'a = [b, c, d];')
- bt('a= f[b];', 'a = f[b];')
- bt(
- '{\n' +
- ' files: a[][ {\n' +
- ' expand: true,\n' +
- ' cwd: "www/gui/",\n' +
- ' src: b(c)[ "im/design_standards/*.*" ],\n' +
- ' dest: "www/gui/build"\n' +
- ' } ]\n' +
- '}',
- # -- output --
- '{\n' +
- ' files: a[][{\n' +
- ' expand: true,\n' +
- ' cwd: "www/gui/",\n' +
- ' src: b(c)["im/design_standards/*.*"],\n' +
- ' dest: "www/gui/build"\n' +
- ' }]\n' +
- '}')
-
- # Space in parens tests - (space_in_paren = "false", space_in_empty_paren = "true")
- self.reset_options()
- self.options.space_in_paren = false
- self.options.space_in_empty_paren = true
- bt('if(p) foo(a,b);', 'if (p) foo(a, b);')
- bt(
- 'try{while(true){willThrow()}}catch(result)switch(result){case 1:++result }',
- # -- output --
- 'try {\n' +
- ' while (true) {\n' +
- ' willThrow()\n' +
- ' }\n' +
- '} catch (result) switch (result) {\n' +
- ' case 1:\n' +
- ' ++result\n' +
- '}')
- bt('((e/((a+(b)*c)-d))^2)*5;', '((e / ((a + (b) * c) - d)) ^ 2) * 5;')
- bt(
- 'function f(a,b) {if(a) b()}function g(a,b) {if(!a) b()}',
- # -- output --
- 'function f(a, b) {\n' +
- ' if (a) b()\n' +
- '}\n' +
- '\n' +
- 'function g(a, b) {\n' +
- ' if (!a) b()\n' +
- '}')
- bt('a=[][ ]( );', 'a = [][]();')
- bt('a=()( )[ ];', 'a = ()()[];')
- bt('a=[b,c,d];', 'a = [b, c, d];')
- bt('a= f[b];', 'a = f[b];')
- bt(
- '{\n' +
- ' files: a[][ {\n' +
- ' expand: true,\n' +
- ' cwd: "www/gui/",\n' +
- ' src: b(c)[ "im/design_standards/*.*" ],\n' +
- ' dest: "www/gui/build"\n' +
- ' } ]\n' +
- '}',
- # -- output --
- '{\n' +
- ' files: a[][{\n' +
- ' expand: true,\n' +
- ' cwd: "www/gui/",\n' +
- ' src: b(c)["im/design_standards/*.*"],\n' +
- ' dest: "www/gui/build"\n' +
- ' }]\n' +
- '}')
-
- # Space in parens tests - (space_in_paren = "true", space_in_empty_paren = "false")
- self.reset_options()
- self.options.space_in_paren = true
- self.options.space_in_empty_paren = false
- bt('if(p) foo(a,b);', 'if ( p ) foo( a, b );')
- bt(
- 'try{while(true){willThrow()}}catch(result)switch(result){case 1:++result }',
- # -- output --
- 'try {\n' +
- ' while ( true ) {\n' +
- ' willThrow()\n' +
- ' }\n' +
- '} catch ( result ) switch ( result ) {\n' +
- ' case 1:\n' +
- ' ++result\n' +
- '}')
- bt('((e/((a+(b)*c)-d))^2)*5;', '( ( e / ( ( a + ( b ) * c ) - d ) ) ^ 2 ) * 5;')
- bt(
- 'function f(a,b) {if(a) b()}function g(a,b) {if(!a) b()}',
- # -- output --
- 'function f( a, b ) {\n' +
- ' if ( a ) b()\n' +
- '}\n' +
- '\n' +
- 'function g( a, b ) {\n' +
- ' if ( !a ) b()\n' +
- '}')
- bt('a=[][ ]( );', 'a = [][]();')
- bt('a=()( )[ ];', 'a = ()()[];')
- bt('a=[b,c,d];', 'a = [ b, c, d ];')
- bt('a= f[b];', 'a = f[ b ];')
- bt(
- '{\n' +
- ' files: a[][ {\n' +
- ' expand: true,\n' +
- ' cwd: "www/gui/",\n' +
- ' src: b(c)[ "im/design_standards/*.*" ],\n' +
- ' dest: "www/gui/build"\n' +
- ' } ]\n' +
- '}',
- # -- output --
- '{\n' +
- ' files: a[][ {\n' +
- ' expand: true,\n' +
- ' cwd: "www/gui/",\n' +
- ' src: b( c )[ "im/design_standards/*.*" ],\n' +
- ' dest: "www/gui/build"\n' +
- ' } ]\n' +
- '}')
-
- # Space in parens tests - (space_in_paren = "true", space_in_empty_paren = "true")
- self.reset_options()
- self.options.space_in_paren = true
- self.options.space_in_empty_paren = true
- bt('if(p) foo(a,b);', 'if ( p ) foo( a, b );')
- bt(
- 'try{while(true){willThrow()}}catch(result)switch(result){case 1:++result }',
- # -- output --
- 'try {\n' +
- ' while ( true ) {\n' +
- ' willThrow( )\n' +
- ' }\n' +
- '} catch ( result ) switch ( result ) {\n' +
- ' case 1:\n' +
- ' ++result\n' +
- '}')
- bt('((e/((a+(b)*c)-d))^2)*5;', '( ( e / ( ( a + ( b ) * c ) - d ) ) ^ 2 ) * 5;')
- bt(
- 'function f(a,b) {if(a) b()}function g(a,b) {if(!a) b()}',
- # -- output --
- 'function f( a, b ) {\n' +
- ' if ( a ) b( )\n' +
- '}\n' +
- '\n' +
- 'function g( a, b ) {\n' +
- ' if ( !a ) b( )\n' +
- '}')
- bt('a=[][ ]( );', 'a = [ ][ ]( );')
- bt('a=()( )[ ];', 'a = ( )( )[ ];')
- bt('a=[b,c,d];', 'a = [ b, c, d ];')
- bt('a= f[b];', 'a = f[ b ];')
- bt(
- '{\n' +
- ' files: a[][ {\n' +
- ' expand: true,\n' +
- ' cwd: "www/gui/",\n' +
- ' src: b(c)[ "im/design_standards/*.*" ],\n' +
- ' dest: "www/gui/build"\n' +
- ' } ]\n' +
- '}',
- # -- output --
- '{\n' +
- ' files: a[ ][ {\n' +
- ' expand: true,\n' +
- ' cwd: "www/gui/",\n' +
- ' src: b( c )[ "im/design_standards/*.*" ],\n' +
- ' dest: "www/gui/build"\n' +
- ' } ]\n' +
- '}')
-
-
- #============================================================
- # general preserve_newlines tests - (preserve_newlines = "false")
- self.reset_options()
- self.options.preserve_newlines = false
- bt(
- 'if (foo) // comment\n' +
- ' bar();')
- bt(
- 'if (foo) // comment\n' +
- ' bar();')
- bt(
- 'if (foo) // comment\n' +
- ' (bar());')
- bt(
- 'if (foo) // comment\n' +
- ' (bar());')
- bt(
- 'if (foo) // comment\n' +
- ' /asdf/;')
- bt(
- 'this.oa = new OAuth(\n' +
- ' _requestToken,\n' +
- ' _accessToken,\n' +
- ' consumer_key\n' +
- ');',
- # -- output --
- 'this.oa = new OAuth(_requestToken, _accessToken, consumer_key);')
- bt(
- 'foo = {\n' +
- ' x: y, // #44\n' +
- ' w: z // #44\n' +
- '}')
- bt(
- 'switch (x) {\n' +
- ' case "a":\n' +
- ' // comment on newline\n' +
- ' break;\n' +
- ' case "b": // comment on same line\n' +
- ' break;\n' +
- '}')
- bt(
- 'this.type =\n' +
- ' this.options =\n' +
- ' // comment\n' +
- ' this.enabled null;',
- # -- output --
- 'this.type = this.options =\n' +
- ' // comment\n' +
- ' this.enabled null;')
- bt(
- 'someObj\n' +
- ' .someFunc1()\n' +
- ' // This comment should not break the indent\n' +
- ' .someFunc2();',
- # -- output --
- 'someObj.someFunc1()\n' +
- ' // This comment should not break the indent\n' +
- ' .someFunc2();')
- bt(
- 'if (true ||\n' +
- '!true) return;',
- # -- output --
- 'if (true || !true) return;')
- bt(
- 'if\n' +
- '(foo)\n' +
- 'if\n' +
- '(bar)\n' +
- 'if\n' +
- '(baz)\n' +
- 'whee();\n' +
- 'a();',
- # -- output --
- 'if (foo)\n' +
- ' if (bar)\n' +
- ' if (baz) whee();\n' +
- 'a();')
- bt(
- 'if\n' +
- '(foo)\n' +
- 'if\n' +
- '(bar)\n' +
- 'if\n' +
- '(baz)\n' +
- 'whee();\n' +
- 'else\n' +
- 'a();',
- # -- output --
- 'if (foo)\n' +
- ' if (bar)\n' +
- ' if (baz) whee();\n' +
- ' else a();')
- bt(
- 'if (foo)\n' +
- 'bar();\n' +
- 'else\n' +
- 'car();',
- # -- output --
- 'if (foo) bar();\n' +
- 'else car();')
- bt(
- 'if (foo) if (bar) if (baz);\n' +
- 'a();',
- # -- output --
- 'if (foo)\n' +
- ' if (bar)\n' +
- ' if (baz);\n' +
- 'a();')
- bt(
- 'if (foo) if (bar) if (baz) whee();\n' +
- 'a();',
- # -- output --
- 'if (foo)\n' +
- ' if (bar)\n' +
- ' if (baz) whee();\n' +
- 'a();')
- bt(
- 'if (foo) a()\n' +
- 'if (bar) if (baz) whee();\n' +
- 'a();',
- # -- output --
- 'if (foo) a()\n' +
- 'if (bar)\n' +
- ' if (baz) whee();\n' +
- 'a();')
- bt(
- 'if (foo);\n' +
- 'if (bar) if (baz) whee();\n' +
- 'a();',
- # -- output --
- 'if (foo);\n' +
- 'if (bar)\n' +
- ' if (baz) whee();\n' +
- 'a();')
- bt(
- 'if (options)\n' +
- ' for (var p in options)\n' +
- ' this[p] = options[p];',
- # -- output --
- 'if (options)\n' +
- ' for (var p in options) this[p] = options[p];')
- bt(
- 'if (options) for (var p in options) this[p] = options[p];',
- # -- output --
- 'if (options)\n' +
- ' for (var p in options) this[p] = options[p];')
- bt(
- 'if (options) do q(); while (b());',
- # -- output --
- 'if (options)\n' +
- ' do q(); while (b());')
- bt(
- 'if (options) while (b()) q();',
- # -- output --
- 'if (options)\n' +
- ' while (b()) q();')
- bt(
- 'if (options) do while (b()) q(); while (a());',
- # -- output --
- 'if (options)\n' +
- ' do\n' +
- ' while (b()) q(); while (a());')
- bt(
- 'function f(a, b, c,\n' +
- 'd, e) {}',
- # -- output --
- 'function f(a, b, c, d, e) {}')
- bt(
- 'function f(a,b) {if(a) b()}function g(a,b) {if(!a) b()}',
- # -- output --
- 'function f(a, b) {\n' +
- ' if (a) b()\n' +
- '}\n' +
- '\n' +
- 'function g(a, b) {\n' +
- ' if (!a) b()\n' +
- '}')
- bt(
- 'function f(a,b) {if(a) b()}\n' +
- '\n' +
- '\n' +
- '\n' +
- 'function g(a,b) {if(!a) b()}',
- # -- output --
- 'function f(a, b) {\n' +
- ' if (a) b()\n' +
- '}\n' +
- '\n' +
- 'function g(a, b) {\n' +
- ' if (!a) b()\n' +
- '}')
- bt(
- '(if(a) b())(if(a) b())',
- # -- output --
- '(\n' +
- ' if (a) b())(\n' +
- ' if (a) b())')
- bt(
- '(if(a) b())\n' +
- '\n' +
- '\n' +
- '(if(a) b())',
- # -- output --
- '(\n' +
- ' if (a) b())\n' +
- '(\n' +
- ' if (a) b())')
- bt(
- 'if\n' +
- '(a)\n' +
- 'b();',
- # -- output --
- 'if (a) b();')
- bt(
- 'var a =\n' +
- 'foo',
- # -- output --
- 'var a = foo')
- bt(
- 'var a = {\n' +
- '"a":1,\n' +
- '"b":2}',
- # -- output --
- 'var a = {\n' +
- ' "a": 1,\n' +
- ' "b": 2\n' +
- '}')
- bt(
- 'var a = {\n' +
- '\'a\':1,\n' +
- '\'b\':2}',
- # -- output --
- 'var a = {\n' +
- ' \'a\': 1,\n' +
- ' \'b\': 2\n' +
- '}')
- bt('var a = /*i*/ "b";')
- bt(
- 'var a = /*i*/\n' +
- '"b";',
- # -- output --
- 'var a = /*i*/ "b";')
- bt(
- '{\n' +
- '\n' +
- '\n' +
- '"x"\n' +
- '}',
- # -- output --
- '{\n' +
- ' "x"\n' +
- '}')
- bt(
- 'if(a &&\n' +
- 'b\n' +
- '||\n' +
- 'c\n' +
- '||d\n' +
- '&&\n' +
- 'e) e = f',
- # -- output --
- 'if (a && b || c || d && e) e = f')
- bt(
- 'if(a &&\n' +
- '(b\n' +
- '||\n' +
- 'c\n' +
- '||d)\n' +
- '&&\n' +
- 'e) e = f',
- # -- output --
- 'if (a && (b || c || d) && e) e = f')
- test_fragment(
- '\n' +
- '\n' +
- '"x"',
- # -- output --
- '"x"')
- test_fragment(
- '{\n' +
- '\n' +
- '"x"\n' +
- 'h=5;\n' +
- '}',
- # -- output --
- '{\n' +
- ' "x"\n' +
- ' h = 5;\n' +
- '}')
- bt(
- 'var a = "foo" +\n' +
- ' "bar";',
- # -- output --
- 'var a = "foo" + "bar";')
- bt(
- 'var a = 42; // foo\n' +
- '\n' +
- 'var b;',
- # -- output --
- 'var a = 42; // foo\n' +
- 'var b;')
- bt(
- 'var a = 42; // foo\n' +
- '\n' +
- '\n' +
- 'var b;',
- # -- output --
- 'var a = 42; // foo\n' +
- 'var b;')
- bt(
- 'a = 1;\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- 'b = 2;',
- # -- output --
- 'a = 1;\n' +
- 'b = 2;')
-
- # general preserve_newlines tests - (preserve_newlines = "true")
- self.reset_options()
- self.options.preserve_newlines = true
- bt(
- 'if (foo) // comment\n' +
- ' bar();')
- bt(
- 'if (foo) // comment\n' +
- ' bar();')
- bt(
- 'if (foo) // comment\n' +
- ' (bar());')
- bt(
- 'if (foo) // comment\n' +
- ' (bar());')
- bt(
- 'if (foo) // comment\n' +
- ' /asdf/;')
- bt(
- 'this.oa = new OAuth(\n' +
- ' _requestToken,\n' +
- ' _accessToken,\n' +
- ' consumer_key\n' +
- ');')
- bt(
- 'foo = {\n' +
- ' x: y, // #44\n' +
- ' w: z // #44\n' +
- '}')
- bt(
- 'switch (x) {\n' +
- ' case "a":\n' +
- ' // comment on newline\n' +
- ' break;\n' +
- ' case "b": // comment on same line\n' +
- ' break;\n' +
- '}')
- bt(
- 'this.type =\n' +
- ' this.options =\n' +
- ' // comment\n' +
- ' this.enabled null;')
- bt(
- 'someObj\n' +
- ' .someFunc1()\n' +
- ' // This comment should not break the indent\n' +
- ' .someFunc2();')
- bt(
- 'if (true ||\n' +
- '!true) return;',
- # -- output --
- 'if (true ||\n' +
- ' !true) return;')
- bt(
- 'if\n' +
- '(foo)\n' +
- 'if\n' +
- '(bar)\n' +
- 'if\n' +
- '(baz)\n' +
- 'whee();\n' +
- 'a();',
- # -- output --
- 'if (foo)\n' +
- ' if (bar)\n' +
- ' if (baz)\n' +
- ' whee();\n' +
- 'a();')
- bt(
- 'if\n' +
- '(foo)\n' +
- 'if\n' +
- '(bar)\n' +
- 'if\n' +
- '(baz)\n' +
- 'whee();\n' +
- 'else\n' +
- 'a();',
- # -- output --
- 'if (foo)\n' +
- ' if (bar)\n' +
- ' if (baz)\n' +
- ' whee();\n' +
- ' else\n' +
- ' a();')
- bt(
- 'if (foo)\n' +
- 'bar();\n' +
- 'else\n' +
- 'car();',
- # -- output --
- 'if (foo)\n' +
- ' bar();\n' +
- 'else\n' +
- ' car();')
- bt(
- 'if (foo) if (bar) if (baz);\n' +
- 'a();',
- # -- output --
- 'if (foo)\n' +
- ' if (bar)\n' +
- ' if (baz);\n' +
- 'a();')
- bt(
- 'if (foo) if (bar) if (baz) whee();\n' +
- 'a();',
- # -- output --
- 'if (foo)\n' +
- ' if (bar)\n' +
- ' if (baz) whee();\n' +
- 'a();')
- bt(
- 'if (foo) a()\n' +
- 'if (bar) if (baz) whee();\n' +
- 'a();',
- # -- output --
- 'if (foo) a()\n' +
- 'if (bar)\n' +
- ' if (baz) whee();\n' +
- 'a();')
- bt(
- 'if (foo);\n' +
- 'if (bar) if (baz) whee();\n' +
- 'a();',
- # -- output --
- 'if (foo);\n' +
- 'if (bar)\n' +
- ' if (baz) whee();\n' +
- 'a();')
- bt(
- 'if (options)\n' +
- ' for (var p in options)\n' +
- ' this[p] = options[p];')
- bt(
- 'if (options) for (var p in options) this[p] = options[p];',
- # -- output --
- 'if (options)\n' +
- ' for (var p in options) this[p] = options[p];')
- bt(
- 'if (options) do q(); while (b());',
- # -- output --
- 'if (options)\n' +
- ' do q(); while (b());')
- bt(
- 'if (options) while (b()) q();',
- # -- output --
- 'if (options)\n' +
- ' while (b()) q();')
- bt(
- 'if (options) do while (b()) q(); while (a());',
- # -- output --
- 'if (options)\n' +
- ' do\n' +
- ' while (b()) q(); while (a());')
- bt(
- 'function f(a, b, c,\n' +
- 'd, e) {}',
- # -- output --
- 'function f(a, b, c,\n' +
- ' d, e) {}')
- bt(
- 'function f(a,b) {if(a) b()}function g(a,b) {if(!a) b()}',
- # -- output --
- 'function f(a, b) {\n' +
- ' if (a) b()\n' +
- '}\n' +
- '\n' +
- 'function g(a, b) {\n' +
- ' if (!a) b()\n' +
- '}')
- bt(
- 'function f(a,b) {if(a) b()}\n' +
- '\n' +
- '\n' +
- '\n' +
- 'function g(a,b) {if(!a) b()}',
- # -- output --
- 'function f(a, b) {\n' +
- ' if (a) b()\n' +
- '}\n' +
- '\n' +
- '\n' +
- '\n' +
- 'function g(a, b) {\n' +
- ' if (!a) b()\n' +
- '}')
- bt(
- '(if(a) b())(if(a) b())',
- # -- output --
- '(\n' +
- ' if (a) b())(\n' +
- ' if (a) b())')
- bt(
- '(if(a) b())\n' +
- '\n' +
- '\n' +
- '(if(a) b())',
- # -- output --
- '(\n' +
- ' if (a) b())\n' +
- '\n' +
- '\n' +
- '(\n' +
- ' if (a) b())')
- bt(
- 'if\n' +
- '(a)\n' +
- 'b();',
- # -- output --
- 'if (a)\n' +
- ' b();')
- bt(
- 'var a =\n' +
- 'foo',
- # -- output --
- 'var a =\n' +
- ' foo')
- bt(
- 'var a = {\n' +
- '"a":1,\n' +
- '"b":2}',
- # -- output --
- 'var a = {\n' +
- ' "a": 1,\n' +
- ' "b": 2\n' +
- '}')
- bt(
- 'var a = {\n' +
- '\'a\':1,\n' +
- '\'b\':2}',
- # -- output --
- 'var a = {\n' +
- ' \'a\': 1,\n' +
- ' \'b\': 2\n' +
- '}')
- bt('var a = /*i*/ "b";')
- bt(
- 'var a = /*i*/\n' +
- '"b";',
- # -- output --
- 'var a = /*i*/\n' +
- ' "b";')
- bt(
- '{\n' +
- '\n' +
- '\n' +
- '"x"\n' +
- '}',
- # -- output --
- '{\n' +
- '\n' +
- '\n' +
- ' "x"\n' +
- '}')
- bt(
- 'if(a &&\n' +
- 'b\n' +
- '||\n' +
- 'c\n' +
- '||d\n' +
- '&&\n' +
- 'e) e = f',
- # -- output --
- 'if (a &&\n' +
- ' b ||\n' +
- ' c ||\n' +
- ' d &&\n' +
- ' e) e = f')
- bt(
- 'if(a &&\n' +
- '(b\n' +
- '||\n' +
- 'c\n' +
- '||d)\n' +
- '&&\n' +
- 'e) e = f',
- # -- output --
- 'if (a &&\n' +
- ' (b ||\n' +
- ' c ||\n' +
- ' d) &&\n' +
- ' e) e = f')
- test_fragment(
- '\n' +
- '\n' +
- '"x"',
- # -- output --
- '"x"')
- test_fragment(
- '{\n' +
- '\n' +
- '"x"\n' +
- 'h=5;\n' +
- '}',
- # -- output --
- '{\n' +
- '\n' +
- ' "x"\n' +
- ' h = 5;\n' +
- '}')
- bt(
- 'var a = "foo" +\n' +
- ' "bar";')
- bt(
- 'var a = 42; // foo\n' +
- '\n' +
- 'var b;')
- bt(
- 'var a = 42; // foo\n' +
- '\n' +
- '\n' +
- 'var b;')
- bt(
- 'a = 1;\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- 'b = 2;')
-
-
- #============================================================
- # break chained methods - (break_chained_methods = "false", preserve_newlines = "false")
- self.reset_options()
- self.options.break_chained_methods = false
- self.options.preserve_newlines = false
- bt(
- 'foo\n' +
- '.bar()\n' +
- '.baz().cucumber(fat)',
- # -- output --
- 'foo.bar().baz().cucumber(fat)')
- bt(
- 'foo\n' +
- '.bar()\n' +
- '.baz().cucumber(fat); foo.bar().baz().cucumber(fat)',
- # -- output --
- 'foo.bar().baz().cucumber(fat);\n' +
- 'foo.bar().baz().cucumber(fat)')
- bt(
- 'foo\n' +
- '.bar()\n' +
- '.baz().cucumber(fat)\n' +
- ' foo.bar().baz().cucumber(fat)',
- # -- output --
- 'foo.bar().baz().cucumber(fat)\n' +
- 'foo.bar().baz().cucumber(fat)')
- bt(
- 'this\n' +
- '.something = foo.bar()\n' +
- '.baz().cucumber(fat)',
- # -- output --
- 'this.something = foo.bar().baz().cucumber(fat)')
- bt('this.something.xxx = foo.moo.bar()')
- bt(
- 'this\n' +
- '.something\n' +
- '.xxx = foo.moo\n' +
- '.bar()',
- # -- output --
- 'this.something.xxx = foo.moo.bar()')
-
- # optional chaining operator
- bt(
- 'foo\n' +
- '?.bar()\n' +
- '?.baz()?.cucumber(fat)',
- # -- output --
- 'foo?.bar()?.baz()?.cucumber(fat)')
- bt(
- 'foo\n' +
- '?.bar()\n' +
- '?.baz()?.cucumber(fat); foo?.bar()?.baz()?.cucumber(fat)',
- # -- output --
- 'foo?.bar()?.baz()?.cucumber(fat);\n' +
- 'foo?.bar()?.baz()?.cucumber(fat)')
- bt(
- 'foo\n' +
- '?.bar()\n' +
- '?.baz()?.cucumber(fat)\n' +
- ' foo?.bar()?.baz()?.cucumber(fat)',
- # -- output --
- 'foo?.bar()?.baz()?.cucumber(fat)\n' +
- 'foo?.bar()?.baz()?.cucumber(fat)')
- bt(
- 'this\n' +
- '?.something = foo?.bar()\n' +
- '?.baz()?.cucumber(fat)',
- # -- output --
- 'this?.something = foo?.bar()?.baz()?.cucumber(fat)')
- bt('this?.something?.xxx = foo?.moo?.bar()')
- bt(
- 'this\n' +
- '?.something\n' +
- '?.xxx = foo?.moo\n' +
- '?.bar()',
- # -- output --
- 'this?.something?.xxx = foo?.moo?.bar()')
-
- # break chained methods - (break_chained_methods = "false", preserve_newlines = "true")
- self.reset_options()
- self.options.break_chained_methods = false
- self.options.preserve_newlines = true
- bt(
- 'foo\n' +
- '.bar()\n' +
- '.baz().cucumber(fat)',
- # -- output --
- 'foo\n' +
- ' .bar()\n' +
- ' .baz().cucumber(fat)')
- bt(
- 'foo\n' +
- '.bar()\n' +
- '.baz().cucumber(fat); foo.bar().baz().cucumber(fat)',
- # -- output --
- 'foo\n' +
- ' .bar()\n' +
- ' .baz().cucumber(fat);\n' +
- 'foo.bar().baz().cucumber(fat)')
- bt(
- 'foo\n' +
- '.bar()\n' +
- '.baz().cucumber(fat)\n' +
- ' foo.bar().baz().cucumber(fat)',
- # -- output --
- 'foo\n' +
- ' .bar()\n' +
- ' .baz().cucumber(fat)\n' +
- 'foo.bar().baz().cucumber(fat)')
- bt(
- 'this\n' +
- '.something = foo.bar()\n' +
- '.baz().cucumber(fat)',
- # -- output --
- 'this\n' +
- ' .something = foo.bar()\n' +
- ' .baz().cucumber(fat)')
- bt('this.something.xxx = foo.moo.bar()')
- bt(
- 'this\n' +
- '.something\n' +
- '.xxx = foo.moo\n' +
- '.bar()',
- # -- output --
- 'this\n' +
- ' .something\n' +
- ' .xxx = foo.moo\n' +
- ' .bar()')
-
- # optional chaining operator
- bt(
- 'foo\n' +
- '?.bar()\n' +
- '?.baz()?.cucumber(fat)',
- # -- output --
- 'foo\n' +
- ' ?.bar()\n' +
- ' ?.baz()?.cucumber(fat)')
- bt(
- 'foo\n' +
- '?.bar()\n' +
- '?.baz()?.cucumber(fat); foo?.bar()?.baz()?.cucumber(fat)',
- # -- output --
- 'foo\n' +
- ' ?.bar()\n' +
- ' ?.baz()?.cucumber(fat);\n' +
- 'foo?.bar()?.baz()?.cucumber(fat)')
- bt(
- 'foo\n' +
- '?.bar()\n' +
- '?.baz()?.cucumber(fat)\n' +
- ' foo?.bar()?.baz()?.cucumber(fat)',
- # -- output --
- 'foo\n' +
- ' ?.bar()\n' +
- ' ?.baz()?.cucumber(fat)\n' +
- 'foo?.bar()?.baz()?.cucumber(fat)')
- bt(
- 'this\n' +
- '?.something = foo?.bar()\n' +
- '?.baz()?.cucumber(fat)',
- # -- output --
- 'this\n' +
- ' ?.something = foo?.bar()\n' +
- ' ?.baz()?.cucumber(fat)')
- bt('this?.something?.xxx = foo?.moo?.bar()')
- bt(
- 'this\n' +
- '?.something\n' +
- '?.xxx = foo?.moo\n' +
- '?.bar()',
- # -- output --
- 'this\n' +
- ' ?.something\n' +
- ' ?.xxx = foo?.moo\n' +
- ' ?.bar()')
-
- # break chained methods - (break_chained_methods = "true", preserve_newlines = "false")
- self.reset_options()
- self.options.break_chained_methods = true
- self.options.preserve_newlines = false
- bt(
- 'foo\n' +
- '.bar()\n' +
- '.baz().cucumber(fat)',
- # -- output --
- 'foo.bar()\n' +
- ' .baz()\n' +
- ' .cucumber(fat)')
- bt(
- 'foo\n' +
- '.bar()\n' +
- '.baz().cucumber(fat); foo.bar().baz().cucumber(fat)',
- # -- output --
- 'foo.bar()\n' +
- ' .baz()\n' +
- ' .cucumber(fat);\n' +
- 'foo.bar()\n' +
- ' .baz()\n' +
- ' .cucumber(fat)')
- bt(
- 'foo\n' +
- '.bar()\n' +
- '.baz().cucumber(fat)\n' +
- ' foo.bar().baz().cucumber(fat)',
- # -- output --
- 'foo.bar()\n' +
- ' .baz()\n' +
- ' .cucumber(fat)\n' +
- 'foo.bar()\n' +
- ' .baz()\n' +
- ' .cucumber(fat)')
- bt(
- 'this\n' +
- '.something = foo.bar()\n' +
- '.baz().cucumber(fat)',
- # -- output --
- 'this.something = foo.bar()\n' +
- ' .baz()\n' +
- ' .cucumber(fat)')
- bt('this.something.xxx = foo.moo.bar()')
- bt(
- 'this\n' +
- '.something\n' +
- '.xxx = foo.moo\n' +
- '.bar()',
- # -- output --
- 'this.something.xxx = foo.moo.bar()')
-
- # optional chaining operator
- bt(
- 'foo\n' +
- '?.bar()\n' +
- '?.baz()?.cucumber(fat)',
- # -- output --
- 'foo?.bar()\n' +
- ' ?.baz()\n' +
- ' ?.cucumber(fat)')
- bt(
- 'foo\n' +
- '?.bar()\n' +
- '?.baz()?.cucumber(fat); foo?.bar()?.baz()?.cucumber(fat)',
- # -- output --
- 'foo?.bar()\n' +
- ' ?.baz()\n' +
- ' ?.cucumber(fat);\n' +
- 'foo?.bar()\n' +
- ' ?.baz()\n' +
- ' ?.cucumber(fat)')
- bt(
- 'foo\n' +
- '?.bar()\n' +
- '?.baz()?.cucumber(fat)\n' +
- ' foo?.bar()?.baz()?.cucumber(fat)',
- # -- output --
- 'foo?.bar()\n' +
- ' ?.baz()\n' +
- ' ?.cucumber(fat)\n' +
- 'foo?.bar()\n' +
- ' ?.baz()\n' +
- ' ?.cucumber(fat)')
- bt(
- 'this\n' +
- '?.something = foo?.bar()\n' +
- '?.baz()?.cucumber(fat)',
- # -- output --
- 'this?.something = foo?.bar()\n' +
- ' ?.baz()\n' +
- ' ?.cucumber(fat)')
- bt('this?.something?.xxx = foo?.moo?.bar()')
- bt(
- 'this\n' +
- '?.something\n' +
- '?.xxx = foo?.moo\n' +
- '?.bar()',
- # -- output --
- 'this?.something?.xxx = foo?.moo?.bar()')
-
- # break chained methods - (break_chained_methods = "true", preserve_newlines = "true")
- self.reset_options()
- self.options.break_chained_methods = true
- self.options.preserve_newlines = true
- bt(
- 'foo\n' +
- '.bar()\n' +
- '.baz().cucumber(fat)',
- # -- output --
- 'foo\n' +
- ' .bar()\n' +
- ' .baz()\n' +
- ' .cucumber(fat)')
- bt(
- 'foo\n' +
- '.bar()\n' +
- '.baz().cucumber(fat); foo.bar().baz().cucumber(fat)',
- # -- output --
- 'foo\n' +
- ' .bar()\n' +
- ' .baz()\n' +
- ' .cucumber(fat);\n' +
- 'foo.bar()\n' +
- ' .baz()\n' +
- ' .cucumber(fat)')
- bt(
- 'foo\n' +
- '.bar()\n' +
- '.baz().cucumber(fat)\n' +
- ' foo.bar().baz().cucumber(fat)',
- # -- output --
- 'foo\n' +
- ' .bar()\n' +
- ' .baz()\n' +
- ' .cucumber(fat)\n' +
- 'foo.bar()\n' +
- ' .baz()\n' +
- ' .cucumber(fat)')
- bt(
- 'this\n' +
- '.something = foo.bar()\n' +
- '.baz().cucumber(fat)',
- # -- output --
- 'this\n' +
- ' .something = foo.bar()\n' +
- ' .baz()\n' +
- ' .cucumber(fat)')
- bt('this.something.xxx = foo.moo.bar()')
- bt(
- 'this\n' +
- '.something\n' +
- '.xxx = foo.moo\n' +
- '.bar()',
- # -- output --
- 'this\n' +
- ' .something\n' +
- ' .xxx = foo.moo\n' +
- ' .bar()')
-
- # optional chaining operator
- bt(
- 'foo\n' +
- '?.bar()\n' +
- '?.baz()?.cucumber(fat)',
- # -- output --
- 'foo\n' +
- ' ?.bar()\n' +
- ' ?.baz()\n' +
- ' ?.cucumber(fat)')
- bt(
- 'foo\n' +
- '?.bar()\n' +
- '?.baz()?.cucumber(fat); foo?.bar()?.baz()?.cucumber(fat)',
- # -- output --
- 'foo\n' +
- ' ?.bar()\n' +
- ' ?.baz()\n' +
- ' ?.cucumber(fat);\n' +
- 'foo?.bar()\n' +
- ' ?.baz()\n' +
- ' ?.cucumber(fat)')
- bt(
- 'foo\n' +
- '?.bar()\n' +
- '?.baz()?.cucumber(fat)\n' +
- ' foo?.bar()?.baz()?.cucumber(fat)',
- # -- output --
- 'foo\n' +
- ' ?.bar()\n' +
- ' ?.baz()\n' +
- ' ?.cucumber(fat)\n' +
- 'foo?.bar()\n' +
- ' ?.baz()\n' +
- ' ?.cucumber(fat)')
- bt(
- 'this\n' +
- '?.something = foo?.bar()\n' +
- '?.baz()?.cucumber(fat)',
- # -- output --
- 'this\n' +
- ' ?.something = foo?.bar()\n' +
- ' ?.baz()\n' +
- ' ?.cucumber(fat)')
- bt('this?.something?.xxx = foo?.moo?.bar()')
- bt(
- 'this\n' +
- '?.something\n' +
- '?.xxx = foo?.moo\n' +
- '?.bar()',
- # -- output --
- 'this\n' +
- ' ?.something\n' +
- ' ?.xxx = foo?.moo\n' +
- ' ?.bar()')
-
-
- #============================================================
- # line wrapping 0
- self.reset_options()
- self.options.preserve_newlines = false
- self.options.wrap_line_length = 0
- test_fragment(
- '' + wrap_input_1 + '',
- # -- output --
- 'foo.bar().baz().cucumber((f && "sass") || (leans && mean));\n' +
- 'Test_very_long_variable_name_this_should_never_wrap.but_this_can\n' +
- 'return between_return_and_expression_should_never_wrap.but_this_can\n' +
- 'throw between_throw_and_expression_should_never_wrap.but_this_can\n' +
- 'if (wraps_can_occur && inside_an_if_block) that_is_.okay();\n' +
- 'object_literal = {\n' +
- ' propertx: first_token + 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap + but_this_can,\n' +
- ' propertz: first_token_should_never_wrap + !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" + "but_this_can"\n' +
- '}')
- test_fragment(
- '' + wrap_input_2 + '',
- # -- output --
- '{\n' +
- ' foo.bar().baz().cucumber((f && "sass") || (leans && mean));\n' +
- ' Test_very_long_variable_name_this_should_never_wrap.but_this_can\n' +
- ' return between_return_and_expression_should_never_wrap.but_this_can\n' +
- ' throw between_throw_and_expression_should_never_wrap.but_this_can\n' +
- ' if (wraps_can_occur && inside_an_if_block) that_is_.okay();\n' +
- ' object_literal = {\n' +
- ' propertx: first_token + 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap + but_this_can,\n' +
- ' propertz: first_token_should_never_wrap + !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" + "but_this_can"\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # line wrapping 70
- self.reset_options()
- self.options.preserve_newlines = false
- self.options.wrap_line_length = 70
- test_fragment(
- '' + wrap_input_1 + '',
- # -- output --
- 'foo.bar().baz().cucumber((f && "sass") || (leans && mean));\n' +
- 'Test_very_long_variable_name_this_should_never_wrap.but_this_can\n' +
- 'return between_return_and_expression_should_never_wrap.but_this_can\n' +
- 'throw between_throw_and_expression_should_never_wrap.but_this_can\n' +
- 'if (wraps_can_occur && inside_an_if_block) that_is_.okay();\n' +
- 'object_literal = {\n' +
- ' propertx: first_token + 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap + but_this_can,\n' +
- ' propertz: first_token_should_never_wrap + !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" + "but_this_can"\n' +
- '}')
- test_fragment(
- '' + wrap_input_2 + '',
- # -- output --
- '{\n' +
- ' foo.bar().baz().cucumber((f && "sass") || (leans && mean));\n' +
- ' Test_very_long_variable_name_this_should_never_wrap.but_this_can\n' +
- ' return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' throw between_throw_and_expression_should_never_wrap.but_this_can\n' +
- ' if (wraps_can_occur && inside_an_if_block) that_is_.okay();\n' +
- ' object_literal = {\n' +
- ' propertx: first_token + 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap + but_this_can,\n' +
- ' propertz: first_token_should_never_wrap + !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" + "but_this_can"\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # line wrapping 40
- self.reset_options()
- self.options.preserve_newlines = false
- self.options.wrap_line_length = 40
- test_fragment(
- '' + wrap_input_1 + '',
- # -- output --
- 'foo.bar().baz().cucumber((f &&\n' +
- ' "sass") || (leans && mean));\n' +
- 'Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'throw between_throw_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'if (wraps_can_occur &&\n' +
- ' inside_an_if_block) that_is_.okay();\n' +
- 'object_literal = {\n' +
- ' propertx: first_token +\n' +
- ' 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap +\n' +
- ' but_this_can,\n' +
- ' propertz: first_token_should_never_wrap +\n' +
- ' !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" +\n' +
- ' "but_this_can"\n' +
- '}')
- test_fragment(
- '' + wrap_input_2 + '',
- # -- output --
- '{\n' +
- ' foo.bar().baz().cucumber((f &&\n' +
- ' "sass") || (leans &&\n' +
- ' mean));\n' +
- ' Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' throw between_throw_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' if (wraps_can_occur &&\n' +
- ' inside_an_if_block) that_is_\n' +
- ' .okay();\n' +
- ' object_literal = {\n' +
- ' propertx: first_token +\n' +
- ' 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap +\n' +
- ' but_this_can,\n' +
- ' propertz: first_token_should_never_wrap +\n' +
- ' !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" +\n' +
- ' "but_this_can"\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # line wrapping 41
- self.reset_options()
- self.options.preserve_newlines = false
- self.options.wrap_line_length = 41
- test_fragment(
- '' + wrap_input_1 + '',
- # -- output --
- 'foo.bar().baz().cucumber((f && "sass") ||\n' +
- ' (leans && mean));\n' +
- 'Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'throw between_throw_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'if (wraps_can_occur &&\n' +
- ' inside_an_if_block) that_is_.okay();\n' +
- 'object_literal = {\n' +
- ' propertx: first_token +\n' +
- ' 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap +\n' +
- ' but_this_can,\n' +
- ' propertz: first_token_should_never_wrap +\n' +
- ' !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" +\n' +
- ' "but_this_can"\n' +
- '}')
- test_fragment(
- '' + wrap_input_2 + '',
- # -- output --
- '{\n' +
- ' foo.bar().baz().cucumber((f &&\n' +
- ' "sass") || (leans &&\n' +
- ' mean));\n' +
- ' Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' throw between_throw_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' if (wraps_can_occur &&\n' +
- ' inside_an_if_block) that_is_\n' +
- ' .okay();\n' +
- ' object_literal = {\n' +
- ' propertx: first_token +\n' +
- ' 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap +\n' +
- ' but_this_can,\n' +
- ' propertz: first_token_should_never_wrap +\n' +
- ' !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" +\n' +
- ' "but_this_can"\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # line wrapping 45
- self.reset_options()
- self.options.preserve_newlines = false
- self.options.wrap_line_length = 45
- test_fragment(
- '' + wrap_input_1 + '',
- # -- output --
- 'foo.bar().baz().cucumber((f && "sass") || (\n' +
- ' leans && mean));\n' +
- 'Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'throw between_throw_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'if (wraps_can_occur && inside_an_if_block)\n' +
- ' that_is_.okay();\n' +
- 'object_literal = {\n' +
- ' propertx: first_token +\n' +
- ' 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap +\n' +
- ' but_this_can,\n' +
- ' propertz: first_token_should_never_wrap +\n' +
- ' !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" +\n' +
- ' "but_this_can"\n' +
- '}')
- test_fragment(
- '' + wrap_input_2 + '',
- # -- output --
- '{\n' +
- ' foo.bar().baz().cucumber((f && "sass") ||\n' +
- ' (leans && mean));\n' +
- ' Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' throw between_throw_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' if (wraps_can_occur &&\n' +
- ' inside_an_if_block) that_is_.okay();\n' +
- ' object_literal = {\n' +
- ' propertx: first_token +\n' +
- ' 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap +\n' +
- ' but_this_can,\n' +
- ' propertz: first_token_should_never_wrap +\n' +
- ' !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" +\n' +
- ' "but_this_can"\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # line wrapping 0
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.wrap_line_length = 0
- test_fragment(
- '' + wrap_input_1 + '',
- # -- output --
- 'foo.bar().baz().cucumber((f && "sass") || (leans && mean));\n' +
- 'Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'return between_return_and_expression_should_never_wrap.but_this_can\n' +
- 'throw between_throw_and_expression_should_never_wrap.but_this_can\n' +
- 'if (wraps_can_occur && inside_an_if_block) that_is_\n' +
- ' .okay();\n' +
- 'object_literal = {\n' +
- ' propertx: first_token + 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap + but_this_can,\n' +
- ' propertz: first_token_should_never_wrap + !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" + "but_this_can"\n' +
- '}')
- test_fragment(
- '' + wrap_input_2 + '',
- # -- output --
- '{\n' +
- ' foo.bar().baz().cucumber((f && "sass") || (leans && mean));\n' +
- ' Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' return between_return_and_expression_should_never_wrap.but_this_can\n' +
- ' throw between_throw_and_expression_should_never_wrap.but_this_can\n' +
- ' if (wraps_can_occur && inside_an_if_block) that_is_\n' +
- ' .okay();\n' +
- ' object_literal = {\n' +
- ' propertx: first_token + 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap + but_this_can,\n' +
- ' propertz: first_token_should_never_wrap + !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" + "but_this_can"\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # line wrapping 70
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.wrap_line_length = 70
- test_fragment(
- '' + wrap_input_1 + '',
- # -- output --
- 'foo.bar().baz().cucumber((f && "sass") || (leans && mean));\n' +
- 'Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'return between_return_and_expression_should_never_wrap.but_this_can\n' +
- 'throw between_throw_and_expression_should_never_wrap.but_this_can\n' +
- 'if (wraps_can_occur && inside_an_if_block) that_is_\n' +
- ' .okay();\n' +
- 'object_literal = {\n' +
- ' propertx: first_token + 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap + but_this_can,\n' +
- ' propertz: first_token_should_never_wrap + !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" + "but_this_can"\n' +
- '}')
- test_fragment(
- '' + wrap_input_2 + '',
- # -- output --
- '{\n' +
- ' foo.bar().baz().cucumber((f && "sass") || (leans && mean));\n' +
- ' Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' throw between_throw_and_expression_should_never_wrap.but_this_can\n' +
- ' if (wraps_can_occur && inside_an_if_block) that_is_\n' +
- ' .okay();\n' +
- ' object_literal = {\n' +
- ' propertx: first_token + 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap + but_this_can,\n' +
- ' propertz: first_token_should_never_wrap + !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" + "but_this_can"\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # line wrapping 40
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.wrap_line_length = 40
- test_fragment(
- '' + wrap_input_1 + '',
- # -- output --
- 'foo.bar().baz().cucumber((f &&\n' +
- ' "sass") || (leans && mean));\n' +
- 'Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'throw between_throw_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'if (wraps_can_occur &&\n' +
- ' inside_an_if_block) that_is_\n' +
- ' .okay();\n' +
- 'object_literal = {\n' +
- ' propertx: first_token +\n' +
- ' 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap +\n' +
- ' but_this_can,\n' +
- ' propertz: first_token_should_never_wrap +\n' +
- ' !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" +\n' +
- ' "but_this_can"\n' +
- '}')
- test_fragment(
- '' + wrap_input_2 + '',
- # -- output --
- '{\n' +
- ' foo.bar().baz().cucumber((f &&\n' +
- ' "sass") || (leans &&\n' +
- ' mean));\n' +
- ' Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' throw between_throw_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' if (wraps_can_occur &&\n' +
- ' inside_an_if_block) that_is_\n' +
- ' .okay();\n' +
- ' object_literal = {\n' +
- ' propertx: first_token +\n' +
- ' 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap +\n' +
- ' but_this_can,\n' +
- ' propertz: first_token_should_never_wrap +\n' +
- ' !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" +\n' +
- ' "but_this_can"\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # line wrapping 41
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.wrap_line_length = 41
- test_fragment(
- '' + wrap_input_1 + '',
- # -- output --
- 'foo.bar().baz().cucumber((f && "sass") ||\n' +
- ' (leans && mean));\n' +
- 'Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'throw between_throw_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'if (wraps_can_occur &&\n' +
- ' inside_an_if_block) that_is_\n' +
- ' .okay();\n' +
- 'object_literal = {\n' +
- ' propertx: first_token +\n' +
- ' 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap +\n' +
- ' but_this_can,\n' +
- ' propertz: first_token_should_never_wrap +\n' +
- ' !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" +\n' +
- ' "but_this_can"\n' +
- '}')
- test_fragment(
- '' + wrap_input_2 + '',
- # -- output --
- '{\n' +
- ' foo.bar().baz().cucumber((f &&\n' +
- ' "sass") || (leans &&\n' +
- ' mean));\n' +
- ' Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' throw between_throw_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' if (wraps_can_occur &&\n' +
- ' inside_an_if_block) that_is_\n' +
- ' .okay();\n' +
- ' object_literal = {\n' +
- ' propertx: first_token +\n' +
- ' 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap +\n' +
- ' but_this_can,\n' +
- ' propertz: first_token_should_never_wrap +\n' +
- ' !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" +\n' +
- ' "but_this_can"\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # line wrapping 45
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.wrap_line_length = 45
- test_fragment(
- '' + wrap_input_1 + '',
- # -- output --
- 'foo.bar().baz().cucumber((f && "sass") || (\n' +
- ' leans && mean));\n' +
- 'Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'throw between_throw_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- 'if (wraps_can_occur && inside_an_if_block)\n' +
- ' that_is_\n' +
- ' .okay();\n' +
- 'object_literal = {\n' +
- ' propertx: first_token +\n' +
- ' 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap +\n' +
- ' but_this_can,\n' +
- ' propertz: first_token_should_never_wrap +\n' +
- ' !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" +\n' +
- ' "but_this_can"\n' +
- '}')
- test_fragment(
- '' + wrap_input_2 + '',
- # -- output --
- '{\n' +
- ' foo.bar().baz().cucumber((f && "sass") ||\n' +
- ' (leans && mean));\n' +
- ' Test_very_long_variable_name_this_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' return between_return_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' throw between_throw_and_expression_should_never_wrap\n' +
- ' .but_this_can\n' +
- ' if (wraps_can_occur &&\n' +
- ' inside_an_if_block) that_is_\n' +
- ' .okay();\n' +
- ' object_literal = {\n' +
- ' propertx: first_token +\n' +
- ' 12345678.99999E-6,\n' +
- ' property: first_token_should_never_wrap +\n' +
- ' but_this_can,\n' +
- ' propertz: first_token_should_never_wrap +\n' +
- ' !but_this_can,\n' +
- ' proper: "first_token_should_never_wrap" +\n' +
- ' "but_this_can"\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # general preserve_newlines tests preserve limit
- self.reset_options()
- self.options.preserve_newlines = true
- self.options.max_preserve_newlines = 8
- bt(
- 'a = 1;\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- 'b = 2;',
- # -- output --
- 'a = 1;\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- '\n' +
- 'b = 2;')
-
-
- #============================================================
- # more random test
- self.reset_options()
- bt('return function();')
- bt('var a = function();')
- bt('var a = 5 + function();')
-
- # actionscript import
- bt('import foo.*;')
-
- # actionscript
- bt('function f(a: a, b: b)')
- bt(
- 'function a(a) {} function b(b) {} function c(c) {}',
- # -- output --
- 'function a(a) {}\n' +
- '\n' +
- 'function b(b) {}\n' +
- '\n' +
- 'function c(c) {}')
- bt('foo(a, function() {})')
- bt('foo(a, /regex/)')
- bt(
- '/* foo */\n' +
- '"x"')
- test_fragment(
- 'roo = {\n' +
- ' /*\n' +
- ' ****\n' +
- ' FOO\n' +
- ' ****\n' +
- ' */\n' +
- ' BAR: 0\n' +
- '};')
- test_fragment(
- 'if (zz) {\n' +
- ' // ....\n' +
- '}\n' +
- '(function')
- bt(
- 'a = //comment\n' +
- ' /regex/;')
- bt('var a = new function();')
- bt('new function')
- bt(
- 'if (a)\n' +
- '{\n' +
- 'b;\n' +
- '}\n' +
- 'else\n' +
- '{\n' +
- 'c;\n' +
- '}',
- # -- output --
- 'if (a) {\n' +
- ' b;\n' +
- '} else {\n' +
- ' c;\n' +
- '}')
-
-
- #============================================================
- # operator_position option - ensure no neswlines if preserve_newlines is false - (preserve_newlines = "false")
- self.reset_options()
- self.options.preserve_newlines = false
- bt(
- 'var res = a + b - c / d * e % f;\n' +
- 'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
- 'var res = p >> q << r >>> s;\n' +
- 'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
- 'ac + -ad')
- bt(
- 'var res = a + b\n' +
- '- c /\n' +
- 'd * e\n' +
- '%\n' +
- 'f;\n' +
- ' var res = g & h\n' +
- '| i ^\n' +
- 'j\n' +
- '|> console.log;\n' +
- 'var res = (k &&\n' +
- 'l\n' +
- '|| m) ?\n' +
- 'n\n' +
- ': o\n' +
- ';\n' +
- 'var res = p\n' +
- '>> q <<\n' +
- 'r\n' +
- '>>> s;\n' +
- 'var res\n' +
- ' = t\n' +
- '\n' +
- ' === u !== v\n' +
- ' !=\n' +
- 'w\n' +
- '== x >=\n' +
- 'y <= z > aa <\n' +
- 'ab;\n' +
- 'ac +\n' +
- '-ad',
- # -- output --
- 'var res = a + b - c / d * e % f;\n' +
- 'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
- 'var res = p >> q << r >>> s;\n' +
- 'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
- 'ac + -ad')
-
- # operator_position option - ensure no neswlines if preserve_newlines is false - (operator_position = ""before-newline"", preserve_newlines = "false")
- self.reset_options()
- self.options.operator_position = 'before-newline'
- self.options.preserve_newlines = false
- bt(
- 'var res = a + b - c / d * e % f;\n' +
- 'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
- 'var res = p >> q << r >>> s;\n' +
- 'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
- 'ac + -ad')
- bt(
- 'var res = a + b\n' +
- '- c /\n' +
- 'd * e\n' +
- '%\n' +
- 'f;\n' +
- ' var res = g & h\n' +
- '| i ^\n' +
- 'j\n' +
- '|> console.log;\n' +
- 'var res = (k &&\n' +
- 'l\n' +
- '|| m) ?\n' +
- 'n\n' +
- ': o\n' +
- ';\n' +
- 'var res = p\n' +
- '>> q <<\n' +
- 'r\n' +
- '>>> s;\n' +
- 'var res\n' +
- ' = t\n' +
- '\n' +
- ' === u !== v\n' +
- ' !=\n' +
- 'w\n' +
- '== x >=\n' +
- 'y <= z > aa <\n' +
- 'ab;\n' +
- 'ac +\n' +
- '-ad',
- # -- output --
- 'var res = a + b - c / d * e % f;\n' +
- 'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
- 'var res = p >> q << r >>> s;\n' +
- 'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
- 'ac + -ad')
-
- # operator_position option - ensure no neswlines if preserve_newlines is false - (operator_position = ""after-newline"", preserve_newlines = "false")
- self.reset_options()
- self.options.operator_position = 'after-newline'
- self.options.preserve_newlines = false
- bt(
- 'var res = a + b - c / d * e % f;\n' +
- 'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
- 'var res = p >> q << r >>> s;\n' +
- 'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
- 'ac + -ad')
- bt(
- 'var res = a + b\n' +
- '- c /\n' +
- 'd * e\n' +
- '%\n' +
- 'f;\n' +
- ' var res = g & h\n' +
- '| i ^\n' +
- 'j\n' +
- '|> console.log;\n' +
- 'var res = (k &&\n' +
- 'l\n' +
- '|| m) ?\n' +
- 'n\n' +
- ': o\n' +
- ';\n' +
- 'var res = p\n' +
- '>> q <<\n' +
- 'r\n' +
- '>>> s;\n' +
- 'var res\n' +
- ' = t\n' +
- '\n' +
- ' === u !== v\n' +
- ' !=\n' +
- 'w\n' +
- '== x >=\n' +
- 'y <= z > aa <\n' +
- 'ab;\n' +
- 'ac +\n' +
- '-ad',
- # -- output --
- 'var res = a + b - c / d * e % f;\n' +
- 'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
- 'var res = p >> q << r >>> s;\n' +
- 'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
- 'ac + -ad')
-
- # operator_position option - ensure no neswlines if preserve_newlines is false - (operator_position = ""preserve-newline"", preserve_newlines = "false")
- self.reset_options()
- self.options.operator_position = 'preserve-newline'
- self.options.preserve_newlines = false
- bt(
- 'var res = a + b - c / d * e % f;\n' +
- 'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
- 'var res = p >> q << r >>> s;\n' +
- 'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
- 'ac + -ad')
- bt(
- 'var res = a + b\n' +
- '- c /\n' +
- 'd * e\n' +
- '%\n' +
- 'f;\n' +
- ' var res = g & h\n' +
- '| i ^\n' +
- 'j\n' +
- '|> console.log;\n' +
- 'var res = (k &&\n' +
- 'l\n' +
- '|| m) ?\n' +
- 'n\n' +
- ': o\n' +
- ';\n' +
- 'var res = p\n' +
- '>> q <<\n' +
- 'r\n' +
- '>>> s;\n' +
- 'var res\n' +
- ' = t\n' +
- '\n' +
- ' === u !== v\n' +
- ' !=\n' +
- 'w\n' +
- '== x >=\n' +
- 'y <= z > aa <\n' +
- 'ab;\n' +
- 'ac +\n' +
- '-ad',
- # -- output --
- 'var res = a + b - c / d * e % f;\n' +
- 'var res = g & h | i ^ j |> console.log;\n' +
- 'var res = (k && l || m) ? n : o;\n' +
- 'var res = p >> q << r >>> s;\n' +
- 'var res = t === u !== v != w == x >= y <= z > aa < ab;\n' +
- 'ac + -ad')
-
-
- #============================================================
- # operator_position option - set to "before-newline" (default value) - ()
- self.reset_options()
-
- # comprehensive, various newlines
- bt(
- 'var res = a + b\n' +
- '- c /\n' +
- 'd * e\n' +
- '%\n' +
- 'f;\n' +
- ' var res = g & h\n' +
- '| i ^\n' +
- 'j\n' +
- '|> console.log;\n' +
- 'var res = (k &&\n' +
- 'l\n' +
- '|| m) ?\n' +
- 'n\n' +
- ': o\n' +
- ';\n' +
- 'var res = p\n' +
- '>> q <<\n' +
- 'r\n' +
- '>>> s;\n' +
- 'var res\n' +
- ' = t\n' +
- '\n' +
- ' === u !== v\n' +
- ' !=\n' +
- 'w\n' +
- '== x >=\n' +
- 'y <= z > aa <\n' +
- 'ab;\n' +
- 'ac +\n' +
- '-ad',
- # -- output --
- 'var res = a + b -\n' +
- ' c /\n' +
- ' d * e %\n' +
- ' f;\n' +
- 'var res = g & h |\n' +
- ' i ^\n' +
- ' j |>\n' +
- ' console.log;\n' +
- 'var res = (k &&\n' +
- ' l ||\n' +
- ' m) ?\n' +
- ' n :\n' +
- ' o;\n' +
- 'var res = p >>\n' +
- ' q <<\n' +
- ' r >>>\n' +
- ' s;\n' +
- 'var res = t\n' +
- '\n' +
- ' ===\n' +
- ' u !== v !=\n' +
- ' w ==\n' +
- ' x >=\n' +
- ' y <= z > aa <\n' +
- ' ab;\n' +
- 'ac +\n' +
- ' -ad')
-
- # colon special case
- bt(
- 'var a = {\n' +
- ' b\n' +
- ': bval,\n' +
- ' c:\n' +
- 'cval\n' +
- ' ,d: dval\n' +
- '};\n' +
- 'var e = f ? g\n' +
- ': h;\n' +
- 'var i = j ? k :\n' +
- 'l;',
- # -- output --
- 'var a = {\n' +
- ' b: bval,\n' +
- ' c: cval,\n' +
- ' d: dval\n' +
- '};\n' +
- 'var e = f ? g :\n' +
- ' h;\n' +
- 'var i = j ? k :\n' +
- ' l;')
-
- # catch-all, includes brackets and other various code
- bt(
- 'var d = 1;\n' +
- 'if (a === b\n' +
- ' && c) {\n' +
- ' d = (c * everything\n' +
- ' / something_else) %\n' +
- ' b;\n' +
- ' e\n' +
- ' += d;\n' +
- '\n' +
- '} else if (!(complex && simple) ||\n' +
- ' (emotion && emotion.name === "happy")) {\n' +
- ' cryTearsOfJoy(many ||\n' +
- ' anOcean\n' +
- ' || aRiver);\n' +
- '}',
- # -- output --
- 'var d = 1;\n' +
- 'if (a === b &&\n' +
- ' c) {\n' +
- ' d = (c * everything /\n' +
- ' something_else) %\n' +
- ' b;\n' +
- ' e\n' +
- ' += d;\n' +
- '\n' +
- '} else if (!(complex && simple) ||\n' +
- ' (emotion && emotion.name === "happy")) {\n' +
- ' cryTearsOfJoy(many ||\n' +
- ' anOcean ||\n' +
- ' aRiver);\n' +
- '}')
-
- # operator_position option - set to "before-newline" (default value) - (operator_position = ""before-newline"")
- self.reset_options()
- self.options.operator_position = 'before-newline'
-
- # comprehensive, various newlines
- bt(
- 'var res = a + b\n' +
- '- c /\n' +
- 'd * e\n' +
- '%\n' +
- 'f;\n' +
- ' var res = g & h\n' +
- '| i ^\n' +
- 'j\n' +
- '|> console.log;\n' +
- 'var res = (k &&\n' +
- 'l\n' +
- '|| m) ?\n' +
- 'n\n' +
- ': o\n' +
- ';\n' +
- 'var res = p\n' +
- '>> q <<\n' +
- 'r\n' +
- '>>> s;\n' +
- 'var res\n' +
- ' = t\n' +
- '\n' +
- ' === u !== v\n' +
- ' !=\n' +
- 'w\n' +
- '== x >=\n' +
- 'y <= z > aa <\n' +
- 'ab;\n' +
- 'ac +\n' +
- '-ad',
- # -- output --
- 'var res = a + b -\n' +
- ' c /\n' +
- ' d * e %\n' +
- ' f;\n' +
- 'var res = g & h |\n' +
- ' i ^\n' +
- ' j |>\n' +
- ' console.log;\n' +
- 'var res = (k &&\n' +
- ' l ||\n' +
- ' m) ?\n' +
- ' n :\n' +
- ' o;\n' +
- 'var res = p >>\n' +
- ' q <<\n' +
- ' r >>>\n' +
- ' s;\n' +
- 'var res = t\n' +
- '\n' +
- ' ===\n' +
- ' u !== v !=\n' +
- ' w ==\n' +
- ' x >=\n' +
- ' y <= z > aa <\n' +
- ' ab;\n' +
- 'ac +\n' +
- ' -ad')
-
- # colon special case
- bt(
- 'var a = {\n' +
- ' b\n' +
- ': bval,\n' +
- ' c:\n' +
- 'cval\n' +
- ' ,d: dval\n' +
- '};\n' +
- 'var e = f ? g\n' +
- ': h;\n' +
- 'var i = j ? k :\n' +
- 'l;',
- # -- output --
- 'var a = {\n' +
- ' b: bval,\n' +
- ' c: cval,\n' +
- ' d: dval\n' +
- '};\n' +
- 'var e = f ? g :\n' +
- ' h;\n' +
- 'var i = j ? k :\n' +
- ' l;')
-
- # catch-all, includes brackets and other various code
- bt(
- 'var d = 1;\n' +
- 'if (a === b\n' +
- ' && c) {\n' +
- ' d = (c * everything\n' +
- ' / something_else) %\n' +
- ' b;\n' +
- ' e\n' +
- ' += d;\n' +
- '\n' +
- '} else if (!(complex && simple) ||\n' +
- ' (emotion && emotion.name === "happy")) {\n' +
- ' cryTearsOfJoy(many ||\n' +
- ' anOcean\n' +
- ' || aRiver);\n' +
- '}',
- # -- output --
- 'var d = 1;\n' +
- 'if (a === b &&\n' +
- ' c) {\n' +
- ' d = (c * everything /\n' +
- ' something_else) %\n' +
- ' b;\n' +
- ' e\n' +
- ' += d;\n' +
- '\n' +
- '} else if (!(complex && simple) ||\n' +
- ' (emotion && emotion.name === "happy")) {\n' +
- ' cryTearsOfJoy(many ||\n' +
- ' anOcean ||\n' +
- ' aRiver);\n' +
- '}')
-
-
- #============================================================
- # operator_position option - set to "after_newline"
- self.reset_options()
- self.options.operator_position = 'after-newline'
-
- # comprehensive, various newlines
- bt(
- 'var res = a + b\n' +
- '- c /\n' +
- 'd * e\n' +
- '%\n' +
- 'f;\n' +
- ' var res = g & h\n' +
- '| i ^\n' +
- 'j\n' +
- '|> console.log;\n' +
- 'var res = (k &&\n' +
- 'l\n' +
- '|| m) ?\n' +
- 'n\n' +
- ': o\n' +
- ';\n' +
- 'var res = p\n' +
- '>> q <<\n' +
- 'r\n' +
- '>>> s;\n' +
- 'var res\n' +
- ' = t\n' +
- '\n' +
- ' === u !== v\n' +
- ' !=\n' +
- 'w\n' +
- '== x >=\n' +
- 'y <= z > aa <\n' +
- 'ab;\n' +
- 'ac +\n' +
- '-ad',
- # -- output --
- 'var res = a + b\n' +
- ' - c\n' +
- ' / d * e\n' +
- ' % f;\n' +
- 'var res = g & h\n' +
- ' | i\n' +
- ' ^ j\n' +
- ' |> console.log;\n' +
- 'var res = (k\n' +
- ' && l\n' +
- ' || m)\n' +
- ' ? n\n' +
- ' : o;\n' +
- 'var res = p\n' +
- ' >> q\n' +
- ' << r\n' +
- ' >>> s;\n' +
- 'var res = t\n' +
- '\n' +
- ' === u !== v\n' +
- ' != w\n' +
- ' == x\n' +
- ' >= y <= z > aa\n' +
- ' < ab;\n' +
- 'ac\n' +
- ' + -ad')
-
- # colon special case
- bt(
- 'var a = {\n' +
- ' b\n' +
- ': bval,\n' +
- ' c:\n' +
- 'cval\n' +
- ' ,d: dval\n' +
- '};\n' +
- 'var e = f ? g\n' +
- ': h;\n' +
- 'var i = j ? k :\n' +
- 'l;',
- # -- output --
- 'var a = {\n' +
- ' b: bval,\n' +
- ' c: cval,\n' +
- ' d: dval\n' +
- '};\n' +
- 'var e = f ? g\n' +
- ' : h;\n' +
- 'var i = j ? k\n' +
- ' : l;')
-
- # catch-all, includes brackets and other various code
- bt(
- 'var d = 1;\n' +
- 'if (a === b\n' +
- ' && c) {\n' +
- ' d = (c * everything\n' +
- ' / something_else) %\n' +
- ' b;\n' +
- ' e\n' +
- ' += d;\n' +
- '\n' +
- '} else if (!(complex && simple) ||\n' +
- ' (emotion && emotion.name === "happy")) {\n' +
- ' cryTearsOfJoy(many ||\n' +
- ' anOcean\n' +
- ' || aRiver);\n' +
- '}',
- # -- output --
- 'var d = 1;\n' +
- 'if (a === b\n' +
- ' && c) {\n' +
- ' d = (c * everything\n' +
- ' / something_else)\n' +
- ' % b;\n' +
- ' e\n' +
- ' += d;\n' +
- '\n' +
- '} else if (!(complex && simple)\n' +
- ' || (emotion && emotion.name === "happy")) {\n' +
- ' cryTearsOfJoy(many\n' +
- ' || anOcean\n' +
- ' || aRiver);\n' +
- '}')
-
-
- #============================================================
- # operator_position option - set to "preserve-newline"
- self.reset_options()
- self.options.operator_position = 'preserve-newline'
-
- # comprehensive, various newlines
- bt(
- 'var res = a + b\n' +
- '- c /\n' +
- 'd * e\n' +
- '%\n' +
- 'f;\n' +
- ' var res = g & h\n' +
- '| i ^\n' +
- 'j\n' +
- '|> console.log;\n' +
- 'var res = (k &&\n' +
- 'l\n' +
- '|| m) ?\n' +
- 'n\n' +
- ': o\n' +
- ';\n' +
- 'var res = p\n' +
- '>> q <<\n' +
- 'r\n' +
- '>>> s;\n' +
- 'var res\n' +
- ' = t\n' +
- '\n' +
- ' === u !== v\n' +
- ' !=\n' +
- 'w\n' +
- '== x >=\n' +
- 'y <= z > aa <\n' +
- 'ab;\n' +
- 'ac +\n' +
- '-ad',
- # -- output --
- 'var res = a + b\n' +
- ' - c /\n' +
- ' d * e\n' +
- ' %\n' +
- ' f;\n' +
- 'var res = g & h\n' +
- ' | i ^\n' +
- ' j\n' +
- ' |> console.log;\n' +
- 'var res = (k &&\n' +
- ' l\n' +
- ' || m) ?\n' +
- ' n\n' +
- ' : o;\n' +
- 'var res = p\n' +
- ' >> q <<\n' +
- ' r\n' +
- ' >>> s;\n' +
- 'var res = t\n' +
- '\n' +
- ' === u !== v\n' +
- ' !=\n' +
- ' w\n' +
- ' == x >=\n' +
- ' y <= z > aa <\n' +
- ' ab;\n' +
- 'ac +\n' +
- ' -ad')
-
- # colon special case
- bt(
- 'var a = {\n' +
- ' b\n' +
- ': bval,\n' +
- ' c:\n' +
- 'cval\n' +
- ' ,d: dval\n' +
- '};\n' +
- 'var e = f ? g\n' +
- ': h;\n' +
- 'var i = j ? k :\n' +
- 'l;',
- # -- output --
- 'var a = {\n' +
- ' b: bval,\n' +
- ' c: cval,\n' +
- ' d: dval\n' +
- '};\n' +
- 'var e = f ? g\n' +
- ' : h;\n' +
- 'var i = j ? k :\n' +
- ' l;')
-
- # catch-all, includes brackets and other various code
- bt(
- 'var d = 1;\n' +
- 'if (a === b\n' +
- ' && c) {\n' +
- ' d = (c * everything\n' +
- ' / something_else) %\n' +
- ' b;\n' +
- ' e\n' +
- ' += d;\n' +
- '\n' +
- '} else if (!(complex && simple) ||\n' +
- ' (emotion && emotion.name === "happy")) {\n' +
- ' cryTearsOfJoy(many ||\n' +
- ' anOcean\n' +
- ' || aRiver);\n' +
- '}')
-
-
- #============================================================
- # Yield tests
- self.reset_options()
- bt('yield /foo\\//;')
- bt('result = yield pgClient.query_(queryString);')
- bt('yield [1, 2]')
- bt('yield function() {};')
- bt('yield* bar();')
-
- # yield should have no space between yield and star
- bt('yield * bar();', 'yield* bar();')
-
- # yield should have space between star and generator
- bt('yield *bar();', 'yield* bar();')
-
-
- #============================================================
- # Async / await tests
- self.reset_options()
- bt('async function foo() {}')
- bt('let w = async function foo() {}')
- bt(
- 'async function foo() {}\n' +
- 'var x = await foo();')
-
- # async function as an input to another function
- bt('wrapper(async function foo() {})')
-
- # await on inline anonymous function. should have a space after await
- bt(
- 'async function() {\n' +
- ' var w = await(async function() {\n' +
- ' return await foo();\n' +
- ' })();\n' +
- '}',
- # -- output --
- 'async function() {\n' +
- ' var w = await (async function() {\n' +
- ' return await foo();\n' +
- ' })();\n' +
- '}')
-
- # Regression test #1228
- bt('const module = await import("...")')
-
- # Regression test #1658
- bt('.')
-
- # ensure that this doesn't break anyone with the async library
- bt('async.map(function(t) {})')
-
- # async on arrow function. should have a space after async
- bt(
- 'async() => {}',
- # -- output --
- 'async () => {}')
-
- # async on arrow function. should have a space after async
- bt(
- 'async() => {\n' +
- ' return 5;\n' +
- '}',
- # -- output --
- 'async () => {\n' +
- ' return 5;\n' +
- '}')
-
- # async on arrow function returning expression. should have a space after async
- bt(
- 'async() => 5;',
- # -- output --
- 'async () => 5;')
-
- # async on arrow function returning object literal. should have a space after async
- bt(
- 'async(x) => ({\n' +
- ' foo: "5"\n' +
- '})',
- # -- output --
- 'async (x) => ({\n' +
- ' foo: "5"\n' +
- '})')
- bt(
- 'async (x) => {\n' +
- ' return x * 2;\n' +
- '}')
- bt('async () => 5;')
- bt('async x => x * 2;')
- bt(
- 'async function() {\n' +
- ' const obj = {\n' +
- ' a: 1,\n' +
- ' b: await fn(),\n' +
- ' c: 2\n' +
- ' };\n' +
- '}')
- bt(
- 'const a = 1,\n' +
- ' b = a ? await foo() : b,\n' +
- ' c = await foo(),\n' +
- ' d = 3,\n' +
- ' e = (await foo()),\n' +
- ' f = 4;')
- bt(
- 'a = {\n' +
- ' myVar: async function() {\n' +
- ' return a;\n' +
- ' },\n' +
- ' myOtherVar: async function() {\n' +
- ' yield b;\n' +
- ' }\n' +
- '}')
- bt(
- 'a = {\n' +
- ' myVar: async () => {\n' +
- ' return a;\n' +
- ' },\n' +
- ' myOtherVar: async async () => {\n' +
- ' yield b;\n' +
- ' }\n' +
- '}')
-
-
- #============================================================
- # e4x - Test that e4x literals passed through when e4x-option is enabled
- self.reset_options()
- self.options.e4x = true
- bt(
- 'xml=\n' +
- ' foox;',
- # -- output --
- 'xml = \n' +
- ' foox;')
- bt('')
- bt('')
- bt('')
- bt('')
- bt('')
-
- # Handles inline expressions
- bt(
- 'xml=<{a} b="c">\n' +
- ' foox{a}>;',
- # -- output --
- 'xml = <{a} b="c">\n' +
- ' foox{a}>;')
- bt(
- 'xml=<{a} b="c">\n' +
- ' \n' +
- ' foox{a}>;',
- # -- output --
- 'xml = <{a} b="c">\n' +
- ' \n' +
- ' foox{a}>;')
-
- # xml literals with special characters in elem names - see http://www.w3.org/TR/REC-xml/#NT-NameChar
- bt('xml = <_:.valid.xml- _:.valid.xml-="123"/>;')
-
- # xml literals with attributes without equal sign
- bt('xml = ;')
-
- # Handles CDATA
- bt(
- 'xml=\n' +
- ' foox/]]>;',
- # -- output --
- 'xml = \n' +
- ' foox/]]>;')
- bt('xml=;', 'xml = ;')
- bt('xml={}]]>;', 'xml = {}]]>;')
-
- # JSX - working jsx from http://prettydiff.com/unit_tests/beautification_javascript_jsx.txt
- bt(
- 'var ListItem = React.createClass({\n' +
- ' render: function() {\n' +
- ' return (\n' +
- ' \n' +
- ' \n' +
- ' this.props.item.name\n' +
- ' \n' +
- ' \n' +
- ' );\n' +
- ' }\n' +
- '});')
- bt(
- 'var List = React.createClass({\n' +
- ' renderList: function() {\n' +
- ' return this.props.items.map(function(item) {\n' +
- ' return ;\n' +
- ' });\n' +
- ' },\n' +
- '\n' +
- ' render: function() {\n' +
- ' return \n' +
- ' this.renderList()\n' +
- '
\n' +
- ' }\n' +
- '});')
- bt(
- 'var Mist = React.createClass({\n' +
- ' renderList: function() {\n' +
- ' return this.props.items.map(function(item) {\n' +
- ' return {item}} key={item.id} />;\n' +
- ' });\n' +
- ' }\n' +
- '});')
- bt(
- '// JSX\n' +
- 'var box = \n' +
- ' {shouldShowAnswer(user) ?\n' +
- ' no : \n' +
- ' Text Content\n' +
- ' }\n' +
- ' ;\n' +
- 'var a = function() {\n' +
- ' return asdf;\n' +
- '};\n' +
- '\n' +
- 'var HelloMessage = React.createClass({\n' +
- ' render: function() {\n' +
- ' return Hello {this.props.name}
;\n' +
- ' }\n' +
- '});\n' +
- 'React.render(, mountNode);')
- bt(
- 'var Timer = React.createClass({\n' +
- ' getInitialState: function() {\n' +
- ' return {\n' +
- ' secondsElapsed: 0\n' +
- ' };\n' +
- ' },\n' +
- ' tick: function() {\n' +
- ' this.setState({\n' +
- ' secondsElapsed: this.state.secondsElapsed + 1\n' +
- ' });\n' +
- ' },\n' +
- ' componentDidMount: function() {\n' +
- ' this.interval = setInterval(this.tick, 1000);\n' +
- ' },\n' +
- ' componentWillUnmount: function() {\n' +
- ' clearInterval(this.interval);\n' +
- ' },\n' +
- ' render: function() {\n' +
- ' return (\n' +
- ' Seconds Elapsed: {this.state.secondsElapsed}
\n' +
- ' );\n' +
- ' }\n' +
- '});\n' +
- 'React.render(, mountNode);')
- bt(
- 'var TodoList = React.createClass({\n' +
- ' render: function() {\n' +
- ' var createItem = function(itemText) {\n' +
- ' return {itemText};\n' +
- ' };\n' +
- ' return {this.props.items.map(createItem)}
;\n' +
- ' }\n' +
- '});')
- bt(
- 'var TodoApp = React.createClass({\n' +
- ' getInitialState: function() {\n' +
- ' return {\n' +
- ' items: [],\n' +
- ' text: \'\'\n' +
- ' };\n' +
- ' },\n' +
- ' onChange: function(e) {\n' +
- ' this.setState({\n' +
- ' text: e.target.value\n' +
- ' });\n' +
- ' },\n' +
- ' handleSubmit: function(e) {\n' +
- ' e.preventDefault();\n' +
- ' var nextItems = this.state.items.concat([this.state.text]);\n' +
- ' var nextText = \'\';\n' +
- ' this.setState({\n' +
- ' items: nextItems,\n' +
- ' text: nextText\n' +
- ' });\n' +
- ' },\n' +
- ' render: function() {\n' +
- ' return (\n' +
- ' \n' +
- '
TODO
\n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' );\n' +
- ' }\n' +
- '});\n' +
- 'React.render(, mountNode);')
- bt(
- 'var converter = new Showdown.converter();\n' +
- 'var MarkdownEditor = React.createClass({\n' +
- ' getInitialState: function() {\n' +
- ' return {value: \'Type some *markdown* here!\'};\n' +
- ' },\n' +
- ' handleChange: function() {\n' +
- ' this.setState({value: this.refs.textarea.getDOMNode().value});\n' +
- ' },\n' +
- ' render: function() {\n' +
- ' return (\n' +
- ' \n' +
- '
Input
\n' +
- '
\n' +
- '
Output
\n' +
- '
\n' +
- '
\n' +
- ' );\n' +
- ' }\n' +
- '});\n' +
- 'React.render(, mountNode);',
- # -- output --
- 'var converter = new Showdown.converter();\n' +
- 'var MarkdownEditor = React.createClass({\n' +
- ' getInitialState: function() {\n' +
- ' return {\n' +
- ' value: \'Type some *markdown* here!\'\n' +
- ' };\n' +
- ' },\n' +
- ' handleChange: function() {\n' +
- ' this.setState({\n' +
- ' value: this.refs.textarea.getDOMNode().value\n' +
- ' });\n' +
- ' },\n' +
- ' render: function() {\n' +
- ' return (\n' +
- ' \n' +
- '
Input
\n' +
- '
\n' +
- '
Output
\n' +
- '
\n' +
- '
\n' +
- ' );\n' +
- ' }\n' +
- '});\n' +
- 'React.render(, mountNode);')
-
- # JSX - Not quite correct jsx formatting that still works
- bt(
- 'var content = (\n' +
- ' \n' +
- ' );\n' +
- 'var qwer = A dropdown list ;\n' +
- 'render(dropdown);',
- # -- output --
- 'var content = (\n' +
- ' \n' +
- ');\n' +
- 'var qwer = A dropdown list ;\n' +
- 'render(dropdown);')
-
- # Handles messed up tags, as long as it isn't the same name
- # as the root tag. Also handles tags of same name as root tag
- # as long as nesting matches.
- bt(
- 'xml=;',
- # -- output --
- 'xml = ;')
-
- # If xml is not terminated, the remainder of the file is treated
- # as part of the xml-literal (passed through unaltered)
- test_fragment(
- 'xml=\n' +
- 'c\n' +
- 'c\n' +
- ' c\n' +
- ' \n' +
- ' );\n' +
- ' }\n' +
- '});')
- bt(
- 'let a = React.createClass({\n' +
- ' render() {\n' +
- ' return (\n' +
- ' \n' +
- ' c\n' +
- '
\n' +
- ' );\n' +
- ' }\n' +
- '});')
- bt(
- 'let a = React.createClass({\n' +
- ' render() {\n' +
- ' return (\n' +
- ' \n' +
- ' c\n' +
- '
\n' +
- ' );\n' +
- ' }\n' +
- '});')
- bt(
- 'let a = React.createClass({\n' +
- ' render() {\n' +
- ' return (\n' +
- ' <{e} className = {d}>\n' +
- ' c\n' +
- ' {e}>\n' +
- ' );\n' +
- ' }\n' +
- '});')
-
- # Issue #914 - Multiline attribute in root tag
- bt(
- 'return (\n' +
- ' {\n' +
- ' e.preventDefault()\n' +
- ' onClick()\n' +
- ' }}>\n' +
- ' {children}\n' +
- ' \n' +
- ');')
- bt(
- 'return (\n' +
- ' <{\n' +
- ' a + b\n' +
- ' } href="#"\n' +
- ' onClick={e => {\n' +
- ' e.preventDefault()\n' +
- ' onClick()\n' +
- ' }}>\n' +
- ' {children}\n' +
- ' {\n' +
- ' a + b\n' +
- ' }>\n' +
- ');')
- bt(
- 'return (\n' +
- ' <{\n' +
- ' a + b\n' +
- ' } href="#"\n' +
- ' onClick={e => {\n' +
- ' e.preventDefault()\n' +
- ' onClick()\n' +
- ' }}>\n' +
- ' {children}\n' +
- ' {a + b}>\n' +
- ' );',
- # -- output --
- 'return (\n' +
- ' <{\n' +
- ' a + b\n' +
- ' } href="#"\n' +
- ' onClick={e => {\n' +
- ' e.preventDefault()\n' +
- ' onClick()\n' +
- ' }}>\n' +
- ' {children}\n' +
- ' {a + b}>\n' +
- ');')
-
-
- #============================================================
- #
- self.reset_options()
-
-
- #============================================================
- # e4x disabled
- self.reset_options()
- self.options.e4x = false
- bt(
- 'xml=\n' +
- ' foox;',
- # -- output --
- 'xml = < a b = "c" > < d / > < e >\n' +
- ' foo < /e>x ;')
-
-
- #============================================================
- # Multiple braces
- self.reset_options()
- bt(
- '{{}/z/}',
- # -- output --
- '{\n' +
- ' {}\n' +
- ' /z/\n' +
- '}')
-
-
- #============================================================
- # Space before conditional - (space_before_conditional = "false")
- self.reset_options()
- self.options.space_before_conditional = false
- bt('if(a) b()')
- bt('while(a) b()')
- bt(
- 'do\n' +
- ' c();\n' +
- 'while(a) b()')
- bt(
- 'if(a)\n' +
- 'b();',
- # -- output --
- 'if(a)\n' +
- ' b();')
- bt(
- 'while(a)\n' +
- 'b();',
- # -- output --
- 'while(a)\n' +
- ' b();')
- bt(
- 'do\n' +
- 'c();\n' +
- 'while(a);',
- # -- output --
- 'do\n' +
- ' c();\n' +
- 'while(a);')
- bt('return [];')
- bt('return ();')
-
- # Space before conditional - (space_before_conditional = "true")
- self.reset_options()
- self.options.space_before_conditional = true
- bt('if (a) b()')
- bt('while (a) b()')
- bt(
- 'do\n' +
- ' c();\n' +
- 'while (a) b()')
- bt(
- 'if(a)\n' +
- 'b();',
- # -- output --
- 'if (a)\n' +
- ' b();')
- bt(
- 'while(a)\n' +
- 'b();',
- # -- output --
- 'while (a)\n' +
- ' b();')
- bt(
- 'do\n' +
- 'c();\n' +
- 'while(a);',
- # -- output --
- 'do\n' +
- ' c();\n' +
- 'while (a);')
- bt('return [];')
- bt('return ();')
-
-
- #============================================================
- # Beautify preserve formatting
- self.reset_options()
- bt(
- '/* beautify preserve:start */\n' +
- '/* beautify preserve:end */')
- bt(
- '/* beautify preserve:start */\n' +
- ' var a = 1;\n' +
- '/* beautify preserve:end */')
- bt(
- 'var a = 1;\n' +
- '/* beautify preserve:start */\n' +
- ' var a = 1;\n' +
- '/* beautify preserve:end */')
- bt('/* beautify preserve:start */ {asdklgh;y;;{}dd2d}/* beautify preserve:end */')
- bt(
- 'var a = 1;\n' +
- '/* beautify preserve:start */\n' +
- ' var a = 1;\n' +
- '/* beautify preserve:end */',
- # -- output --
- 'var a = 1;\n' +
- '/* beautify preserve:start */\n' +
- ' var a = 1;\n' +
- '/* beautify preserve:end */')
- bt(
- 'var a = 1;\n' +
- ' /* beautify preserve:start */\n' +
- ' var a = 1;\n' +
- '/* beautify preserve:end */',
- # -- output --
- 'var a = 1;\n' +
- '/* beautify preserve:start */\n' +
- ' var a = 1;\n' +
- '/* beautify preserve:end */')
- bt(
- 'var a = {\n' +
- ' /* beautify preserve:start */\n' +
- ' one : 1\n' +
- ' two : 2,\n' +
- ' three : 3,\n' +
- ' ten : 10\n' +
- ' /* beautify preserve:end */\n' +
- '};')
- bt(
- 'var a = {\n' +
- '/* beautify preserve:start */\n' +
- ' one : 1,\n' +
- ' two : 2,\n' +
- ' three : 3,\n' +
- ' ten : 10\n' +
- '/* beautify preserve:end */\n' +
- '};',
- # -- output --
- 'var a = {\n' +
- ' /* beautify preserve:start */\n' +
- ' one : 1,\n' +
- ' two : 2,\n' +
- ' three : 3,\n' +
- ' ten : 10\n' +
- '/* beautify preserve:end */\n' +
- '};')
-
- # one space before and after required, only single spaces inside.
- bt(
- 'var a = {\n' +
- '/* beautify preserve:start */\n' +
- ' one : 1,\n' +
- ' two : 2,\n' +
- ' three : 3,\n' +
- ' ten : 10\n' +
- '};',
- # -- output --
- 'var a = {\n' +
- ' /* beautify preserve:start */\n' +
- ' one: 1,\n' +
- ' two: 2,\n' +
- ' three: 3,\n' +
- ' ten: 10\n' +
- '};')
- bt(
- 'var a = {\n' +
- '/*beautify preserve:start*/\n' +
- ' one : 1,\n' +
- ' two : 2,\n' +
- ' three : 3,\n' +
- ' ten : 10\n' +
- '};',
- # -- output --
- 'var a = {\n' +
- ' /*beautify preserve:start*/\n' +
- ' one: 1,\n' +
- ' two: 2,\n' +
- ' three: 3,\n' +
- ' ten: 10\n' +
- '};')
- bt(
- 'var a = {\n' +
- '/*beautify preserve:start*/\n' +
- ' one : 1,\n' +
- ' two : 2,\n' +
- ' three : 3,\n' +
- ' ten : 10\n' +
- '};',
- # -- output --
- 'var a = {\n' +
- ' /*beautify preserve:start*/\n' +
- ' one: 1,\n' +
- ' two: 2,\n' +
- ' three: 3,\n' +
- ' ten: 10\n' +
- '};')
-
- # Directive: ignore
- bt(
- '/* beautify ignore:start */\n' +
- '/* beautify ignore:end */')
- bt(
- '/* beautify ignore:start */\n' +
- ' var a,,,{ 1;\n' +
- ' /* beautify ignore:end */')
- bt(
- 'var a = 1;\n' +
- '/* beautify ignore:start */\n' +
- ' var a = 1;\n' +
- '/* beautify ignore:end */')
-
- # ignore starts _after_ the start comment, ends after the end comment
- bt('/* beautify ignore:start */ {asdklgh;y;+++;dd2d}/* beautify ignore:end */')
- bt('/* beautify ignore:start */ {asdklgh;y;+++;dd2d} /* beautify ignore:end */')
- bt(
- 'var a = 1;\n' +
- '/* beautify ignore:start */\n' +
- ' var a,,,{ 1;\n' +
- '/*beautify ignore:end*/',
- # -- output --
- 'var a = 1;\n' +
- '/* beautify ignore:start */\n' +
- ' var a,,,{ 1;\n' +
- '/*beautify ignore:end*/')
- bt(
- 'var a = 1;\n' +
- ' /* beautify ignore:start */\n' +
- ' var a,,,{ 1;\n' +
- '/* beautify ignore:end */',
- # -- output --
- 'var a = 1;\n' +
- '/* beautify ignore:start */\n' +
- ' var a,,,{ 1;\n' +
- '/* beautify ignore:end */')
- bt(
- 'var a = {\n' +
- ' /* beautify ignore:start */\n' +
- ' one : 1\n' +
- ' two : 2,\n' +
- ' three : {\n' +
- ' ten : 10\n' +
- ' /* beautify ignore:end */\n' +
- '};')
- bt(
- 'var a = {\n' +
- '/* beautify ignore:start */\n' +
- ' one : 1\n' +
- ' two : 2,\n' +
- ' three : {\n' +
- ' ten : 10\n' +
- '/* beautify ignore:end */\n' +
- '};',
- # -- output --
- 'var a = {\n' +
- ' /* beautify ignore:start */\n' +
- ' one : 1\n' +
- ' two : 2,\n' +
- ' three : {\n' +
- ' ten : 10\n' +
- '/* beautify ignore:end */\n' +
- '};')
-
- # Directives - multiple and interacting
- bt(
- 'var a = {\n' +
- '/* beautify preserve:start */\n' +
- '/* beautify preserve:start */\n' +
- ' one : 1,\n' +
- ' /* beautify preserve:end */\n' +
- ' two : 2,\n' +
- ' three : 3,\n' +
- '/* beautify preserve:start */\n' +
- ' ten : 10\n' +
- '/* beautify preserve:end */\n' +
- '};',
- # -- output --
- 'var a = {\n' +
- ' /* beautify preserve:start */\n' +
- '/* beautify preserve:start */\n' +
- ' one : 1,\n' +
- ' /* beautify preserve:end */\n' +
- ' two: 2,\n' +
- ' three: 3,\n' +
- ' /* beautify preserve:start */\n' +
- ' ten : 10\n' +
- '/* beautify preserve:end */\n' +
- '};')
- bt(
- 'var a = {\n' +
- '/* beautify ignore:start */\n' +
- ' one : 1\n' +
- ' /* beautify ignore:end */\n' +
- ' two : 2,\n' +
- '/* beautify ignore:start */\n' +
- ' three : {\n' +
- ' ten : 10\n' +
- '/* beautify ignore:end */\n' +
- '};',
- # -- output --
- 'var a = {\n' +
- ' /* beautify ignore:start */\n' +
- ' one : 1\n' +
- ' /* beautify ignore:end */\n' +
- ' two: 2,\n' +
- ' /* beautify ignore:start */\n' +
- ' three : {\n' +
- ' ten : 10\n' +
- '/* beautify ignore:end */\n' +
- '};')
-
- # Starts can occur together, ignore:end must occur alone.
- bt(
- 'var a = {\n' +
- '/* beautify ignore:start */\n' +
- ' one : 1\n' +
- ' NOTE: ignore end block does not support starting other directives\n' +
- ' This does not match the ending the ignore...\n' +
- ' /* beautify ignore:end preserve:start */\n' +
- ' two : 2,\n' +
- '/* beautify ignore:start */\n' +
- ' three : {\n' +
- ' ten : 10\n' +
- ' ==The next comment ends the starting ignore==\n' +
- '/* beautify ignore:end */\n' +
- '};',
- # -- output --
- 'var a = {\n' +
- ' /* beautify ignore:start */\n' +
- ' one : 1\n' +
- ' NOTE: ignore end block does not support starting other directives\n' +
- ' This does not match the ending the ignore...\n' +
- ' /* beautify ignore:end preserve:start */\n' +
- ' two : 2,\n' +
- '/* beautify ignore:start */\n' +
- ' three : {\n' +
- ' ten : 10\n' +
- ' ==The next comment ends the starting ignore==\n' +
- '/* beautify ignore:end */\n' +
- '};')
- bt(
- 'var a = {\n' +
- '/* beautify ignore:start preserve:start */\n' +
- ' one : {\n' +
- ' /* beautify ignore:end */\n' +
- ' two : 2,\n' +
- ' /* beautify ignore:start */\n' +
- ' three : {\n' +
- '/* beautify ignore:end */\n' +
- ' ten : 10\n' +
- ' // This is all preserved\n' +
- '};',
- # -- output --
- 'var a = {\n' +
- ' /* beautify ignore:start preserve:start */\n' +
- ' one : {\n' +
- ' /* beautify ignore:end */\n' +
- ' two : 2,\n' +
- ' /* beautify ignore:start */\n' +
- ' three : {\n' +
- '/* beautify ignore:end */\n' +
- ' ten : 10\n' +
- ' // This is all preserved\n' +
- '};')
- bt(
- 'var a = {\n' +
- '/* beautify ignore:start preserve:start */\n' +
- ' one : {\n' +
- ' /* beautify ignore:end */\n' +
- ' two : 2,\n' +
- ' /* beautify ignore:start */\n' +
- ' three : {\n' +
- '/* beautify ignore:end */\n' +
- ' ten : 10,\n' +
- '/* beautify preserve:end */\n' +
- ' eleven: 11\n' +
- '};',
- # -- output --
- 'var a = {\n' +
- ' /* beautify ignore:start preserve:start */\n' +
- ' one : {\n' +
- ' /* beautify ignore:end */\n' +
- ' two : 2,\n' +
- ' /* beautify ignore:start */\n' +
- ' three : {\n' +
- '/* beautify ignore:end */\n' +
- ' ten : 10,\n' +
- '/* beautify preserve:end */\n' +
- ' eleven: 11\n' +
- '};')
-
-
- #============================================================
- # Comments and tests
- self.reset_options()
-
- # #913
- bt(
- 'class test {\n' +
- ' method1() {\n' +
- ' let resp = null;\n' +
- ' }\n' +
- ' /**\n' +
- ' * @param {String} id\n' +
- ' */\n' +
- ' method2(id) {\n' +
- ' let resp2 = null;\n' +
- ' }\n' +
- '}')
-
- # #1090
- bt(
- 'for (var i = 0; i < 20; ++i) // loop\n' +
- ' if (i % 3) {\n' +
- ' console.log(i);\n' +
- ' }\n' +
- 'console.log("done");')
-
- # #1043
- bt(
- 'var o = {\n' +
- ' k: 0\n' +
- '}\n' +
- '// ...\n' +
- 'foo(o)')
-
- # #713 and #964
- bt(
- 'Meteor.call("foo", bar, function(err, result) {\n' +
- ' Session.set("baz", result.lorem)\n' +
- '})\n' +
- '//blah blah')
-
- # #815
- bt(
- 'foo()\n' +
- '// this is a comment\n' +
- 'bar()\n' +
- '\n' +
- 'const foo = 5\n' +
- '// comment\n' +
- 'bar()')
-
- # This shows current behavior. Note #1069 is not addressed yet.
- bt(
- 'if (modulus === 2) {\n' +
- ' // i might be odd here\n' +
- ' i += (i & 1);\n' +
- ' // now i is guaranteed to be even\n' +
- ' // this block is obviously about the statement above\n' +
- '\n' +
- ' // #1069 This should attach to the block below\n' +
- ' // this comment is about the block after it.\n' +
- '} else {\n' +
- ' // rounding up using integer arithmetic only\n' +
- ' if (i % modulus)\n' +
- ' i += modulus - (i % modulus);\n' +
- ' // now i is divisible by modulus\n' +
- ' // behavior of comments should be different for single statements vs block statements/expressions\n' +
- '}\n' +
- '\n' +
- 'if (modulus === 2)\n' +
- ' // i might be odd here\n' +
- ' i += (i & 1);\n' +
- '// now i is guaranteed to be even\n' +
- '// non-braced comments unindent immediately\n' +
- '\n' +
- '// this comment is about the block after it.\n' +
- 'else\n' +
- ' // rounding up using integer arithmetic only\n' +
- ' if (i % modulus)\n' +
- ' i += modulus - (i % modulus);\n' +
- '// behavior of comments should be different for single statements vs block statements/expressions')
-
-
- #============================================================
- # minimal template handling - ()
- self.reset_options()
- self.options.templating = ['django', 'erb', 'handlebars', 'php']
- bt('var a = ;', 'var a = ;')
- bt(
- 'a = abc");\n' +
- '}\n' +
- '?>;')
- test_fragment(
- '\n' +
- 'test.method();')
- bt(
- 'abc;\n' +
- '.test();\n' +
- '" "')
- bt(
- ';\n' +
- 'test.method();')
- bt('"";')
-
- # minimal template handling - ()
- self.reset_options()
- self.options.templating = ['django', 'erb', 'handlebars', 'php']
- bt('var a = =$view["name"]; ?>;', 'var a = =$view["name"]; ?>;')
- bt(
- 'a = abc=\n' +
- 'for($i = 1; $i <= 100; $i++;) {\n' +
- ' #count to 100!\n' +
- ' echo($i . "");\n' +
- '}\n' +
- '?>;')
- test_fragment(
- '= ?>\n' +
- 'test.met= someValue ?>hod();')
- bt(
- '= "A" ?>abc= "D" ?>;\n' +
- '= "B" ?>.test();\n' +
- '" = "C" \'D\' ?> "')
- bt(
- '=\n' +
- 'echo "A";\n' +
- '?>;\n' +
- 'test.method();')
- bt('"=";if(0){}"?>";')
-
- # minimal template handling - ()
- self.reset_options()
- self.options.templating = ['django', 'erb', 'handlebars', 'php']
- bt('var a = <%$view["name"]; %>;', 'var a = <%$view["name"]; %>;')
- bt(
- 'a = abc<%\n' +
- 'for($i = 1; $i <= 100; $i++;) {\n' +
- ' #count to 100!\n' +
- ' echo($i . "");\n' +
- '}\n' +
- '%>;')
- test_fragment(
- '<% %>\n' +
- 'test.met<% someValue %>hod();')
- bt(
- '<% "A" %>abc<% "D" %>;\n' +
- '<% "B" %>.test();\n' +
- '" <% "C" \'D\' %> "')
- bt(
- '<%\n' +
- 'echo "A";\n' +
- '%>;\n' +
- 'test.method();')
- bt('"<%";if(0){}"%>";')
-
- # minimal template handling - ()
- self.reset_options()
- self.options.templating = ['django', 'erb', 'handlebars', 'php']
- bt('var a = <%=$view["name"]; %>;', 'var a = <%=$view["name"]; %>;')
- bt(
- 'a = abc<%=\n' +
- 'for($i = 1; $i <= 100; $i++;) {\n' +
- ' #count to 100!\n' +
- ' echo($i . "");\n' +
- '}\n' +
- '%>;')
- test_fragment(
- '<%= %>\n' +
- 'test.met<%= someValue %>hod();')
- bt(
- '<%= "A" %>abc<%= "D" %>;\n' +
- '<%= "B" %>.test();\n' +
- '" <%= "C" \'D\' %> "')
- bt(
- '<%=\n' +
- 'echo "A";\n' +
- '%>;\n' +
- 'test.method();')
- bt('"<%=";if(0){}"%>";')
-
- # minimal template handling - ()
- self.reset_options()
- self.options.templating = ['django', 'erb', 'handlebars', 'php']
- bt('var a = {{$view["name"]; }};', 'var a = {{$view["name"]; }};')
- bt(
- 'a = abc{{\n' +
- 'for($i = 1; $i <= 100; $i++;) {\n' +
- ' #count to 100!\n' +
- ' echo($i . "");\n' +
- '}\n' +
- '}};')
- test_fragment(
- '{{ }}\n' +
- 'test.met{{ someValue }}hod();')
- bt(
- '{{ "A" }}abc{{ "D" }};\n' +
- '{{ "B" }}.test();\n' +
- '" {{ "C" \'D\' }} "')
- bt(
- '{{\n' +
- 'echo "A";\n' +
- '}};\n' +
- 'test.method();')
- bt('"{{";if(0){}"}}";')
-
- # minimal template handling - ()
- self.reset_options()
- self.options.templating = ['django', 'erb', 'handlebars', 'php']
- bt('var a = {#$view["name"]; #};', 'var a = {#$view["name"]; #};')
- bt(
- 'a = abc{#\n' +
- 'for($i = 1; $i <= 100; $i++;) {\n' +
- ' #count to 100!\n' +
- ' echo($i . "");\n' +
- '}\n' +
- '#};')
- test_fragment(
- '{# #}\n' +
- 'test.met{# someValue #}hod();')
- bt(
- '{# "A" #}abc{# "D" #};\n' +
- '{# "B" #}.test();\n' +
- '" {# "C" \'D\' #} "')
- bt(
- '{#\n' +
- 'echo "A";\n' +
- '#};\n' +
- 'test.method();')
- bt('"{#";if(0){}"#}";')
-
- # minimal template handling - ()
- self.reset_options()
- self.options.templating = ['django', 'erb', 'handlebars', 'php']
- bt('var a = {%$view["name"]; %};', 'var a = {%$view["name"]; %};')
- bt(
- 'a = abc{%\n' +
- 'for($i = 1; $i <= 100; $i++;) {\n' +
- ' #count to 100!\n' +
- ' echo($i . "");\n' +
- '}\n' +
- '%};')
- test_fragment(
- '{% %}\n' +
- 'test.met{% someValue %}hod();')
- bt(
- '{% "A" %}abc{% "D" %};\n' +
- '{% "B" %}.test();\n' +
- '" {% "C" \'D\' %} "')
- bt(
- '{%\n' +
- 'echo "A";\n' +
- '%};\n' +
- 'test.method();')
- bt('"{%";if(0){}"%}";')
-
- # minimal template handling - ()
- self.reset_options()
- self.options.templating = ['django', 'erb', 'handlebars', 'php']
- bt('var a = {{$view["name"]; }};', 'var a = {{$view["name"]; }};')
- bt(
- 'a = abc{{\n' +
- 'for($i = 1; $i <= 100; $i++;) {\n' +
- ' #count to 100!\n' +
- ' echo($i . "");\n' +
- '}\n' +
- '}};')
- test_fragment(
- '{{ }}\n' +
- 'test.met{{ someValue }}hod();')
- bt(
- '{{ "A" }}abc{{ "D" }};\n' +
- '{{ "B" }}.test();\n' +
- '" {{ "C" \'D\' }} "')
- bt(
- '{{\n' +
- 'echo "A";\n' +
- '}};\n' +
- 'test.method();')
- bt('"{{";if(0){}"}}";')
-
- # minimal template handling - ()
- self.reset_options()
- self.options.templating = ['django', 'erb', 'handlebars', 'php']
- bt('var a = {{{$view["name"]; }}};', 'var a = {{{$view["name"]; }}};')
- bt(
- 'a = abc{{{\n' +
- 'for($i = 1; $i <= 100; $i++;) {\n' +
- ' #count to 100!\n' +
- ' echo($i . "");\n' +
- '}\n' +
- '}}};')
- test_fragment(
- '{{{ }}}\n' +
- 'test.met{{{ someValue }}}hod();')
- bt(
- '{{{ "A" }}}abc{{{ "D" }}};\n' +
- '{{{ "B" }}}.test();\n' +
- '" {{{ "C" \'D\' }}} "')
- bt(
- '{{{\n' +
- 'echo "A";\n' +
- '}}};\n' +
- 'test.method();')
- bt('"{{{";if(0){}"}}}";')
-
- # minimal template handling - ()
- self.reset_options()
- self.options.templating = ['django', 'erb', 'handlebars', 'php']
- bt('var a = {{^$view["name"]; }};', 'var a = {{^$view["name"]; }};')
- bt(
- 'a = abc{{^\n' +
- 'for($i = 1; $i <= 100; $i++;) {\n' +
- ' #count to 100!\n' +
- ' echo($i . "");\n' +
- '}\n' +
- '}};')
- test_fragment(
- '{{^ }}\n' +
- 'test.met{{^ someValue }}hod();')
- bt(
- '{{^ "A" }}abc{{^ "D" }};\n' +
- '{{^ "B" }}.test();\n' +
- '" {{^ "C" \'D\' }} "')
- bt(
- '{{^\n' +
- 'echo "A";\n' +
- '}};\n' +
- 'test.method();')
- bt('"{{^";if(0){}"}}";')
-
- # minimal template handling - ()
- self.reset_options()
- self.options.templating = ['django', 'erb', 'handlebars', 'php']
- bt('var a = {{#$view["name"]; }};', 'var a = {{#$view["name"]; }};')
- bt(
- 'a = abc{{#\n' +
- 'for($i = 1; $i <= 100; $i++;) {\n' +
- ' #count to 100!\n' +
- ' echo($i . "");\n' +
- '}\n' +
- '}};')
- test_fragment(
- '{{# }}\n' +
- 'test.met{{# someValue }}hod();')
- bt(
- '{{# "A" }}abc{{# "D" }};\n' +
- '{{# "B" }}.test();\n' +
- '" {{# "C" \'D\' }} "')
- bt(
- '{{#\n' +
- 'echo "A";\n' +
- '}};\n' +
- 'test.method();')
- bt('"{{#";if(0){}"}}";')
-
- # minimal template handling - ()
- self.reset_options()
- self.options.templating = ['django', 'erb', 'handlebars', 'php']
- bt('var a = {{!$view["name"]; }};', 'var a = {{!$view["name"]; }};')
- bt(
- 'a = abc{{!\n' +
- 'for($i = 1; $i <= 100; $i++;) {\n' +
- ' #count to 100!\n' +
- ' echo($i . "");\n' +
- '}\n' +
- '}};')
- test_fragment(
- '{{! }}\n' +
- 'test.met{{! someValue }}hod();')
- bt(
- '{{! "A" }}abc{{! "D" }};\n' +
- '{{! "B" }}.test();\n' +
- '" {{! "C" \'D\' }} "')
- bt(
- '{{!\n' +
- 'echo "A";\n' +
- '}};\n' +
- 'test.method();')
- bt('"{{!";if(0){}"}}";')
-
- # minimal template handling - ()
- self.reset_options()
- self.options.templating = ['django', 'erb', 'handlebars', 'php']
- bt('var a = {{!--$view["name"]; --}};', 'var a = {{!--$view["name"]; --}};')
- bt(
- 'a = abc{{!--\n' +
- 'for($i = 1; $i <= 100; $i++;) {\n' +
- ' #count to 100!\n' +
- ' echo($i . "");\n' +
- '}\n' +
- '--}};')
- test_fragment(
- '{{!-- --}}\n' +
- 'test.met{{!-- someValue --}}hod();')
- bt(
- '{{!-- "A" --}}abc{{!-- "D" --}};\n' +
- '{{!-- "B" --}}.test();\n' +
- '" {{!-- "C" \'D\' --}} "')
- bt(
- '{{!--\n' +
- 'echo "A";\n' +
- '--}};\n' +
- 'test.method();')
- bt('"{{!--";if(0){}"--}}";')
-
-
- #============================================================
- # Templating disabled - ensure formatting - ()
- self.reset_options()
- self.options.templating = ['auto']
- bt(
- '"";',
- # -- output --
- '"";')
- bt(
- '"";',
- # -- output --
- '"=";\n' +
- 'if (0) {}\n' +
- '"?>";')
- bt(
- '"=";if(0){}',
- # -- output --
- '"=";\n' +
- 'if (0) {}')
-
- # Templating disabled - ensure formatting - ()
- self.reset_options()
- self.options.templating = ['auto']
- bt(
- '"<%";if(0){}"%>";',
- # -- output --
- '"<%";\n' +
- 'if (0) {}\n' +
- '"%>";')
- bt(
- '"<%";if(0){}',
- # -- output --
- '"<%";\n' +
- 'if (0) {}')
-
- # Templating disabled - ensure formatting - ()
- self.reset_options()
- self.options.templating = ['auto']
- bt(
- '"<%=";if(0){}"%>";',
- # -- output --
- '"<%=";\n' +
- 'if (0) {}\n' +
- '"%>";')
- bt(
- '"<%=";if(0){}',
- # -- output --
- '"<%=";\n' +
- 'if (0) {}')
-
- # Templating disabled - ensure formatting - ()
- self.reset_options()
- self.options.templating = ['auto']
- bt(
- '"{{";if(0){}"}}";',
- # -- output --
- '"{{";\n' +
- 'if (0) {}\n' +
- '"}}";')
- bt(
- '"{{";if(0){}',
- # -- output --
- '"{{";\n' +
- 'if (0) {}')
-
- # Templating disabled - ensure formatting - ()
- self.reset_options()
- self.options.templating = ['auto']
- bt(
- '"{#";if(0){}"#}";',
- # -- output --
- '"{#";\n' +
- 'if (0) {}\n' +
- '"#}";')
- bt(
- '"{#";if(0){}',
- # -- output --
- '"{#";\n' +
- 'if (0) {}')
-
- # Templating disabled - ensure formatting - ()
- self.reset_options()
- self.options.templating = ['auto']
- bt(
- '"{%";if(0){}"%}";',
- # -- output --
- '"{%";\n' +
- 'if (0) {}\n' +
- '"%}";')
- bt(
- '"{%";if(0){}',
- # -- output --
- '"{%";\n' +
- 'if (0) {}')
-
- # Templating disabled - ensure formatting - ()
- self.reset_options()
- self.options.templating = ['auto']
- bt(
- '"{{";if(0){}"}}";',
- # -- output --
- '"{{";\n' +
- 'if (0) {}\n' +
- '"}}";')
- bt(
- '"{{";if(0){}',
- # -- output --
- '"{{";\n' +
- 'if (0) {}')
-
- # Templating disabled - ensure formatting - ()
- self.reset_options()
- self.options.templating = ['auto']
- bt(
- '"{{{";if(0){}"}}}";',
- # -- output --
- '"{{{";\n' +
- 'if (0) {}\n' +
- '"}}}";')
- bt(
- '"{{{";if(0){}',
- # -- output --
- '"{{{";\n' +
- 'if (0) {}')
-
- # Templating disabled - ensure formatting - ()
- self.reset_options()
- self.options.templating = ['auto']
- bt(
- '"{{^";if(0){}"}}";',
- # -- output --
- '"{{^";\n' +
- 'if (0) {}\n' +
- '"}}";')
- bt(
- '"{{^";if(0){}',
- # -- output --
- '"{{^";\n' +
- 'if (0) {}')
-
- # Templating disabled - ensure formatting - ()
- self.reset_options()
- self.options.templating = ['auto']
- bt(
- '"{{#";if(0){}"}}";',
- # -- output --
- '"{{#";\n' +
- 'if (0) {}\n' +
- '"}}";')
- bt(
- '"{{#";if(0){}',
- # -- output --
- '"{{#";\n' +
- 'if (0) {}')
-
- # Templating disabled - ensure formatting - ()
- self.reset_options()
- self.options.templating = ['auto']
- bt(
- '"{{!";if(0){}"}}";',
- # -- output --
- '"{{!";\n' +
- 'if (0) {}\n' +
- '"}}";')
- bt(
- '"{{!";if(0){}',
- # -- output --
- '"{{!";\n' +
- 'if (0) {}')
-
- # Templating disabled - ensure formatting - ()
- self.reset_options()
- self.options.templating = ['auto']
- bt(
- '"{{!--";if(0){}"--}}";',
- # -- output --
- '"{{!--";\n' +
- 'if (0) {}\n' +
- '"--}}";')
- bt(
- '"{{!--";if(0){}',
- # -- output --
- '"{{!--";\n' +
- 'if (0) {}')
-
-
- #============================================================
- # jslint and space after anon function - (jslint_happy = "true", space_after_anon_function = "true")
- self.reset_options()
- self.options.jslint_happy = true
- self.options.space_after_anon_function = true
- bt(
- 'a=typeof(x)',
- # -- output --
- 'a = typeof (x)')
- bt(
- 'x();\n' +
- '\n' +
- 'function(){}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'function () {}')
- bt(
- 'x();\n' +
- '\n' +
- 'function y(){}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'function y() {}')
- bt(
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- 'x: function(){}\n' +
- '}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- ' x: function () {}\n' +
- '}')
- bt(
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- 'x: function y(){}\n' +
- '}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- ' x: function y() {}\n' +
- '}')
- bt(
- 'function () {\n' +
- ' var a, b, c, d, e = [],\n' +
- ' f;\n' +
- '}')
- bt(
- 'switch(x) {case 0: case 1: a(); break; default: break}',
- # -- output --
- 'switch (x) {\n' +
- 'case 0:\n' +
- 'case 1:\n' +
- ' a();\n' +
- ' break;\n' +
- 'default:\n' +
- ' break\n' +
- '}')
- bt(
- 'switch(x){case -1:break;case !y:break;}',
- # -- output --
- 'switch (x) {\n' +
- 'case -1:\n' +
- ' break;\n' +
- 'case !y:\n' +
- ' break;\n' +
- '}')
-
- # Issue #1357
- bt(
- 'switch(x) {case 0: case 1:{a(); break;} default: break}',
- # -- output --
- 'switch (x) {\n' +
- 'case 0:\n' +
- 'case 1: {\n' +
- ' a();\n' +
- ' break;\n' +
- '}\n' +
- 'default:\n' +
- ' break\n' +
- '}')
-
- # Issue #1357
- bt(
- 'switch(x){case -1:break;case !y:{break;}}',
- # -- output --
- 'switch (x) {\n' +
- 'case -1:\n' +
- ' break;\n' +
- 'case !y: {\n' +
- ' break;\n' +
- '}\n' +
- '}')
-
- # typical greasemonkey start
- test_fragment(
- '// comment 2\n' +
- '(function ()')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function() {}, d = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function () {},\n' +
- ' d = \'\';')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function yoohoo() {}, d = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function yoohoo() {},\n' +
- ' d = \'\';')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function() {},\n' +
- 'd = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function () {},\n' +
- ' d = \'\';')
- bt(
- 'var o2=$.extend(a);function(){alert(x);}',
- # -- output --
- 'var o2 = $.extend(a);\n' +
- '\n' +
- 'function () {\n' +
- ' alert(x);\n' +
- '}')
- bt(
- 'var o2=$.extend(a);function yoohoo(){alert(x);}',
- # -- output --
- 'var o2 = $.extend(a);\n' +
- '\n' +
- 'function yoohoo() {\n' +
- ' alert(x);\n' +
- '}')
- bt(
- 'function*() {\n' +
- ' yield 1;\n' +
- '}',
- # -- output --
- 'function* () {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'function* yoohoo() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'function* x() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'async x() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'var a={data(){},\n' +
- 'data2(){}}',
- # -- output --
- 'var a = {\n' +
- ' data() {},\n' +
- ' data2() {}\n' +
- '}')
- bt(
- 'new Vue({\n' +
- 'data(){},\n' +
- 'data2(){}, a:1})',
- # -- output --
- 'new Vue({\n' +
- ' data() {},\n' +
- ' data2() {},\n' +
- ' a: 1\n' +
- '})')
- bt(
- 'export default {data(){},\n' +
- 'data2(){},\n' +
- 'a:1}',
- # -- output --
- 'export default {\n' +
- ' data() {},\n' +
- ' data2() {},\n' +
- ' a: 1\n' +
- '}')
- bt(
- 'var a={*data(){},*data2(){}}',
- # -- output --
- 'var a = {\n' +
- ' * data() {},\n' +
- ' * data2() {}\n' +
- '}')
- bt(
- 'new Vue({\n' +
- '*data(){},*data2(){}, a:1})',
- # -- output --
- 'new Vue({\n' +
- ' * data() {},\n' +
- ' * data2() {},\n' +
- ' a: 1\n' +
- '})')
- bt(
- 'export default {*data(){},*data2(){},\n' +
- 'a:1}',
- # -- output --
- 'export default {\n' +
- ' * data() {},\n' +
- ' * data2() {},\n' +
- ' a: 1\n' +
- '}')
-
- # jslint and space after anon function - (jslint_happy = "true", space_after_anon_function = "false")
- self.reset_options()
- self.options.jslint_happy = true
- self.options.space_after_anon_function = false
- bt(
- 'a=typeof(x)',
- # -- output --
- 'a = typeof (x)')
- bt(
- 'x();\n' +
- '\n' +
- 'function(){}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'function () {}')
- bt(
- 'x();\n' +
- '\n' +
- 'function y(){}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'function y() {}')
- bt(
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- 'x: function(){}\n' +
- '}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- ' x: function () {}\n' +
- '}')
- bt(
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- 'x: function y(){}\n' +
- '}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- ' x: function y() {}\n' +
- '}')
- bt(
- 'function () {\n' +
- ' var a, b, c, d, e = [],\n' +
- ' f;\n' +
- '}')
- bt(
- 'switch(x) {case 0: case 1: a(); break; default: break}',
- # -- output --
- 'switch (x) {\n' +
- 'case 0:\n' +
- 'case 1:\n' +
- ' a();\n' +
- ' break;\n' +
- 'default:\n' +
- ' break\n' +
- '}')
- bt(
- 'switch(x){case -1:break;case !y:break;}',
- # -- output --
- 'switch (x) {\n' +
- 'case -1:\n' +
- ' break;\n' +
- 'case !y:\n' +
- ' break;\n' +
- '}')
-
- # Issue #1357
- bt(
- 'switch(x) {case 0: case 1:{a(); break;} default: break}',
- # -- output --
- 'switch (x) {\n' +
- 'case 0:\n' +
- 'case 1: {\n' +
- ' a();\n' +
- ' break;\n' +
- '}\n' +
- 'default:\n' +
- ' break\n' +
- '}')
-
- # Issue #1357
- bt(
- 'switch(x){case -1:break;case !y:{break;}}',
- # -- output --
- 'switch (x) {\n' +
- 'case -1:\n' +
- ' break;\n' +
- 'case !y: {\n' +
- ' break;\n' +
- '}\n' +
- '}')
-
- # typical greasemonkey start
- test_fragment(
- '// comment 2\n' +
- '(function ()')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function() {}, d = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function () {},\n' +
- ' d = \'\';')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function yoohoo() {}, d = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function yoohoo() {},\n' +
- ' d = \'\';')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function() {},\n' +
- 'd = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function () {},\n' +
- ' d = \'\';')
- bt(
- 'var o2=$.extend(a);function(){alert(x);}',
- # -- output --
- 'var o2 = $.extend(a);\n' +
- '\n' +
- 'function () {\n' +
- ' alert(x);\n' +
- '}')
- bt(
- 'var o2=$.extend(a);function yoohoo(){alert(x);}',
- # -- output --
- 'var o2 = $.extend(a);\n' +
- '\n' +
- 'function yoohoo() {\n' +
- ' alert(x);\n' +
- '}')
- bt(
- 'function*() {\n' +
- ' yield 1;\n' +
- '}',
- # -- output --
- 'function* () {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'function* yoohoo() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'function* x() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'async x() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'var a={data(){},\n' +
- 'data2(){}}',
- # -- output --
- 'var a = {\n' +
- ' data() {},\n' +
- ' data2() {}\n' +
- '}')
- bt(
- 'new Vue({\n' +
- 'data(){},\n' +
- 'data2(){}, a:1})',
- # -- output --
- 'new Vue({\n' +
- ' data() {},\n' +
- ' data2() {},\n' +
- ' a: 1\n' +
- '})')
- bt(
- 'export default {data(){},\n' +
- 'data2(){},\n' +
- 'a:1}',
- # -- output --
- 'export default {\n' +
- ' data() {},\n' +
- ' data2() {},\n' +
- ' a: 1\n' +
- '}')
- bt(
- 'var a={*data(){},*data2(){}}',
- # -- output --
- 'var a = {\n' +
- ' * data() {},\n' +
- ' * data2() {}\n' +
- '}')
- bt(
- 'new Vue({\n' +
- '*data(){},*data2(){}, a:1})',
- # -- output --
- 'new Vue({\n' +
- ' * data() {},\n' +
- ' * data2() {},\n' +
- ' a: 1\n' +
- '})')
- bt(
- 'export default {*data(){},*data2(){},\n' +
- 'a:1}',
- # -- output --
- 'export default {\n' +
- ' * data() {},\n' +
- ' * data2() {},\n' +
- ' a: 1\n' +
- '}')
-
- # jslint and space after anon function - (jslint_happy = "false", space_after_anon_function = "true")
- self.reset_options()
- self.options.jslint_happy = false
- self.options.space_after_anon_function = true
- bt(
- 'a=typeof(x)',
- # -- output --
- 'a = typeof (x)')
- bt(
- 'x();\n' +
- '\n' +
- 'function(){}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'function () {}')
- bt(
- 'x();\n' +
- '\n' +
- 'function y(){}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'function y() {}')
- bt(
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- 'x: function(){}\n' +
- '}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- ' x: function () {}\n' +
- '}')
- bt(
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- 'x: function y(){}\n' +
- '}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- ' x: function y() {}\n' +
- '}')
- bt(
- 'function () {\n' +
- ' var a, b, c, d, e = [],\n' +
- ' f;\n' +
- '}')
- bt(
- 'switch(x) {case 0: case 1: a(); break; default: break}',
- # -- output --
- 'switch (x) {\n' +
- ' case 0:\n' +
- ' case 1:\n' +
- ' a();\n' +
- ' break;\n' +
- ' default:\n' +
- ' break\n' +
- '}')
- bt(
- 'switch(x){case -1:break;case !y:break;}',
- # -- output --
- 'switch (x) {\n' +
- ' case -1:\n' +
- ' break;\n' +
- ' case !y:\n' +
- ' break;\n' +
- '}')
-
- # Issue #1357
- bt(
- 'switch(x) {case 0: case 1:{a(); break;} default: break}',
- # -- output --
- 'switch (x) {\n' +
- ' case 0:\n' +
- ' case 1: {\n' +
- ' a();\n' +
- ' break;\n' +
- ' }\n' +
- ' default:\n' +
- ' break\n' +
- '}')
-
- # Issue #1357
- bt(
- 'switch(x){case -1:break;case !y:{break;}}',
- # -- output --
- 'switch (x) {\n' +
- ' case -1:\n' +
- ' break;\n' +
- ' case !y: {\n' +
- ' break;\n' +
- ' }\n' +
- '}')
-
- # typical greasemonkey start
- test_fragment(
- '// comment 2\n' +
- '(function ()')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function() {}, d = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function () {},\n' +
- ' d = \'\';')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function yoohoo() {}, d = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function yoohoo() {},\n' +
- ' d = \'\';')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function() {},\n' +
- 'd = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function () {},\n' +
- ' d = \'\';')
- bt(
- 'var o2=$.extend(a);function(){alert(x);}',
- # -- output --
- 'var o2 = $.extend(a);\n' +
- '\n' +
- 'function () {\n' +
- ' alert(x);\n' +
- '}')
- bt(
- 'var o2=$.extend(a);function yoohoo(){alert(x);}',
- # -- output --
- 'var o2 = $.extend(a);\n' +
- '\n' +
- 'function yoohoo() {\n' +
- ' alert(x);\n' +
- '}')
- bt(
- 'function*() {\n' +
- ' yield 1;\n' +
- '}',
- # -- output --
- 'function* () {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'function* yoohoo() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'function* x() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'async x() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'var a={data(){},\n' +
- 'data2(){}}',
- # -- output --
- 'var a = {\n' +
- ' data() {},\n' +
- ' data2() {}\n' +
- '}')
- bt(
- 'new Vue({\n' +
- 'data(){},\n' +
- 'data2(){}, a:1})',
- # -- output --
- 'new Vue({\n' +
- ' data() {},\n' +
- ' data2() {},\n' +
- ' a: 1\n' +
- '})')
- bt(
- 'export default {data(){},\n' +
- 'data2(){},\n' +
- 'a:1}',
- # -- output --
- 'export default {\n' +
- ' data() {},\n' +
- ' data2() {},\n' +
- ' a: 1\n' +
- '}')
- bt(
- 'var a={*data(){},*data2(){}}',
- # -- output --
- 'var a = {\n' +
- ' * data() {},\n' +
- ' * data2() {}\n' +
- '}')
- bt(
- 'new Vue({\n' +
- '*data(){},*data2(){}, a:1})',
- # -- output --
- 'new Vue({\n' +
- ' * data() {},\n' +
- ' * data2() {},\n' +
- ' a: 1\n' +
- '})')
- bt(
- 'export default {*data(){},*data2(){},\n' +
- 'a:1}',
- # -- output --
- 'export default {\n' +
- ' * data() {},\n' +
- ' * data2() {},\n' +
- ' a: 1\n' +
- '}')
-
- # jslint and space after anon function - (jslint_happy = "false", space_after_anon_function = "false")
- self.reset_options()
- self.options.jslint_happy = false
- self.options.space_after_anon_function = false
- bt(
- 'a=typeof(x)',
- # -- output --
- 'a = typeof(x)')
- bt(
- 'x();\n' +
- '\n' +
- 'function(){}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'function() {}')
- bt(
- 'x();\n' +
- '\n' +
- 'function y(){}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'function y() {}')
- bt(
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- 'x: function(){}\n' +
- '}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- ' x: function() {}\n' +
- '}')
- bt(
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- 'x: function y(){}\n' +
- '}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- ' x: function y() {}\n' +
- '}')
- bt(
- 'function () {\n' +
- ' var a, b, c, d, e = [],\n' +
- ' f;\n' +
- '}',
- # -- output --
- 'function() {\n' +
- ' var a, b, c, d, e = [],\n' +
- ' f;\n' +
- '}')
- bt(
- 'switch(x) {case 0: case 1: a(); break; default: break}',
- # -- output --
- 'switch (x) {\n' +
- ' case 0:\n' +
- ' case 1:\n' +
- ' a();\n' +
- ' break;\n' +
- ' default:\n' +
- ' break\n' +
- '}')
- bt(
- 'switch(x){case -1:break;case !y:break;}',
- # -- output --
- 'switch (x) {\n' +
- ' case -1:\n' +
- ' break;\n' +
- ' case !y:\n' +
- ' break;\n' +
- '}')
-
- # Issue #1357
- bt(
- 'switch(x) {case 0: case 1:{a(); break;} default: break}',
- # -- output --
- 'switch (x) {\n' +
- ' case 0:\n' +
- ' case 1: {\n' +
- ' a();\n' +
- ' break;\n' +
- ' }\n' +
- ' default:\n' +
- ' break\n' +
- '}')
-
- # Issue #1357
- bt(
- 'switch(x){case -1:break;case !y:{break;}}',
- # -- output --
- 'switch (x) {\n' +
- ' case -1:\n' +
- ' break;\n' +
- ' case !y: {\n' +
- ' break;\n' +
- ' }\n' +
- '}')
-
- # typical greasemonkey start
- test_fragment(
- '// comment 2\n' +
- '(function()')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function() {}, d = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function() {},\n' +
- ' d = \'\';')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function yoohoo() {}, d = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function yoohoo() {},\n' +
- ' d = \'\';')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function() {},\n' +
- 'd = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function() {},\n' +
- ' d = \'\';')
- bt(
- 'var o2=$.extend(a);function(){alert(x);}',
- # -- output --
- 'var o2 = $.extend(a);\n' +
- '\n' +
- 'function() {\n' +
- ' alert(x);\n' +
- '}')
- bt(
- 'var o2=$.extend(a);function yoohoo(){alert(x);}',
- # -- output --
- 'var o2 = $.extend(a);\n' +
- '\n' +
- 'function yoohoo() {\n' +
- ' alert(x);\n' +
- '}')
- bt(
- 'function*() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'function* yoohoo() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'function* x() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'async x() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'var a={data(){},\n' +
- 'data2(){}}',
- # -- output --
- 'var a = {\n' +
- ' data() {},\n' +
- ' data2() {}\n' +
- '}')
- bt(
- 'new Vue({\n' +
- 'data(){},\n' +
- 'data2(){}, a:1})',
- # -- output --
- 'new Vue({\n' +
- ' data() {},\n' +
- ' data2() {},\n' +
- ' a: 1\n' +
- '})')
- bt(
- 'export default {data(){},\n' +
- 'data2(){},\n' +
- 'a:1}',
- # -- output --
- 'export default {\n' +
- ' data() {},\n' +
- ' data2() {},\n' +
- ' a: 1\n' +
- '}')
- bt(
- 'var a={*data(){},*data2(){}}',
- # -- output --
- 'var a = {\n' +
- ' * data() {},\n' +
- ' * data2() {}\n' +
- '}')
- bt(
- 'new Vue({\n' +
- '*data(){},*data2(){}, a:1})',
- # -- output --
- 'new Vue({\n' +
- ' * data() {},\n' +
- ' * data2() {},\n' +
- ' a: 1\n' +
- '})')
- bt(
- 'export default {*data(){},*data2(){},\n' +
- 'a:1}',
- # -- output --
- 'export default {\n' +
- ' * data() {},\n' +
- ' * data2() {},\n' +
- ' a: 1\n' +
- '}')
-
- # jslint and space after anon function - (space_after_named_function = "true")
- self.reset_options()
- self.options.space_after_named_function = true
- bt(
- 'a=typeof(x)',
- # -- output --
- 'a = typeof(x)')
- bt(
- 'x();\n' +
- '\n' +
- 'function(){}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'function() {}')
- bt(
- 'x();\n' +
- '\n' +
- 'function y(){}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'function y () {}')
- bt(
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- 'x: function(){}\n' +
- '}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- ' x: function() {}\n' +
- '}')
- bt(
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- 'x: function y(){}\n' +
- '}',
- # -- output --
- 'x();\n' +
- '\n' +
- 'var x = {\n' +
- ' x: function y () {}\n' +
- '}')
- bt(
- 'function () {\n' +
- ' var a, b, c, d, e = [],\n' +
- ' f;\n' +
- '}',
- # -- output --
- 'function() {\n' +
- ' var a, b, c, d, e = [],\n' +
- ' f;\n' +
- '}')
- bt(
- 'switch(x) {case 0: case 1: a(); break; default: break}',
- # -- output --
- 'switch (x) {\n' +
- ' case 0:\n' +
- ' case 1:\n' +
- ' a();\n' +
- ' break;\n' +
- ' default:\n' +
- ' break\n' +
- '}')
- bt(
- 'switch(x){case -1:break;case !y:break;}',
- # -- output --
- 'switch (x) {\n' +
- ' case -1:\n' +
- ' break;\n' +
- ' case !y:\n' +
- ' break;\n' +
- '}')
-
- # Issue #1357
- bt(
- 'switch(x) {case 0: case 1:{a(); break;} default: break}',
- # -- output --
- 'switch (x) {\n' +
- ' case 0:\n' +
- ' case 1: {\n' +
- ' a();\n' +
- ' break;\n' +
- ' }\n' +
- ' default:\n' +
- ' break\n' +
- '}')
-
- # Issue #1357
- bt(
- 'switch(x){case -1:break;case !y:{break;}}',
- # -- output --
- 'switch (x) {\n' +
- ' case -1:\n' +
- ' break;\n' +
- ' case !y: {\n' +
- ' break;\n' +
- ' }\n' +
- '}')
-
- # typical greasemonkey start
- test_fragment(
- '// comment 2\n' +
- '(function()')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function() {}, d = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function() {},\n' +
- ' d = \'\';')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function yoohoo() {}, d = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function yoohoo () {},\n' +
- ' d = \'\';')
- bt(
- 'var a2, b2, c2, d2 = 0, c = function() {},\n' +
- 'd = \'\';',
- # -- output --
- 'var a2, b2, c2, d2 = 0,\n' +
- ' c = function() {},\n' +
- ' d = \'\';')
- bt(
- 'var o2=$.extend(a);function(){alert(x);}',
- # -- output --
- 'var o2 = $.extend(a);\n' +
- '\n' +
- 'function() {\n' +
- ' alert(x);\n' +
- '}')
- bt(
- 'var o2=$.extend(a);function yoohoo(){alert(x);}',
- # -- output --
- 'var o2 = $.extend(a);\n' +
- '\n' +
- 'function yoohoo () {\n' +
- ' alert(x);\n' +
- '}')
- bt(
- 'function*() {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'function* yoohoo() {\n' +
- ' yield 1;\n' +
- '}',
- # -- output --
- 'function* yoohoo () {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'function* x() {\n' +
- ' yield 1;\n' +
- '}',
- # -- output --
- 'function* x () {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'async x() {\n' +
- ' yield 1;\n' +
- '}',
- # -- output --
- 'async x () {\n' +
- ' yield 1;\n' +
- '}')
- bt(
- 'var a={data(){},\n' +
- 'data2(){}}',
- # -- output --
- 'var a = {\n' +
- ' data () {},\n' +
- ' data2 () {}\n' +
- '}')
- bt(
- 'new Vue({\n' +
- 'data(){},\n' +
- 'data2(){}, a:1})',
- # -- output --
- 'new Vue({\n' +
- ' data () {},\n' +
- ' data2 () {},\n' +
- ' a: 1\n' +
- '})')
- bt(
- 'export default {data(){},\n' +
- 'data2(){},\n' +
- 'a:1}',
- # -- output --
- 'export default {\n' +
- ' data () {},\n' +
- ' data2 () {},\n' +
- ' a: 1\n' +
- '}')
- bt(
- 'var a={*data(){},*data2(){}}',
- # -- output --
- 'var a = {\n' +
- ' * data () {},\n' +
- ' * data2 () {}\n' +
- '}')
- bt(
- 'new Vue({\n' +
- '*data(){},*data2(){}, a:1})',
- # -- output --
- 'new Vue({\n' +
- ' * data () {},\n' +
- ' * data2 () {},\n' +
- ' a: 1\n' +
- '})')
- bt(
- 'export default {*data(){},*data2(){},\n' +
- 'a:1}',
- # -- output --
- 'export default {\n' +
- ' * data () {},\n' +
- ' * data2 () {},\n' +
- ' a: 1\n' +
- '}')
-
-
- #============================================================
- # Regression tests
- self.reset_options()
-
- # Issue 241
- bt(
- 'obj\n' +
- ' .last({\n' +
- ' foo: 1,\n' +
- ' bar: 2\n' +
- ' });\n' +
- 'var test = 1;')
-
- # Issue #1663
- bt(
- '{\n' +
- ' /* howdy\n' +
- ' \n' +
- ' */\n' +
- '}')
- bt(
- 'obj\n' +
- ' .last(a, function() {\n' +
- ' var test;\n' +
- ' });\n' +
- 'var test = 1;')
- bt(
- 'obj.first()\n' +
- ' .second()\n' +
- ' .last(function(err, response) {\n' +
- ' console.log(err);\n' +
- ' });')
-
- # Issue 268 and 275
- bt(
- 'obj.last(a, function() {\n' +
- ' var test;\n' +
- '});\n' +
- 'var test = 1;')
- bt(
- 'obj.last(a,\n' +
- ' function() {\n' +
- ' var test;\n' +
- ' });\n' +
- 'var test = 1;')
- bt(
- '(function() {if (!window.FOO) window.FOO || (window.FOO = function() {var b = {bar: "zort"};});})();',
- # -- output --
- '(function() {\n' +
- ' if (!window.FOO) window.FOO || (window.FOO = function() {\n' +
- ' var b = {\n' +
- ' bar: "zort"\n' +
- ' };\n' +
- ' });\n' +
- '})();')
-
- # Issue 281
- bt(
- 'define(["dojo/_base/declare", "my/Employee", "dijit/form/Button",\n' +
- ' "dojo/_base/lang", "dojo/Deferred"\n' +
- '], function(declare, Employee, Button, lang, Deferred) {\n' +
- ' return declare(Employee, {\n' +
- ' constructor: function() {\n' +
- ' new Button({\n' +
- ' onClick: lang.hitch(this, function() {\n' +
- ' new Deferred().then(lang.hitch(this, function() {\n' +
- ' this.salary * 0.25;\n' +
- ' }));\n' +
- ' })\n' +
- ' });\n' +
- ' }\n' +
- ' });\n' +
- '});')
- bt(
- 'define(["dojo/_base/declare", "my/Employee", "dijit/form/Button",\n' +
- ' "dojo/_base/lang", "dojo/Deferred"\n' +
- ' ],\n' +
- ' function(declare, Employee, Button, lang, Deferred) {\n' +
- ' return declare(Employee, {\n' +
- ' constructor: function() {\n' +
- ' new Button({\n' +
- ' onClick: lang.hitch(this, function() {\n' +
- ' new Deferred().then(lang.hitch(this, function() {\n' +
- ' this.salary * 0.25;\n' +
- ' }));\n' +
- ' })\n' +
- ' });\n' +
- ' }\n' +
- ' });\n' +
- ' });')
-
- # Issue 459
- bt(
- '(function() {\n' +
- ' return {\n' +
- ' foo: function() {\n' +
- ' return "bar";\n' +
- ' },\n' +
- ' bar: ["bar"]\n' +
- ' };\n' +
- '}());')
-
- # Issue 505 - strings should end at newline unless continued by backslash
- bt(
- 'var name = "a;\n' +
- 'name = "b";')
- bt(
- 'var name = "a;\\\n' +
- ' name = b";')
-
- # Issue 514 - some operators require spaces to distinguish them
- bt('var c = "_ACTION_TO_NATIVEAPI_" + ++g++ + +new Date;')
- bt('var c = "_ACTION_TO_NATIVEAPI_" - --g-- - -new Date;')
-
- # Issue 440 - reserved words can be used as object property names
- bt(
- 'a = {\n' +
- ' function: {},\n' +
- ' "function": {},\n' +
- ' throw: {},\n' +
- ' "throw": {},\n' +
- ' var: {},\n' +
- ' "var": {},\n' +
- ' set: {},\n' +
- ' "set": {},\n' +
- ' get: {},\n' +
- ' "get": {},\n' +
- ' if: {},\n' +
- ' "if": {},\n' +
- ' then: {},\n' +
- ' "then": {},\n' +
- ' else: {},\n' +
- ' "else": {},\n' +
- ' yay: {}\n' +
- '};')
-
- # Issue 331 - if-else with braces edge case
- bt(
- 'if(x){a();}else{b();}if(y){c();}',
- # -- output --
- 'if (x) {\n' +
- ' a();\n' +
- '} else {\n' +
- ' b();\n' +
- '}\n' +
- 'if (y) {\n' +
- ' c();\n' +
- '}')
-
- # Issue 485 - ensure function declarations behave the same in arrays as elsewhere
- bt(
- 'var v = ["a",\n' +
- ' function() {\n' +
- ' return;\n' +
- ' }, {\n' +
- ' id: 1\n' +
- ' }\n' +
- '];')
- bt(
- 'var v = ["a", function() {\n' +
- ' return;\n' +
- '}, {\n' +
- ' id: 1\n' +
- '}];')
-
- # Issue 382 - initial totally cursory support for es6 module export
- bt(
- 'module "Even" {\n' +
- ' import odd from "Odd";\n' +
- ' export function sum(x, y) {\n' +
- ' return x + y;\n' +
- ' }\n' +
- ' export var pi = 3.141593;\n' +
- ' export default moduleName;\n' +
- '}')
- bt(
- 'module "Even" {\n' +
- ' export default function div(x, y) {}\n' +
- '}')
-
- # Issue 889 - export default { ... }
- bt(
- 'export default {\n' +
- ' func1() {},\n' +
- ' func2() {}\n' +
- ' func3() {}\n' +
- '}')
- bt(
- 'export default {\n' +
- ' a() {\n' +
- ' return 1;\n' +
- ' },\n' +
- ' b() {\n' +
- ' return 2;\n' +
- ' },\n' +
- ' c() {\n' +
- ' return 3;\n' +
- ' }\n' +
- '}')
-
- # Issue 508
- bt('set["name"]')
- bt('get["name"]')
- test_fragment(
- 'a = {\n' +
- ' set b(x) {},\n' +
- ' c: 1,\n' +
- ' d: function() {}\n' +
- '};')
- test_fragment(
- 'a = {\n' +
- ' get b() {\n' +
- ' retun 0;\n' +
- ' },\n' +
- ' c: 1,\n' +
- ' d: function() {}\n' +
- '};')
-
- # Issue 298 - do not under indent if/while/for condtionals experesions
- bt(
- '\'use strict\';\n' +
- 'if ([].some(function() {\n' +
- ' return false;\n' +
- ' })) {\n' +
- ' console.log("hello");\n' +
- '}')
-
- # Issue 298 - do not under indent if/while/for condtionals experesions
- bt(
- '\'use strict\';\n' +
- 'if ([].some(function() {\n' +
- ' return false;\n' +
- ' })) {\n' +
- ' console.log("hello");\n' +
- '}')
-
- # Issue 552 - Typescript? Okay... we didn't break it before, so try not to break it now.
- bt(
- 'class Test {\n' +
- ' blah: string[];\n' +
- ' foo(): number {\n' +
- ' return 0;\n' +
- ' }\n' +
- ' bar(): number {\n' +
- ' return 0;\n' +
- ' }\n' +
- '}')
-
- # Issue 1544 - Typescript declare formatting (no newline).
- bt(
- 'declare const require: any;\n' +
- 'declare function greet(greeting: string): void;\n' +
- 'declare var foo: number;\n' +
- 'declare namespace myLib {\n' +
- ' function makeGreeting(s: string): string;\n' +
- ' let numberOfGreetings: number;\n' +
- '}\n' +
- 'declare let test: any;')
- bt(
- 'interface Test {\n' +
- ' blah: string[];\n' +
- ' foo(): number {\n' +
- ' return 0;\n' +
- ' }\n' +
- ' bar(): number {\n' +
- ' return 0;\n' +
- ' }\n' +
- '}')
-
- # Issue 583 - Functions with comments after them should still indent correctly.
- bt(
- 'function exit(code) {\n' +
- ' setTimeout(function() {\n' +
- ' phantom.exit(code);\n' +
- ' }, 0);\n' +
- ' phantom.onError = function() {};\n' +
- '}\n' +
- '// Comment')
-
- # Issue 806 - newline arrow functions
- bt(
- 'a.b("c",\n' +
- ' () => d.e\n' +
- ')')
-
- # Issue 810 - es6 object literal detection
- bt(
- 'function badFormatting() {\n' +
- ' return {\n' +
- ' a,\n' +
- ' b: c,\n' +
- ' d: e,\n' +
- ' f: g,\n' +
- ' h,\n' +
- ' i,\n' +
- ' j: k\n' +
- ' }\n' +
- '}\n' +
- '\n' +
- 'function goodFormatting() {\n' +
- ' return {\n' +
- ' a: b,\n' +
- ' c,\n' +
- ' d: e,\n' +
- ' f: g,\n' +
- ' h,\n' +
- ' i,\n' +
- ' j: k\n' +
- ' }\n' +
- '}')
-
- # Issue 602 - ES6 object literal shorthand functions
- bt(
- 'return {\n' +
- ' fn1() {},\n' +
- ' fn2() {}\n' +
- '}')
- bt(
- 'throw {\n' +
- ' fn1() {},\n' +
- ' fn2() {}\n' +
- '}')
- bt(
- 'foo({\n' +
- ' fn1(a) {}\n' +
- ' fn2(a) {}\n' +
- '})')
- bt(
- 'foo("text", {\n' +
- ' fn1(a) {}\n' +
- ' fn2(a) {}\n' +
- '})')
- bt(
- 'oneArg = {\n' +
- ' fn1(a) {\n' +
- ' do();\n' +
- ' },\n' +
- ' fn2() {}\n' +
- '}')
- bt(
- 'multiArg = {\n' +
- ' fn1(a, b, c) {\n' +
- ' do();\n' +
- ' },\n' +
- ' fn2() {}\n' +
- '}')
- bt(
- 'noArgs = {\n' +
- ' fn1() {\n' +
- ' do();\n' +
- ' },\n' +
- ' fn2() {}\n' +
- '}')
- bt(
- 'emptyFn = {\n' +
- ' fn1() {},\n' +
- ' fn2() {}\n' +
- '}')
- bt(
- 'nested = {\n' +
- ' fns: {\n' +
- ' fn1() {},\n' +
- ' fn2() {}\n' +
- ' }\n' +
- '}')
- bt(
- 'array = [{\n' +
- ' fn1() {},\n' +
- ' prop: val,\n' +
- ' fn2() {}\n' +
- '}]')
- bt(
- 'expr = expr ? expr : {\n' +
- ' fn1() {},\n' +
- ' fn2() {}\n' +
- '}')
- bt(
- 'strange = valid + {\n' +
- ' fn1() {},\n' +
- ' fn2() {\n' +
- ' return 1;\n' +
- ' }\n' +
- '}.fn2()')
-
- # Issue 854 - Arrow function with statement block
- bt(
- 'test(() => {\n' +
- ' var a = {}\n' +
- '\n' +
- ' a.what = () => true ? 1 : 2\n' +
- '\n' +
- ' a.thing = () => {\n' +
- ' b();\n' +
- ' }\n' +
- '})')
-
- # Issue 1727 - Optional chaining
- bt('true?.1:.2', 'true ? .1 : .2')
-
- # Issue 406 - Multiline array
- bt(
- 'var tempName = [\n' +
- ' "temp",\n' +
- ' process.pid,\n' +
- ' (Math.random() * 0x1000000000).toString(36),\n' +
- ' new Date().getTime()\n' +
- '].join("-");')
-
- # Issue 1374 - Parameters starting with ! or [ merged into single line
- bt(
- 'fn(\n' +
- ' 1,\n' +
- ' !1,\n' +
- ' 1,\n' +
- ' [1]\n' +
- ')')
-
- # Issue 1288 - Negative numbers remove newlines in array
- bt(
- 'var array = [\n' +
- ' -1,\n' +
- ' 0,\n' +
- ' "a",\n' +
- ' -2,\n' +
- ' 1,\n' +
- ' -3,\n' +
- '];')
-
- # Issue 1229 - Negated expressions in array
- bt(
- 'a = [\n' +
- ' true && 1,\n' +
- ' true && 1,\n' +
- ' true && 1\n' +
- ']\n' +
- 'a = [\n' +
- ' !true && 1,\n' +
- ' !true && 1,\n' +
- ' !true && 1\n' +
- ']')
-
- # Issue #996 - Input ends with backslash throws exception
- test_fragment(
- 'sd = 1;\n' +
- '/')
-
- # Issue #1079 - unbraced if with comments should still look right
- bt(
- 'if (console.log)\n' +
- ' for (var i = 0; i < 20; ++i)\n' +
- ' if (i % 3)\n' +
- ' console.log(i);\n' +
- '// all done\n' +
- 'console.log("done");')
-
- # Issue #1085 - function should not have blank line in a number of cases
- bt(
- 'var transformer =\n' +
- ' options.transformer ||\n' +
- ' globalSettings.transformer ||\n' +
- ' function(x) {\n' +
- ' return x;\n' +
- ' };')
-
- # Issue #569 - function should not have blank line in a number of cases
- bt(
- '(function(global) {\n' +
- ' "use strict";\n' +
- '\n' +
- ' /* jshint ignore:start */\n' +
- ' include "somefile.js"\n' +
- ' /* jshint ignore:end */\n' +
- '}(this));')
- bt(
- 'function bindAuthEvent(eventName) {\n' +
- ' self.auth.on(eventName, function(event, meta) {\n' +
- ' self.emit(eventName, event, meta);\n' +
- ' });\n' +
- '}\n' +
- '["logged_in", "logged_out", "signed_up", "updated_user"].forEach(bindAuthEvent);\n' +
- '\n' +
- 'function bindBrowserEvent(eventName) {\n' +
- ' browser.on(eventName, function(event, meta) {\n' +
- ' self.emit(eventName, event, meta);\n' +
- ' });\n' +
- '}\n' +
- '["navigating"].forEach(bindBrowserEvent);')
-
- # Issue #892 - new line between chained methods
- bt(
- 'foo\n' +
- ' .who()\n' +
- '\n' +
- ' .knows()\n' +
- ' // comment\n' +
- ' .nothing() // comment\n' +
- '\n' +
- ' .more()')
-
- # Issue #1107 - Missing space between words for label
- bt(
- 'function f(a) {c: do if (x) {} else if (y) {} while(0); return 0;}',
- # -- output --
- 'function f(a) {\n' +
- ' c: do\n' +
- ' if (x) {} else if (y) {}\n' +
- ' while (0);\n' +
- ' return 0;\n' +
- '}')
- bt(
- 'function f(a) {c: if (x) {} else if (y) {} return 0;}',
- # -- output --
- 'function f(a) {\n' +
- ' c: if (x) {} else if (y) {}\n' +
- ' return 0;\n' +
- '}')
-
-
- #============================================================
- # Test non-positionable-ops
- self.reset_options()
- bt('a += 2;')
- bt('a -= 2;')
- bt('a *= 2;')
- bt('a /= 2;')
- bt('a %= 2;')
- bt('a &= 2;')
- bt('a ^= 2;')
- bt('a |= 2;')
- bt('a **= 2;')
- bt('a <<= 2;')
- bt('a >>= 2;')
-
-
- #============================================================
- #
- self.reset_options()
-
- # exponent literals
- bt('a = 1e10')
- bt('a = 1.3e10')
- bt('a = 1.3e-10')
- bt('a = -12345.3e-10')
- bt('a = .12345e-10')
- bt('a = 06789e-10')
- bt('a = e - 10')
- bt('a = 1.3e+10')
- bt('a = 1.e-7')
- bt('a = -12345.3e+10')
- bt('a = .12345e+10')
- bt('a = 06789e+10')
- bt('a = e + 10')
- bt('a=0e-12345.3e-10', 'a = 0e-12345 .3e-10')
- bt('a=0.e-12345.3e-10', 'a = 0.e-12345 .3e-10')
- bt('a=0x.e-12345.3e-10', 'a = 0x.e - 12345.3e-10')
- bt('a=0x0.e-12345.3e-10', 'a = 0x0.e - 12345.3e-10')
- bt('a=0x0.0e-12345.3e-10', 'a = 0x0 .0e-12345 .3e-10')
- bt('a=0g-12345.3e-10', 'a = 0 g - 12345.3e-10')
- bt('a=0.g-12345.3e-10', 'a = 0. g - 12345.3e-10')
- bt('a=0x.g-12345.3e-10', 'a = 0x.g - 12345.3e-10')
- bt('a=0x0.g-12345.3e-10', 'a = 0x0.g - 12345.3e-10')
- bt('a=0x0.0g-12345.3e-10', 'a = 0x0 .0 g - 12345.3e-10')
-
- # Decimal literals
- bt('a = 0123456789;')
- bt('a = 9876543210;')
- bt('a = 5647308291;')
- bt('a=030e-5', 'a = 030e-5')
- bt('a=00+4', 'a = 00 + 4')
- bt('a=32+4', 'a = 32 + 4')
- bt('a=0.6g+4', 'a = 0.6 g + 4')
- bt('a=01.10', 'a = 01.10')
- bt('a=a.10', 'a = a .10')
- bt('a=00B0x0', 'a = 00 B0x0')
- bt('a=00B0xb0', 'a = 00 B0xb0')
- bt('a=00B0x0b0', 'a = 00 B0x0b0')
- bt('a=0090x0', 'a = 0090 x0')
- bt('a=0g0b0o0', 'a = 0 g0b0o0')
-
- # Hexadecimal literals
- bt('a = 0x0123456789abcdef;')
- bt('a = 0X0123456789ABCDEF;')
- bt('a = 0xFeDcBa9876543210;')
- bt('a=0x30e-5', 'a = 0x30e - 5')
- bt('a=0xF0+4', 'a = 0xF0 + 4')
- bt('a=0Xff+4', 'a = 0Xff + 4')
- bt('a=0Xffg+4', 'a = 0Xff g + 4')
- bt('a=0x01.10', 'a = 0x01 .10')
- bt('a = 0xb0ce;')
- bt('a = 0x0b0;')
- bt('a=0x0B0x0', 'a = 0x0B0 x0')
- bt('a=0x0B0xb0', 'a = 0x0B0 xb0')
- bt('a=0x0B0x0b0', 'a = 0x0B0 x0b0')
- bt('a=0X090x0', 'a = 0X090 x0')
- bt('a=0Xg0b0o0', 'a = 0X g0b0o0')
-
- # Octal literals
- bt('a = 0o01234567;')
- bt('a = 0O01234567;')
- bt('a = 0o34120675;')
- bt('a=0o30e-5', 'a = 0o30 e - 5')
- bt('a=0o70+4', 'a = 0o70 + 4')
- bt('a=0O77+4', 'a = 0O77 + 4')
- bt('a=0O778+4', 'a = 0O77 8 + 4')
- bt('a=0O77a+4', 'a = 0O77 a + 4')
- bt('a=0o01.10', 'a = 0o01 .10')
- bt('a=0o0B0x0', 'a = 0o0 B0x0')
- bt('a=0o0B0xb0', 'a = 0o0 B0xb0')
- bt('a=0o0B0x0b0', 'a = 0o0 B0x0b0')
- bt('a=0O090x0', 'a = 0O0 90 x0')
- bt('a=0Og0b0o0', 'a = 0O g0b0o0')
-
- # Binary literals
- bt('a = 0b010011;')
- bt('a = 0B010011;')
- bt('a = 0b01001100001111;')
- bt('a=0b10e-5', 'a = 0b10 e - 5')
- bt('a=0b10+4', 'a = 0b10 + 4')
- bt('a=0B11+4', 'a = 0B11 + 4')
- bt('a=0B112+4', 'a = 0B11 2 + 4')
- bt('a=0B11a+4', 'a = 0B11 a + 4')
- bt('a=0b01.10', 'a = 0b01 .10')
- bt('a=0b0B0x0', 'a = 0b0 B0x0')
- bt('a=0b0B0xb0', 'a = 0b0 B0xb0')
- bt('a=0b0B0x0b0', 'a = 0b0 B0x0b0')
- bt('a=0B090x0', 'a = 0B0 90 x0')
- bt('a=0Bg0b0o0', 'a = 0B g0b0o0')
-
- # BigInt literals
- bt('a = 1n;')
- bt('a = 1234567890123456789n;')
- bt('a = -1234567890123456789n;')
- bt('a = 1234567890123456789 N;')
- bt('a=0b10e-5n', 'a = 0b10 e - 5n')
- bt('a=.0n', 'a = .0 n')
- bt('a=1.0n', 'a = 1.0 n')
- bt('a=1e0n', 'a = 1e0 n')
- bt('a=0n11a+4', 'a = 0n 11 a + 4')
-
-
- #============================================================
- # brace_style ,preserve-inline tests - (brace_style = ""collapse,preserve-inline"")
- self.reset_options()
- self.options.brace_style = 'collapse,preserve-inline'
- bt('import { asdf } from "asdf";')
- bt('import { get } from "asdf";')
- bt('function inLine() { console.log("oh em gee"); }')
- bt('if (cancer) { console.log("Im sorry but you only have so long to live..."); }')
- bt('if (ding) { console.log("dong"); } else { console.log("dang"); }')
- bt(
- 'function kindaComplex() {\n' +
- ' var a = 2;\n' +
- ' var obj = {};\n' +
- ' var obj2 = { a: "a", b: "b" };\n' +
- ' var obj3 = {\n' +
- ' c: "c",\n' +
- ' d: "d",\n' +
- ' e: "e"\n' +
- ' };\n' +
- '}')
- bt(
- 'function complex() {\n' +
- ' console.log("wowe");\n' +
- ' (function() { var a = 2; var b = 3; })();\n' +
- ' $.each(arr, function(el, idx) { return el; });\n' +
- ' var obj = {\n' +
- ' a: function() { console.log("test"); },\n' +
- ' b() {\n' +
- ' console.log("test2");\n' +
- ' }\n' +
- ' };\n' +
- '}',
- # -- output --
- 'function complex() {\n' +
- ' console.log("wowe");\n' +
- ' (function() { var a = 2; var b = 3; })();\n' +
- ' $.each(arr, function(el, idx) { return el; });\n' +
- ' var obj = {\n' +
- ' a: function() { console.log("test"); },\n' +
- ' b() {\n' +
- ' console.log("test2");\n' +
- ' }\n' +
- ' };\n' +
- '}')
-
- # brace_style ,preserve-inline tests - (brace_style = ""expand,preserve-inline"")
- self.reset_options()
- self.options.brace_style = 'expand,preserve-inline'
- bt('import { asdf } from "asdf";')
- bt('import { get } from "asdf";')
- bt('function inLine() { console.log("oh em gee"); }')
- bt('if (cancer) { console.log("Im sorry but you only have so long to live..."); }')
- bt(
- 'if (ding) { console.log("dong"); } else { console.log("dang"); }',
- # -- output --
- 'if (ding) { console.log("dong"); }\n' +
- 'else { console.log("dang"); }')
- bt(
- 'function kindaComplex() {\n' +
- ' var a = 2;\n' +
- ' var obj = {};\n' +
- ' var obj2 = { a: "a", b: "b" };\n' +
- ' var obj3 = {\n' +
- ' c: "c",\n' +
- ' d: "d",\n' +
- ' e: "e"\n' +
- ' };\n' +
- '}',
- # -- output --
- 'function kindaComplex()\n' +
- '{\n' +
- ' var a = 2;\n' +
- ' var obj = {};\n' +
- ' var obj2 = { a: "a", b: "b" };\n' +
- ' var obj3 = {\n' +
- ' c: "c",\n' +
- ' d: "d",\n' +
- ' e: "e"\n' +
- ' };\n' +
- '}')
- bt(
- 'function complex() {\n' +
- ' console.log("wowe");\n' +
- ' (function() { var a = 2; var b = 3; })();\n' +
- ' $.each(arr, function(el, idx) { return el; });\n' +
- ' var obj = {\n' +
- ' a: function() { console.log("test"); },\n' +
- ' b() {\n' +
- ' console.log("test2");\n' +
- ' }\n' +
- ' };\n' +
- '}',
- # -- output --
- 'function complex()\n' +
- '{\n' +
- ' console.log("wowe");\n' +
- ' (function() { var a = 2; var b = 3; })();\n' +
- ' $.each(arr, function(el, idx) { return el; });\n' +
- ' var obj = {\n' +
- ' a: function() { console.log("test"); },\n' +
- ' b()\n' +
- ' {\n' +
- ' console.log("test2");\n' +
- ' }\n' +
- ' };\n' +
- '}')
-
- # brace_style ,preserve-inline tests - (brace_style = ""end-expand,preserve-inline"")
- self.reset_options()
- self.options.brace_style = 'end-expand,preserve-inline'
- bt('import { asdf } from "asdf";')
- bt('import { get } from "asdf";')
- bt('function inLine() { console.log("oh em gee"); }')
- bt('if (cancer) { console.log("Im sorry but you only have so long to live..."); }')
- bt(
- 'if (ding) { console.log("dong"); } else { console.log("dang"); }',
- # -- output --
- 'if (ding) { console.log("dong"); }\n' +
- 'else { console.log("dang"); }')
- bt(
- 'function kindaComplex() {\n' +
- ' var a = 2;\n' +
- ' var obj = {};\n' +
- ' var obj2 = { a: "a", b: "b" };\n' +
- ' var obj3 = {\n' +
- ' c: "c",\n' +
- ' d: "d",\n' +
- ' e: "e"\n' +
- ' };\n' +
- '}')
- bt(
- 'function complex() {\n' +
- ' console.log("wowe");\n' +
- ' (function() { var a = 2; var b = 3; })();\n' +
- ' $.each(arr, function(el, idx) { return el; });\n' +
- ' var obj = {\n' +
- ' a: function() { console.log("test"); },\n' +
- ' b() {\n' +
- ' console.log("test2");\n' +
- ' }\n' +
- ' };\n' +
- '}',
- # -- output --
- 'function complex() {\n' +
- ' console.log("wowe");\n' +
- ' (function() { var a = 2; var b = 3; })();\n' +
- ' $.each(arr, function(el, idx) { return el; });\n' +
- ' var obj = {\n' +
- ' a: function() { console.log("test"); },\n' +
- ' b() {\n' +
- ' console.log("test2");\n' +
- ' }\n' +
- ' };\n' +
- '}')
-
- # brace_style ,preserve-inline tests - (brace_style = ""none,preserve-inline"")
- self.reset_options()
- self.options.brace_style = 'none,preserve-inline'
- bt('import { asdf } from "asdf";')
- bt('import { get } from "asdf";')
- bt('function inLine() { console.log("oh em gee"); }')
- bt('if (cancer) { console.log("Im sorry but you only have so long to live..."); }')
- bt('if (ding) { console.log("dong"); } else { console.log("dang"); }')
- bt(
- 'function kindaComplex() {\n' +
- ' var a = 2;\n' +
- ' var obj = {};\n' +
- ' var obj2 = { a: "a", b: "b" };\n' +
- ' var obj3 = {\n' +
- ' c: "c",\n' +
- ' d: "d",\n' +
- ' e: "e"\n' +
- ' };\n' +
- '}')
- bt(
- 'function complex() {\n' +
- ' console.log("wowe");\n' +
- ' (function() { var a = 2; var b = 3; })();\n' +
- ' $.each(arr, function(el, idx) { return el; });\n' +
- ' var obj = {\n' +
- ' a: function() { console.log("test"); },\n' +
- ' b() {\n' +
- ' console.log("test2");\n' +
- ' }\n' +
- ' };\n' +
- '}',
- # -- output --
- 'function complex() {\n' +
- ' console.log("wowe");\n' +
- ' (function() { var a = 2; var b = 3; })();\n' +
- ' $.each(arr, function(el, idx) { return el; });\n' +
- ' var obj = {\n' +
- ' a: function() { console.log("test"); },\n' +
- ' b() {\n' +
- ' console.log("test2");\n' +
- ' }\n' +
- ' };\n' +
- '}')
-
- # brace_style ,preserve-inline tests - (brace_style = ""collapse-preserve-inline"")
- self.reset_options()
- self.options.brace_style = 'collapse-preserve-inline'
- bt('import { asdf } from "asdf";')
- bt('import { get } from "asdf";')
- bt('function inLine() { console.log("oh em gee"); }')
- bt('if (cancer) { console.log("Im sorry but you only have so long to live..."); }')
- bt('if (ding) { console.log("dong"); } else { console.log("dang"); }')
- bt(
- 'function kindaComplex() {\n' +
- ' var a = 2;\n' +
- ' var obj = {};\n' +
- ' var obj2 = { a: "a", b: "b" };\n' +
- ' var obj3 = {\n' +
- ' c: "c",\n' +
- ' d: "d",\n' +
- ' e: "e"\n' +
- ' };\n' +
- '}')
- bt(
- 'function complex() {\n' +
- ' console.log("wowe");\n' +
- ' (function() { var a = 2; var b = 3; })();\n' +
- ' $.each(arr, function(el, idx) { return el; });\n' +
- ' var obj = {\n' +
- ' a: function() { console.log("test"); },\n' +
- ' b() {\n' +
- ' console.log("test2");\n' +
- ' }\n' +
- ' };\n' +
- '}',
- # -- output --
- 'function complex() {\n' +
- ' console.log("wowe");\n' +
- ' (function() { var a = 2; var b = 3; })();\n' +
- ' $.each(arr, function(el, idx) { return el; });\n' +
- ' var obj = {\n' +
- ' a: function() { console.log("test"); },\n' +
- ' b() {\n' +
- ' console.log("test2");\n' +
- ' }\n' +
- ' };\n' +
- '}')
-
-
- #============================================================
- # Destructured and related
- self.reset_options()
- self.options.brace_style = 'collapse,preserve-inline'
-
- # Issue 382 - import destructured
- bt(
- 'module "Even" {\n' +
- ' import { odd, oddly } from "Odd";\n' +
- '}')
- bt(
- 'import defaultMember from "module-name";\n' +
- 'import * as name from "module-name";\n' +
- 'import { member } from "module-name";\n' +
- 'import { member as alias } from "module-name";\n' +
- 'import { member1, member2 } from "module-name";\n' +
- 'import { member1, member2 as alias2 } from "module-name";\n' +
- 'import defaultMember, { member, member2 } from "module-name";\n' +
- 'import defaultMember, * as name from "module-name";\n' +
- 'import "module-name";\n' +
- 'import("module-name")')
-
- # Issue #1393 - dynamic import()
- bt(
- 'if (from < to) {\n' +
- ' import(`dynamic${library}`);\n' +
- '} else {\n' +
- ' import("otherdynamic");\n' +
- '}')
-
- # Issue #1197 - dynamic import() arrow syntax
- bt('frontend = Async(() => import("../frontend").then(m => m.default ))', 'frontend = Async(() => import("../frontend").then(m => m.default))')
-
- # Issue 858 - from is a keyword only after import
- bt(
- 'if (from < to) {\n' +
- ' from++;\n' +
- '} else {\n' +
- ' from--;\n' +
- '}')
-
- # Issue 511 - destrutured
- bt(
- 'var { b, c } = require("../stores");\n' +
- 'var { ProjectStore } = require("../stores");\n' +
- '\n' +
- 'function takeThing({ prop }) {\n' +
- ' console.log("inner prop", prop)\n' +
- '}')
-
- # Issue 315 - Short objects
- bt('var a = { b: { c: { d: e } } };')
- bt(
- 'var a = {\n' +
- ' b: {\n' +
- ' c: { d: e }\n' +
- ' c3: { d: e }\n' +
- ' },\n' +
- ' b2: { c: { d: e } }\n' +
- '};')
-
- # Issue 370 - Short objects in array
- bt(
- 'var methods = [\n' +
- ' { name: "to" },\n' +
- ' { name: "step" },\n' +
- ' { name: "move" },\n' +
- ' { name: "min" },\n' +
- ' { name: "max" }\n' +
- '];')
-
- # Issue 838 - Short objects in array
- bt(
- 'function(url, callback) {\n' +
- ' var script = document.createElement("script")\n' +
- ' if (true) script.onreadystatechange = function() {\n' +
- ' foo();\n' +
- ' }\n' +
- ' else script.onload = callback;\n' +
- '}')
-
- # Issue 578 - Odd indenting after function
- bt(
- 'function bindAuthEvent(eventName) {\n' +
- ' self.auth.on(eventName, function(event, meta) {\n' +
- ' self.emit(eventName, event, meta);\n' +
- ' });\n' +
- '}\n' +
- '["logged_in", "logged_out", "signed_up", "updated_user"].forEach(bindAuthEvent);')
-
- # Issue #487 - some short expressions examples
- bt(
- 'if (a == 1) { a++; }\n' +
- 'a = { a: a };\n' +
- 'UserDB.findOne({ username: "xyz" }, function(err, user) {});\n' +
- 'import { fs } from "fs";')
-
- # Issue #982 - Fixed return expression collapse-preserve-inline
- bt(
- 'function foo(arg) {\n' +
- ' if (!arg) { a(); }\n' +
- ' if (!arg) { return false; }\n' +
- ' if (!arg) { throw "inline"; }\n' +
- ' return true;\n' +
- '}')
-
- # Issue #338 - Short expressions
- bt(
- 'if (someCondition) { return something; }\n' +
- 'if (someCondition) {\n' +
- ' return something;\n' +
- '}\n' +
- 'if (someCondition) { break; }\n' +
- 'if (someCondition) {\n' +
- ' return something;\n' +
- '}')
-
- # Issue #1283 - Javascript ++ Operator get wrong indent
- bt(
- '{this.foo++\n' +
- 'bar}',
- # -- output --
- '{\n' +
- ' this.foo++\n' +
- ' bar\n' +
- '}')
-
- # Issue #1283 - Javascript ++ Operator get wrong indent (2)
- bt(
- 'axios.interceptors.request.use(\n' +
- ' config => {\n' +
- ' // loading\n' +
- ' window.store.loading++\n' +
- ' let extraParams = {}\n' +
- ' }\n' +
- ')')
-
-
- #============================================================
- # keep_array_indentation false
- self.reset_options()
- self.options.keep_array_indentation = false
- bt(
- 'a = ["a", "b", "c",\n' +
- ' "d", "e", "f"]',
- # -- output --
- 'a = ["a", "b", "c",\n' +
- ' "d", "e", "f"\n' +
- ']')
- bt(
- 'a = ["a", "b", "c",\n' +
- ' "d", "e", "f",\n' +
- ' "g", "h", "i"]',
- # -- output --
- 'a = ["a", "b", "c",\n' +
- ' "d", "e", "f",\n' +
- ' "g", "h", "i"\n' +
- ']')
- bt(
- 'a = ["a", "b", "c",\n' +
- ' "d", "e", "f",\n' +
- ' "g", "h", "i"]',
- # -- output --
- 'a = ["a", "b", "c",\n' +
- ' "d", "e", "f",\n' +
- ' "g", "h", "i"\n' +
- ']')
- bt(
- 'var x = [{}\n' +
- ']',
- # -- output --
- 'var x = [{}]')
- bt(
- 'var x = [{foo:bar}\n' +
- ']',
- # -- output --
- 'var x = [{\n' +
- ' foo: bar\n' +
- '}]')
- bt(
- 'a = ["something",\n' +
- ' "completely",\n' +
- ' "different"];\n' +
- 'if (x);',
- # -- output --
- 'a = ["something",\n' +
- ' "completely",\n' +
- ' "different"\n' +
- '];\n' +
- 'if (x);')
- bt('a = ["a","b","c"]', 'a = ["a", "b", "c"]')
- bt('a = ["a", "b","c"]', 'a = ["a", "b", "c"]')
- bt(
- 'x = [{"a":0}]',
- # -- output --
- 'x = [{\n' +
- ' "a": 0\n' +
- '}]')
- bt(
- '{a([[a1]], {b;});}',
- # -- output --
- '{\n' +
- ' a([\n' +
- ' [a1]\n' +
- ' ], {\n' +
- ' b;\n' +
- ' });\n' +
- '}')
- bt(
- 'a ();\n' +
- ' [\n' +
- ' ["sdfsdfsd"],\n' +
- ' ["sdfsdfsdf"]\n' +
- ' ].toString();',
- # -- output --
- 'a();\n' +
- '[\n' +
- ' ["sdfsdfsd"],\n' +
- ' ["sdfsdfsdf"]\n' +
- '].toString();')
- bt(
- 'a ();\n' +
- 'a = [\n' +
- ' ["sdfsdfsd"],\n' +
- ' ["sdfsdfsdf"]\n' +
- ' ].toString();',
- # -- output --
- 'a();\n' +
- 'a = [\n' +
- ' ["sdfsdfsd"],\n' +
- ' ["sdfsdfsdf"]\n' +
- '].toString();')
- bt(
- 'function() {\n' +
- ' Foo([\n' +
- ' ["sdfsdfsd"],\n' +
- ' ["sdfsdfsdf"]\n' +
- ' ]);\n' +
- '}',
- # -- output --
- 'function() {\n' +
- ' Foo([\n' +
- ' ["sdfsdfsd"],\n' +
- ' ["sdfsdfsdf"]\n' +
- ' ]);\n' +
- '}')
- bt(
- 'function foo() {\n' +
- ' return [\n' +
- ' "one",\n' +
- ' "two"\n' +
- ' ];\n' +
- '}',
- # -- output --
- 'function foo() {\n' +
- ' return [\n' +
- ' "one",\n' +
- ' "two"\n' +
- ' ];\n' +
- '}')
- bt(
- 'function foo() {\n' +
- ' return [\n' +
- ' {\n' +
- ' one: "x",\n' +
- ' two: [\n' +
- ' {\n' +
- ' id: "a",\n' +
- ' name: "apple"\n' +
- ' }, {\n' +
- ' id: "b",\n' +
- ' name: "banana"\n' +
- ' }\n' +
- ' ]\n' +
- ' }\n' +
- ' ];\n' +
- '}',
- # -- output --
- 'function foo() {\n' +
- ' return [{\n' +
- ' one: "x",\n' +
- ' two: [{\n' +
- ' id: "a",\n' +
- ' name: "apple"\n' +
- ' }, {\n' +
- ' id: "b",\n' +
- ' name: "banana"\n' +
- ' }]\n' +
- ' }];\n' +
- '}')
- bt(
- 'function foo() {\n' +
- ' return [\n' +
- ' {\n' +
- ' one: "x",\n' +
- ' two: [\n' +
- ' {\n' +
- ' id: "a",\n' +
- ' name: "apple"\n' +
- ' }, {\n' +
- ' id: "b",\n' +
- ' name: "banana"\n' +
- ' }\n' +
- ' ]\n' +
- ' }\n' +
- ' ];\n' +
- '}',
- # -- output --
- 'function foo() {\n' +
- ' return [{\n' +
- ' one: "x",\n' +
- ' two: [{\n' +
- ' id: "a",\n' +
- ' name: "apple"\n' +
- ' }, {\n' +
- ' id: "b",\n' +
- ' name: "banana"\n' +
- ' }]\n' +
- ' }];\n' +
- '}')
-
-
- #============================================================
- # keep_array_indentation true
- self.reset_options()
- self.options.keep_array_indentation = true
- bt(
- 'a = ["a", "b", "c",\n' +
- ' "d", "e", "f"]',
- # -- output --
- 'a = ["a", "b", "c",\n' +
- ' "d", "e", "f"]')
- bt(
- 'a = ["a", "b", "c",\n' +
- ' "d", "e", "f",\n' +
- ' "g", "h", "i"]',
- # -- output --
- 'a = ["a", "b", "c",\n' +
- ' "d", "e", "f",\n' +
- ' "g", "h", "i"]')
- bt(
- 'a = ["a", "b", "c",\n' +
- ' "d", "e", "f",\n' +
- ' "g", "h", "i"]',
- # -- output --
- 'a = ["a", "b", "c",\n' +
- ' "d", "e", "f",\n' +
- ' "g", "h", "i"]')
- bt(
- 'var x = [{}\n' +
- ']',
- # -- output --
- 'var x = [{}\n' +
- ']')
- bt(
- 'var x = [{foo:bar}\n' +
- ']',
- # -- output --
- 'var x = [{\n' +
- ' foo: bar\n' +
- ' }\n' +
- ']')
- bt(
- 'a = ["something",\n' +
- ' "completely",\n' +
- ' "different"];\n' +
- 'if (x);',
- # -- output --
- 'a = ["something",\n' +
- ' "completely",\n' +
- ' "different"];\n' +
- 'if (x);')
- bt('a = ["a","b","c"]', 'a = ["a", "b", "c"]')
- bt('a = ["a", "b","c"]', 'a = ["a", "b", "c"]')
- bt(
- 'x = [{"a":0}]',
- # -- output --
- 'x = [{\n' +
- ' "a": 0\n' +
- '}]')
- bt(
- '{a([[a1]], {b;});}',
- # -- output --
- '{\n' +
- ' a([[a1]], {\n' +
- ' b;\n' +
- ' });\n' +
- '}')
- bt(
- 'a ();\n' +
- ' [\n' +
- ' ["sdfsdfsd"],\n' +
- ' ["sdfsdfsdf"]\n' +
- ' ].toString();',
- # -- output --
- 'a();\n' +
- ' [\n' +
- ' ["sdfsdfsd"],\n' +
- ' ["sdfsdfsdf"]\n' +
- ' ].toString();')
- bt(
- 'a ();\n' +
- 'a = [\n' +
- ' ["sdfsdfsd"],\n' +
- ' ["sdfsdfsdf"]\n' +
- ' ].toString();',
- # -- output --
- 'a();\n' +
- 'a = [\n' +
- ' ["sdfsdfsd"],\n' +
- ' ["sdfsdfsdf"]\n' +
- ' ].toString();')
- bt(
- 'function() {\n' +
- ' Foo([\n' +
- ' ["sdfsdfsd"],\n' +
- ' ["sdfsdfsdf"]\n' +
- ' ]);\n' +
- '}',
- # -- output --
- 'function() {\n' +
- ' Foo([\n' +
- ' ["sdfsdfsd"],\n' +
- ' ["sdfsdfsdf"]\n' +
- ' ]);\n' +
- '}')
- bt(
- 'function foo() {\n' +
- ' return [\n' +
- ' "one",\n' +
- ' "two"\n' +
- ' ];\n' +
- '}',
- # -- output --
- 'function foo() {\n' +
- ' return [\n' +
- ' "one",\n' +
- ' "two"\n' +
- ' ];\n' +
- '}')
- bt(
- 'function foo() {\n' +
- ' return [\n' +
- ' {\n' +
- ' one: "x",\n' +
- ' two: [\n' +
- ' {\n' +
- ' id: "a",\n' +
- ' name: "apple"\n' +
- ' }, {\n' +
- ' id: "b",\n' +
- ' name: "banana"\n' +
- ' }\n' +
- ' ]\n' +
- ' }\n' +
- ' ];\n' +
- '}',
- # -- output --
- 'function foo() {\n' +
- ' return [\n' +
- ' {\n' +
- ' one: "x",\n' +
- ' two: [\n' +
- ' {\n' +
- ' id: "a",\n' +
- ' name: "apple"\n' +
- ' }, {\n' +
- ' id: "b",\n' +
- ' name: "banana"\n' +
- ' }\n' +
- ' ]\n' +
- ' }\n' +
- ' ];\n' +
- '}')
-
-
- #============================================================
- # indent_empty_lines true
- self.reset_options()
- self.options.indent_empty_lines = true
- test_fragment(
- 'var a = 1;\n' +
- '\n' +
- 'var b = 1;')
- test_fragment(
- 'var a = 1;\n' +
- ' \n' +
- 'var b = 1;',
- # -- output --
- 'var a = 1;\n' +
- '\n' +
- 'var b = 1;')
- test_fragment(
- '{\n' +
- ' var a = 1;\n' +
- ' \n' +
- ' var b = 1;\n' +
- '\n' +
- '}',
- # -- output --
- '{\n' +
- ' var a = 1;\n' +
- ' \n' +
- ' var b = 1;\n' +
- ' \n' +
- '}')
- test_fragment(
- '{\n' +
- '\n' +
- ' var a = 1;\n' +
- '\n' +
- '\n' +
- '\n' +
- ' var b = 1;\n' +
- '\n' +
- '}',
- # -- output --
- '{\n' +
- ' \n' +
- ' var a = 1;\n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' var b = 1;\n' +
- ' \n' +
- '}')
- test_fragment(
- '{\n' +
- '\n' +
- ' var a = 1;\n' +
- '\n' +
- 'function A() {\n' +
- '\n' +
- '}\n' +
- '\n' +
- ' var b = 1;\n' +
- '\n' +
- '}',
- # -- output --
- '{\n' +
- ' \n' +
- ' var a = 1;\n' +
- ' \n' +
- ' function A() {\n' +
- ' \n' +
- ' }\n' +
- ' \n' +
- ' var b = 1;\n' +
- ' \n' +
- '}')
-
-
- #============================================================
- # indent_empty_lines false
- self.reset_options()
- self.options.indent_empty_lines = false
- test_fragment(
- 'var a = 1;\n' +
- '\n' +
- 'var b = 1;')
- test_fragment(
- 'var a = 1;\n' +
- ' \n' +
- 'var b = 1;',
- # -- output --
- 'var a = 1;\n' +
- '\n' +
- 'var b = 1;')
- test_fragment(
- '{\n' +
- ' var a = 1;\n' +
- ' \n' +
- ' var b = 1;\n' +
- '\n' +
- '}',
- # -- output --
- '{\n' +
- ' var a = 1;\n' +
- '\n' +
- ' var b = 1;\n' +
- '\n' +
- '}')
- test_fragment(
- '{\n' +
- '\n' +
- ' var a = 1;\n' +
- '\n' +
- '\n' +
- '\n' +
- ' var b = 1;\n' +
- '\n' +
- '}')
- test_fragment(
- '{\n' +
- '\n' +
- ' var a = 1;\n' +
- '\n' +
- 'function A() {\n' +
- '\n' +
- '}\n' +
- '\n' +
- ' var b = 1;\n' +
- '\n' +
- '}',
- # -- output --
- '{\n' +
- '\n' +
- ' var a = 1;\n' +
- '\n' +
- ' function A() {\n' +
- '\n' +
- ' }\n' +
- '\n' +
- ' var b = 1;\n' +
- '\n' +
- '}')
-
-
- #============================================================
- # Old tests
- self.reset_options()
- bt('')
- test_fragment(' return .5')
- test_fragment(
- ' return .5;\n' +
- ' a();')
- test_fragment(
- ' return .5;\n' +
- ' a();')
- test_fragment(
- ' return .5;\n' +
- ' a();')
- test_fragment(' < div')
- bt('a = 1', 'a = 1')
- bt('a=1', 'a = 1')
- bt('(3) / 2')
- bt('["a", "b"].join("")')
- bt(
- 'a();\n' +
- '\n' +
- 'b();')
- bt(
- 'var a = 1 var b = 2',
- # -- output --
- 'var a = 1\n' +
- 'var b = 2')
- bt(
- 'var a=1, b=c[d], e=6;',
- # -- output --
- 'var a = 1,\n' +
- ' b = c[d],\n' +
- ' e = 6;')
- bt(
- 'var a,\n' +
- ' b,\n' +
- ' c;')
- bt(
- 'let a = 1 let b = 2',
- # -- output --
- 'let a = 1\n' +
- 'let b = 2')
- bt(
- 'let a=1, b=c[d], e=6;',
- # -- output --
- 'let a = 1,\n' +
- ' b = c[d],\n' +
- ' e = 6;')
- bt(
- 'let a,\n' +
- ' b,\n' +
- ' c;')
- bt(
- 'const a = 1 const b = 2',
- # -- output --
- 'const a = 1\n' +
- 'const b = 2')
- bt(
- 'const a=1, b=c[d], e=6;',
- # -- output --
- 'const a = 1,\n' +
- ' b = c[d],\n' +
- ' e = 6;')
- bt(
- 'const a,\n' +
- ' b,\n' +
- ' c;')
- bt('a = " 12345 "')
- bt('a = \' 12345 \'')
- bt('if (a == 1) b = 2;')
- bt(
- 'if(1){2}else{3}',
- # -- output --
- 'if (1) {\n' +
- ' 2\n' +
- '} else {\n' +
- ' 3\n' +
- '}')
- bt('if(1||2);', 'if (1 || 2);')
- bt('(a==1)||(b==2)', '(a == 1) || (b == 2)')
- bt(
- 'var a = 1 if (2) 3;',
- # -- output --
- 'var a = 1\n' +
- 'if (2) 3;')
- bt('a = a + 1')
- bt('a = a == 1')
- bt('/12345[^678]*9+/.match(a)')
- bt('a /= 5')
- bt('a = 0.5 * 3')
- bt('a *= 10.55')
- bt('a < .5')
- bt('a <= .5')
- bt('a<.5', 'a < .5')
- bt('a<=.5', 'a <= .5')
- bt('a = [1, 2, 3, 4]')
- bt('F*(g/=f)*g+b', 'F * (g /= f) * g + b')
- bt(
- 'a.b({c:d})',
- # -- output --
- 'a.b({\n' +
- ' c: d\n' +
- '})')
- bt(
- 'a.b\n' +
- '(\n' +
- '{\n' +
- 'c:\n' +
- 'd\n' +
- '}\n' +
- ')',
- # -- output --
- 'a.b({\n' +
- ' c: d\n' +
- '})')
- bt(
- 'a.b({c:"d"})',
- # -- output --
- 'a.b({\n' +
- ' c: "d"\n' +
- '})')
- bt(
- 'a.b\n' +
- '(\n' +
- '{\n' +
- 'c:\n' +
- '"d"\n' +
- '}\n' +
- ')',
- # -- output --
- 'a.b({\n' +
- ' c: "d"\n' +
- '})')
- bt('a=!b', 'a = !b')
- bt('a=!!b', 'a = !!b')
- bt('a?b:c', 'a ? b : c')
- bt('a?1:2', 'a ? 1 : 2')
- bt('a?(b):c', 'a ? (b) : c')
- bt(
- 'x={a:1,b:w=="foo"?x:y,c:z}',
- # -- output --
- 'x = {\n' +
- ' a: 1,\n' +
- ' b: w == "foo" ? x : y,\n' +
- ' c: z\n' +
- '}')
- bt('x=a?b?c?d:e:f:g;', 'x = a ? b ? c ? d : e : f : g;')
- bt(
- 'x=a?b?c?d:{e1:1,e2:2}:f:g;',
- # -- output --
- 'x = a ? b ? c ? d : {\n' +
- ' e1: 1,\n' +
- ' e2: 2\n' +
- '} : f : g;')
- bt('function void(void) {}')
- bt('if(!a)foo();', 'if (!a) foo();')
- bt('a=~a', 'a = ~a')
- bt(
- 'a;/*comment*/b;',
- # -- output --
- 'a; /*comment*/\n' +
- 'b;')
- bt(
- 'a;/* comment */b;',
- # -- output --
- 'a; /* comment */\n' +
- 'b;')
-
- # simple comments don't get touched at all
- test_fragment(
- 'a;/*\n' +
- 'comment\n' +
- '*/b;',
- # -- output --
- 'a;\n' +
- '/*\n' +
- 'comment\n' +
- '*/\n' +
- 'b;')
- bt(
- 'a;/**\n' +
- '* javadoc\n' +
- '*/b;',
- # -- output --
- 'a;\n' +
- '/**\n' +
- ' * javadoc\n' +
- ' */\n' +
- 'b;')
- test_fragment(
- 'a;/**\n' +
- '\n' +
- 'no javadoc\n' +
- '*/b;',
- # -- output --
- 'a;\n' +
- '/**\n' +
- '\n' +
- 'no javadoc\n' +
- '*/\n' +
- 'b;')
-
- # comment blocks detected and reindented even w/o javadoc starter
- bt(
- 'a;/*\n' +
- '* javadoc\n' +
- '*/b;',
- # -- output --
- 'a;\n' +
- '/*\n' +
- ' * javadoc\n' +
- ' */\n' +
- 'b;')
- bt('if(a)break;', 'if (a) break;')
- bt(
- 'if(a){break}',
- # -- output --
- 'if (a) {\n' +
- ' break\n' +
- '}')
- bt('if((a))foo();', 'if ((a)) foo();')
- bt('for(var i=0;;) a', 'for (var i = 0;;) a')
- bt(
- 'for(var i=0;;)\n' +
- 'a',
- # -- output --
- 'for (var i = 0;;)\n' +
- ' a')
- bt('a++;')
- bt('for(;;i++)a()', 'for (;; i++) a()')
- bt(
- 'for(;;i++)\n' +
- 'a()',
- # -- output --
- 'for (;; i++)\n' +
- ' a()')
- bt('for(;;++i)a', 'for (;; ++i) a')
- bt('return(1)', 'return (1)')
- bt(
- 'try{a();}catch(b){c();}finally{d();}',
- # -- output --
- 'try {\n' +
- ' a();\n' +
- '} catch (b) {\n' +
- ' c();\n' +
- '} finally {\n' +
- ' d();\n' +
- '}')
-
- # magic function call
- bt('(xx)()')
-
- # another magic function call
- bt('a[1]()')
- bt(
- 'if(a){b();}else if(c) foo();',
- # -- output --
- 'if (a) {\n' +
- ' b();\n' +
- '} else if (c) foo();')
- bt(
- 'switch(x) {case 0: case 1: a(); break; default: break}',
- # -- output --
- 'switch (x) {\n' +
- ' case 0:\n' +
- ' case 1:\n' +
- ' a();\n' +
- ' break;\n' +
- ' default:\n' +
- ' break\n' +
- '}')
- bt(
- 'switch(x) {default: case 1: a(); break; case 0: break}',
- # -- output --
- 'switch (x) {\n' +
- ' default:\n' +
- ' case 1:\n' +
- ' a();\n' +
- ' break;\n' +
- ' case 0:\n' +
- ' break\n' +
- '}')
- bt(
- 'switch(x){case -1:break;case !y:break;}',
- # -- output --
- 'switch (x) {\n' +
- ' case -1:\n' +
- ' break;\n' +
- ' case !y:\n' +
- ' break;\n' +
- '}')
- bt('a !== b')
- bt(
- 'if (a) b(); else c();',
- # -- output --
- 'if (a) b();\n' +
- 'else c();')
-
- # typical greasemonkey start
- bt(
- '// comment\n' +
- '(function something() {})')
-
- # duplicating newlines
- bt(
- '{\n' +
- '\n' +
- ' x();\n' +
- '\n' +
- '}')
- bt('if (a in b) foo();')
- bt('if (a of b) foo();')
- bt('if (a of [1, 2, 3]) foo();')
- bt(
- 'if(X)if(Y)a();else b();else c();',
- # -- output --
- 'if (X)\n' +
- ' if (Y) a();\n' +
- ' else b();\n' +
- 'else c();')
- bt(
- 'if (foo) bar();\n' +
- 'else break')
- bt('var a, b;')
- bt('var a = new function();')
- test_fragment('new function')
- bt('var a, b')
- bt(
- '{a:1, b:2}',
- # -- output --
- '{\n' +
- ' a: 1,\n' +
- ' b: 2\n' +
- '}')
- bt(
- 'a={1:[-1],2:[+1]}',
- # -- output --
- 'a = {\n' +
- ' 1: [-1],\n' +
- ' 2: [+1]\n' +
- '}')
- bt(
- 'var l = {\'a\':\'1\', \'b\':\'2\'}',
- # -- output --
- 'var l = {\n' +
- ' \'a\': \'1\',\n' +
- ' \'b\': \'2\'\n' +
- '}')
- bt('if (template.user[n] in bk) foo();')
- bt('return 45')
- bt(
- 'return this.prevObject ||\n' +
- '\n' +
- ' this.constructor(null);')
- bt('If[1]')
- bt('Then[1]')
- bt('a = 1;// comment', 'a = 1; // comment')
- bt('a = 1; // comment')
- bt(
- 'a = 1;\n' +
- ' // comment',
- # -- output --
- 'a = 1;\n' +
- '// comment')
- bt('a = [-1, -1, -1]')
- bt(
- '// a\n' +
- '// b\n' +
- '\n' +
- '\n' +
- '\n' +
- '// c\n' +
- '// d')
- bt(
- '// func-comment\n' +
- '\n' +
- 'function foo() {}\n' +
- '\n' +
- '// end-func-comment')
-
- # The exact formatting these should have is open for discussion, but they are at least reasonable
- bt(
- 'a = [ // comment\n' +
- ' -1, -1, -1\n' +
- ']')
- bt(
- 'var a = [ // comment\n' +
- ' -1, -1, -1\n' +
- ']')
- bt(
- 'a = [ // comment\n' +
- ' -1, // comment\n' +
- ' -1, -1\n' +
- ']')
- bt(
- 'var a = [ // comment\n' +
- ' -1, // comment\n' +
- ' -1, -1\n' +
- ']')
- bt(
- 'o = [{a:b},{c:d}]',
- # -- output --
- 'o = [{\n' +
- ' a: b\n' +
- '}, {\n' +
- ' c: d\n' +
- '}]')
-
- # was: extra space appended
- bt(
- 'if (a) {\n' +
- ' do();\n' +
- '}')
-
- # if/else statement with empty body
- bt(
- 'if (a) {\n' +
- '// comment\n' +
- '}else{\n' +
- '// comment\n' +
- '}',
- # -- output --
- 'if (a) {\n' +
- ' // comment\n' +
- '} else {\n' +
- ' // comment\n' +
- '}')
-
- # multiple comments indentation
- bt(
- 'if (a) {\n' +
- '// comment\n' +
- '// comment\n' +
- '}',
- # -- output --
- 'if (a) {\n' +
- ' // comment\n' +
- ' // comment\n' +
- '}')
- bt(
- 'if (a) b() else c();',
- # -- output --
- 'if (a) b()\n' +
- 'else c();')
- bt(
- 'if (a) b() else if c() d();',
- # -- output --
- 'if (a) b()\n' +
- 'else if c() d();')
- bt('{}')
- bt(
- '{\n' +
- '\n' +
- '}')
- bt(
- 'do { a(); } while ( 1 );',
- # -- output --
- 'do {\n' +
- ' a();\n' +
- '} while (1);')
- bt('do {} while (1);')
- bt(
- 'do {\n' +
- '} while (1);',
- # -- output --
- 'do {} while (1);')
- bt(
- 'do {\n' +
- '\n' +
- '} while (1);')
- bt('var a = x(a, b, c)')
- bt(
- 'delete x if (a) b();',
- # -- output --
- 'delete x\n' +
- 'if (a) b();')
- bt(
- 'delete x[x] if (a) b();',
- # -- output --
- 'delete x[x]\n' +
- 'if (a) b();')
- bt('for(var a=1,b=2)d', 'for (var a = 1, b = 2) d')
- bt('for(var a=1,b=2,c=3) d', 'for (var a = 1, b = 2, c = 3) d')
- bt(
- 'for(var a=1,b=2,c=3;d<3;d++)\n' +
- 'e',
- # -- output --
- 'for (var a = 1, b = 2, c = 3; d < 3; d++)\n' +
- ' e')
- bt(
- 'function x(){(a||b).c()}',
- # -- output --
- 'function x() {\n' +
- ' (a || b).c()\n' +
- '}')
- bt(
- 'function x(){return - 1}',
- # -- output --
- 'function x() {\n' +
- ' return -1\n' +
- '}')
- bt(
- 'function x(){return ! a}',
- # -- output --
- 'function x() {\n' +
- ' return !a\n' +
- '}')
- bt('x => x')
- bt('(x) => x')
- bt(
- 'x => { x }',
- # -- output --
- 'x => {\n' +
- ' x\n' +
- '}')
- bt(
- '(x) => { x }',
- # -- output --
- '(x) => {\n' +
- ' x\n' +
- '}')
-
- # a common snippet in jQuery plugins
- bt(
- 'settings = $.extend({},defaults,settings);',
- # -- output --
- 'settings = $.extend({}, defaults, settings);')
- bt('$http().then().finally().default()')
- bt(
- '$http()\n' +
- '.then()\n' +
- '.finally()\n' +
- '.default()',
- # -- output --
- '$http()\n' +
- ' .then()\n' +
- ' .finally()\n' +
- ' .default()')
- bt('$http().when.in.new.catch().throw()')
- bt(
- '$http()\n' +
- '.when\n' +
- '.in\n' +
- '.new\n' +
- '.catch()\n' +
- '.throw()',
- # -- output --
- '$http()\n' +
- ' .when\n' +
- ' .in\n' +
- ' .new\n' +
- ' .catch()\n' +
- ' .throw()')
- bt(
- '{xxx;}()',
- # -- output --
- '{\n' +
- ' xxx;\n' +
- '}()')
- bt(
- 'a = \'a\'\n' +
- 'b = \'b\'')
- bt('a = /reg/exp')
- bt('a = /reg/')
- bt('/abc/.test()')
- bt('/abc/i.test()')
- bt(
- '{/abc/i.test()}',
- # -- output --
- '{\n' +
- ' /abc/i.test()\n' +
- '}')
- bt('var x=(a)/a;', 'var x = (a) / a;')
- bt('x != -1')
- bt('for (; s-->0;)t', 'for (; s-- > 0;) t')
- bt('for (; s++>0;)u', 'for (; s++ > 0;) u')
- bt('a = s++>s--;', 'a = s++ > s--;')
- bt('a = s++>--s;', 'a = s++ > --s;')
- bt(
- '{x=#1=[]}',
- # -- output --
- '{\n' +
- ' x = #1=[]\n' +
- '}')
- bt(
- '{a:#1={}}',
- # -- output --
- '{\n' +
- ' a: #1={}\n' +
- '}')
- bt(
- '{a:#1#}',
- # -- output --
- '{\n' +
- ' a: #1#\n' +
- '}')
- test_fragment('"incomplete-string')
- test_fragment('\'incomplete-string')
- test_fragment('/incomplete-regex')
- test_fragment('`incomplete-template-string')
- test_fragment(
- '{a:1},{a:2}',
- # -- output --
- '{\n' +
- ' a: 1\n' +
- '}, {\n' +
- ' a: 2\n' +
- '}')
- test_fragment(
- 'var ary=[{a:1}, {a:2}];',
- # -- output --
- 'var ary = [{\n' +
- ' a: 1\n' +
- '}, {\n' +
- ' a: 2\n' +
- '}];')
-
- # incomplete
- test_fragment(
- '{a:#1',
- # -- output --
- '{\n' +
- ' a: #1')
-
- # incomplete
- test_fragment(
- '{a:#',
- # -- output --
- '{\n' +
- ' a: #')
-
- # incomplete
- test_fragment(
- '}}}',
- # -- output --
- '}\n' +
- '}\n' +
- '}')
- test_fragment(
- '')
-
- # incomplete regexp
- test_fragment('a=/regexp', 'a = /regexp')
- bt(
- '{a:#1=[],b:#1#,c:#999999#}',
- # -- output --
- '{\n' +
- ' a: #1=[],\n' +
- ' b: #1#,\n' +
- ' c: #999999#\n' +
- '}')
- bt(
- 'do{x()}while(a>1)',
- # -- output --
- 'do {\n' +
- ' x()\n' +
- '} while (a > 1)')
- bt(
- 'x(); /reg/exp.match(something)',
- # -- output --
- 'x();\n' +
- '/reg/exp.match(something)')
- test_fragment(
- 'something();(',
- # -- output --
- 'something();\n' +
- '(')
- test_fragment(
- '#!she/bangs, she bangs\n' +
- 'f=1',
- # -- output --
- '#!she/bangs, she bangs\n' +
- '\n' +
- 'f = 1')
- test_fragment(
- '#!she/bangs, she bangs\n' +
- '\n' +
- 'f=1',
- # -- output --
- '#!she/bangs, she bangs\n' +
- '\n' +
- 'f = 1')
- test_fragment(
- '#!she/bangs, she bangs\n' +
- '\n' +
- '/* comment */')
- test_fragment(
- '#!she/bangs, she bangs\n' +
- '\n' +
- '\n' +
- '/* comment */')
- test_fragment('#')
- test_fragment('#!')
- test_fragment('#include')
- test_fragment('#include "settings.jsxinc"')
- test_fragment(
- '#include "settings.jsxinc"\n' +
- '\n' +
- '\n' +
- '/* comment */')
- test_fragment(
- '#include "settings.jsxinc"\n' +
- '\n' +
- '\n' +
- '#include "settings.jsxinc"\n' +
- '\n' +
- '\n' +
- '/* comment */')
- bt('function namespace::something()')
- test_fragment(
- '')
- test_fragment(
- '',
- # -- output --
- '')
- bt(
- '{foo();--bar;}',
- # -- output --
- '{\n' +
- ' foo();\n' +
- ' --bar;\n' +
- '}')
- bt(
- '{foo();++bar;}',
- # -- output --
- '{\n' +
- ' foo();\n' +
- ' ++bar;\n' +
- '}')
- bt(
- '{--bar;}',
- # -- output --
- '{\n' +
- ' --bar;\n' +
- '}')
- bt(
- '{++bar;}',
- # -- output --
- '{\n' +
- ' ++bar;\n' +
- '}')
- bt('if(true)++a;', 'if (true) ++a;')
- bt(
- 'if(true)\n' +
- '++a;',
- # -- output --
- 'if (true)\n' +
- ' ++a;')
- bt('if(true)--a;', 'if (true) --a;')
- bt(
- 'if(true)\n' +
- '--a;',
- # -- output --
- 'if (true)\n' +
- ' --a;')
- bt('elem[array]++;')
- bt('elem++ * elem[array]++;')
- bt('elem-- * -elem[array]++;')
- bt('elem-- + elem[array]++;')
- bt('elem-- - elem[array]++;')
- bt('elem-- - -elem[array]++;')
- bt('elem-- - +elem[array]++;')
-
- # Handling of newlines around unary ++ and -- operators
- bt(
- '{foo\n' +
- '++bar;}',
- # -- output --
- '{\n' +
- ' foo\n' +
- ' ++bar;\n' +
- '}')
- bt(
- '{foo++\n' +
- 'bar;}',
- # -- output --
- '{\n' +
- ' foo++\n' +
- ' bar;\n' +
- '}')
-
- # This is invalid, but harder to guard against. Issue #203.
- bt(
- '{foo\n' +
- '++\n' +
- 'bar;}',
- # -- output --
- '{\n' +
- ' foo\n' +
- ' ++\n' +
- ' bar;\n' +
- '}')
-
- # regexps
- bt(
- 'a(/abc\\/\\/def/);b()',
- # -- output --
- 'a(/abc\\/\\/def/);\n' +
- 'b()')
- bt(
- 'a(/a[b\\[\\]c]d/);b()',
- # -- output --
- 'a(/a[b\\[\\]c]d/);\n' +
- 'b()')
-
- # incomplete char class
- test_fragment('a(/a[b\\[')
-
- # allow unescaped / in char classes
- bt(
- 'a(/[a/b]/);b()',
- # -- output --
- 'a(/[a/b]/);\n' +
- 'b()')
- bt('typeof /foo\\//;')
- bt('throw /foo\\//;')
- bt('do /foo\\//;')
- bt('return /foo\\//;')
- bt(
- 'switch (a) {\n' +
- ' case /foo\\//:\n' +
- ' b\n' +
- '}')
- bt(
- 'if (a) /foo\\//\n' +
- 'else /foo\\//;')
- bt('if (foo) /regex/.test();')
- bt('for (index in [1, 2, 3]) /^test$/i.test(s)')
- bt(
- 'function foo() {\n' +
- ' return [\n' +
- ' "one",\n' +
- ' "two"\n' +
- ' ];\n' +
- '}')
- bt(
- 'a=[[1,2],[4,5],[7,8]]',
- # -- output --
- 'a = [\n' +
- ' [1, 2],\n' +
- ' [4, 5],\n' +
- ' [7, 8]\n' +
- ']')
- bt(
- 'a=[[1,2],[4,5],function(){},[7,8]]',
- # -- output --
- 'a = [\n' +
- ' [1, 2],\n' +
- ' [4, 5],\n' +
- ' function() {},\n' +
- ' [7, 8]\n' +
- ']')
- bt(
- 'a=[[1,2],[4,5],function(){},function(){},[7,8]]',
- # -- output --
- 'a = [\n' +
- ' [1, 2],\n' +
- ' [4, 5],\n' +
- ' function() {},\n' +
- ' function() {},\n' +
- ' [7, 8]\n' +
- ']')
- bt(
- 'a=[[1,2],[4,5],function(){},[7,8]]',
- # -- output --
- 'a = [\n' +
- ' [1, 2],\n' +
- ' [4, 5],\n' +
- ' function() {},\n' +
- ' [7, 8]\n' +
- ']')
- bt('a=[b,c,function(){},function(){},d]', 'a = [b, c, function() {}, function() {}, d]')
- bt(
- 'a=[b,c,\n' +
- 'function(){},function(){},d]',
- # -- output --
- 'a = [b, c,\n' +
- ' function() {},\n' +
- ' function() {},\n' +
- ' d\n' +
- ']')
- bt('a=[a[1],b[4],c[d[7]]]', 'a = [a[1], b[4], c[d[7]]]')
- bt('[1,2,[3,4,[5,6],7],8]', '[1, 2, [3, 4, [5, 6], 7], 8]')
- bt(
- '[[["1","2"],["3","4"]],[["5","6","7"],["8","9","0"]],[["1","2","3"],["4","5","6","7"],["8","9","0"]]]',
- # -- output --
- '[\n' +
- ' [\n' +
- ' ["1", "2"],\n' +
- ' ["3", "4"]\n' +
- ' ],\n' +
- ' [\n' +
- ' ["5", "6", "7"],\n' +
- ' ["8", "9", "0"]\n' +
- ' ],\n' +
- ' [\n' +
- ' ["1", "2", "3"],\n' +
- ' ["4", "5", "6", "7"],\n' +
- ' ["8", "9", "0"]\n' +
- ' ]\n' +
- ']')
- bt(
- '{[x()[0]];indent;}',
- # -- output --
- '{\n' +
- ' [x()[0]];\n' +
- ' indent;\n' +
- '}')
- bt(
- '/*\n' +
- ' foo trailing space \n' +
- ' * bar trailing space \n' +
- '**/')
- bt(
- '{\n' +
- ' /*\n' +
- ' foo \n' +
- ' * bar \n' +
- ' */\n' +
- '}')
- bt('return ++i')
- bt(
- 'obj.num++\n' +
- 'foo()\n' +
- 'bar()\n' +
- '\n' +
- 'obj.num--\n' +
- 'foo()\n' +
- 'bar()')
- bt('return !!x')
- bt('return !x')
- bt('return [1,2]', 'return [1, 2]')
- bt('return;')
- bt(
- 'return\n' +
- 'func')
- bt('catch(e)', 'catch (e)')
- bt(
- 'var a=1,b={foo:2,bar:3},{baz:4,wham:5},c=4;',
- # -- output --
- 'var a = 1,\n' +
- ' b = {\n' +
- ' foo: 2,\n' +
- ' bar: 3\n' +
- ' },\n' +
- ' {\n' +
- ' baz: 4,\n' +
- ' wham: 5\n' +
- ' }, c = 4;')
- bt(
- 'var a=1,b={foo:2,bar:3},{baz:4,wham:5},\n' +
- 'c=4;',
- # -- output --
- 'var a = 1,\n' +
- ' b = {\n' +
- ' foo: 2,\n' +
- ' bar: 3\n' +
- ' },\n' +
- ' {\n' +
- ' baz: 4,\n' +
- ' wham: 5\n' +
- ' },\n' +
- ' c = 4;')
-
- # inline comment
- bt(
- 'function x(/*int*/ start, /*string*/ foo)',
- # -- output --
- 'function x( /*int*/ start, /*string*/ foo)')
-
- # javadoc comment
- bt(
- '/**\n' +
- '* foo\n' +
- '*/',
- # -- output --
- '/**\n' +
- ' * foo\n' +
- ' */')
- bt(
- '{\n' +
- '/**\n' +
- '* foo\n' +
- '*/\n' +
- '}',
- # -- output --
- '{\n' +
- ' /**\n' +
- ' * foo\n' +
- ' */\n' +
- '}')
-
- # starless block comment
- bt(
- '/**\n' +
- 'foo\n' +
- '*/')
- bt(
- '/**\n' +
- 'foo\n' +
- '**/')
- bt(
- '/**\n' +
- 'foo\n' +
- 'bar\n' +
- '**/')
- bt(
- '/**\n' +
- 'foo\n' +
- '\n' +
- 'bar\n' +
- '**/')
- bt(
- '/**\n' +
- 'foo\n' +
- ' bar\n' +
- '**/')
- bt(
- '{\n' +
- '/**\n' +
- 'foo\n' +
- '*/\n' +
- '}',
- # -- output --
- '{\n' +
- ' /**\n' +
- ' foo\n' +
- ' */\n' +
- '}')
- bt(
- '{\n' +
- '/**\n' +
- 'foo\n' +
- '**/\n' +
- '}',
- # -- output --
- '{\n' +
- ' /**\n' +
- ' foo\n' +
- ' **/\n' +
- '}')
- bt(
- '{\n' +
- '/**\n' +
- 'foo\n' +
- 'bar\n' +
- '**/\n' +
- '}',
- # -- output --
- '{\n' +
- ' /**\n' +
- ' foo\n' +
- ' bar\n' +
- ' **/\n' +
- '}')
- bt(
- '{\n' +
- '/**\n' +
- 'foo\n' +
- '\n' +
- 'bar\n' +
- '**/\n' +
- '}',
- # -- output --
- '{\n' +
- ' /**\n' +
- ' foo\n' +
- '\n' +
- ' bar\n' +
- ' **/\n' +
- '}')
- bt(
- '{\n' +
- '/**\n' +
- 'foo\n' +
- ' bar\n' +
- '**/\n' +
- '}',
- # -- output --
- '{\n' +
- ' /**\n' +
- ' foo\n' +
- ' bar\n' +
- ' **/\n' +
- '}')
- bt(
- '{\n' +
- ' /**\n' +
- ' foo\n' +
- 'bar\n' +
- ' **/\n' +
- '}')
- bt(
- 'var a,b,c=1,d,e,f=2;',
- # -- output --
- 'var a, b, c = 1,\n' +
- ' d, e, f = 2;')
- bt(
- 'var a,b,c=[],d,e,f=2;',
- # -- output --
- 'var a, b, c = [],\n' +
- ' d, e, f = 2;')
- bt(
- 'function() {\n' +
- ' var a, b, c, d, e = [],\n' +
- ' f;\n' +
- '}')
- bt(
- 'do/regexp/;\n' +
- 'while(1);',
- # -- output --
- 'do /regexp/;\n' +
- 'while (1);')
- bt(
- 'var a = a,\n' +
- 'a;\n' +
- 'b = {\n' +
- 'b\n' +
- '}',
- # -- output --
- 'var a = a,\n' +
- ' a;\n' +
- 'b = {\n' +
- ' b\n' +
- '}')
- bt(
- 'var a = a,\n' +
- ' /* c */\n' +
- ' b;')
- bt(
- 'var a = a,\n' +
- ' // c\n' +
- ' b;')
-
- # weird element referencing
- bt('foo.("bar");')
- bt(
- 'if (a) a()\n' +
- 'else b()\n' +
- 'newline()')
- bt(
- 'if (a) a()\n' +
- 'newline()')
- bt('a=typeof(x)', 'a = typeof(x)')
- bt(
- 'var a = function() {\n' +
- ' return null;\n' +
- ' },\n' +
- ' b = false;')
- bt(
- 'var a = function() {\n' +
- ' func1()\n' +
- '}')
- bt(
- 'var a = function() {\n' +
- ' func1()\n' +
- '}\n' +
- 'var b = function() {\n' +
- ' func2()\n' +
- '}')
-
- # code with and without semicolons
- bt(
- 'var whatever = require("whatever");\n' +
- 'function() {\n' +
- ' a = 6;\n' +
- '}',
- # -- output --
- 'var whatever = require("whatever");\n' +
- '\n' +
- 'function() {\n' +
- ' a = 6;\n' +
- '}')
- bt(
- 'var whatever = require("whatever")\n' +
- 'function() {\n' +
- ' a = 6\n' +
- '}',
- # -- output --
- 'var whatever = require("whatever")\n' +
- '\n' +
- 'function() {\n' +
- ' a = 6\n' +
- '}')
- bt(
- '{"x":[{"a":1,"b":3},\n' +
- '7,8,8,8,8,{"b":99},{"a":11}]}',
- # -- output --
- '{\n' +
- ' "x": [{\n' +
- ' "a": 1,\n' +
- ' "b": 3\n' +
- ' },\n' +
- ' 7, 8, 8, 8, 8, {\n' +
- ' "b": 99\n' +
- ' }, {\n' +
- ' "a": 11\n' +
- ' }\n' +
- ' ]\n' +
- '}')
- bt(
- '{"x":[{"a":1,"b":3},7,8,8,8,8,{"b":99},{"a":11}]}',
- # -- output --
- '{\n' +
- ' "x": [{\n' +
- ' "a": 1,\n' +
- ' "b": 3\n' +
- ' }, 7, 8, 8, 8, 8, {\n' +
- ' "b": 99\n' +
- ' }, {\n' +
- ' "a": 11\n' +
- ' }]\n' +
- '}')
- bt(
- '{"1":{"1a":"1b"},"2"}',
- # -- output --
- '{\n' +
- ' "1": {\n' +
- ' "1a": "1b"\n' +
- ' },\n' +
- ' "2"\n' +
- '}')
- bt(
- '{a:{a:b},c}',
- # -- output --
- '{\n' +
- ' a: {\n' +
- ' a: b\n' +
- ' },\n' +
- ' c\n' +
- '}')
- bt(
- '{[y[a]];keep_indent;}',
- # -- output --
- '{\n' +
- ' [y[a]];\n' +
- ' keep_indent;\n' +
- '}')
- bt(
- 'if (x) {y} else { if (x) {y}}',
- # -- output --
- 'if (x) {\n' +
- ' y\n' +
- '} else {\n' +
- ' if (x) {\n' +
- ' y\n' +
- ' }\n' +
- '}')
- bt(
- 'if (foo) one()\n' +
- 'two()\n' +
- 'three()')
- bt(
- 'if (1 + foo() && bar(baz()) / 2) one()\n' +
- 'two()\n' +
- 'three()')
- bt(
- 'if (1 + foo() && bar(baz()) / 2) one();\n' +
- 'two();\n' +
- 'three();')
- bt(
- 'var a=1,b={bang:2},c=3;',
- # -- output --
- 'var a = 1,\n' +
- ' b = {\n' +
- ' bang: 2\n' +
- ' },\n' +
- ' c = 3;')
- bt(
- 'var a={bing:1},b=2,c=3;',
- # -- output --
- 'var a = {\n' +
- ' bing: 1\n' +
- ' },\n' +
- ' b = 2,\n' +
- ' c = 3;')
-
-
-
- def test_beautifier_unconverted(self):
- test_fragment = self.decodesto
- bt = self.bt
-
- self.reset_options()
- #============================================================
- bt(None, "")
-
- self.reset_options()
- #============================================================
- # Test user pebkac protection, converts dash names to underscored names
- setattr(self.options, 'end-with-newline', True)
- test_fragment(None, '\n')
-
- self.reset_options()
- #============================================================
- # Test passing dictionary or tuple
- self.options = {'end_with_newline': True, 'eol': '\r\n' }
- test_fragment(None, '\r\n')
-
- self.options = {'end-with-newline': True}
- test_fragment(None, '\n')
-
- self.options = {'end-with-newline': False}
- test_fragment(None, '')
-
- self.options = ( ('end-with-newline', True), ('eol', '\r') )
- test_fragment(None, '\r')
-
- self.reset_options()
- #============================================================
- self.options.indent_size = 1
- self.options.indent_char = ' '
- bt('{ one_char() }', "{\n one_char()\n}")
-
- bt('var a,b=1,c=2', 'var a, b = 1,\n c = 2')
-
- self.options.indent_size = 4
- self.options.indent_char = ' '
- bt('{ one_char() }', "{\n one_char()\n}")
-
- self.options.indent_size = 1
- self.options.indent_char = "\t"
- bt('{ one_char() }', "{\n\tone_char()\n}")
- bt('x = a ? b : c; x;', 'x = a ? b : c;\nx;')
-
- #set to something else than it should change to, but with tabs on, should override
- self.options.indent_size = 5
- self.options.indent_char = ' '
- self.options.indent_with_tabs = True
-
- bt('{ one_char() }', "{\n\tone_char()\n}")
- bt('x = a ? b : c; x;', 'x = a ? b : c;\nx;')
-
-
- self.reset_options()
- #============================================================
- self.options.preserve_newlines = False
- bt('var\na=dont_preserve_newlines;', 'var a = dont_preserve_newlines;')
-
- # make sure the blank line between function definitions stays
- # even when preserve_newlines = False
- bt('function foo() {\n return 1;\n}\n\nfunction foo() {\n return 1;\n}')
- bt('function foo() {\n return 1;\n}\nfunction foo() {\n return 1;\n}',
- 'function foo() {\n return 1;\n}\n\nfunction foo() {\n return 1;\n}'
- )
- bt('function foo() {\n return 1;\n}\n\n\nfunction foo() {\n return 1;\n}',
- 'function foo() {\n return 1;\n}\n\nfunction foo() {\n return 1;\n}'
- )
-
-
- self.options.preserve_newlines = True
- bt('var\na=do_preserve_newlines;', 'var\n a = do_preserve_newlines;')
- bt('if (foo) // comment\n{\n bar();\n}')
-
-
- self.reset_options()
- #============================================================
- # START tests for brace positioning
-
- # If this is ever supported, update tests for each brace style.
- # test_fragment('return\n{', 'return\n{') # can't support this?, but that's an improbable and extreme case anyway.
-
- self.options.brace_style = 'expand'
-
- bt('//case 1\nif (a == 1)\n{}\n//case 2\nelse if (a == 2)\n{}')
- bt('if(1){2}else{3}', "if (1)\n{\n 2\n}\nelse\n{\n 3\n}")
- bt('try{a();}catch(b){c();}catch(d){}finally{e();}',
- "try\n{\n a();\n}\ncatch (b)\n{\n c();\n}\ncatch (d)\n{}\nfinally\n{\n e();\n}")
- bt('if(a){b();}else if(c) foo();',
- "if (a)\n{\n b();\n}\nelse if (c) foo();")
- bt("if (a) {\n// comment\n}else{\n// comment\n}",
- "if (a)\n{\n // comment\n}\nelse\n{\n // comment\n}") # if/else statement with empty body
- bt('if (x) {y} else { if (x) {y}}',
- 'if (x)\n{\n y\n}\nelse\n{\n if (x)\n {\n y\n }\n}')
- bt('if (a)\n{\nb;\n}\nelse\n{\nc;\n}',
- 'if (a)\n{\n b;\n}\nelse\n{\n c;\n}')
- test_fragment(' /*\n* xx\n*/\n// xx\nif (foo) {\n bar();\n}',
- ' /*\n * xx\n */\n // xx\n if (foo)\n {\n bar();\n }')
- bt('if (foo)\n{}\nelse /regex/.test();')
- test_fragment('if (foo) {', 'if (foo)\n{')
- test_fragment('foo {', 'foo\n{')
- test_fragment('return {', 'return {') # return needs the brace.
- test_fragment('return /* inline */ {', 'return /* inline */ {')
- test_fragment('return;\n{', 'return;\n{')
- bt("throw {}")
- bt("throw {\n foo;\n}")
- bt('var foo = {}')
- bt('function x() {\n foo();\n}zzz', 'function x()\n{\n foo();\n}\nzzz')
- test_fragment('a: do {} while (); xxx', 'a: do {} while ();\nxxx')
- bt('{a: do {} while (); xxx}', '{\n a: do {} while ();xxx\n}')
- bt('var a = new function() {};')
- bt('var a = new function a() {};', 'var a = new function a()\n{};')
- bt('var a = new function()\n{};', 'var a = new function() {};')
- bt('var a = new function a()\n{};')
- bt('var a = new function a()\n {},\n b = new function b()\n {};')
- bt("foo({\n 'a': 1\n},\n10);",
- "foo(\n {\n 'a': 1\n },\n 10);")
- bt('(["foo","bar"]).each(function(i) {return i;});',
- '(["foo", "bar"]).each(function(i)\n{\n return i;\n});')
- bt('(function(i) {return i;})();',
- '(function(i)\n{\n return i;\n})();')
- bt( "test( /*Argument 1*/ {\n" +
- " 'Value1': '1'\n" +
- "}, /*Argument 2\n" +
- " */ {\n" +
- " 'Value2': '2'\n" +
- "});",
- # expected
- "test( /*Argument 1*/\n" +
- " {\n" +
- " 'Value1': '1'\n" +
- " },\n" +
- " /*Argument 2\n" +
- " */\n" +
- " {\n" +
- " 'Value2': '2'\n" +
- " });")
- bt( "test(\n" +
- "/*Argument 1*/ {\n" +
- " 'Value1': '1'\n" +
- "},\n" +
- "/*Argument 2\n" +
- " */ {\n" +
- " 'Value2': '2'\n" +
- "});",
- # expected
- "test(\n" +
- " /*Argument 1*/\n" +
- " {\n" +
- " 'Value1': '1'\n" +
- " },\n" +
- " /*Argument 2\n" +
- " */\n" +
- " {\n" +
- " 'Value2': '2'\n" +
- " });")
- bt( "test( /*Argument 1*/\n" +
- "{\n" +
- " 'Value1': '1'\n" +
- "}, /*Argument 2\n" +
- " */\n" +
- "{\n" +
- " 'Value2': '2'\n" +
- "});",
- # expected
- "test( /*Argument 1*/\n" +
- " {\n" +
- " 'Value1': '1'\n" +
- " },\n" +
- " /*Argument 2\n" +
- " */\n" +
- " {\n" +
- " 'Value2': '2'\n" +
- " });")
-
- self.options.brace_style = 'collapse'
-
- bt('//case 1\nif (a == 1) {}\n//case 2\nelse if (a == 2) {}')
- bt('if(1){2}else{3}', "if (1) {\n 2\n} else {\n 3\n}")
- bt('try{a();}catch(b){c();}catch(d){}finally{e();}',
- "try {\n a();\n} catch (b) {\n c();\n} catch (d) {} finally {\n e();\n}")
- bt('if(a){b();}else if(c) foo();',
- "if (a) {\n b();\n} else if (c) foo();")
- bt("if (a) {\n// comment\n}else{\n// comment\n}",
- "if (a) {\n // comment\n} else {\n // comment\n}") # if/else statement with empty body
- bt('if (x) {y} else { if (x) {y}}',
- 'if (x) {\n y\n} else {\n if (x) {\n y\n }\n}')
- bt('if (a)\n{\nb;\n}\nelse\n{\nc;\n}',
- 'if (a) {\n b;\n} else {\n c;\n}')
- test_fragment(' /*\n* xx\n*/\n// xx\nif (foo) {\n bar();\n}',
- ' /*\n * xx\n */\n // xx\n if (foo) {\n bar();\n }')
- bt('if (foo) {} else /regex/.test();')
- test_fragment('if (foo) {', 'if (foo) {')
- test_fragment('foo {', 'foo {')
- test_fragment('return {', 'return {') # return needs the brace.
- test_fragment('return /* inline */ {', 'return /* inline */ {')
- test_fragment('return;\n{', 'return; {')
- bt("throw {}")
- bt("throw {\n foo;\n}")
- bt('var foo = {}')
- bt('function x() {\n foo();\n}zzz', 'function x() {\n foo();\n}\nzzz')
- test_fragment('a: do {} while (); xxx', 'a: do {} while ();\nxxx')
- bt('{a: do {} while (); xxx}', '{\n a: do {} while ();xxx\n}')
- bt('var a = new function() {};')
- bt('var a = new function a() {};')
- bt('var a = new function()\n{};', 'var a = new function() {};')
- bt('var a = new function a()\n{};', 'var a = new function a() {};')
- bt('var a = new function a()\n {},\n b = new function b()\n {};', 'var a = new function a() {},\n b = new function b() {};')
- bt("foo({\n 'a': 1\n},\n10);",
- "foo({\n 'a': 1\n },\n 10);")
- bt('(["foo","bar"]).each(function(i) {return i;});',
- '(["foo", "bar"]).each(function(i) {\n return i;\n});')
- bt('(function(i) {return i;})();',
- '(function(i) {\n return i;\n})();')
- bt( "test( /*Argument 1*/ {\n" +
- " 'Value1': '1'\n" +
- "}, /*Argument 2\n" +
- " */ {\n" +
- " 'Value2': '2'\n" +
- "});",
- # expected
- "test( /*Argument 1*/ {\n" +
- " 'Value1': '1'\n" +
- " },\n" +
- " /*Argument 2\n" +
- " */\n" +
- " {\n" +
- " 'Value2': '2'\n" +
- " });")
- bt( "test(\n" +
- "/*Argument 1*/ {\n" +
- " 'Value1': '1'\n" +
- "},\n" +
- "/*Argument 2\n" +
- " */ {\n" +
- " 'Value2': '2'\n" +
- "});",
- # expected
- "test(\n" +
- " /*Argument 1*/\n" +
- " {\n" +
- " 'Value1': '1'\n" +
- " },\n" +
- " /*Argument 2\n" +
- " */\n" +
- " {\n" +
- " 'Value2': '2'\n" +
- " });")
- bt( "test( /*Argument 1*/\n" +
- "{\n" +
- " 'Value1': '1'\n" +
- "}, /*Argument 2\n" +
- " */\n" +
- "{\n" +
- " 'Value2': '2'\n" +
- "});",
- # expected
- "test( /*Argument 1*/ {\n" +
- " 'Value1': '1'\n" +
- " },\n" +
- " /*Argument 2\n" +
- " */\n" +
- " {\n" +
- " 'Value2': '2'\n" +
- " });")
-
- self.options.brace_style = "end-expand"
-
- bt('//case 1\nif (a == 1) {}\n//case 2\nelse if (a == 2) {}')
- bt('if(1){2}else{3}', "if (1) {\n 2\n}\nelse {\n 3\n}")
- bt('try{a();}catch(b){c();}catch(d){}finally{e();}',
- "try {\n a();\n}\ncatch (b) {\n c();\n}\ncatch (d) {}\nfinally {\n e();\n}")
- bt('if(a){b();}else if(c) foo();',
- "if (a) {\n b();\n}\nelse if (c) foo();")
- bt("if (a) {\n// comment\n}else{\n// comment\n}",
- "if (a) {\n // comment\n}\nelse {\n // comment\n}") # if/else statement with empty body
- bt('if (x) {y} else { if (x) {y}}',
- 'if (x) {\n y\n}\nelse {\n if (x) {\n y\n }\n}')
- bt('if (a)\n{\nb;\n}\nelse\n{\nc;\n}',
- 'if (a) {\n b;\n}\nelse {\n c;\n}')
- test_fragment(' /*\n* xx\n*/\n// xx\nif (foo) {\n bar();\n}',
- ' /*\n * xx\n */\n // xx\n if (foo) {\n bar();\n }')
- bt('if (foo) {}\nelse /regex/.test();')
- test_fragment('if (foo) {', 'if (foo) {')
- test_fragment('foo {', 'foo {')
- test_fragment('return {', 'return {') # return needs the brace.
- test_fragment('return /* inline */ {', 'return /* inline */ {')
- test_fragment('return;\n{', 'return; {')
- bt("throw {}")
- bt("throw {\n foo;\n}")
- bt('var foo = {}')
- bt('function x() {\n foo();\n}zzz', 'function x() {\n foo();\n}\nzzz')
- test_fragment('a: do {} while (); xxx', 'a: do {} while ();\nxxx')
- bt('{a: do {} while (); xxx}', '{\n a: do {} while ();xxx\n}')
- bt('var a = new function() {};')
- bt('var a = new function a() {};')
- bt('var a = new function()\n{};', 'var a = new function() {};')
- bt('var a = new function a()\n{};', 'var a = new function a() {};')
- bt('var a = new function a()\n {},\n b = new function b()\n {};', 'var a = new function a() {},\n b = new function b() {};')
- bt("foo({\n 'a': 1\n},\n10);",
- "foo({\n 'a': 1\n },\n 10);")
- bt('(["foo","bar"]).each(function(i) {return i;});',
- '(["foo", "bar"]).each(function(i) {\n return i;\n});')
- bt('(function(i) {return i;})();',
- '(function(i) {\n return i;\n})();')
- bt( "test( /*Argument 1*/ {\n" +
- " 'Value1': '1'\n" +
- "}, /*Argument 2\n" +
- " */ {\n" +
- " 'Value2': '2'\n" +
- "});",
- # expected
- "test( /*Argument 1*/ {\n" +
- " 'Value1': '1'\n" +
- " },\n" +
- " /*Argument 2\n" +
- " */\n" +
- " {\n" +
- " 'Value2': '2'\n" +
- " });")
- bt( "test(\n" +
- "/*Argument 1*/ {\n" +
- " 'Value1': '1'\n" +
- "},\n" +
- "/*Argument 2\n" +
- " */ {\n" +
- " 'Value2': '2'\n" +
- "});",
- # expected
- "test(\n" +
- " /*Argument 1*/\n" +
- " {\n" +
- " 'Value1': '1'\n" +
- " },\n" +
- " /*Argument 2\n" +
- " */\n" +
- " {\n" +
- " 'Value2': '2'\n" +
- " });")
- bt( "test( /*Argument 1*/\n" +
- "{\n" +
- " 'Value1': '1'\n" +
- "}, /*Argument 2\n" +
- " */\n" +
- "{\n" +
- " 'Value2': '2'\n" +
- "});",
- # expected
- "test( /*Argument 1*/ {\n" +
- " 'Value1': '1'\n" +
- " },\n" +
- " /*Argument 2\n" +
- " */\n" +
- " {\n" +
- " 'Value2': '2'\n" +
- " });")
-
- self.options.brace_style = 'none'
-
- bt('//case 1\nif (a == 1)\n{}\n//case 2\nelse if (a == 2)\n{}')
- bt('if(1){2}else{3}', "if (1) {\n 2\n} else {\n 3\n}")
- bt('try{a();}catch(b){c();}catch(d){}finally{e();}',
- "try {\n a();\n} catch (b) {\n c();\n} catch (d) {} finally {\n e();\n}")
- bt('if(a){b();}else if(c) foo();',
- "if (a) {\n b();\n} else if (c) foo();")
- bt("if (a) {\n// comment\n}else{\n// comment\n}",
- "if (a) {\n // comment\n} else {\n // comment\n}") # if/else statement with empty body
- bt('if (x) {y} else { if (x) {y}}',
- 'if (x) {\n y\n} else {\n if (x) {\n y\n }\n}')
- bt('if (a)\n{\nb;\n}\nelse\n{\nc;\n}',
- 'if (a)\n{\n b;\n}\nelse\n{\n c;\n}')
- test_fragment(' /*\n* xx\n*/\n// xx\nif (foo) {\n bar();\n}',
- ' /*\n * xx\n */\n // xx\n if (foo) {\n bar();\n }')
- bt('if (foo)\n{}\nelse /regex/.test();')
- test_fragment('if (foo) {')
- test_fragment('foo {')
- test_fragment('return {') # return needs the brace.
- test_fragment('return /* inline */ {')
- test_fragment('return;\n{')
- bt("throw {}")
- bt("throw {\n foo;\n}")
- bt('var foo = {}')
- bt('function x() {\n foo();\n}zzz', 'function x() {\n foo();\n}\nzzz')
- test_fragment('a: do {} while (); xxx', 'a: do {} while ();\nxxx')
- bt('{a: do {} while (); xxx}', '{\n a: do {} while ();xxx\n}')
- bt('var a = new function() {};')
- bt('var a = new function a() {};')
- bt('var a = new function()\n{};', 'var a = new function() {};')
- bt('var a = new function a()\n{};')
- bt('var a = new function a()\n {},\n b = new function b()\n {};')
- bt("foo({\n 'a': 1\n},\n10);",
- "foo({\n 'a': 1\n },\n 10);")
- bt('(["foo","bar"]).each(function(i) {return i;});',
- '(["foo", "bar"]).each(function(i) {\n return i;\n});')
- bt('(function(i) {return i;})();',
- '(function(i) {\n return i;\n})();')
- bt( "test( /*Argument 1*/ {\n" +
- " 'Value1': '1'\n" +
- "}, /*Argument 2\n" +
- " */ {\n" +
- " 'Value2': '2'\n" +
- "});",
- # expected
- "test( /*Argument 1*/ {\n" +
- " 'Value1': '1'\n" +
- " },\n" +
- " /*Argument 2\n" +
- " */\n" +
- " {\n" +
- " 'Value2': '2'\n" +
- " });")
- bt( "test(\n" +
- "/*Argument 1*/ {\n" +
- " 'Value1': '1'\n" +
- "},\n" +
- "/*Argument 2\n" +
- " */ {\n" +
- " 'Value2': '2'\n" +
- "});",
- # expected
- "test(\n" +
- " /*Argument 1*/\n" +
- " {\n" +
- " 'Value1': '1'\n" +
- " },\n" +
- " /*Argument 2\n" +
- " */\n" +
- " {\n" +
- " 'Value2': '2'\n" +
- " });")
- bt( "test( /*Argument 1*/\n" +
- "{\n" +
- " 'Value1': '1'\n" +
- "}, /*Argument 2\n" +
- " */\n" +
- "{\n" +
- " 'Value2': '2'\n" +
- "});",
- # expected
- "test( /*Argument 1*/\n" +
- " {\n" +
- " 'Value1': '1'\n" +
- " },\n" +
- " /*Argument 2\n" +
- " */\n" +
- " {\n" +
- " 'Value2': '2'\n" +
- " });")
- # END tests for brace position
-
- self.reset_options()
- #============================================================
- self.options.preserve_newlines = True
- bt("var a = 'foo' +\n 'bar';")
-
- bt('"foo""bar""baz"', '"foo"\n"bar"\n"baz"')
- bt("'foo''bar''baz'", "'foo'\n'bar'\n'baz'")
- bt("{\n get foo() {}\n}")
- bt("{\n var a = get\n foo();\n}")
- bt("{\n set foo() {}\n}")
- bt("{\n var a = set\n foo();\n}")
- bt("var x = {\n get function()\n}")
- bt("var x = {\n set function()\n}")
-
- # According to my current research get/set have no special meaning outside of an object literal
- bt("var x = set\n\na() {}", "var x = set\n\na() {}")
- bt("var x = set\n\nfunction() {}", "var x = set\n\nfunction() {}")
-
- bt('for () /abc/.test()')
- bt('if (k) /aaa/m.test(v) && l();')
- bt('switch (true) {\n case /swf/i.test(foo):\n bar();\n}')
- bt('createdAt = {\n type: Date,\n default: Date.now\n}')
- bt('switch (createdAt) {\n case a:\n Date,\n default:\n Date.now\n}')
-
- self.reset_options()
- #============================================================
-
-
- def decodesto(self, input, expectation=None):
- if expectation is None:
- expectation = input
-
- self.assertMultiLineEqual(
- jsbeautifier.beautify(input, self.options), expectation)
-
- # if the expected is different from input, run it again
- # expected output should be unchanged when run twice.
- if not expectation is None:
- self.assertMultiLineEqual(
- jsbeautifier.beautify(expectation, self.options), expectation)
-
- if self.options is None or not isinstance(self.options, (dict, tuple)):
- # Everywhere we do newlines, they should be replaced with opts.eol
- self.options.eol = '\r\\n'
- expectation = expectation.replace('\n', '\r\n')
- self.options.disabled = True
- self.assertMultiLineEqual(
- jsbeautifier.beautify(input, self.options), input or '')
- self.assertMultiLineEqual(
- jsbeautifier.beautify('\n\n' + expectation, self.options), '\n\n' + expectation)
- self.options.disabled = False;
- self.assertMultiLineEqual(
- jsbeautifier.beautify(input, self.options), expectation)
- if input and input.find('\n') != -1:
- input = input.replace('\n', '\r\n')
- self.assertMultiLineEqual(
- jsbeautifier.beautify(input, self.options), expectation)
- # Ensure support for auto eol detection
- self.options.eol = 'auto'
- self.assertMultiLineEqual(
- jsbeautifier.beautify(input, self.options), expectation)
- self.options.eol = '\n'
-
- def wrap(self, text):
- return self.wrapregex.sub(' \\1', text)
-
- def bt(self, input, expectation=None):
- if expectation is None:
- expectation = input
-
- self.decodesto(input, expectation)
- # If we set raw, input should be unchanged
- self.options.test_output_raw = True
- if self.options.end_with_newline:
- self.decodesto(input, input)
- self.options.test_output_raw = False
-
- current_indent_size = None
- if self.options.js and self.options.js['indent_size']:
- current_indent_size = self.options.js['indent_size']
-
- if not current_indent_size:
- current_indent_size = self.options.indent_size
-
- if current_indent_size == 4 and input:
- wrapped_input = '{\n%s\n foo = bar;\n}' % self.wrap(input)
- wrapped_expect = '{\n%s\n foo = bar;\n}' % self.wrap(expectation)
- self.decodesto(wrapped_input, wrapped_expect)
-
- # If we set raw, input should be unchanged
- self.options.test_output_raw = True
- if self.options.end_with_newline:
- self.decodesto(wrapped_input, wrapped_input)
- self.options.test_output_raw = False
-
-
-if __name__ == '__main__':
- unittest.main()
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/__init__.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/__init__.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/__init__.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/__init__.py 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-# Empty file :)
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/shell-test.sh node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/shell-test.sh
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/shell-test.sh 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/shell-test.sh 1970-01-01 00:00:00.000000000 +0000
@@ -1,398 +0,0 @@
-#!/usr/bin/env bash
-
-REL_SCRIPT_DIR="`dirname \"$0\"`"
-SCRIPT_DIR="`( cd \"$REL_SCRIPT_DIR\" && pwd )`"
-PROJECT_DIR="`( cd \"$SCRIPT_DIR/../../..\" && pwd )`"
-
-case "$OSTYPE" in
- darwin*) PLATFORM="OSX" ;;
- linux*) PLATFORM="LINUX" ;;
- bsd*) PLATFORM="BSD" ;;
- *) PLATFORM="UNKNOWN" ;;
-esac
-
-
-test_cli_common()
-{
- echo ----------------------------------------
- echo Testing common cli behavior...
- CLI_SCRIPT_NAME=${1:?missing_param}
- CLI_SCRIPT=${2:-$SCRIPT_DIR/../../$CLI_SCRIPT_NAME}
- echo Script: $CLI_SCRIPT
-
- # should find the minimal help output
- $CLI_SCRIPT 2>&1 < /dev/null | grep -q "Must pipe input or define at least one file\." || {
- $CLI_SCRIPT 2>&1 < /dev/null
- echo "[$CLI_SCRIPT_NAME] Output should be help message."
- exit 1
- }
-
- # unicode error - only happens in python
- # Note: different exceptions are thrown on different platforms.
- if [[ "$PLATFORM" == "OSX" || "$PLATFORM" == "BSD" || "$PLATFORM" == "LINUX" ]]; then
- $CLI_SCRIPT ../test/resources/unicode-error.js 2>&1 | grep -q "Error while decoding input or encoding output:" || {
- $CLI_SCRIPT ../test/resources/unicode-error.js 2>&1
- echo "[$CLI_SCRIPT_NAME] Output should be unicode error message."
- exit 1
- }
- fi
-
- $CLI_SCRIPT 2> /dev/null < /dev/null && {
- echo "[$CLI_SCRIPT_NAME (with no parameters)] Return code should be error."
- exit 1
- }
-
- $CLI_SCRIPT -Z 2> /dev/null && {
- echo "[$CLI_SCRIPT_NAME -Z] Return code for invalid parameter should be error."
- exit 1
- }
-
- $CLI_SCRIPT -h > /dev/null || {
- echo "[$CLI_SCRIPT_NAME -h] Return code should be success."
- exit 1
- }
-
- $CLI_SCRIPT -v > /dev/null || {
- echo "[$CLI_SCRIPT_NAME -v] Return code should be success."
- exit 1
- }
-
- MISSING_FILE="$SCRIPT_DIR/../../../js/bin/missing_file"
- MISSING_FILE_MESSAGE="No such file or directory"
- $CLI_SCRIPT $MISSING_FILE 2> /dev/null && {
- echo "[$CLI_SCRIPT_NAME $MISSING_FILE] Return code should be error."
- exit 1
- }
-
- $CLI_SCRIPT $MISSING_FILE 2>&1 | grep -q "$MISSING_FILE_MESSAGE" || {
- echo "[$CLI_SCRIPT_NAME $MISSING_FILE] Stderr should have useful message."
- exit 1
- }
-
- if [ "`$CLI_SCRIPT $MISSING_FILE 2> /dev/null`" != "" ]; then
- echo "[$CLI_SCRIPT_NAME $MISSING_FILE] Stdout should have no text."
- exit 1
- fi
-}
-
-setup_temp()
-{
- mkdir -p target
- TEST_TEMP=$PWD/`mktemp -d target/test_temp_XXXX`
- echo Created $TEST_TEMP...
-}
-
-cleanup()
-{
- rm -rf $TEST_TEMP && echo Removed $TEST_TEMP...
- test -z $1 || exit $1
-}
-
-test_cli_js_beautify()
-{
- echo ----------------------------------------
- echo Testing js-beautify cli behavior...
- CLI_SCRIPT=${1:-$SCRIPT_DIR/../../js-beautify}
-
- $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/js-beautify.js > /dev/null || {
- echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js was expected succeed."
- exit 1
- }
-
- $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/css-beautify.js > /dev/null || {
- echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/css-beautify.js was expected succeed."
- exit 1
- }
-
- setup_temp
- $CLI_SCRIPT -o $TEST_TEMP/js-beautify-file.js $SCRIPT_DIR/../../../js/bin/js-beautify.js && diff $SCRIPT_DIR/../../../js/bin/js-beautify.js $TEST_TEMP/js-beautify-file.js || {
- $CLI_SCRIPT -o $TEST_TEMP/js-beautify-file.js $SCRIPT_DIR/../../../js/bin/js-beautify.js && diff $SCRIPT_DIR/../../../js/bin/js-beautify.js $TEST_TEMP/js-beautify-file.js | cat -t -e
- echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js was expected to be unchanged."
- cleanup 1
- }
-
- cat $SCRIPT_DIR/../../../js/bin/js-beautify.js | $CLI_SCRIPT -o $TEST_TEMP/js-beautify-pipe.js - && diff $SCRIPT_DIR/../../../js/bin/js-beautify.js $TEST_TEMP/js-beautify-pipe.js || {
- cat $SCRIPT_DIR/../../../js/bin/js-beautify.js | $CLI_SCRIPT -o $TEST_TEMP/js-beautify-pipe.js - && diff $SCRIPT_DIR/../../../js/bin/js-beautify.js $TEST_TEMP/js-beautify-pipe.js | cat -t -e
- echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js should have been created in $TEST_TEMP/js-beautify-pipe.js."
- cleanup 1
- }
-
- $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/js-beautify.js | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - || {
- $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/js-beautify.js | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - | cat -t -e
- echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js was expected to be unchanged."
- cleanup 1
- }
-
- cat $SCRIPT_DIR/../../../js/bin/js-beautify.js | $CLI_SCRIPT | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - || {
- $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/js-beautify.js | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - | cat -t -e
- echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js was expected to be unchanged."
- cleanup 1
- }
-
- cat $SCRIPT_DIR/../../../js/bin/js-beautify.js | $CLI_SCRIPT - | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - || {
- $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/js-beautify.js | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - | cat -t -e
- echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js was expected to be unchanged."
- cleanup 1
- }
-
- cat $SCRIPT_DIR/../../../js/bin/js-beautify.js | $CLI_SCRIPT -f - | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - || {
- $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/js-beautify.js | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - | cat -t -e
- echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js was expected to be unchanged."
- cleanup 1
- }
-
- $CLI_SCRIPT -o $TEST_TEMP/js-beautify.js $SCRIPT_DIR/../../../js/bin/js-beautify.js && diff $SCRIPT_DIR/../../../js/bin/js-beautify.js $TEST_TEMP/js-beautify.js || {
- $CLI_SCRIPT -o $TEST_TEMP/js-beautify.js $SCRIPT_DIR/../../../js/bin/js-beautify.js && diff $SCRIPT_DIR/../../../js/bin/js-beautify.js $TEST_TEMP/js-beautify.js | cat -t -e
- echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js should have been created in $TEST_TEMP/js-beautify.js."
- cleanup 1
- }
-
- # ensure new line settings work
- $CLI_SCRIPT -o $TEST_TEMP/js-beautify-n.js -e '\n' $SCRIPT_DIR/../../../js/bin/js-beautify.js
- $CLI_SCRIPT -o $TEST_TEMP/js-beautify-rn.js -e '\r\n' $TEST_TEMP/js-beautify-n.js
-
- # ensure eol processed correctly
- $CLI_SCRIPT -o $TEST_TEMP/js-beautify-n-dash.js --indent-size 2 --eol '\n' $TEST_TEMP/js-beautify-n.js
- $CLI_SCRIPT -o $TEST_TEMP/js-beautify-rn-dash.js --indent-size 2 --eol '\r\n' $TEST_TEMP/js-beautify-n.js
- diff -q $TEST_TEMP/js-beautify-n-dash.js $TEST_TEMP/js-beautify-rn-dash.js && {
- diff $TEST_TEMP/js-beautify-n-dash.js $TEST_TEMP/js-beautify-rn-dash.js | cat -t -e
- echo "js-beautify output for $TEST_TEMP/js-beautify-n-dash.js and $TEST_TEMP/js-beautify-rn-dash.js was expected to be different."
- cleanup 1
- }
-
- diff -q $TEST_TEMP/js-beautify-n.js $TEST_TEMP/js-beautify-rn.js && {
- diff $TEST_TEMP/js-beautify-n.js $TEST_TEMP/js-beautify-rn.js | cat -t -e
- echo "js-beautify output for $TEST_TEMP/js-beautify-n.js and $TEST_TEMP/js-beautify-rn.js was expected to be different."
- cleanup 1
- }
-
- $CLI_SCRIPT $TEST_TEMP/js-beautify-n.js | diff -q $TEST_TEMP/js-beautify-n.js - || {
- echo "js-beautify output for $TEST_TEMP/js-beautify-n.js was expected to be unchanged."
- cleanup 1
- }
-
- $CLI_SCRIPT -e 'auto' $TEST_TEMP/js-beautify-rn.js | diff -q $TEST_TEMP/js-beautify-rn.js - || {
- echo "js-beautify output for $TEST_TEMP/js-beautify-rn.js was expected to be unchanged."
- cleanup 1
- }
-
- # Glob related tests
- cp -r $PROJECT_DIR/js/src $TEST_TEMP/
- FILE_RCOUNT=$(find $PROJECT_DIR/js/src -name 't*.js' | grep -c .)
- FILE_COUNT=$(ls $PROJECT_DIR/js/src/*.js | grep -c .)
-
- $CLI_SCRIPT '*/*/missing_file' > /dev/null || {
- echo "[$CLI_SCRIPT_NAME $MISSING_FILE_GLOB] Return code should be success for globs."
- exit 1
- }
-
-
- if [ "$FILE_COUNT" != "$(cd $TEST_TEMP && $CLI_SCRIPT 'src/*.js' | grep -c .)" ]; then
- echo "js-beautify output for 'src/*.js' was expected have $FILE_COUNT files."
- echo $(cd $TEST_TEMP && $CLI_SCRIPT 'src/*.js')
- cleanup 1
- fi
-
- if [ "$FILE_COUNT" != "$(cd $TEST_TEMP && $CLI_SCRIPT --file 'src/*.js' | grep -c .)" ]; then
- echo "js-beautify output for 'src/*.js' was expected have $FILE_COUNT files."
- echo $(cd $TEST_TEMP && $CLI_SCRIPT --file 'src/*.js')
- cleanup 1
- fi
-
- if [ "$FILE_COUNT" != "$(cd $TEST_TEMP && $CLI_SCRIPT --file 'src/cl?.js' --file 'src/??dex.js' | grep -c .)" ]; then
- echo "js-beautify output for --file 'src/cl?.js' --file 'src/??dex.js' was expected have $FILE_COUNT files."
- echo $(cd $TEST_TEMP && $CLI_SCRIPT --file 'src/cl?.js' --file 'src/??dex.js')
- cleanup 1
- fi
-
- if [ "1" != "$(cd $TEST_TEMP && $CLI_SCRIPT --file 'src/cl?.js' --file 'src/c??.js' 'src/cli.js' | grep -c .)" ]; then
- echo "js-beautify output for --file 'src/cl?.js' --file 'src/cl?.js' was expected have 1 file."
- echo $(cd $TEST_TEMP && $CLI_SCRIPT --file 'src/cl?.js' --file 'src/c??.js' 'src/cli.js')
- cleanup 1
- fi
-
- # recursive wildcard not supported in python 3.4 or less
- # only run this test if the script doesn't report failure.
- $CLI_SCRIPT 'src/**/t*.js' && {
- if [ "$FILE_RCOUNT" != "$(cd $TEST_TEMP && $CLI_SCRIPT 'src/**/t*.js' | grep -c .)" ]; then
- echo "js-beautify output for 'src/**/t*.js' was expected have $FILE_RCOUNT files."
- echo $(cd $TEST_TEMP && $CLI_SCRIPT 'src/**/t*.js')
- cleanup 1
- fi
- }
-
- # EditorConfig related tests
- cp -r ../js/test/resources/editorconfig $TEST_TEMP/
- $CLI_SCRIPT -o $TEST_TEMP/editorconfig/example.js --end-with-newline --indent-size 4 -e '\n' $TEST_TEMP/editorconfig/example-base.js
- $CLI_SCRIPT -o $TEST_TEMP/editorconfig/example-ec.js --indent-size 2 -e '\n' $TEST_TEMP/editorconfig/example-base.js
-
- $CLI_SCRIPT -o $TEST_TEMP/editorconfig/cr/example.js --end-with-newline --indent-size 4 -e '\n' $TEST_TEMP/editorconfig/example-base.js
- $CLI_SCRIPT -o $TEST_TEMP/editorconfig/cr/example-ec.js --indent-size 2 -e '\r' $TEST_TEMP/editorconfig/example-base.js
-
- $CLI_SCRIPT -o $TEST_TEMP/editorconfig/crlf/example.js --end-with-newline --indent-size 4 -e '\n' $TEST_TEMP/editorconfig/example-base.js
- $CLI_SCRIPT -o $TEST_TEMP/editorconfig/crlf/example-ec.js --indent-size 2 -e '\r\n' $TEST_TEMP/editorconfig/example-base.js
-
- $CLI_SCRIPT -o $TEST_TEMP/editorconfig/error/example.js --end-with-newline --indent-size 4 -e '\n' $TEST_TEMP/editorconfig/example-base.js
-
- pushd $TEST_TEMP/editorconfig
-
- cd $TEST_TEMP/editorconfig/error
- $CLI_SCRIPT --editorconfig $TEST_TEMP/js-beautify-n.js \
- > /dev/null || {
- echo "Invalid editorconfig file should not report error (consistent with the EditorConfig)."
- cleanup 1
- }
-
- $CLI_SCRIPT --editorconfig example.js \
- > /dev/null || {
- echo "Invalid editorconfig file should not report error (consistent with the EditorConfig)."
- cleanup 1
- }
-
- # TODO: EditorConfig setting should NOT overide cli setting, but that is
- # the current by-design behavior, due to code limitations.
-
- # file input scenario
- SCENARIO=a
- cd $TEST_TEMP/editorconfig || exit 1
- $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js example.js \
- && diff -q example-${SCENARIO}.js example-ec.js || {
- echo "EditorConfig setting should overide cli setting."
- diff example-${SCENARIO}.js example-ec.js | cat -t -e
- cleanup 1
- }
-
- cd $TEST_TEMP/editorconfig/crlf || exit 1
- $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js example.js \
- && diff -q example-${SCENARIO}.js example-ec.js || {
- echo "EditorConfig setting should overide cli setting."
- diff example-${SCENARIO}.js example-ec.js | cat -t -e
- cleanup 1
- }
-
- cd $TEST_TEMP/editorconfig/cr || exit 1
- $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js example.js \
- && diff -q example-${SCENARIO}.js example-ec.js || {
- echo "EditorConfig setting should overide cli setting."
- diff example-${SCENARIO}.js example-ec.js | cat -t -e
- cleanup 1
- }
-
- # stdin input to stdout scenario
- SCENARIO=b
- cd $TEST_TEMP/editorconfig || exit 1
- echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js"
- cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js \
- && diff -q example-${SCENARIO}.js example-ec.js || {
- echo "EditorConfig setting should overide cli setting."
- diff example-${SCENARIO}.js example-ec.js | cat -t -e
- cleanup 1
- }
-
- cd $TEST_TEMP/editorconfig/crlf || exit 1
- echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js"
- cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js \
- && diff -q example-${SCENARIO}.js example-ec.js || {
- echo "EditorConfig setting should overide cli setting."
- diff example-${SCENARIO}.js example-ec.js | cat -t -e
- cleanup 1
- }
-
- cd $TEST_TEMP/editorconfig/cr || exit 1
- echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js"
- cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js \
- && diff -q example-${SCENARIO}.js example-ec.js || {
- echo "EditorConfig setting should overide cli setting."
- diff example-${SCENARIO}.js example-ec.js | cat -t -e
- cleanup 1
- }
-
-
- # stdin input to file scenario
- SCENARIO=c
- cd $TEST_TEMP/editorconfig || exit 1
- echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js"
- cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js - \
- && diff -q example-${SCENARIO}.js example-ec.js || {
- echo "EditorConfig setting should overide cli setting."
- diff example-${SCENARIO}.js example-ec.js | cat -t -e
- cleanup 1
- }
-
- cd $TEST_TEMP/editorconfig/crlf || exit 1
- cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js - \
- && diff -q example-${SCENARIO}.js example-ec.js || {
- echo "EditorConfig setting should overide cli setting."
- diff example-${SCENARIO}.js example-ec.js | cat -t -e
- cleanup 1
- }
-
- cd $TEST_TEMP/editorconfig/cr || exit 1
- cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js - \
- && diff -q example-${SCENARIO}.js example-ec.js || {
- echo "EditorConfig setting should overide cli setting."
- diff example-${SCENARIO}.js example-ec.js | cat -t -e
- cleanup 1
- }
-
- popd
- # End EditorConfig
-
- # ensure unchanged files are not overwritten
- $CLI_SCRIPT -o $TEST_TEMP/js-beautify.js $SCRIPT_DIR/../../../js/bin/js-beautify.js
- cp -p $TEST_TEMP/js-beautify.js $TEST_TEMP/js-beautify-old.js
- touch $TEST_TEMP/js-beautify.js
- sleep 2
- touch $TEST_TEMP/js-beautify-old.js
- $CLI_SCRIPT -r $TEST_TEMP/js-beautify.js && test $TEST_TEMP/js-beautify.js -nt $TEST_TEMP/js-beautify-old.js && {
- echo "js-beautify should not replace unchanged file $TEST_TEMP/js-beautify.js when using -r"
- cleanup 1
- }
-
- $CLI_SCRIPT -o $TEST_TEMP/js-beautify.js $TEST_TEMP/js-beautify.js && test $TEST_TEMP/js-beautify.js -nt $TEST_TEMP/js-beautify-old.js && {
- echo "js-beautify should not replace unchanged file $TEST_TEMP/js-beautify.js when using -o and same file name"
- cleanup 1
- }
-
- $CLI_SCRIPT -o $TEST_TEMP/js-beautify.js $TEST_TEMP/js-beautify-old.js && test $TEST_TEMP/js-beautify.js -nt $TEST_TEMP/js-beautify-old.js && {
- echo "js-beautify should not replace unchanged file $TEST_TEMP/js-beautify.js when using -o and different file name"
- cleanup 1
- }
-
- $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/css-beautify.js | diff -q $SCRIPT_DIR/../../../js/bin/css-beautify.js - && {
- echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/css-beautify.js was expected to be different."
- cleanup 1
- }
-
- #meta-parameter brace_style
- cp ../js/test/resources/example1.js $TEST_TEMP/example.js
- $CLI_SCRIPT --brace-style=invalid $TEST_TEMP/example.js > /dev/null && {
- echo "[$CLI_SCRIPT_NAME --brace-style=invalid $TEST_TEMP/example.js] Return code for invalid brace_style meta-parameter should be error."
- cleanup 1
- }
- $CLI_SCRIPT --brace-style='expand,preserve-inline,invalid' $TEST_TEMP/example.js > /dev/null && {
- echo "[$CLI_SCRIPT_NAME --brace-style=expand,preserve-inline,invalid $TEST_TEMP/example.js] Return code for invalid brace_style meta-parameter should be error."
- cleanup 1
- }
- $CLI_SCRIPT --brace-style=preserve-inline $TEST_TEMP/example.js > /dev/null || {
- echo "[$CLI_SCRIPT_NAME --brace-style=preserve-inline $TEST_TEMP/example.js] Return code for only one part of valid brace_style meta-parameter should be success (uses default where it can)."
- cleanup 1
- }
-
- cleanup
-}
-
-main() {
- #test_cli_common css-beautify
- #test_cli_common html-beautify
- test_cli_common js-beautify "$SCRIPT_DIR/../../../tools/python-dev js-beautify"
- test_cli_common js-beautify "$SCRIPT_DIR/../../../tools/python-rel js-beautify"
-
- test_cli_js_beautify "$SCRIPT_DIR/../../../tools/python-dev js-beautify"
-
- echo ----------------------------------------
- echo $0 - PASSED.
- echo ----------------------------------------
-}
-
-(main $*)
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/testindentation.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/testindentation.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/tests/testindentation.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/tests/testindentation.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,48 +0,0 @@
-import re
-import unittest
-import jsbeautifier
-
-
-class TestJSBeautifierIndentation(unittest.TestCase):
- def test_tabs(self):
- test_fragment = self.decodesto
-
- self.options.indent_with_tabs = 1
- test_fragment('{tabs()}', "{\n\ttabs()\n}")
-
- def test_function_indent(self):
- test_fragment = self.decodesto
-
- self.options.indent_with_tabs = 1
- self.options.keep_function_indentation = 1
- test_fragment(
- 'var foo = function(){ bar() }();',
- "var foo = function() {\n\tbar()\n}();")
-
- self.options.tabs = 1
- self.options.keep_function_indentation = 0
- test_fragment(
- 'var foo = function(){ baz() }();',
- "var foo = function() {\n\tbaz()\n}();")
-
- def decodesto(self, input, expectation=None):
- self.assertEqual(
- jsbeautifier.beautify(input, self.options), expectation or input)
-
- @classmethod
- def setUpClass(cls):
- options = jsbeautifier.default_options()
- options.indent_size = 4
- options.indent_char = ' '
- options.preserve_newlines = True
- options.jslint_happy = False
- options.keep_array_indentation = False
- options.brace_style = 'collapse'
- options.indent_level = 0
-
- cls.options = options
- cls.wrapregex = re.compile('^(.+)$', re.MULTILINE)
-
-
-if __name__ == '__main__':
- unittest.main()
diff -Nru node-js-beautify-1.11.0+dfsg/python/jsbeautifier/__version__.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/__version__.py
--- node-js-beautify-1.11.0+dfsg/python/jsbeautifier/__version__.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/jsbeautifier/__version__.py 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-__version__ = '1.11.0'
diff -Nru node-js-beautify-1.11.0+dfsg/python/js-beautify-profile node-js-beautify-1.13.6+dfsg+~0.15.3/python/js-beautify-profile
--- node-js-beautify-1.11.0+dfsg/python/js-beautify-profile 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/js-beautify-profile 1970-01-01 00:00:00.000000000 +0000
@@ -1,34 +0,0 @@
-#! /usr/bin/env python
-
-# To run this: ./js-beautify/tools/python-dev python ./python/js-beautify-profile
-
-import sys
-import unittest
-import pstats
-from pstats import SortKey
-
-# Speedup things...
-try:
- import cProfile as profile
-except ImportError:
- import profile
-import os
-import copy
-import jsbeautifier
-options = jsbeautifier.default_options()
-options.wrap_line_length = 80
-
-def beautifier_test_github_min():
- jsbeautifier.beautify(github_min, options)
-
-if __name__ == '__main__':
- dirname = os.path.dirname(os.path.abspath(__file__))
- github_min_file = os.path.join(
- dirname, "../", "test/resources/github-min.js")
- github_min = copy.copy(''.join(open( github_min_file).readlines()))
-
- profile.run('beautifier_test_github_min()',
- os.path.join(dirname, "../", 'build/jsbstats'))
-
- p = pstats.Stats(os.path.join(dirname, "../", 'build/jsbstats'))
- p.strip_dirs().sort_stats(SortKey.CUMULATIVE).print_stats()
diff -Nru node-js-beautify-1.11.0+dfsg/python/js-beautify-test node-js-beautify-1.13.6+dfsg+~0.15.3/python/js-beautify-test
--- node-js-beautify-1.11.0+dfsg/python/js-beautify-test 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/js-beautify-test 1970-01-01 00:00:00.000000000 +0000
@@ -1,10 +0,0 @@
-#! /bin/sh
-#
-# Test suite launcher
-#
-
-if [ -z $PYTHON ]; then
- env python js-beautify-test.py
-else
- env $PYTHON js-beautify-test.py
-fi
diff -Nru node-js-beautify-1.11.0+dfsg/python/js-beautify-test.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/js-beautify-test.py
--- node-js-beautify-1.11.0+dfsg/python/js-beautify-test.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/js-beautify-test.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,16 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import unittest
-
-
-def run_tests():
- suite = unittest.TestLoader().discover(
- 'jsbeautifier', pattern="test*.py")
- suite.addTests(unittest.TestLoader().discover(
- 'cssbeautifier', pattern="test*.py"))
- return unittest.TextTestRunner(verbosity=2).run(suite)
-
-
-if __name__ == "__main__":
- sys.exit(not run_tests().wasSuccessful())
diff -Nru node-js-beautify-1.11.0+dfsg/python/MANIFEST.in node-js-beautify-1.13.6+dfsg+~0.15.3/python/MANIFEST.in
--- node-js-beautify-1.11.0+dfsg/python/MANIFEST.in 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/MANIFEST.in 1970-01-01 00:00:00.000000000 +0000
@@ -1,2 +0,0 @@
-include js-beautify
-include js-beautify-test
diff -Nru node-js-beautify-1.11.0+dfsg/python/setup-css.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/setup-css.py
--- node-js-beautify-1.11.0+dfsg/python/setup-css.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/setup-css.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,46 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import sys
-
-from setup import PyTest # from setyp.py, not setuptools!
-
-from setuptools import setup
-from jsbeautifier.__version__ import __version__
-
-from setuptools.command.test import test as TestCommand
-
-DIR_CSS = 'cssbeautifier/tests/'
-
-
-class PyTestCSS(PyTest):
- def initialize_options(self):
- TestCommand.initialize_options(self)
- self.pytest_args = ['--assert=plain'] + \
- [DIR_CSS + x for x in os.listdir(DIR_CSS)
- if x.endswith('.py') and x[0] not in '._']
-
-
-setup(name='cssbeautifier',
- version=__version__,
- description='CSS unobfuscator and beautifier.',
- long_description=('Beautify, unpack or deobfuscate CSS'),
- author='Liam Newman, Einar Lielmanis, et al.',
- author_email='team@beautifier.io',
- url='https://beautifier.io',
- entry_points={
- 'console_scripts': [
- 'css-beautify = cssbeautifier:main'
- ]
- },
- packages=['cssbeautifier',
- 'cssbeautifier.tests', 'cssbeautifier.tests.generated',
- 'cssbeautifier.css'],
- install_requires=["jsbeautifier",
- "six>=1.13.0",
- "editorconfig>=0.12.2"],
- license='MIT',
- test_suite='pytest.collector',
- cmdclass={'test': PyTestCSS},
-
- )
diff -Nru node-js-beautify-1.11.0+dfsg/python/setup.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/setup.py
--- node-js-beautify-1.11.0+dfsg/python/setup.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/setup.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,53 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import sys
-
-from setuptools import setup
-from jsbeautifier.__version__ import __version__
-
-from setuptools.command.test import test as TestCommand
-
-DIR = 'jsbeautifier/tests/'
-
-
-class PyTest(TestCommand):
- user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
-
- def initialize_options(self):
- TestCommand.initialize_options(self)
- self.pytest_args = ['--assert=plain'] + \
- [DIR + x for x in os.listdir(DIR)
- if x.endswith('.py') and x[0] not in '._']
-
- def run_tests(self):
- # import here, cause outside the eggs aren't loaded
- import pytest
- errno = pytest.main(self.pytest_args)
- sys.exit(errno)
-
-
-setup(name='jsbeautifier',
- version=__version__,
- description='JavaScript unobfuscator and beautifier.',
- long_description=('Beautify, unpack or deobfuscate JavaScript. '
- 'Handles popular online obfuscators.'),
- author='Liam Newman, Einar Lielmanis, et al.',
- author_email='team@beautifier.io',
- url='https://beautifier.io',
- entry_points={
- 'console_scripts': [
- 'js-beautify = jsbeautifier:main'
- ]
- },
- packages=['jsbeautifier',
- 'jsbeautifier.tests', 'jsbeautifier.tests.generated',
- 'jsbeautifier.core',
- 'jsbeautifier.javascript',
- 'jsbeautifier.unpackers', 'jsbeautifier.unpackers.tests'],
- install_requires=["six>=1.13.0", "editorconfig>=0.12.2"],
- license='MIT',
- test_suite='pytest.collector',
- cmdclass={'test': PyTest},
-
- )
diff -Nru node-js-beautify-1.11.0+dfsg/python/test-perf-cssbeautifier.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/test-perf-cssbeautifier.py
--- node-js-beautify-1.11.0+dfsg/python/test-perf-cssbeautifier.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/test-perf-cssbeautifier.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import io
-import os
-import copy
-import cssbeautifier
-options = cssbeautifier.default_options()
-options.wrap_line_length = 80
-data = ''
-
-
-def beautifier_test_github_css():
- cssbeautifier.beautify(data, options)
-
-
-def report_perf(fn):
- import timeit
- iter = 5
- time = timeit.timeit(
- fn +
- "()",
- setup="from __main__ import " +
- fn +
- "; gc.enable()",
- number=iter)
- print(fn + ": " + str(iter / time) + " cycles/sec")
-
-
-if __name__ == '__main__':
- dirname = os.path.dirname(os.path.abspath(__file__))
- github_file = os.path.join(
- dirname, "../", "test/resources/github.css")
- data = copy.copy(''.join(io.open(github_file).readlines()))
-
- # warm up
- beautifier_test_github_css()
-
- report_perf("beautifier_test_github_css")
diff -Nru node-js-beautify-1.11.0+dfsg/python/test-perf-jsbeautifier.py node-js-beautify-1.13.6+dfsg+~0.15.3/python/test-perf-jsbeautifier.py
--- node-js-beautify-1.11.0+dfsg/python/test-perf-jsbeautifier.py 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/python/test-perf-jsbeautifier.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import io
-import os
-import copy
-import jsbeautifier
-options = jsbeautifier.default_options()
-options.wrap_line_length = 80
-data = ''
-data_min = ''
-
-
-def beautifier_test_underscore():
- jsbeautifier.beautify(data, options)
-
-
-def beautifier_test_underscore_min():
- jsbeautifier.beautify(data_min, options)
-
-def beautifier_test_github_min():
- jsbeautifier.beautify(github_min, options)
-
-
-def report_perf(fn):
- import timeit
- iter = 5
- time = timeit.timeit(
- fn +
- "()",
- setup="from __main__ import " +
- fn +
- "; gc.enable()",
- number=iter)
- print(fn + ": " + str(iter / time) + " cycles/sec")
-
-
-if __name__ == '__main__':
- dirname = os.path.dirname(os.path.abspath(__file__))
- underscore_file = os.path.join(
- dirname, "../", "test/resources/underscore.js")
- underscore_min_file = os.path.join(
- dirname, "../", "test/resources/underscore-min.js")
- github_min_file = os.path.join(
- dirname, "../", "test/resources/github-min.js")
- data = copy.copy(''.join(io.open(underscore_file, encoding="UTF-8").readlines()))
- data_min = copy.copy(''.join(io.open(underscore_min_file, encoding="UTF-8").readlines()))
- github_min = copy.copy(''.join(io.open(github_min_file, encoding="UTF-8").readlines()))
-
- # warm up
- beautifier_test_underscore()
- beautifier_test_underscore_min()
- beautifier_test_github_min()
-
- report_perf("beautifier_test_underscore")
- report_perf("beautifier_test_underscore_min")
- report_perf("beautifier_test_github_min")
diff -Nru node-js-beautify-1.11.0+dfsg/README.md node-js-beautify-1.13.6+dfsg+~0.15.3/README.md
--- node-js-beautify-1.11.0+dfsg/README.md 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/README.md 2021-01-26 17:37:55.000000000 +0000
@@ -1,5 +1,5 @@
# JS Beautifier
-[![Build Status](https://dev.azure.com/beautifier-io/js-beautify/_apis/build/status/beautify-web.js-beautify)](https://dev.azure.com/beautifier-io/js-beautify/_build/latest?definitionId=1)
+![CI](https://github.com/beautify-web/js-beautify/workflows/CI/badge.svg)
[![PyPI version](https://img.shields.io/pypi/v/jsbeautifier.svg)](https://pypi.python.org/pypi/jsbeautifier)
[![CDNJS version](https://img.shields.io/cdnjs/v/js-beautify.svg)](https://cdnjs.com/libraries/js-beautify)
@@ -24,7 +24,7 @@
This is a popular project and widely used but it desperately needs contributors who have time to commit to fixing both
customer facing bugs and underlying problems with the internal design and implementation.
-If you are interested, please take a look at the [CONTRIBUTING.md](https://github.com/beautify-web/js-beautify/blob/master/CONTRIBUTING.md) then fix an issue marked with the ["Good first issue"](https://github.com/beautify-web/js-beautify/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) label and submit a PR. Repeat as often as possible. Thanks!
+If you are interested, please take a look at the [CONTRIBUTING.md](https://github.com/beautify-web/js-beautify/blob/main/CONTRIBUTING.md) then fix an issue marked with the ["Good first issue"](https://github.com/beautify-web/js-beautify/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) label and submit a PR. Repeat as often as possible. Thanks!
# Installation
@@ -61,17 +61,17 @@
To pull the latest version from one of these services include one set of the script tags below in your document:
```html
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
```
Older versions are available by changing the version number.
@@ -85,7 +85,7 @@
```bash
$ pip install jsbeautifier
```
-Unlike the JavaScript version, the Python version can only reformat JavaScript. It does not work against HTML or CSS files, but you can install _css-beautify_ for CSS (_jsbeautifier_ needs to be installed already)
+Unlike the JavaScript version, the Python version can only reformat JavaScript. It does not work against HTML or CSS files, but you can install _css-beautify_ for CSS:
```bash
$ pip install cssbeautifier
@@ -195,7 +195,7 @@
-C, --comma-first Put commas at the beginning of new line instead of end
-O, --operator-position Set operator position (before-newline|after-newline|preserve-newline) [before-newline]
--indent-empty-lines Keep indentation on empty lines
- --templating List of templating languages (auto,django,erb,handlebars,php) ["auto"] auto = none in JavaScript, all in html
+ --templating List of templating languages (auto,django,erb,handlebars,php,smarty) ["auto"] auto = none in JavaScript, all in html
```
Which correspond to the underscored option keys for both library interfaces
@@ -322,6 +322,7 @@
-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
+ -b, --brace-style [collapse|expand] ["collapse"]
-L, --selector-separator-newline Add a newline between multiple selectors
-N, --newline-between-rules Add a newline between CSS rules
--indent-empty-lines Keep indentation on empty lines
@@ -348,7 +349,7 @@
--indent_scripts Sets indent level inside script tags ("normal", "keep", "separate")
--unformatted_content_delimiter Keep text content together between this string [""]
--indent-empty-lines Keep indentation on empty lines
- --templating List of templating languages (auto,none,django,erb,handlebars,php) ["auto"] auto = none in JavaScript, all in html
+ --templating List of templating languages (auto,none,django,erb,handlebars,php,smarty) ["auto"] auto = none in JavaScript, all in html
```
## Directives
@@ -403,4 +404,4 @@
Vasilevsky, Vital Batmanov, Ron Baldwin, Gabriel Harrison, Chris J. Shull,
Mathias Bynens, Vittorio Gambaletta and others.
-(README.md: js-beautify@1.11.0)
+(README.md: js-beautify@1.13.6)
diff -Nru node-js-beautify-1.11.0+dfsg/test/data/css/tests.js node-js-beautify-1.13.6+dfsg+~0.15.3/test/data/css/tests.js
--- node-js-beautify-1.11.0+dfsg/test/data/css/tests.js 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/test/data/css/tests.js 2021-01-26 17:37:55.000000000 +0000
@@ -29,6 +29,7 @@
{ name: "indent_size", value: "4" },
{ name: "indent_char", value: "' '" },
{ name: "selector_separator_newline", value: "true" },
+ { name: "brace_style", value: "'collapse'" },
{ name: "end_with_newline", value: "false" },
{ name: "newline_between_rules", value: "false" },
{ name: "space_around_combinator", value: "false" },
@@ -289,6 +290,8 @@
],
separator: ' ',
separator1: ' ',
+ curly_separator: ' ',
+ curly_separator2: ' ',
new_rule: '\n',
first_nested_rule: ''
}, {
@@ -299,6 +302,8 @@
],
separator: ' ',
separator1: ' ',
+ curly_separator: ' ',
+ curly_separator2: ' ',
new_rule: '',
first_nested_rule: ''
}, {
@@ -310,6 +315,8 @@
// BUG: #713
separator: ' ',
separator1: ' ',
+ curly_separator: ' ',
+ curly_separator2: ' ',
new_rule: '',
first_nested_rule: ''
}, {
@@ -320,6 +327,8 @@
],
separator: '\\n',
separator1: '\\n\ ',
+ curly_separator: ' ',
+ curly_separator2: ' ',
new_rule: '\n',
first_nested_rule: '\n' // bug #1489
}, {
@@ -330,6 +339,8 @@
],
separator: '\\n',
separator1: '\\n\ ',
+ curly_separator: ' ',
+ curly_separator2: ' ',
new_rule: '',
first_nested_rule: ''
}, {
@@ -340,27 +351,79 @@
],
separator: '\\n',
separator1: '\\n\ ',
+ curly_separator: ' ',
+ curly_separator2: ' ',
+ new_rule: '',
+ new_rule_bug: ''
+ }, {
+ options: [
+ { name: 'selector_separator_newline', value: 'true' },
+ { name: 'selector_separator', value: '" "' },
+ { name: 'brace_style', value: '"expand"' },
+ { name: 'newline_between_rules', value: 'false' }
+ ],
+ separator: '\\n',
+ separator1: '\\n\ ',
+ curly_separator: '\\n',
+ curly_separator2: '\\n ',
new_rule: '',
new_rule_bug: ''
}],
- tests: [
- { input: '#bla, #foo{color:green}', output: '#bla,{{separator}}#foo {\n color: green\n}' },
- { input: '#bla, #foo{color:green}\n#bla, #foo{color:green}', output: '#bla,{{separator}}#foo {\n color: green\n}{{new_rule}}\n#bla,{{separator}}#foo {\n color: green\n}' },
- { input: '@media print {.tab{}}', output: '@media print {\n .tab {}\n}' },
-
+ tests: [{
+ input: '#bla, #foo{color:green}',
+ output: '#bla,{{separator}}#foo{{curly_separator}}{\n color: green\n}'
+ },
+ {
+ input: '#bla, #foo{color:green}\n#bla, #foo{color:green}',
+ output: [
+ '#bla,{{separator}}#foo{{curly_separator}}{',
+ ' color: green',
+ '}{{new_rule}}',
+ '#bla,{{separator}}#foo{{curly_separator}}{',
+ ' color: green',
+ '}'
+ ]
+ },
+ {
+ input: '@media print {.tab{}}',
+ output: '@media print{{curly_separator}}{\n .tab{{curly_separator2}}{}\n}'
+ },
{
comment: 'This is bug #1489',
input: '@media print {.tab,.bat{}}',
- output: '@media print {\n{{first_nested_rule}} .tab,{{separator1}}.bat {}\n}'
+ output: '@media print{{curly_separator}}{\n{{first_nested_rule}} .tab,{{separator1}}.bat{{curly_separator2}}{}\n}'
},
{
comment: 'This is bug #1489',
input: '@media print {// comment\n//comment 2\n.bat{}}',
- output: '@media print {\n{{new_rule}} // comment\n //comment 2\n .bat {}\n}'
+ output: [
+ '@media print{{curly_separator}}{',
+ '{{new_rule}} // comment',
+ ' //comment 2',
+ ' .bat{{curly_separator2}}{}',
+ '}'
+ ]
+ },
+ {
+ input: '#bla, #foo{color:black}',
+ output: '#bla,{{separator}}#foo{{curly_separator}}{\n color: black\n}'
},
- { input: '#bla, #foo{color:black}', output: '#bla,{{separator}}#foo {\n color: black\n}' }, {
+ {
input: 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}\na:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}',
- output: 'a:first-child,{{separator}}a:first-child {\n color: red;{{new_rule}}\n div:first-child,{{separator1}}div:hover {\n color: black;\n }\n}\n{{new_rule}}a:first-child,{{separator}}a:first-child {\n color: red;{{new_rule}}\n div:first-child,{{separator1}}div:hover {\n color: black;\n }\n}'
+ output: [
+ 'a:first-child,{{separator}}a:first-child{{curly_separator}}{',
+ ' color: red;{{new_rule}}',
+ ' div:first-child,{{separator1}}div:hover{{curly_separator2}}{',
+ ' color: black;',
+ ' }',
+ '}',
+ '{{new_rule}}a:first-child,{{separator}}a:first-child{{curly_separator}}{',
+ ' color: red;{{new_rule}}',
+ ' div:first-child,{{separator1}}div:hover{{curly_separator2}}{',
+ ' color: black;',
+ ' }',
+ '}'
+ ]
}
]
}, {
@@ -1604,6 +1667,77 @@
]
}]
}, {
+ name: "brace_style = expand",
+ description: "",
+ matrix: [{
+ options: [
+ { name: "brace_style", value: "'expand'" },
+ { name: "selector_separator_newline", value: "false" },
+ { name: "newline_between_rules", value: "true" }
+ ],
+ empty_line_indent: '',
+ newline: '\n'
+ }, {
+ options: [
+ { name: "brace_style", value: "'expand'" },
+ { name: "indent_empty_lines", value: "true" },
+ { name: "selector_separator_newline", value: "false" },
+ { name: "preserve_newlines", value: "true" }
+ ],
+ empty_line_indent: ' \\n',
+ newline: ''
+ }, {
+ options: [
+ { name: "brace_style", value: "'expand'" },
+ { name: "indent_empty_lines", value: "false" },
+ { name: "selector_separator_newline", value: "false" },
+ { name: "preserve_newlines", value: "true" }
+ ],
+ empty_line_indent: '\\n',
+ newline: ''
+ }],
+
+ tests: [{
+ input: [
+ 'a, b, .c {',
+ ' width: auto;',
+ ' ',
+ ' height: auto;',
+ '}'
+ ],
+ output: [
+ 'a, b, .c',
+ '{',
+ ' width: auto;',
+ '{{empty_line_indent}} height: auto;',
+ '}'
+ ]
+ }, {
+ comment: 'edge case - empty line after { should not be indented without indent_empty_lines',
+ input: [
+ 'a, b, .c {',
+ '',
+ ' width: auto;',
+ '}'
+ ],
+ output: [
+ 'a, b, .c',
+ '{',
+ '{{empty_line_indent}} width: auto;',
+ '}'
+ ]
+ }, {
+ comment: 'integration test of newline_between_rules, imports, and brace_style="expand"',
+ input: '.a{} @import "custom.css";.rule{}',
+ output: [
+ '.a',
+ '{}',
+ '{{newline}}@import "custom.css";',
+ '{{newline}}.rule',
+ '{}'
+ ]
+ }]
+ }, {
name: "LESS mixins",
description: "",
tests: [{
@@ -1666,6 +1800,21 @@
]
}]
}, {
+ name: "Preserve Newlines and max number of new lines",
+ options: [
+ { name: "preserve_newlines", value: "true" },
+ { name: "max_preserve_newlines", value: "2" }
+ ],
+ description: "",
+ tests: [{
+ input: 'p {\n\n\n\n color: blue;\n}',
+ output: 'p {\n\n color: blue;\n}'
+ }, {
+ unchanged: 'p {\n\n color: blue;\n}'
+ }, {
+ unchanged: 'p {\n color: blue;\n}'
+ }]
+ }, {
}
]
diff -Nru node-js-beautify-1.11.0+dfsg/test/data/html/tests.js node-js-beautify-1.13.6+dfsg+~0.15.3/test/data/html/tests.js
--- node-js-beautify-1.11.0+dfsg/test/data/html/tests.js 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/test/data/html/tests.js 2021-01-26 17:37:55.000000000 +0000
@@ -56,6 +56,53 @@
}, {
fragment: true,
unchanged: 'Inline'
+ }, {
+ // Issue #1718 - Empty, non-inline tags with newlines should break parent ending tag into another line
+ input: [
+ ''
+ ],
+ output: [
+ ''
+ ]
+ }, {
+ // Issue #1365 -- Inline tags with newlines should break block parent ending tags into another line
+ input: [
+ '',
+ '',
+ 'Collision
'
+ ],
+ output: [
+ '',
+ ' ',
+ ' Collision',
+ '
'
+ ]
+ }, {
+ // Issue #1365 -- Inline tags with newlines should not break inline parent ending tags into another line
+ input: [
+ 'Collision',
+ ''
+ ],
+ output: [
+ 'Collision',
+ ' '
+ ]
+ }, {
+ // Issue #1365 -- Inline tags with newlines should not break inline parent ending tags into another line
+ input: [
+ 'Collision',
+ '
'
+ ],
+ output: [
+ 'Collision',
+ ' ',
+ '
'
+ ]
}]
}, {
name: "End With Newline",
@@ -2097,6 +2144,28 @@
s: '{%',
e: '%}'
},
+ // smarty {...} and {/* ... */} and {literal} ... {/literal}
+ {
+ options: [
+ { name: "templating", value: "'smarty'" }
+ ],
+ s: '{a',
+ e: 'a}'
+ },
+ {
+ options: [
+ { name: "templating", value: "'smarty'" }
+ ],
+ s: '{*',
+ e: '*}'
+ },
+ {
+ options: [
+ { name: "templating", value: "'smarty'" }
+ ],
+ s: '{literal}',
+ e: '{/literal}'
+ },
// handlebars {{ ... }} and {{# ... }} and {{! ... }} and {{!-- --}}
{
options: [
@@ -2537,7 +2606,8 @@
//.---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10--------11--------12--------13--------14--------15--------16--------17--------18--------19--------20--------21--------22--------23--------24--------25--------26--------27--------28--------29
output: [
'----1---------2---------3---------4---------5---------6---------7-----',
- '
-'
+ '
-',
+ ''
]
}, {
input: [
@@ -2995,12 +3065,84 @@
name: "unformatted to prevent formatting changes",
description: "",
options: [
- { name: 'unformatted', value: "['u', 'span', 'textarea']" }
+ { name: 'unformatted', value: "['h1', 'br', 'u', 'span', 'textarea']" }
],
tests: [{
unchanged: 'Ignore block tags in unformatted regions
'
}, {
- unchanged: 'Don\\\'t wrap unformatted regions with extra newlines
'
+ unchanged: 'Do not wrap unformatted regions with extra newlines
'
+ }, {
+ input: [
+ '',
+ 'Do not wrap unformatted regions with extra newlines
'
+ ],
+ output: [
+ '',
+ ' Do not wrap unformatted regions with extra newlines',
+ '
'
+ ]
+ }, {
+ unchanged: '
'
+ }, {
+ input: [
+ '',
+ '
'
+ ],
+ output: [
+ '',
+ '
',
+ '
'
+ ]
+ }, {
+ unchanged: ''
+ }, {
+ input: [
+ '',
+ '
'
+ ],
+ output: [
+ '',
+ '
',
+ ''
+ ]
+ }, {
+ unchanged: '
'
+ }, {
+ comment: "Inline parent should not add newline unlike block",
+ input: [
+ '',
+ '
'
+ ],
+ output: [
+ '',
+ '
'
+ ]
+ }, {
+ comment: "Inline parent with unformatted non-inline child",
+ unchanged: 'Unformatted non-inline
'
+ }, {
+ comment: "Inline parent with unformatted non-inline child",
+ input: [
+ '',
+ 'Unformatted non-inline
'
+ ],
+ output: [
+ '',
+ ' Unformatted non-inline
'
+ ]
+ }, {
+ comment: "Inline parent with unformatted non-inline empty child",
+ unchanged: ''
+ }, {
+ comment: "Inline parent with unformatted non-inline empty child",
+ input: [
+ '',
+ ''
+ ],
+ output: [
+ '',
+ ' '
+ ]
}, {
input_: ' \n\n\n Ignore extra """whitespace mostly \n\n\n ',
output: '\n\n\n Ignore extra """whitespace mostly \n\n\n '
@@ -3079,7 +3221,8 @@
'',
'
',
'
',
- '
'
+ '
',
+ ''
]
}, {
comment: 'Regression test #1534 - interaction between unformatted, content_unformatted, and inline',
@@ -3334,6 +3477,30 @@
]
}]
}, {
+ name: "Smarty tests for extra whitespace in nested quotes",
+ description: "Check beautifier adds extra whitespace in nested quotes by assuming as the end of the attribute",
+ options: [
+ { name: "templating", value: "'smarty'" }
+ ],
+ tests: [{
+ unchanged: 'foo
'
+ }, {
+ unchanged: ''
+ }]
+ }, {
+ name: "Smarty tests for script",
+ description: "",
+ options: [
+ { name: "templating", value: "'smarty'" }
+ ],
+ tests: [{
+ unchanged: [
+ ''
+ ]
+ }]
+ }, {
name: "New Test Suite"
}]
};
diff -Nru node-js-beautify-1.11.0+dfsg/test/data/javascript/inputlib.js node-js-beautify-1.13.6+dfsg+~0.15.3/test/data/javascript/inputlib.js
--- node-js-beautify-1.11.0+dfsg/test/data/javascript/inputlib.js 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/test/data/javascript/inputlib.js 2021-01-26 17:37:55.000000000 +0000
@@ -6,7 +6,7 @@
sanity: [
'var res = a + b - c / d * e % f;',
'var res = g & h | i ^ j |> console.log;',
- 'var res = (k && l || m) ? n : o;',
+ 'var res = (k && l || m) ? n ?? nn : o;',
'var res = p >> q << r >>> s;',
'var res = t === u !== v != w == x >= y <= z > aa < ab;',
'ac + -ad'
@@ -25,6 +25,7 @@
'l',
'|| m) ?',
'n',
+ '?? nn',
': o',
';',
'var res = p',
diff -Nru node-js-beautify-1.11.0+dfsg/test/data/javascript/tests.js node-js-beautify-1.13.6+dfsg+~0.15.3/test/data/javascript/tests.js
--- node-js-beautify-1.11.0+dfsg/test/data/javascript/tests.js 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/test/data/javascript/tests.js 2021-01-26 17:37:55.000000000 +0000
@@ -1708,10 +1708,33 @@
{
input: 'if (a)\n{\nb;\n}\nelse\n{\nc;\n}',
output: 'if (a) {\n b;\n} else {\n c;\n}'
+ },
+ {
+ unchanged: 'fn`tagged`'
+ },
+ {
+ unchanged: 'fn()`tagged`'
+ },
+ {
+ unchanged: 'fn`${algo} ${`6string`}`'
+ },
+ {
+ unchanged: 'fn`${fn2()} more text ${`${`more text`}`} banana ${fn3`test`} ${fn4()`moretest banana2`}`'
+ },
+ {
+ input: '`untagged`+`untagged`',
+ output: '`untagged` + `untagged`'
+ },
+ {
+ unchanged: "fun() `taggedd`"
+ },
+ {
+ input: 'fn[0]`tagged`',
+ output: 'fn[0] `tagged`'
}
]
}, {
- name: "operator_position option - ensure no neswlines if preserve_newlines is false",
+ name: "operator_position option - ensure no newlines if preserve_newlines is false",
matrix: [{
options: [
// test for default
@@ -1767,7 +1790,8 @@
'var res = (k &&',
' l ||',
' m) ?',
- ' n :',
+ ' n ??',
+ ' nn :',
' o;',
'var res = p >>',
' q <<',
@@ -1841,6 +1865,7 @@
' && l',
' || m)',
' ? n',
+ ' ?? nn',
' : o;',
'var res = p',
' >> q',
@@ -1914,6 +1939,7 @@
' l',
' || m) ?',
' n',
+ ' ?? nn',
' : o;',
'var res = p',
' >> q <<',
@@ -2487,6 +2513,20 @@
' {a + b}>',
');'
]
+ },
+ {
+ unchanged: [
+ 'class Columns extends React.Component {',
+ ' render() {',
+ ' return (',
+ ' <>',
+ ' Hello | ',
+ ' World | ',
+ ' >',
+ ' );',
+ ' }',
+ '}'
+ ]
}
]
},
@@ -2536,6 +2576,7 @@
{ unchanged: 'if{{s}}(a) b()' },
{ unchanged: 'while{{s}}(a) b()' },
{ unchanged: 'do\n c();\nwhile{{s}}(a) b()' },
+ { unchanged: 'switch{{s}}(a) b()' },
{
input: 'if(a)\nb();',
output: 'if{{s}}(a)\n b();'
@@ -2548,6 +2589,10 @@
input: 'do\nc();\nwhile(a);',
output: 'do\n c();\nwhile{{s}}(a);'
},
+ {
+ input: 'switch(a)\nb()',
+ output: 'switch{{s}}(a)\n b()'
+ },
{ unchanged: 'return [];' },
{ unchanged: 'return ();' }
]
@@ -3735,6 +3780,13 @@
]
},
{
+ comment: "Issue 1801 - Optional chaining w/ obj?.[expr] syntax",
+ unchanged: [
+ 'let nestedProp = obj?.["prop" + "Name"];',
+ 'let arrayItem = arr?.[42];'
+ ]
+ },
+ {
comment: "Issue 1374 - Parameters starting with ! or [ merged into single line",
unchanged: [
'fn(',
@@ -3806,6 +3858,12 @@
]
},
{
+ comment: 'Issue #1794 - support nullish-coalescing',
+ unchanged: [
+ 'a = b ?? c'
+ ]
+ },
+ {
comment: "Issue #569 - function should not have blank line in a number of cases",
unchanged: [
'(function(global) {',
diff -Nru node-js-beautify-1.11.0+dfsg/tools/python-dev3 node-js-beautify-1.13.6+dfsg+~0.15.3/tools/python-dev3
--- node-js-beautify-1.11.0+dfsg/tools/python-dev3 1970-01-01 00:00:00.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/tools/python-dev3 2021-01-26 17:37:55.000000000 +0000
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+REL_SCRIPT_DIR="`dirname \"$0\"`"
+SCRIPT_DIR="`( cd \"$REL_SCRIPT_DIR\" && pwd )`"
+PROJECT_DIR="`( cd \"$SCRIPT_DIR/..\" && pwd )`"
+PYTHON_ENV=python-dev
+PYTHON_VERSION="`$PROJECT_DIR/build/$PYTHON_ENV/bin/python --version 2>&1`"
+
+# only run the command on python3
+if [ -z "${PYTHON_VERSION##Python 3.*}" ]; then
+ $SCRIPT_DIR/python-dev $@
+fi
+
diff -Nru node-js-beautify-1.11.0+dfsg/tools/release-all.sh node-js-beautify-1.13.6+dfsg+~0.15.3/tools/release-all.sh
--- node-js-beautify-1.11.0+dfsg/tools/release-all.sh 2020-04-05 19:25:03.000000000 +0000
+++ node-js-beautify-1.13.6+dfsg+~0.15.3/tools/release-all.sh 2021-01-26 17:37:55.000000000 +0000
@@ -13,19 +13,22 @@
release_python()
{
cd $SCRIPT_DIR/..
- git checkout -B release origin/release
+ git checkout -B staging/release origin/staging/release
git clean -xfd || exit 1
cd python
# python setup.py register -r pypi
+ cp setup-js.py setup.py || exit 1
python setup.py sdist || exit 1
- python setup-css.py sdist || exit 1
+ cp setup-css.py setup.py || exit 1
+ python setup.py sdist || exit 1
+ rm setup.py || exit 1
python -m twine upload dist/* || exit 1
}
release_node()
{
cd $SCRIPT_DIR/..
- git checkout -B release origin/release
+ git checkout -B staging/release origin/staging/release
git clean -xfd || exit 1
unset NPM_TAG
if [[ $NEW_VERSION =~ .*(rc|beta).* ]]; then
@@ -36,14 +39,19 @@
release_web()
{
- echo release is now on beautifier/beautifier.io
- # cd $SCRIPT_DIR/..
- # git clean -xfd || exit 1
- # git fetch || exit 1
- # git checkout -B gh-pages origin/gh-pages || exit 1
- # git merge origin/release --no-edit || exit 1
- # git push || exit 1
- # git checkout master
+ cd $SCRIPT_DIR/..
+ git clean -xfd || exit 1
+ git fetch --all || exit 1
+
+ git checkout -B staging/gh-pages site/staging/gh-pages || exit 1
+ git reset --hard site/gh-pages || exit 1
+ git merge origin/release --no-edit || exit 1
+ git push || exit 1
+
+ git checkout -B staging/main site/staging/main || exit 1
+ git reset --hard site/main || exit 1
+ git merge origin/staging/main --no-edit || exit 1
+ git push || exit 1
}
sedi() {
@@ -59,27 +67,35 @@
update_versions()
{
git fetch --all || exit 1
- git checkout master || exit 1
- git reset --hard origin/master || exit 1
+ # trigger remote uses deploy key, push will cause downstream GitHub Actions to fire
+ git checkout -B staging/main trigger/staging/main || exit 1
+ git merge origin/main --no-edit || exit 1
git clean -xfd || exit 1
- npm version --no-git-tag-version $NEW_VERSION
+
+ $SCRIPT_DIR/generate-changelog.sh beautify-web/js-beautify $GITHUB_TOKEN || exit 1
+
+ npm version --no-git-tag-version $NEW_VERSION || exit 1
sedi -E 's@(cdn.rawgit.+beautify/v)[^/]+@\1'$NEW_VERSION'@' README.md
sedi -E 's@(cdnjs.cloudflare.+beautify/)[^/]+@\1'$NEW_VERSION'@' README.md
sedi -E 's/\((README\.md:.js-beautify@).+\)/(\1'$NEW_VERSION')/' README.md
- echo "__version__ = '$NEW_VERSION'" > python/jsbeautifier/__version__.py
- git add .
- git commit -am "Bump version numbers for $NEW_VERSION"
- git push
+ echo "__version__ = \"$NEW_VERSION\"" > python/jsbeautifier/__version__.py
+ echo "__version__ = \"$NEW_VERSION\"" > python/cssbeautifier/__version__.py
+ git add . || exit 1
+ git commit -am "Bump version numbers for $NEW_VERSION" || exit 1
+ git push || exit 1
}
update_release_branch()
{
git reset --hard
git clean -xfd
- git checkout -B release origin/release || exit 1
- git merge origin/master --no-edit || exit 1
+ git fetch --all || exit 1
+ # trigger remote uses deploy key, push will cause downstream GitHub Actions to fire
+ git checkout -B staging/release trigger/staging/release || exit 1
+ git merge origin/release --no-edit || exit 1
+ git merge origin/staging/main --no-edit || exit 1
make js || exit 1
git add -f js/lib/ || exit 1
@@ -94,9 +110,12 @@
cd $SCRIPT_DIR/..
local NEW_VERSION=$1
- NEW_VERSION=$1
+ NEW_VERSION=${NEW_VERSION/v/}
- git checkout master || exit 1
+ if [[ ! $NEW_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9].*$ ]]; then
+ echo Version number must start with MAJOR.MINOR.INCREMENTAL numbering.
+ exit 1
+ fi
npm --version > /dev/null || {
echo ERROR: npm must be installed before attempting release
@@ -104,7 +123,6 @@
}
twine -h > /dev/null || {
- echo ERROR: twine must be installed before attempting release
exit 1
}
@@ -115,7 +133,7 @@
release_node
release_web
- git checkout master
+ git checkout main
}
(main $*)