mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-02 12:00:03 +02:00
update node modules
This commit is contained in:
9
node_modules/abab/CHANGELOG.md
generated
vendored
9
node_modules/abab/CHANGELOG.md
generated
vendored
@@ -1,3 +1,12 @@
|
||||
## 2.0.5
|
||||
|
||||
- Use a lookup string in atobLookup and btoaLookup (@GiovanniFrigo in #38)
|
||||
- Dependency updates
|
||||
|
||||
## 2.0.4
|
||||
|
||||
- Dependency updates
|
||||
|
||||
## 2.0.3
|
||||
|
||||
- Use standard wording for BSD-3-Clause license (@PhilippWendler)
|
||||
|
11
node_modules/abab/README.md
generated
vendored
11
node_modules/abab/README.md
generated
vendored
@@ -39,12 +39,13 @@ const atob = require('abab/lib/atob');
|
||||
const btoa = require('abab/lib/btoa');
|
||||
```
|
||||
|
||||
-----
|
||||
## Development
|
||||
|
||||
### Checklists
|
||||
If you're **submitting a PR** or **deploying to npm**, please use the [checklists in CONTRIBUTING.md](CONTRIBUTING.md#checklists).
|
||||
|
||||
If you're **submitting a PR** or **deploying to npm**, please use the [checklists in CONTRIBUTING.md](https://github.com/jsdom/abab/blob/master/CONTRIBUTING.md#checklists)
|
||||
## Remembering what `atob` and `btoa` stand for
|
||||
|
||||
### Remembering `atob` vs. `btoa`
|
||||
Base64 comes from IETF [RFC 4648](https://tools.ietf.org/html/rfc4648#section-4) (2006).
|
||||
|
||||
Here's a mnemonic that might be useful: if you have a plain string and want to base64 encode it, then decode it, `btoa` is what you run before (**b**efore - **b**toa), and `atob` is what you run after (**a**fter - **a**tob).
|
||||
- **`btoa`**, the encoder function, stands for **binary** to **ASCII**, meaning it converts any binary input into a subset of **ASCII** (Base64).
|
||||
- **`atob`**, the decoder function, converts **ASCII** (or Base64) to its original **binary** format.
|
||||
|
24
node_modules/abab/lib/atob.js
generated
vendored
24
node_modules/abab/lib/atob.js
generated
vendored
@@ -84,24 +84,14 @@ function atob(data) {
|
||||
* A lookup table for atob(), which converts an ASCII character to the
|
||||
* corresponding six-bit number.
|
||||
*/
|
||||
|
||||
const keystr =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
function atobLookup(chr) {
|
||||
if (/[A-Z]/.test(chr)) {
|
||||
return chr.charCodeAt(0) - "A".charCodeAt(0);
|
||||
}
|
||||
if (/[a-z]/.test(chr)) {
|
||||
return chr.charCodeAt(0) - "a".charCodeAt(0) + 26;
|
||||
}
|
||||
if (/[0-9]/.test(chr)) {
|
||||
return chr.charCodeAt(0) - "0".charCodeAt(0) + 52;
|
||||
}
|
||||
if (chr === "+") {
|
||||
return 62;
|
||||
}
|
||||
if (chr === "/") {
|
||||
return 63;
|
||||
}
|
||||
// Throw exception; should not be hit in tests
|
||||
return undefined;
|
||||
const index = keystr.indexOf(chr);
|
||||
// Throw exception if character is not in the lookup string; should not be hit in tests
|
||||
return index < 0 ? undefined : index;
|
||||
}
|
||||
|
||||
module.exports = atob;
|
||||
|
22
node_modules/abab/lib/btoa.js
generated
vendored
22
node_modules/abab/lib/btoa.js
generated
vendored
@@ -43,22 +43,14 @@ function btoa(s) {
|
||||
* Lookup table for btoa(), which converts a six-bit number into the
|
||||
* corresponding ASCII character.
|
||||
*/
|
||||
function btoaLookup(idx) {
|
||||
if (idx < 26) {
|
||||
return String.fromCharCode(idx + "A".charCodeAt(0));
|
||||
}
|
||||
if (idx < 52) {
|
||||
return String.fromCharCode(idx - 26 + "a".charCodeAt(0));
|
||||
}
|
||||
if (idx < 62) {
|
||||
return String.fromCharCode(idx - 52 + "0".charCodeAt(0));
|
||||
}
|
||||
if (idx === 62) {
|
||||
return "+";
|
||||
}
|
||||
if (idx === 63) {
|
||||
return "/";
|
||||
const keystr =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
function btoaLookup(index) {
|
||||
if (index >= 0 && index < 64) {
|
||||
return keystr[index];
|
||||
}
|
||||
|
||||
// Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the tests.
|
||||
return undefined;
|
||||
}
|
||||
|
20
node_modules/abab/package.json
generated
vendored
20
node_modules/abab/package.json
generated
vendored
@@ -1,27 +1,27 @@
|
||||
{
|
||||
"_from": "abab@^2.0.3",
|
||||
"_id": "abab@2.0.3",
|
||||
"_from": "abab@^2.0.5",
|
||||
"_id": "abab@2.0.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==",
|
||||
"_integrity": "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==",
|
||||
"_location": "/abab",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "abab@^2.0.3",
|
||||
"raw": "abab@^2.0.5",
|
||||
"name": "abab",
|
||||
"escapedName": "abab",
|
||||
"rawSpec": "^2.0.3",
|
||||
"rawSpec": "^2.0.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.3"
|
||||
"fetchSpec": "^2.0.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/data-urls",
|
||||
"/jsdom"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz",
|
||||
"_shasum": "623e2075e02eb2d3f2475e49f99c91846467907a",
|
||||
"_spec": "abab@^2.0.3",
|
||||
"_resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz",
|
||||
"_shasum": "c0b678fb32d60fc1219c784d6a826fe385aeb79a",
|
||||
"_spec": "abab@^2.0.5",
|
||||
"_where": "D:\\Projects\\minifyfromhtml\\node_modules\\jsdom",
|
||||
"author": {
|
||||
"name": "Jeff Carpenter",
|
||||
@@ -67,5 +67,5 @@
|
||||
"mocha": "mocha test/node",
|
||||
"test": "npm run lint && npm run mocha && npm run karma"
|
||||
},
|
||||
"version": "2.0.3"
|
||||
"version": "2.0.5"
|
||||
}
|
||||
|
15
node_modules/acorn-globals/node_modules/.bin/acorn
generated
vendored
Normal file
15
node_modules/acorn-globals/node_modules/.bin/acorn
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../acorn/bin/acorn" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../acorn/bin/acorn" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
17
node_modules/acorn-globals/node_modules/.bin/acorn.cmd
generated
vendored
Normal file
17
node_modules/acorn-globals/node_modules/.bin/acorn.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\acorn\bin\acorn" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/acorn-globals/node_modules/.bin/acorn.ps1
generated
vendored
Normal file
18
node_modules/acorn-globals/node_modules/.bin/acorn.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../acorn/bin/acorn" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
620
node_modules/acorn-globals/node_modules/acorn/CHANGELOG.md
generated
vendored
Normal file
620
node_modules/acorn-globals/node_modules/acorn/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,620 @@
|
||||
## 7.4.0 (2020-08-03)
|
||||
|
||||
### New features
|
||||
|
||||
Add support for logical assignment operators.
|
||||
|
||||
Add support for numeric separators.
|
||||
|
||||
## 7.3.1 (2020-06-11)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Make the string in the `version` export match the actual library version.
|
||||
|
||||
## 7.3.0 (2020-06-11)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a bug that caused parsing of object patterns with a property named `set` that had a default value to fail.
|
||||
|
||||
### New features
|
||||
|
||||
Add support for optional chaining (`?.`).
|
||||
|
||||
## 7.2.0 (2020-05-09)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix precedence issue in parsing of async arrow functions.
|
||||
|
||||
### New features
|
||||
|
||||
Add support for nullish coalescing.
|
||||
|
||||
Add support for `import.meta`.
|
||||
|
||||
Support `export * as ...` syntax.
|
||||
|
||||
Upgrade to Unicode 13.
|
||||
|
||||
## 6.4.1 (2020-03-09)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
More carefully check for valid UTF16 surrogate pairs in regexp validator.
|
||||
|
||||
## 7.1.1 (2020-03-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Treat `\8` and `\9` as invalid escapes in template strings.
|
||||
|
||||
Allow unicode escapes in property names that are keywords.
|
||||
|
||||
Don't error on an exponential operator expression as argument to `await`.
|
||||
|
||||
More carefully check for valid UTF16 surrogate pairs in regexp validator.
|
||||
|
||||
## 7.1.0 (2019-09-24)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow trailing object literal commas when ecmaVersion is less than 5.
|
||||
|
||||
### New features
|
||||
|
||||
Add a static `acorn` property to the `Parser` class that contains the entire module interface, to allow plugins to access the instance of the library that they are acting on.
|
||||
|
||||
## 7.0.0 (2019-08-13)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
Changes the node format for dynamic imports to use the `ImportExpression` node type, as defined in [ESTree](https://github.com/estree/estree/blob/master/es2020.md#importexpression).
|
||||
|
||||
Makes 10 (ES2019) the default value for the `ecmaVersion` option.
|
||||
|
||||
## 6.3.0 (2019-08-12)
|
||||
|
||||
### New features
|
||||
|
||||
`sourceType: "module"` can now be used even when `ecmaVersion` is less than 6, to parse module-style code that otherwise conforms to an older standard.
|
||||
|
||||
## 6.2.1 (2019-07-21)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug causing Acorn to treat some characters as identifier characters that shouldn't be treated as such.
|
||||
|
||||
Fix issue where setting the `allowReserved` option to `"never"` allowed reserved words in some circumstances.
|
||||
|
||||
## 6.2.0 (2019-07-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Improve valid assignment checking in `for`/`in` and `for`/`of` loops.
|
||||
|
||||
Disallow binding `let` in patterns.
|
||||
|
||||
### New features
|
||||
|
||||
Support bigint syntax with `ecmaVersion` >= 11.
|
||||
|
||||
Support dynamic `import` syntax with `ecmaVersion` >= 11.
|
||||
|
||||
Upgrade to Unicode version 12.
|
||||
|
||||
## 6.1.1 (2019-02-27)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug that caused parsing default exports of with names to fail.
|
||||
|
||||
## 6.1.0 (2019-02-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix scope checking when redefining a `var` as a lexical binding.
|
||||
|
||||
### New features
|
||||
|
||||
Split up `parseSubscripts` to use an internal `parseSubscript` method to make it easier to extend with plugins.
|
||||
|
||||
## 6.0.7 (2019-02-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Check that exported bindings are defined.
|
||||
|
||||
Don't treat `\u180e` as a whitespace character.
|
||||
|
||||
Check for duplicate parameter names in methods.
|
||||
|
||||
Don't allow shorthand properties when they are generators or async methods.
|
||||
|
||||
Forbid binding `await` in async arrow function's parameter list.
|
||||
|
||||
## 6.0.6 (2019-01-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
The content of class declarations and expressions is now always parsed in strict mode.
|
||||
|
||||
Don't allow `let` or `const` to bind the variable name `let`.
|
||||
|
||||
Treat class declarations as lexical.
|
||||
|
||||
Don't allow a generator function declaration as the sole body of an `if` or `else`.
|
||||
|
||||
Ignore `"use strict"` when after an empty statement.
|
||||
|
||||
Allow string line continuations with special line terminator characters.
|
||||
|
||||
Treat `for` bodies as part of the `for` scope when checking for conflicting bindings.
|
||||
|
||||
Fix bug with parsing `yield` in a `for` loop initializer.
|
||||
|
||||
Implement special cases around scope checking for functions.
|
||||
|
||||
## 6.0.5 (2019-01-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix TypeScript type for `Parser.extend` and add `allowAwaitOutsideFunction` to options type.
|
||||
|
||||
Don't treat `let` as a keyword when the next token is `{` on the next line.
|
||||
|
||||
Fix bug that broke checking for parentheses around an object pattern in a destructuring assignment when `preserveParens` was on.
|
||||
|
||||
## 6.0.4 (2018-11-05)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Further improvements to tokenizing regular expressions in corner cases.
|
||||
|
||||
## 6.0.3 (2018-11-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug in tokenizing an expression-less return followed by a function followed by a regular expression.
|
||||
|
||||
Remove stray symlink in the package tarball.
|
||||
|
||||
## 6.0.2 (2018-09-26)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug where default expressions could fail to parse inside an object destructuring assignment expression.
|
||||
|
||||
## 6.0.1 (2018-09-14)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix wrong value in `version` export.
|
||||
|
||||
## 6.0.0 (2018-09-14)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Better handle variable-redefinition checks for catch bindings and functions directly under if statements.
|
||||
|
||||
Forbid `new.target` in top-level arrow functions.
|
||||
|
||||
Fix issue with parsing a regexp after `yield` in some contexts.
|
||||
|
||||
### New features
|
||||
|
||||
The package now comes with TypeScript definitions.
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The default value of the `ecmaVersion` option is now 9 (2018).
|
||||
|
||||
Plugins work differently, and will have to be rewritten to work with this version.
|
||||
|
||||
The loose parser and walker have been moved into separate packages (`acorn-loose` and `acorn-walk`).
|
||||
|
||||
## 5.7.3 (2018-09-10)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix failure to tokenize regexps after expressions like `x.of`.
|
||||
|
||||
Better error message for unterminated template literals.
|
||||
|
||||
## 5.7.2 (2018-08-24)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Properly handle `allowAwaitOutsideFunction` in for statements.
|
||||
|
||||
Treat function declarations at the top level of modules like let bindings.
|
||||
|
||||
Don't allow async function declarations as the only statement under a label.
|
||||
|
||||
## 5.7.0 (2018-06-15)
|
||||
|
||||
### New features
|
||||
|
||||
Upgraded to Unicode 11.
|
||||
|
||||
## 5.6.0 (2018-05-31)
|
||||
|
||||
### New features
|
||||
|
||||
Allow U+2028 and U+2029 in string when ECMAVersion >= 10.
|
||||
|
||||
Allow binding-less catch statements when ECMAVersion >= 10.
|
||||
|
||||
Add `allowAwaitOutsideFunction` option for parsing top-level `await`.
|
||||
|
||||
## 5.5.3 (2018-03-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
A _second_ republish of the code in 5.5.1, this time with yarn, to hopefully get valid timestamps.
|
||||
|
||||
## 5.5.2 (2018-03-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
A republish of the code in 5.5.1 in an attempt to solve an issue with the file timestamps in the npm package being 0.
|
||||
|
||||
## 5.5.1 (2018-03-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix misleading error message for octal escapes in template strings.
|
||||
|
||||
## 5.5.0 (2018-02-27)
|
||||
|
||||
### New features
|
||||
|
||||
The identifier character categorization is now based on Unicode version 10.
|
||||
|
||||
Acorn will now validate the content of regular expressions, including new ES9 features.
|
||||
|
||||
## 5.4.0 (2018-02-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow duplicate or escaped flags on regular expressions.
|
||||
|
||||
Disallow octal escapes in strings in strict mode.
|
||||
|
||||
### New features
|
||||
|
||||
Add support for async iteration.
|
||||
|
||||
Add support for object spread and rest.
|
||||
|
||||
## 5.3.0 (2017-12-28)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix parsing of floating point literals with leading zeroes in loose mode.
|
||||
|
||||
Allow duplicate property names in object patterns.
|
||||
|
||||
Don't allow static class methods named `prototype`.
|
||||
|
||||
Disallow async functions directly under `if` or `else`.
|
||||
|
||||
Parse right-hand-side of `for`/`of` as an assignment expression.
|
||||
|
||||
Stricter parsing of `for`/`in`.
|
||||
|
||||
Don't allow unicode escapes in contextual keywords.
|
||||
|
||||
### New features
|
||||
|
||||
Parsing class members was factored into smaller methods to allow plugins to hook into it.
|
||||
|
||||
## 5.2.1 (2017-10-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a token context corruption bug.
|
||||
|
||||
## 5.2.0 (2017-10-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix token context tracking for `class` and `function` in property-name position.
|
||||
|
||||
Make sure `%*` isn't parsed as a valid operator.
|
||||
|
||||
Allow shorthand properties `get` and `set` to be followed by default values.
|
||||
|
||||
Disallow `super` when not in callee or object position.
|
||||
|
||||
### New features
|
||||
|
||||
Support [`directive` property](https://github.com/estree/estree/compare/b3de58c9997504d6fba04b72f76e6dd1619ee4eb...1da8e603237144f44710360f8feb7a9977e905e0) on directive expression statements.
|
||||
|
||||
## 5.1.2 (2017-09-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disable parsing of legacy HTML-style comments in modules.
|
||||
|
||||
Fix parsing of async methods whose names are keywords.
|
||||
|
||||
## 5.1.1 (2017-07-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix problem with disambiguating regexp and division after a class.
|
||||
|
||||
## 5.1.0 (2017-07-05)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix tokenizing of regexps in an object-desctructuring `for`/`of` loop and after `yield`.
|
||||
|
||||
Parse zero-prefixed numbers with non-octal digits as decimal.
|
||||
|
||||
Allow object/array patterns in rest parameters.
|
||||
|
||||
Don't error when `yield` is used as a property name.
|
||||
|
||||
Allow `async` as a shorthand object property.
|
||||
|
||||
### New features
|
||||
|
||||
Implement the [template literal revision proposal](https://github.com/tc39/proposal-template-literal-revision) for ES9.
|
||||
|
||||
## 5.0.3 (2017-04-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix spurious duplicate variable definition errors for named functions.
|
||||
|
||||
## 5.0.2 (2017-03-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
A binary operator after a parenthesized arrow expression is no longer incorrectly treated as an error.
|
||||
|
||||
## 5.0.0 (2017-03-28)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Raise an error for duplicated lexical bindings.
|
||||
|
||||
Fix spurious error when an assignement expression occurred after a spread expression.
|
||||
|
||||
Accept regular expressions after `of` (in `for`/`of`), `yield` (in a generator), and braced arrow functions.
|
||||
|
||||
Allow labels in front or `var` declarations, even in strict mode.
|
||||
|
||||
### Breaking changes
|
||||
|
||||
Parse declarations following `export default` as declaration nodes, not expressions. This means that class and function declarations nodes can now have `null` as their `id`.
|
||||
|
||||
## 4.0.11 (2017-02-07)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Allow all forms of member expressions to be parenthesized as lvalue.
|
||||
|
||||
## 4.0.10 (2017-02-07)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Don't expect semicolons after default-exported functions or classes, even when they are expressions.
|
||||
|
||||
Check for use of `'use strict'` directives in non-simple parameter functions, even when already in strict mode.
|
||||
|
||||
## 4.0.9 (2017-02-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix incorrect error raised for parenthesized simple assignment targets, so that `(x) = 1` parses again.
|
||||
|
||||
## 4.0.8 (2017-02-03)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Solve spurious parenthesized pattern errors by temporarily erring on the side of accepting programs that our delayed errors don't handle correctly yet.
|
||||
|
||||
## 4.0.7 (2017-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Accept invalidly rejected code like `(x).y = 2` again.
|
||||
|
||||
Don't raise an error when a function _inside_ strict code has a non-simple parameter list.
|
||||
|
||||
## 4.0.6 (2017-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix exponential behavior (manifesting itself as a complete hang for even relatively small source files) introduced by the new 'use strict' check.
|
||||
|
||||
## 4.0.5 (2017-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow parenthesized pattern expressions.
|
||||
|
||||
Allow keywords as export names.
|
||||
|
||||
Don't allow the `async` keyword to be parenthesized.
|
||||
|
||||
Properly raise an error when a keyword contains a character escape.
|
||||
|
||||
Allow `"use strict"` to appear after other string literal expressions.
|
||||
|
||||
Disallow labeled declarations.
|
||||
|
||||
## 4.0.4 (2016-12-19)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix crash when `export` was followed by a keyword that can't be
|
||||
exported.
|
||||
|
||||
## 4.0.3 (2016-08-16)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Allow regular function declarations inside single-statement `if` branches in loose mode. Forbid them entirely in strict mode.
|
||||
|
||||
Properly parse properties named `async` in ES2017 mode.
|
||||
|
||||
Fix bug where reserved words were broken in ES2017 mode.
|
||||
|
||||
## 4.0.2 (2016-08-11)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Don't ignore period or 'e' characters after octal numbers.
|
||||
|
||||
Fix broken parsing for call expressions in default parameter values of arrow functions.
|
||||
|
||||
## 4.0.1 (2016-08-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix false positives in duplicated export name errors.
|
||||
|
||||
## 4.0.0 (2016-08-07)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The default `ecmaVersion` option value is now 7.
|
||||
|
||||
A number of internal method signatures changed, so plugins might need to be updated.
|
||||
|
||||
### Bug fixes
|
||||
|
||||
The parser now raises errors on duplicated export names.
|
||||
|
||||
`arguments` and `eval` can now be used in shorthand properties.
|
||||
|
||||
Duplicate parameter names in non-simple argument lists now always produce an error.
|
||||
|
||||
### New features
|
||||
|
||||
The `ecmaVersion` option now also accepts year-style version numbers
|
||||
(2015, etc).
|
||||
|
||||
Support for `async`/`await` syntax when `ecmaVersion` is >= 8.
|
||||
|
||||
Support for trailing commas in call expressions when `ecmaVersion` is >= 8.
|
||||
|
||||
## 3.3.0 (2016-07-25)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug in tokenizing of regexp operator after a function declaration.
|
||||
|
||||
Fix parser crash when parsing an array pattern with a hole.
|
||||
|
||||
### New features
|
||||
|
||||
Implement check against complex argument lists in functions that enable strict mode in ES7.
|
||||
|
||||
## 3.2.0 (2016-06-07)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Improve handling of lack of unicode regexp support in host
|
||||
environment.
|
||||
|
||||
Properly reject shorthand properties whose name is a keyword.
|
||||
|
||||
### New features
|
||||
|
||||
Visitors created with `visit.make` now have their base as _prototype_, rather than copying properties into a fresh object.
|
||||
|
||||
## 3.1.0 (2016-04-18)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Properly tokenize the division operator directly after a function expression.
|
||||
|
||||
Allow trailing comma in destructuring arrays.
|
||||
|
||||
## 3.0.4 (2016-02-25)
|
||||
|
||||
### Fixes
|
||||
|
||||
Allow update expressions as left-hand-side of the ES7 exponential operator.
|
||||
|
||||
## 3.0.2 (2016-02-10)
|
||||
|
||||
### Fixes
|
||||
|
||||
Fix bug that accidentally made `undefined` a reserved word when parsing ES7.
|
||||
|
||||
## 3.0.0 (2016-02-10)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The default value of the `ecmaVersion` option is now 6 (used to be 5).
|
||||
|
||||
Support for comprehension syntax (which was dropped from the draft spec) has been removed.
|
||||
|
||||
### Fixes
|
||||
|
||||
`let` and `yield` are now “contextual keywords”, meaning you can mostly use them as identifiers in ES5 non-strict code.
|
||||
|
||||
A parenthesized class or function expression after `export default` is now parsed correctly.
|
||||
|
||||
### New features
|
||||
|
||||
When `ecmaVersion` is set to 7, Acorn will parse the exponentiation operator (`**`).
|
||||
|
||||
The identifier character ranges are now based on Unicode 8.0.0.
|
||||
|
||||
Plugins can now override the `raiseRecoverable` method to override the way non-critical errors are handled.
|
||||
|
||||
## 2.7.0 (2016-01-04)
|
||||
|
||||
### Fixes
|
||||
|
||||
Stop allowing rest parameters in setters.
|
||||
|
||||
Disallow `y` rexexp flag in ES5.
|
||||
|
||||
Disallow `\00` and `\000` escapes in strict mode.
|
||||
|
||||
Raise an error when an import name is a reserved word.
|
||||
|
||||
## 2.6.2 (2015-11-10)
|
||||
|
||||
### Fixes
|
||||
|
||||
Don't crash when no options object is passed.
|
||||
|
||||
## 2.6.0 (2015-11-09)
|
||||
|
||||
### Fixes
|
||||
|
||||
Add `await` as a reserved word in module sources.
|
||||
|
||||
Disallow `yield` in a parameter default value for a generator.
|
||||
|
||||
Forbid using a comma after a rest pattern in an array destructuring.
|
||||
|
||||
### New features
|
||||
|
||||
Support parsing stdin in command-line tool.
|
||||
|
||||
## 2.5.0 (2015-10-27)
|
||||
|
||||
### Fixes
|
||||
|
||||
Fix tokenizer support in the command-line tool.
|
||||
|
||||
Stop allowing `new.target` outside of functions.
|
||||
|
||||
Remove legacy `guard` and `guardedHandler` properties from try nodes.
|
||||
|
||||
Stop allowing multiple `__proto__` properties on an object literal in strict mode.
|
||||
|
||||
Don't allow rest parameters to be non-identifier patterns.
|
||||
|
||||
Check for duplicate paramter names in arrow functions.
|
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
Copyright (C) 2012-2018 by various contributors (see AUTHORS)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
269
node_modules/acorn-globals/node_modules/acorn/README.md
generated
vendored
Normal file
269
node_modules/acorn-globals/node_modules/acorn/README.md
generated
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
# Acorn
|
||||
|
||||
A tiny, fast JavaScript parser written in JavaScript.
|
||||
|
||||
## Community
|
||||
|
||||
Acorn is open source software released under an
|
||||
[MIT license](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE).
|
||||
|
||||
You are welcome to
|
||||
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
|
||||
requests on [github](https://github.com/acornjs/acorn). For questions
|
||||
and discussion, please use the
|
||||
[Tern discussion forum](https://discuss.ternjs.net).
|
||||
|
||||
## Installation
|
||||
|
||||
The easiest way to install acorn is from [`npm`](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
npm install acorn
|
||||
```
|
||||
|
||||
Alternately, you can download the source and build acorn yourself:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/acornjs/acorn.git
|
||||
cd acorn
|
||||
npm install
|
||||
```
|
||||
|
||||
## Interface
|
||||
|
||||
**parse**`(input, options)` is the main interface to the library. The
|
||||
`input` parameter is a string, `options` can be undefined or an object
|
||||
setting some of the options listed below. The return value will be an
|
||||
abstract syntax tree object as specified by the [ESTree
|
||||
spec](https://github.com/estree/estree).
|
||||
|
||||
```javascript
|
||||
let acorn = require("acorn");
|
||||
console.log(acorn.parse("1 + 1"));
|
||||
```
|
||||
|
||||
When encountering a syntax error, the parser will raise a
|
||||
`SyntaxError` object with a meaningful message. The error object will
|
||||
have a `pos` property that indicates the string offset at which the
|
||||
error occurred, and a `loc` object that contains a `{line, column}`
|
||||
object referring to that same position.
|
||||
|
||||
Options can be provided by passing a second argument, which should be
|
||||
an object containing any of these fields:
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||
either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019) or 11
|
||||
(2020, partial support). This influences support for strict mode,
|
||||
the set of reserved words, and support for new syntax features.
|
||||
Default is 10.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features can be implemented
|
||||
through plugins.
|
||||
|
||||
- **sourceType**: Indicate the mode the code should be parsed in. Can be
|
||||
either `"script"` or `"module"`. This influences global strict mode
|
||||
and parsing of `import` and `export` declarations.
|
||||
|
||||
**NOTE**: If set to `"module"`, then static `import` / `export` syntax
|
||||
will be valid, even if `ecmaVersion` is less than 6.
|
||||
|
||||
- **onInsertedSemicolon**: If given a callback, that callback will be
|
||||
called whenever a missing semicolon is inserted by the parser. The
|
||||
callback will be given the character offset of the point where the
|
||||
semicolon is inserted as argument, and if `locations` is on, also a
|
||||
`{line, column}` object representing this position.
|
||||
|
||||
- **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing
|
||||
commas.
|
||||
|
||||
- **allowReserved**: If `false`, using a reserved word will generate
|
||||
an error. Defaults to `true` for `ecmaVersion` 3, `false` for higher
|
||||
versions. When given the value `"never"`, reserved words and
|
||||
keywords can also not be used as property names (as in Internet
|
||||
Explorer's old parser).
|
||||
|
||||
- **allowReturnOutsideFunction**: By default, a return statement at
|
||||
the top level raises an error. Set this to `true` to accept such
|
||||
code.
|
||||
|
||||
- **allowImportExportEverywhere**: By default, `import` and `export`
|
||||
declarations can only appear at a program's top level. Setting this
|
||||
option to `true` allows them anywhere where a statement is allowed.
|
||||
|
||||
- **allowAwaitOutsideFunction**: By default, `await` expressions can
|
||||
only appear inside `async` functions. Setting this option to
|
||||
`true` allows to have top-level `await` expressions. They are
|
||||
still not allowed in non-`async` functions, though.
|
||||
|
||||
- **allowHashBang**: When this is enabled (off by default), if the
|
||||
code starts with the characters `#!` (as in a shellscript), the
|
||||
first line will be treated as a comment.
|
||||
|
||||
- **locations**: When `true`, each node has a `loc` object attached
|
||||
with `start` and `end` subobjects, each of which contains the
|
||||
one-based line and zero-based column numbers in `{line, column}`
|
||||
form. Default is `false`.
|
||||
|
||||
- **onToken**: If a function is passed for this option, each found
|
||||
token will be passed in same format as tokens returned from
|
||||
`tokenizer().getToken()`.
|
||||
|
||||
If array is passed, each found token is pushed to it.
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **onComment**: If a function is passed for this option, whenever a
|
||||
comment is encountered the function will be called with the
|
||||
following parameters:
|
||||
|
||||
- `block`: `true` if the comment is a block comment, false if it
|
||||
is a line comment.
|
||||
- `text`: The content of the comment.
|
||||
- `start`: Character offset of the start of the comment.
|
||||
- `end`: Character offset of the end of the comment.
|
||||
|
||||
When the `locations` options is on, the `{line, column}` locations
|
||||
of the comment’s start and end are passed as two additional
|
||||
parameters.
|
||||
|
||||
If array is passed for this option, each found comment is pushed
|
||||
to it as object in Esprima format:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"type": "Line" | "Block",
|
||||
"value": "comment text",
|
||||
"start": Number,
|
||||
"end": Number,
|
||||
// If `locations` option is on:
|
||||
"loc": {
|
||||
"start": {line: Number, column: Number}
|
||||
"end": {line: Number, column: Number}
|
||||
},
|
||||
// If `ranges` option is on:
|
||||
"range": [Number, Number]
|
||||
}
|
||||
```
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **ranges**: Nodes have their start and end characters offsets
|
||||
recorded in `start` and `end` properties (directly on the node,
|
||||
rather than the `loc` object, which holds line/column data. To also
|
||||
add a
|
||||
[semi-standardized](https://bugzilla.mozilla.org/show_bug.cgi?id=745678)
|
||||
`range` property holding a `[start, end]` array with the same
|
||||
numbers, set the `ranges` option to `true`.
|
||||
|
||||
- **program**: It is possible to parse multiple files into a single
|
||||
AST by passing the tree produced by parsing the first file as the
|
||||
`program` option in subsequent parses. This will add the toplevel
|
||||
forms of the parsed file to the "Program" (top) node of an existing
|
||||
parse tree.
|
||||
|
||||
- **sourceFile**: When the `locations` option is `true`, you can pass
|
||||
this option to add a `source` attribute in every node’s `loc`
|
||||
object. Note that the contents of this option are not examined or
|
||||
processed in any way; you are free to use whatever format you
|
||||
choose.
|
||||
|
||||
- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property
|
||||
will be added (regardless of the `location` option) directly to the
|
||||
nodes, rather than the `loc` object.
|
||||
|
||||
- **preserveParens**: If this option is `true`, parenthesized expressions
|
||||
are represented by (non-standard) `ParenthesizedExpression` nodes
|
||||
that have a single `expression` property containing the expression
|
||||
inside parentheses.
|
||||
|
||||
**parseExpressionAt**`(input, offset, options)` will parse a single
|
||||
expression in a string, and return its AST. It will not complain if
|
||||
there is more of the string left after the expression.
|
||||
|
||||
**tokenizer**`(input, options)` returns an object with a `getToken`
|
||||
method that can be called repeatedly to get the next token, a `{start,
|
||||
end, type, value}` object (with added `loc` property when the
|
||||
`locations` option is enabled and `range` property when the `ranges`
|
||||
option is enabled). When the token's type is `tokTypes.eof`, you
|
||||
should stop calling the method, since it will keep returning that same
|
||||
token forever.
|
||||
|
||||
In ES6 environment, returned result can be used as any other
|
||||
protocol-compliant iterable:
|
||||
|
||||
```javascript
|
||||
for (let token of acorn.tokenizer(str)) {
|
||||
// iterate over the tokens
|
||||
}
|
||||
|
||||
// transform code to array of tokens:
|
||||
var tokens = [...acorn.tokenizer(str)];
|
||||
```
|
||||
|
||||
**tokTypes** holds an object mapping names to the token type objects
|
||||
that end up in the `type` properties of tokens.
|
||||
|
||||
**getLineInfo**`(input, offset)` can be used to get a `{line,
|
||||
column}` object for a given program string and offset.
|
||||
|
||||
### The `Parser` class
|
||||
|
||||
Instances of the **`Parser`** class contain all the state and logic
|
||||
that drives a parse. It has static methods `parse`,
|
||||
`parseExpressionAt`, and `tokenizer` that match the top-level
|
||||
functions by the same name.
|
||||
|
||||
When extending the parser with plugins, you need to call these methods
|
||||
on the extended version of the class. To extend a parser with plugins,
|
||||
you can use its static `extend` method.
|
||||
|
||||
```javascript
|
||||
var acorn = require("acorn");
|
||||
var jsx = require("acorn-jsx");
|
||||
var JSXParser = acorn.Parser.extend(jsx());
|
||||
JSXParser.parse("foo(<bar/>)");
|
||||
```
|
||||
|
||||
The `extend` method takes any number of plugin values, and returns a
|
||||
new `Parser` class that includes the extra parser logic provided by
|
||||
the plugins.
|
||||
|
||||
## Command line interface
|
||||
|
||||
The `bin/acorn` utility can be used to parse a file from the command
|
||||
line. It accepts as arguments its input file and the following
|
||||
options:
|
||||
|
||||
- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version
|
||||
to parse. Default is version 9.
|
||||
|
||||
- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise.
|
||||
|
||||
- `--locations`: Attaches a "loc" object to each node with "start" and
|
||||
"end" subobjects, each of which contains the one-based line and
|
||||
zero-based column numbers in `{line, column}` form.
|
||||
|
||||
- `--allow-hash-bang`: If the code starts with the characters #! (as
|
||||
in a shellscript), the first line will be treated as a comment.
|
||||
|
||||
- `--compact`: No whitespace is used in the AST output.
|
||||
|
||||
- `--silent`: Do not output the AST, just return the exit status.
|
||||
|
||||
- `--help`: Print the usage information and quit.
|
||||
|
||||
The utility spits out the syntax tree as JSON data.
|
||||
|
||||
## Existing plugins
|
||||
|
||||
- [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx)
|
||||
|
||||
Plugins for ECMAScript proposals:
|
||||
|
||||
- [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling:
|
||||
- [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields)
|
||||
- [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta)
|
||||
- [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)n
|
4
node_modules/acorn-globals/node_modules/acorn/bin/acorn
generated
vendored
Normal file
4
node_modules/acorn-globals/node_modules/acorn/bin/acorn
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
require('../dist/bin.js');
|
209
node_modules/acorn-globals/node_modules/acorn/dist/acorn.d.ts
generated
vendored
Normal file
209
node_modules/acorn-globals/node_modules/acorn/dist/acorn.d.ts
generated
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
export as namespace acorn
|
||||
export = acorn
|
||||
|
||||
declare namespace acorn {
|
||||
function parse(input: string, options?: Options): Node
|
||||
|
||||
function parseExpressionAt(input: string, pos?: number, options?: Options): Node
|
||||
|
||||
function tokenizer(input: string, options?: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
|
||||
interface Options {
|
||||
ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
|
||||
sourceType?: 'script' | 'module'
|
||||
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
allowReserved?: boolean | 'never'
|
||||
allowReturnOutsideFunction?: boolean
|
||||
allowImportExportEverywhere?: boolean
|
||||
allowAwaitOutsideFunction?: boolean
|
||||
allowHashBang?: boolean
|
||||
locations?: boolean
|
||||
onToken?: ((token: Token) => any) | Token[]
|
||||
onComment?: ((
|
||||
isBlock: boolean, text: string, start: number, end: number, startLoc?: Position,
|
||||
endLoc?: Position
|
||||
) => void) | Comment[]
|
||||
ranges?: boolean
|
||||
program?: Node
|
||||
sourceFile?: string
|
||||
directSourceFile?: string
|
||||
preserveParens?: boolean
|
||||
}
|
||||
|
||||
class Parser {
|
||||
constructor(options: Options, input: string, startPos?: number)
|
||||
parse(this: Parser): Node
|
||||
static parse(this: typeof Parser, input: string, options?: Options): Node
|
||||
static parseExpressionAt(this: typeof Parser, input: string, pos: number, options?: Options): Node
|
||||
static tokenizer(this: typeof Parser, input: string, options?: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
static extend(this: typeof Parser, ...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser
|
||||
}
|
||||
|
||||
interface Position { line: number; column: number; offset: number }
|
||||
|
||||
const defaultOptions: Options
|
||||
|
||||
function getLineInfo(input: string, offset: number): Position
|
||||
|
||||
class SourceLocation {
|
||||
start: Position
|
||||
end: Position
|
||||
source?: string | null
|
||||
constructor(p: Parser, start: Position, end: Position)
|
||||
}
|
||||
|
||||
class Node {
|
||||
type: string
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
sourceFile?: string
|
||||
range?: [number, number]
|
||||
constructor(parser: Parser, pos: number, loc?: SourceLocation)
|
||||
}
|
||||
|
||||
class TokenType {
|
||||
label: string
|
||||
keyword: string
|
||||
beforeExpr: boolean
|
||||
startsExpr: boolean
|
||||
isLoop: boolean
|
||||
isAssign: boolean
|
||||
prefix: boolean
|
||||
postfix: boolean
|
||||
binop: number
|
||||
updateContext?: (prevType: TokenType) => void
|
||||
constructor(label: string, conf?: any)
|
||||
}
|
||||
|
||||
const tokTypes: {
|
||||
num: TokenType
|
||||
regexp: TokenType
|
||||
string: TokenType
|
||||
name: TokenType
|
||||
eof: TokenType
|
||||
bracketL: TokenType
|
||||
bracketR: TokenType
|
||||
braceL: TokenType
|
||||
braceR: TokenType
|
||||
parenL: TokenType
|
||||
parenR: TokenType
|
||||
comma: TokenType
|
||||
semi: TokenType
|
||||
colon: TokenType
|
||||
dot: TokenType
|
||||
question: TokenType
|
||||
arrow: TokenType
|
||||
template: TokenType
|
||||
ellipsis: TokenType
|
||||
backQuote: TokenType
|
||||
dollarBraceL: TokenType
|
||||
eq: TokenType
|
||||
assign: TokenType
|
||||
incDec: TokenType
|
||||
prefix: TokenType
|
||||
logicalOR: TokenType
|
||||
logicalAND: TokenType
|
||||
bitwiseOR: TokenType
|
||||
bitwiseXOR: TokenType
|
||||
bitwiseAND: TokenType
|
||||
equality: TokenType
|
||||
relational: TokenType
|
||||
bitShift: TokenType
|
||||
plusMin: TokenType
|
||||
modulo: TokenType
|
||||
star: TokenType
|
||||
slash: TokenType
|
||||
starstar: TokenType
|
||||
_break: TokenType
|
||||
_case: TokenType
|
||||
_catch: TokenType
|
||||
_continue: TokenType
|
||||
_debugger: TokenType
|
||||
_default: TokenType
|
||||
_do: TokenType
|
||||
_else: TokenType
|
||||
_finally: TokenType
|
||||
_for: TokenType
|
||||
_function: TokenType
|
||||
_if: TokenType
|
||||
_return: TokenType
|
||||
_switch: TokenType
|
||||
_throw: TokenType
|
||||
_try: TokenType
|
||||
_var: TokenType
|
||||
_const: TokenType
|
||||
_while: TokenType
|
||||
_with: TokenType
|
||||
_new: TokenType
|
||||
_this: TokenType
|
||||
_super: TokenType
|
||||
_class: TokenType
|
||||
_extends: TokenType
|
||||
_export: TokenType
|
||||
_import: TokenType
|
||||
_null: TokenType
|
||||
_true: TokenType
|
||||
_false: TokenType
|
||||
_in: TokenType
|
||||
_instanceof: TokenType
|
||||
_typeof: TokenType
|
||||
_void: TokenType
|
||||
_delete: TokenType
|
||||
}
|
||||
|
||||
class TokContext {
|
||||
constructor(token: string, isExpr: boolean, preserveSpace: boolean, override?: (p: Parser) => void)
|
||||
}
|
||||
|
||||
const tokContexts: {
|
||||
b_stat: TokContext
|
||||
b_expr: TokContext
|
||||
b_tmpl: TokContext
|
||||
p_stat: TokContext
|
||||
p_expr: TokContext
|
||||
q_tmpl: TokContext
|
||||
f_expr: TokContext
|
||||
}
|
||||
|
||||
function isIdentifierStart(code: number, astral?: boolean): boolean
|
||||
|
||||
function isIdentifierChar(code: number, astral?: boolean): boolean
|
||||
|
||||
interface AbstractToken {
|
||||
}
|
||||
|
||||
interface Comment extends AbstractToken {
|
||||
type: string
|
||||
value: string
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
range?: [number, number]
|
||||
}
|
||||
|
||||
class Token {
|
||||
type: TokenType
|
||||
value: any
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
range?: [number, number]
|
||||
constructor(p: Parser)
|
||||
}
|
||||
|
||||
function isNewLine(code: number): boolean
|
||||
|
||||
const lineBreak: RegExp
|
||||
|
||||
const lineBreakG: RegExp
|
||||
|
||||
const version: string
|
||||
}
|
5186
node_modules/acorn-globals/node_modules/acorn/dist/acorn.js
generated
vendored
Normal file
5186
node_modules/acorn-globals/node_modules/acorn/dist/acorn.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/acorn-globals/node_modules/acorn/dist/acorn.js.map
generated
vendored
Normal file
1
node_modules/acorn-globals/node_modules/acorn/dist/acorn.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5155
node_modules/acorn-globals/node_modules/acorn/dist/acorn.mjs
generated
vendored
Normal file
5155
node_modules/acorn-globals/node_modules/acorn/dist/acorn.mjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/acorn-globals/node_modules/acorn/dist/acorn.mjs.d.ts
generated
vendored
Normal file
2
node_modules/acorn-globals/node_modules/acorn/dist/acorn.mjs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import * as acorn from "./acorn";
|
||||
export = acorn;
|
1
node_modules/acorn-globals/node_modules/acorn/dist/acorn.mjs.map
generated
vendored
Normal file
1
node_modules/acorn-globals/node_modules/acorn/dist/acorn.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
64
node_modules/acorn-globals/node_modules/acorn/dist/bin.js
generated
vendored
Normal file
64
node_modules/acorn-globals/node_modules/acorn/dist/bin.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var acorn = require('./acorn.js');
|
||||
|
||||
var infile, forceFile, silent = false, compact = false, tokenize = false;
|
||||
var options = {};
|
||||
|
||||
function help(status) {
|
||||
var print = (status === 0) ? console.log : console.error;
|
||||
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
|
||||
print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]");
|
||||
process.exit(status);
|
||||
}
|
||||
|
||||
for (var i = 2; i < process.argv.length; ++i) {
|
||||
var arg = process.argv[i];
|
||||
if ((arg === "-" || arg[0] !== "-") && !infile) { infile = arg; }
|
||||
else if (arg === "--" && !infile && i + 2 === process.argv.length) { forceFile = infile = process.argv[++i]; }
|
||||
else if (arg === "--locations") { options.locations = true; }
|
||||
else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
|
||||
else if (arg === "--silent") { silent = true; }
|
||||
else if (arg === "--compact") { compact = true; }
|
||||
else if (arg === "--help") { help(0); }
|
||||
else if (arg === "--tokenize") { tokenize = true; }
|
||||
else if (arg === "--module") { options.sourceType = "module"; }
|
||||
else {
|
||||
var match = arg.match(/^--ecma(\d+)$/);
|
||||
if (match)
|
||||
{ options.ecmaVersion = +match[1]; }
|
||||
else
|
||||
{ help(1); }
|
||||
}
|
||||
}
|
||||
|
||||
function run(code) {
|
||||
var result;
|
||||
try {
|
||||
if (!tokenize) {
|
||||
result = acorn.parse(code, options);
|
||||
} else {
|
||||
result = [];
|
||||
var tokenizer = acorn.tokenizer(code, options), token;
|
||||
do {
|
||||
token = tokenizer.getToken();
|
||||
result.push(token);
|
||||
} while (token.type !== acorn.tokTypes.eof)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(infile && infile !== "-" ? e.message.replace(/\(\d+:\d+\)$/, function (m) { return m.slice(0, 1) + infile + " " + m.slice(1); }) : e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
|
||||
}
|
||||
|
||||
if (forceFile || infile && infile !== "-") {
|
||||
run(fs.readFileSync(infile, "utf8"));
|
||||
} else {
|
||||
var code = "";
|
||||
process.stdin.resume();
|
||||
process.stdin.on("data", function (chunk) { return code += chunk; });
|
||||
process.stdin.on("end", function () { return run(code); });
|
||||
}
|
67
node_modules/acorn-globals/node_modules/acorn/package.json
generated
vendored
Normal file
67
node_modules/acorn-globals/node_modules/acorn/package.json
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"_from": "acorn@^7.1.1",
|
||||
"_id": "acorn@7.4.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
|
||||
"_location": "/acorn-globals/acorn",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "acorn@^7.1.1",
|
||||
"name": "acorn",
|
||||
"escapedName": "acorn",
|
||||
"rawSpec": "^7.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/acorn-globals"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
|
||||
"_shasum": "feaed255973d2e77555b83dbc08851a6c63520fa",
|
||||
"_spec": "acorn@^7.1.1",
|
||||
"_where": "D:\\Projects\\minifyfromhtml\\node_modules\\acorn-globals",
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/acornjs/acorn/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "ECMAScript parser",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
},
|
||||
"homepage": "https://github.com/acornjs/acorn",
|
||||
"license": "MIT",
|
||||
"main": "dist/acorn.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Marijn Haverbeke",
|
||||
"email": "marijnh@gmail.com",
|
||||
"url": "https://marijnhaverbeke.nl"
|
||||
},
|
||||
{
|
||||
"name": "Ingvar Stepanyan",
|
||||
"email": "me@rreverser.com",
|
||||
"url": "https://rreverser.com/"
|
||||
},
|
||||
{
|
||||
"name": "Adrian Heine",
|
||||
"url": "http://adrianheine.de"
|
||||
}
|
||||
],
|
||||
"module": "dist/acorn.mjs",
|
||||
"name": "acorn",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/acornjs/acorn.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "cd ..; npm run build:main && npm run build:bin"
|
||||
},
|
||||
"types": "dist/acorn.d.ts",
|
||||
"version": "7.4.1"
|
||||
}
|
112
node_modules/acorn/CHANGELOG.md
generated
vendored
112
node_modules/acorn/CHANGELOG.md
generated
vendored
@@ -1,3 +1,115 @@
|
||||
## 8.2.4 (2021-05-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix spec conformity in corner case 'for await (async of ...)'.
|
||||
|
||||
## 8.2.3 (2021-05-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix an issue where the library couldn't parse 'for (async of ...)'.
|
||||
|
||||
Fix a bug in UTF-16 decoding that would read characters incorrectly in some circumstances.
|
||||
|
||||
## 8.2.2 (2021-04-29)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a bug where a class field initialized to an async arrow function wouldn't allow await inside it. Same issue existed for generator arrow functions with yield.
|
||||
|
||||
## 8.2.1 (2021-04-24)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a regression introduced in 8.2.0 where static or async class methods with keyword names fail to parse.
|
||||
|
||||
## 8.2.0 (2021-04-24)
|
||||
|
||||
### New features
|
||||
|
||||
Add support for ES2022 class fields and private methods.
|
||||
|
||||
## 8.1.1 (2021-04-12)
|
||||
|
||||
### Various
|
||||
|
||||
Stop shipping source maps in the NPM package.
|
||||
|
||||
## 8.1.0 (2021-03-09)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a spurious error in nested destructuring arrays.
|
||||
|
||||
### New features
|
||||
|
||||
Expose `allowAwaitOutsideFunction` in CLI interface.
|
||||
|
||||
Make `allowImportExportAnywhere` also apply to `import.meta`.
|
||||
|
||||
## 8.0.5 (2021-01-25)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Adjust package.json to work with Node 12.16.0 and 13.0-13.6.
|
||||
|
||||
## 8.0.4 (2020-10-05)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Make `await x ** y` an error, following the spec.
|
||||
|
||||
Fix potentially exponential regular expression.
|
||||
|
||||
## 8.0.3 (2020-10-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a wasteful loop during `Parser` creation when setting `ecmaVersion` to `"latest"`.
|
||||
|
||||
## 8.0.2 (2020-09-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Make the TypeScript types reflect the current allowed values for `ecmaVersion`.
|
||||
|
||||
Fix another regexp/division tokenizer issue.
|
||||
|
||||
## 8.0.1 (2020-08-12)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Provide the correct value in the `version` export.
|
||||
|
||||
## 8.0.0 (2020-08-12)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow expressions like `(a = b) = c`.
|
||||
|
||||
Make non-octal escape sequences a syntax error in strict mode.
|
||||
|
||||
### New features
|
||||
|
||||
The package can now be loaded directly as an ECMAScript module in node 13+.
|
||||
|
||||
Update to the set of Unicode properties from ES2021.
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The `ecmaVersion` option is now required. For the moment, omitting it will still work with a warning, but that will change in a future release.
|
||||
|
||||
Some changes to method signatures that may be used by plugins.
|
||||
|
||||
## 7.4.0 (2020-08-03)
|
||||
|
||||
### New features
|
||||
|
||||
Add support for logical assignment operators.
|
||||
|
||||
Add support for numeric separators.
|
||||
|
||||
## 7.3.1 (2020-06-11)
|
||||
|
||||
### Bug fixes
|
||||
|
4
node_modules/acorn/LICENSE
generated
vendored
4
node_modules/acorn/LICENSE
generated
vendored
@@ -1,4 +1,6 @@
|
||||
Copyright (C) 2012-2018 by various contributors (see AUTHORS)
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2012-2020 by various contributors (see AUTHORS)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
37
node_modules/acorn/README.md
generated
vendored
37
node_modules/acorn/README.md
generated
vendored
@@ -32,14 +32,14 @@ npm install
|
||||
## Interface
|
||||
|
||||
**parse**`(input, options)` is the main interface to the library. The
|
||||
`input` parameter is a string, `options` can be undefined or an object
|
||||
setting some of the options listed below. The return value will be an
|
||||
abstract syntax tree object as specified by the [ESTree
|
||||
`input` parameter is a string, `options` must be an object setting
|
||||
some of the options listed below. The return value will be an abstract
|
||||
syntax tree object as specified by the [ESTree
|
||||
spec](https://github.com/estree/estree).
|
||||
|
||||
```javascript
|
||||
let acorn = require("acorn");
|
||||
console.log(acorn.parse("1 + 1"));
|
||||
console.log(acorn.parse("1 + 1", {ecmaVersion: 2020}));
|
||||
```
|
||||
|
||||
When encountering a syntax error, the parser will raise a
|
||||
@@ -48,18 +48,19 @@ have a `pos` property that indicates the string offset at which the
|
||||
error occurred, and a `loc` object that contains a `{line, column}`
|
||||
object referring to that same position.
|
||||
|
||||
Options can be provided by passing a second argument, which should be
|
||||
an object containing any of these fields:
|
||||
Options are provided by in a second argument, which should be an
|
||||
object containing any of these fields (only `ecmaVersion` is
|
||||
required):
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||
either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019) or 11
|
||||
(2020, partial support). This influences support for strict mode,
|
||||
the set of reserved words, and support for new syntax features.
|
||||
Default is 10.
|
||||
either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019),
|
||||
11 (2020), or 12 (2021, partial support), or `"latest"` (the latest
|
||||
the library supports). This influences support for strict mode, the
|
||||
set of reserved words, and support for new syntax features.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features can be implemented
|
||||
through plugins.
|
||||
implemented by Acorn. Other proposed new features must be
|
||||
implemented through plugins.
|
||||
|
||||
- **sourceType**: Indicate the mode the code should be parsed in. Can be
|
||||
either `"script"` or `"module"`. This influences global strict mode
|
||||
@@ -89,8 +90,10 @@ an object containing any of these fields:
|
||||
|
||||
- **allowImportExportEverywhere**: By default, `import` and `export`
|
||||
declarations can only appear at a program's top level. Setting this
|
||||
option to `true` allows them anywhere where a statement is allowed.
|
||||
|
||||
option to `true` allows them anywhere where a statement is allowed,
|
||||
and also allows `import.meta` expressions to appear in scripts
|
||||
(when `sourceType` is not `"module"`).
|
||||
|
||||
- **allowAwaitOutsideFunction**: By default, `await` expressions can
|
||||
only appear inside `async` functions. Setting this option to
|
||||
`true` allows to have top-level `await` expressions. They are
|
||||
@@ -224,7 +227,7 @@ you can use its static `extend` method.
|
||||
var acorn = require("acorn");
|
||||
var jsx = require("acorn-jsx");
|
||||
var JSXParser = acorn.Parser.extend(jsx());
|
||||
JSXParser.parse("foo(<bar/>)");
|
||||
JSXParser.parse("foo(<bar/>)", {ecmaVersion: 2020});
|
||||
```
|
||||
|
||||
The `extend` method takes any number of plugin values, and returns a
|
||||
@@ -249,6 +252,9 @@ options:
|
||||
- `--allow-hash-bang`: If the code starts with the characters #! (as
|
||||
in a shellscript), the first line will be treated as a comment.
|
||||
|
||||
- `--allow-await-outside-function`: Allows top-level `await` expressions.
|
||||
See the `allowAwaitOutsideFunction` option for more information.
|
||||
|
||||
- `--compact`: No whitespace is used in the AST output.
|
||||
|
||||
- `--silent`: Do not output the AST, just return the exit status.
|
||||
@@ -266,5 +272,4 @@ Plugins for ECMAScript proposals:
|
||||
- [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling:
|
||||
- [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields)
|
||||
- [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta)
|
||||
- [`acorn-numeric-separator`](https://github.com/acornjs/acorn-numeric-separator): Parse [numeric separator proposal](https://github.com/tc39/proposal-numeric-separator)
|
||||
- [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)n
|
||||
|
15
node_modules/acorn/dist/acorn.d.ts
generated
vendored
15
node_modules/acorn/dist/acorn.d.ts
generated
vendored
@@ -2,17 +2,17 @@ export as namespace acorn
|
||||
export = acorn
|
||||
|
||||
declare namespace acorn {
|
||||
function parse(input: string, options?: Options): Node
|
||||
function parse(input: string, options: Options): Node
|
||||
|
||||
function parseExpressionAt(input: string, pos?: number, options?: Options): Node
|
||||
function parseExpressionAt(input: string, pos: number, options: Options): Node
|
||||
|
||||
function tokenizer(input: string, options?: Options): {
|
||||
function tokenizer(input: string, options: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
|
||||
interface Options {
|
||||
ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
|
||||
ecmaVersion: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 'latest'
|
||||
sourceType?: 'script' | 'module'
|
||||
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
@@ -37,9 +37,9 @@ declare namespace acorn {
|
||||
class Parser {
|
||||
constructor(options: Options, input: string, startPos?: number)
|
||||
parse(this: Parser): Node
|
||||
static parse(this: typeof Parser, input: string, options?: Options): Node
|
||||
static parseExpressionAt(this: typeof Parser, input: string, pos: number, options?: Options): Node
|
||||
static tokenizer(this: typeof Parser, input: string, options?: Options): {
|
||||
static parse(this: typeof Parser, input: string, options: Options): Node
|
||||
static parseExpressionAt(this: typeof Parser, input: string, pos: number, options: Options): Node
|
||||
static tokenizer(this: typeof Parser, input: string, options: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
@@ -88,6 +88,7 @@ declare namespace acorn {
|
||||
regexp: TokenType
|
||||
string: TokenType
|
||||
name: TokenType
|
||||
privateId: TokenType
|
||||
eof: TokenType
|
||||
bracketL: TokenType
|
||||
bracketR: TokenType
|
||||
|
738
node_modules/acorn/dist/acorn.js
generated
vendored
738
node_modules/acorn/dist/acorn.js
generated
vendored
File diff suppressed because it is too large
Load Diff
1
node_modules/acorn/dist/acorn.js.map
generated
vendored
1
node_modules/acorn/dist/acorn.js.map
generated
vendored
File diff suppressed because one or more lines are too long
738
node_modules/acorn/dist/acorn.mjs
generated
vendored
738
node_modules/acorn/dist/acorn.mjs
generated
vendored
File diff suppressed because it is too large
Load Diff
1
node_modules/acorn/dist/acorn.mjs.map
generated
vendored
1
node_modules/acorn/dist/acorn.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
3
node_modules/acorn/dist/bin.js
generated
vendored
3
node_modules/acorn/dist/bin.js
generated
vendored
@@ -10,7 +10,7 @@ var options = {};
|
||||
function help(status) {
|
||||
var print = (status === 0) ? console.log : console.error;
|
||||
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
|
||||
print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]");
|
||||
print(" [--tokenize] [--locations] [---allow-hash-bang] [--allow-await-outside-function] [--compact] [--silent] [--module] [--help] [--] [infile]");
|
||||
process.exit(status);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ for (var i = 2; i < process.argv.length; ++i) {
|
||||
else if (arg === "--" && !infile && i + 2 === process.argv.length) { forceFile = infile = process.argv[++i]; }
|
||||
else if (arg === "--locations") { options.locations = true; }
|
||||
else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
|
||||
else if (arg === "--allow-await-outside-function") { options.allowAwaitOutsideFunction = true; }
|
||||
else if (arg === "--silent") { silent = true; }
|
||||
else if (arg === "--compact") { compact = true; }
|
||||
else if (arg === "--help") { help(0); }
|
||||
|
32
node_modules/acorn/package.json
generated
vendored
32
node_modules/acorn/package.json
generated
vendored
@@ -1,27 +1,26 @@
|
||||
{
|
||||
"_from": "acorn@^7.1.1",
|
||||
"_id": "acorn@7.3.1",
|
||||
"_from": "acorn@^8.1.0",
|
||||
"_id": "acorn@8.2.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA==",
|
||||
"_integrity": "sha512-Ibt84YwBDDA890eDiDCEqcbwvHlBvzzDkU2cGBBDDI1QWT12jTiXIOn2CIw5KK4i6N5Z2HUxwYjzriDyqaqqZg==",
|
||||
"_location": "/acorn",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "acorn@^7.1.1",
|
||||
"raw": "acorn@^8.1.0",
|
||||
"name": "acorn",
|
||||
"escapedName": "acorn",
|
||||
"rawSpec": "^7.1.1",
|
||||
"rawSpec": "^8.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.1.1"
|
||||
"fetchSpec": "^8.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/acorn-globals",
|
||||
"/jsdom"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.1.tgz",
|
||||
"_shasum": "85010754db53c3fbaf3b9ea3e083aa5c5d147ffd",
|
||||
"_spec": "acorn@^7.1.1",
|
||||
"_resolved": "https://registry.npmjs.org/acorn/-/acorn-8.2.4.tgz",
|
||||
"_shasum": "caba24b08185c3b56e3168e97d15ed17f4d31fd0",
|
||||
"_spec": "acorn@^8.1.0",
|
||||
"_where": "D:\\Projects\\minifyfromhtml\\node_modules\\jsdom",
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
@@ -35,6 +34,17 @@
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
},
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"import": "./dist/acorn.mjs",
|
||||
"require": "./dist/acorn.js",
|
||||
"default": "./dist/acorn.js"
|
||||
},
|
||||
"./dist/acorn.js"
|
||||
],
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"homepage": "https://github.com/acornjs/acorn",
|
||||
"license": "MIT",
|
||||
"main": "dist/acorn.js",
|
||||
@@ -64,5 +74,5 @@
|
||||
"prepare": "cd ..; npm run build:main && npm run build:bin"
|
||||
},
|
||||
"types": "dist/acorn.d.ts",
|
||||
"version": "7.3.1"
|
||||
"version": "8.2.4"
|
||||
}
|
||||
|
77
node_modules/ajv/README.md
generated
vendored
77
node_modules/ajv/README.md
generated
vendored
@@ -6,35 +6,63 @@ The fastest JSON Schema validator for Node.js and browser. Supports draft-04/06/
|
||||
|
||||
[](https://travis-ci.org/ajv-validator/ajv)
|
||||
[](https://www.npmjs.com/package/ajv)
|
||||
[](https://www.npmjs.com/package/ajv/v/7.0.0-beta.0)
|
||||
[](https://www.npmjs.com/package/ajv)
|
||||
[](https://coveralls.io/github/ajv-validator/ajv?branch=master)
|
||||
[](https://gitter.im/ajv-validator/ajv)
|
||||
[](https://github.com/sponsors/epoberezkin)
|
||||
|
||||
|
||||
## Ajv v7 beta is released
|
||||
|
||||
[Ajv version 7.0.0-beta.0](https://github.com/ajv-validator/ajv/tree/v7-beta) is released with these changes:
|
||||
|
||||
- to reduce the mistakes in JSON schemas and unexpected validation results, [strict mode](./docs/strict-mode.md) is added - it prohibits ignored or ambiguous JSON Schema elements.
|
||||
- to make code injection from untrusted schemas impossible, [code generation](./docs/codegen.md) is fully re-written to be safe.
|
||||
- to simplify Ajv extensions, the new keyword API that is used by pre-defined keywords is available to user-defined keywords - it is much easier to define any keywords now, especially with subschemas.
|
||||
- schemas are compiled to ES6 code (ES5 code generation is supported with an option).
|
||||
- to improve reliability and maintainability the code is migrated to TypeScript.
|
||||
|
||||
**Please note**:
|
||||
|
||||
- the support for JSON-Schema draft-04 is removed - if you have schemas using "id" attributes you have to replace them with "\$id" (or continue using version 6 that will be supported until 02/28/2021).
|
||||
- all formats are separated to ajv-formats package - they have to be explicitely added if you use them.
|
||||
|
||||
See [release notes](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.0) for the details.
|
||||
|
||||
To install the new version:
|
||||
|
||||
```bash
|
||||
npm install ajv@beta
|
||||
```
|
||||
|
||||
See [Getting started with v7](https://github.com/ajv-validator/ajv/tree/v7-beta#usage) for code example.
|
||||
|
||||
|
||||
## Mozilla MOSS grant and OpenJS Foundation
|
||||
|
||||
[<img src="https://www.poberezkin.com/images/mozilla.png" width="240" height="68">](https://www.mozilla.org/en-US/moss/) [<img src="https://www.poberezkin.com/images/openjs.png" width="220" height="68">](https://openjsf.org/blog/2020/08/14/ajv-joins-openjs-foundation-as-an-incubation-project/)
|
||||
|
||||
Ajv has been awarded a grant from Mozilla’s [Open Source Support (MOSS) program](https://www.mozilla.org/en-US/moss/) in the “Foundational Technology” track! It will sponsor the development of Ajv support of [JSON Schema version 2019-09](https://tools.ietf.org/html/draft-handrews-json-schema-02) and of [JSON Type Definition](https://tools.ietf.org/html/draft-ucarion-json-type-definition-04).
|
||||
|
||||
Ajv also joined [OpenJS Foundation](https://openjsf.org/) – having this support will help ensure the longevity and stability of Ajv for all its users.
|
||||
|
||||
This [blog post](https://www.poberezkin.com/posts/2020-08-14-ajv-json-validator-mozilla-open-source-grant-openjs-foundation.html) has more details.
|
||||
|
||||
I am looking for the long term maintainers of Ajv – working with [ReadySet](https://www.thereadyset.co/), also sponsored by Mozilla, to establish clear guidelines for the role of a "maintainer" and the contribution standards, and to encourage a wider, more inclusive, contribution from the community.
|
||||
|
||||
|
||||
## Please [sponsor Ajv development](https://github.com/sponsors/epoberezkin)
|
||||
|
||||
I will get straight to the point - I need your support to ensure that the development of Ajv continues.
|
||||
Since I asked to support Ajv development 40 people and 6 organizations contributed via GitHub and OpenCollective - this support helped receiving the MOSS grant!
|
||||
|
||||
I have developed Ajv for 5 years in my free time, but it is not sustainable. I'd appreciate if you consider supporting its further development with donations:
|
||||
Your continuing support is very important - the funds will be used to develop and maintain Ajv once the next major version is released.
|
||||
|
||||
Please sponsor Ajv via:
|
||||
- [GitHub sponsors page](https://github.com/sponsors/epoberezkin) (GitHub will match it)
|
||||
- [Ajv Open Collective️](https://opencollective.com/ajv)
|
||||
|
||||
There are many small and large improvements that are long due, including the support of the next versions of JSON Schema specification, improving website and documentation, and making Ajv more modular and maintainable to address its limitations - what Ajv needs to evolve is much more than what I can contribute in my free time.
|
||||
|
||||
I would also really appreciate any advice you could give on how to raise funds for Ajv development - whether some suitable open-source fund I could apply to or some sponsor I should approach.
|
||||
|
||||
Since 2015 Ajv has become widely used, thanks to your help and contributions:
|
||||
|
||||
- **90** contributors 🏗
|
||||
- **5,000** dependent npm packages ⚙️
|
||||
- **7,000** github stars, from GitHub users [all over the world](https://www.google.com/maps/d/u/0/viewer?mid=1MGRV8ciFUGIbO1l0EKFWNJGYE7iSkDxP&ll=-3.81666561775622e-14%2C4.821737100000007&z=2) ⭐️
|
||||
- **5,000,000** dependent repositories on GitHub 🚀
|
||||
- **120,000,000** npm downloads per month! 💯
|
||||
|
||||
I believe it would benefit all Ajv users to help put together the fund that will be used for its further development - it would allow to bring some additional maintainers to the project.
|
||||
|
||||
Thank you
|
||||
Thank you.
|
||||
|
||||
|
||||
#### Open Collective sponsors
|
||||
@@ -156,8 +184,6 @@ Performance of different validators by [json-schema-benchmark](https://github.co
|
||||
- [$data reference](#data-reference) to use values from the validated data as values for the schema keywords
|
||||
- [asynchronous validation](#asynchronous-validation) of custom formats and keywords
|
||||
|
||||
Currently Ajv is the only validator that passes all the tests from [JSON Schema Test Suite](https://github.com/json-schema/JSON-Schema-Test-Suite) (according to [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark), apart from the test that requires that `1.0` is not an integer that is impossible to satisfy in JavaScript).
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
@@ -330,7 +356,7 @@ There are two modes of format validation: `fast` and `full`. This mode affects f
|
||||
|
||||
You can add additional formats and replace any of the formats above using [addFormat](#api-addformat) method.
|
||||
|
||||
The option `unknownFormats` allows changing the default behaviour when an unknown format is encountered. In this case Ajv can either fail schema compilation (default) or ignore it (default in versions before 5.0.0). You also can whitelist specific format(s) to be ignored. See [Options](#options) for details.
|
||||
The option `unknownFormats` allows changing the default behaviour when an unknown format is encountered. In this case Ajv can either fail schema compilation (default) or ignore it (default in versions before 5.0.0). You also can allow specific format(s) that will be ignored. See [Options](#options) for details.
|
||||
|
||||
You can find regular expressions used for format validation and the sources that were used in [formats.js](https://github.com/ajv-validator/ajv/blob/master/lib/compile/formats.js).
|
||||
|
||||
@@ -1450,16 +1476,9 @@ Please see [Contributing guidelines](https://github.com/ajv-validator/ajv/blob/m
|
||||
|
||||
See https://github.com/ajv-validator/ajv/releases
|
||||
|
||||
__Please note__: [Changes in version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0).
|
||||
|
||||
[Version 5.0.0](https://github.com/ajv-validator/ajv/releases/tag/5.0.0).
|
||||
|
||||
[Version 4.0.0](https://github.com/ajv-validator/ajv/releases/tag/4.0.0).
|
||||
|
||||
[Version 3.0.0](https://github.com/ajv-validator/ajv/releases/tag/3.0.0).
|
||||
|
||||
[Version 2.0.0](https://github.com/ajv-validator/ajv/releases/tag/2.0.0).
|
||||
__Please note__: [Changes in version 7.0.0-beta](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.0)
|
||||
|
||||
[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0).
|
||||
|
||||
## Code of conduct
|
||||
|
||||
|
136
node_modules/ajv/dist/ajv.bundle.js
generated
vendored
136
node_modules/ajv/dist/ajv.bundle.js
generated
vendored
@@ -170,8 +170,8 @@ var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|
|
||||
// For the source: https://gist.github.com/dperini/729294
|
||||
// For test cases: https://mathiasbynens.be/demo/url-regex
|
||||
// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.
|
||||
// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
|
||||
var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
|
||||
// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
|
||||
var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
|
||||
var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
||||
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
||||
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
||||
@@ -193,8 +193,8 @@ formats.fast = {
|
||||
time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
|
||||
'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,
|
||||
// uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
|
||||
uri: /^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i,
|
||||
'uri-reference': /^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
||||
uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
|
||||
'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
||||
'uri-template': URITEMPLATE,
|
||||
url: URL,
|
||||
// email (sources from jsen validator):
|
||||
@@ -1827,7 +1827,7 @@ module.exports = function generate_allOf(it, $keyword, $ruleType) {
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
$allSchemasEmpty = false;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
@@ -1869,7 +1869,7 @@ module.exports = function generate_anyOf(it, $keyword, $ruleType) {
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $noEmptySchema = $schema.every(function($sch) {
|
||||
return (it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all));
|
||||
return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all));
|
||||
});
|
||||
if ($noEmptySchema) {
|
||||
var $currentBaseId = $it.baseId;
|
||||
@@ -2021,7 +2021,7 @@ module.exports = function generate_contains(it, $keyword, $ruleType) {
|
||||
$dataNxt = $it.dataLevel = it.dataLevel + 1,
|
||||
$nextData = 'data' + $dataNxt,
|
||||
$currentBaseId = it.baseId,
|
||||
$nonEmptySchema = (it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all));
|
||||
$nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all));
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
|
||||
if ($nonEmptySchema) {
|
||||
var $wasComposite = it.compositeRule;
|
||||
@@ -2459,7 +2459,7 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
|
||||
var $currentBaseId = $it.baseId;
|
||||
for (var $property in $schemaDeps) {
|
||||
var $sch = $schemaDeps[$property];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
|
||||
if ($ownProperties) {
|
||||
out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
|
||||
@@ -2721,8 +2721,8 @@ module.exports = function generate_if(it, $keyword, $ruleType) {
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $thenSch = it.schema['then'],
|
||||
$elseSch = it.schema['else'],
|
||||
$thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? typeof $thenSch == 'object' && Object.keys($thenSch).length > 0 : it.util.schemaHasRules($thenSch, it.RULES.all)),
|
||||
$elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? typeof $elseSch == 'object' && Object.keys($elseSch).length > 0 : it.util.schemaHasRules($elseSch, it.RULES.all)),
|
||||
$thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)),
|
||||
$elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)),
|
||||
$currentBaseId = $it.baseId;
|
||||
if ($thenPresent || $elsePresent) {
|
||||
var $ifClause;
|
||||
@@ -2912,7 +2912,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { ';
|
||||
var $passData = $data + '[' + $i + ']';
|
||||
$it.schema = $sch;
|
||||
@@ -2935,7 +2935,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0 : it.util.schemaHasRules($additionalItems, it.RULES.all))) {
|
||||
if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) {
|
||||
$it.schema = $additionalItems;
|
||||
$it.schemaPath = it.schemaPath + '.additionalItems';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
@@ -2959,7 +2959,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
} else if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
} else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
@@ -3082,7 +3082,7 @@ module.exports = function generate_not(it, $keyword, $ruleType) {
|
||||
var $it = it.util.copy(it);
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
@@ -3182,7 +3182,7 @@ module.exports = function generate_oneOf(it, $keyword, $ruleType) {
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
@@ -3497,7 +3497,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
while (i3 < l3) {
|
||||
$propertyKey = arr3[i3 += 1];
|
||||
var $sch = $schema[$propertyKey];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
var $prop = it.util.getProperty($propertyKey),
|
||||
$passData = $data + $prop,
|
||||
$hasDefault = $useDefaults && $sch.default !== undefined;
|
||||
@@ -3600,7 +3600,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
while (i4 < l4) {
|
||||
$pProperty = arr4[i4 += 1];
|
||||
var $sch = $pProperties[$pProperty];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
|
||||
$it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);
|
||||
@@ -3659,7 +3659,7 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
out += 'var ' + ($errs) + ' = errors;';
|
||||
if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
@@ -3882,7 +3882,7 @@ module.exports = function generate_required(it, $keyword, $ruleType) {
|
||||
while (i1 < l1) {
|
||||
$property = arr1[i1 += 1];
|
||||
var $propertySch = it.schema.properties[$property];
|
||||
if (!($propertySch && (it.opts.strictKeywords ? typeof $propertySch == 'object' && Object.keys($propertySch).length > 0 : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
|
||||
if (!($propertySch && (it.opts.strictKeywords ? (typeof $propertySch == 'object' && Object.keys($propertySch).length > 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
|
||||
$required[$required.length] = $property;
|
||||
}
|
||||
}
|
||||
@@ -4305,7 +4305,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema));
|
||||
it.baseId = it.baseId || it.rootId;
|
||||
delete it.isTop;
|
||||
it.dataPathArr = [undefined];
|
||||
it.dataPathArr = [""];
|
||||
if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
|
||||
var $defaultMsg = 'default is ignored in the schema root';
|
||||
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
|
||||
@@ -4367,43 +4367,35 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
if ($coerceToTypes) {
|
||||
var $dataType = 'dataType' + $lvl,
|
||||
$coerced = 'coerced' + $lvl;
|
||||
out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; ';
|
||||
out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; ';
|
||||
if (it.opts.coerceTypes == 'array') {
|
||||
out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ')) ' + ($dataType) + ' = \'array\'; ';
|
||||
out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ') && ' + ($data) + '.length == 1) { ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; if (' + (it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)) + ') ' + ($coerced) + ' = ' + ($data) + '; } ';
|
||||
}
|
||||
out += ' var ' + ($coerced) + ' = undefined; ';
|
||||
var $bracesCoercion = '';
|
||||
out += ' if (' + ($coerced) + ' !== undefined) ; ';
|
||||
var arr1 = $coerceToTypes;
|
||||
if (arr1) {
|
||||
var $type, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$type = arr1[$i += 1];
|
||||
if ($i) {
|
||||
out += ' if (' + ($coerced) + ' === undefined) { ';
|
||||
$bracesCoercion += '}';
|
||||
}
|
||||
if (it.opts.coerceTypes == 'array' && $type != 'array') {
|
||||
out += ' if (' + ($dataType) + ' == \'array\' && ' + ($data) + '.length == 1) { ' + ($coerced) + ' = ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; } ';
|
||||
}
|
||||
if ($type == 'string') {
|
||||
out += ' if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
|
||||
out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
|
||||
} else if ($type == 'number' || $type == 'integer') {
|
||||
out += ' if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
|
||||
out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
|
||||
if ($type == 'integer') {
|
||||
out += ' && !(' + ($data) + ' % 1)';
|
||||
}
|
||||
out += ')) ' + ($coerced) + ' = +' + ($data) + '; ';
|
||||
} else if ($type == 'boolean') {
|
||||
out += ' if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
|
||||
out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
|
||||
} else if ($type == 'null') {
|
||||
out += ' if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
|
||||
out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
|
||||
} else if (it.opts.coerceTypes == 'array' && $type == 'array') {
|
||||
out += ' if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
|
||||
out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
|
||||
}
|
||||
}
|
||||
}
|
||||
out += ' ' + ($bracesCoercion) + ' if (' + ($coerced) + ' === undefined) { ';
|
||||
out += ' else { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
@@ -4443,7 +4435,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } else { ';
|
||||
out += ' } if (' + ($coerced) + ' !== undefined) { ';
|
||||
var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
|
||||
$parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
|
||||
out += ' ' + ($data) + ' = ' + ($coerced) + '; ';
|
||||
@@ -5241,7 +5233,7 @@ function escapeJsonPtr(str) {
|
||||
}
|
||||
|
||||
},{}],45:[function(require,module,exports){
|
||||
/** @license URI.js v4.2.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
||||
/** @license URI.js v4.4.0 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
@@ -6204,9 +6196,9 @@ function _recomposeAuthority(components, options) {
|
||||
return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
|
||||
}));
|
||||
}
|
||||
if (typeof components.port === "number") {
|
||||
if (typeof components.port === "number" || typeof components.port === "string") {
|
||||
uriTokens.push(":");
|
||||
uriTokens.push(components.port.toString(10));
|
||||
uriTokens.push(String(components.port));
|
||||
}
|
||||
return uriTokens.length ? uriTokens.join("") : undefined;
|
||||
}
|
||||
@@ -6409,8 +6401,9 @@ var handler = {
|
||||
return components;
|
||||
},
|
||||
serialize: function serialize(components, options) {
|
||||
var secure = String(components.scheme).toLowerCase() === "https";
|
||||
//normalize the default port
|
||||
if (components.port === (String(components.scheme).toLowerCase() !== "https" ? 80 : 443) || components.port === "") {
|
||||
if (components.port === (secure ? 443 : 80) || components.port === "") {
|
||||
components.port = undefined;
|
||||
}
|
||||
//normalize the empty path
|
||||
@@ -6431,6 +6424,57 @@ var handler$1 = {
|
||||
serialize: handler.serialize
|
||||
};
|
||||
|
||||
function isSecure(wsComponents) {
|
||||
return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
|
||||
}
|
||||
//RFC 6455
|
||||
var handler$2 = {
|
||||
scheme: "ws",
|
||||
domainHost: true,
|
||||
parse: function parse(components, options) {
|
||||
var wsComponents = components;
|
||||
//indicate if the secure flag is set
|
||||
wsComponents.secure = isSecure(wsComponents);
|
||||
//construct resouce name
|
||||
wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
|
||||
wsComponents.path = undefined;
|
||||
wsComponents.query = undefined;
|
||||
return wsComponents;
|
||||
},
|
||||
serialize: function serialize(wsComponents, options) {
|
||||
//normalize the default port
|
||||
if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
|
||||
wsComponents.port = undefined;
|
||||
}
|
||||
//ensure scheme matches secure flag
|
||||
if (typeof wsComponents.secure === 'boolean') {
|
||||
wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
|
||||
wsComponents.secure = undefined;
|
||||
}
|
||||
//reconstruct path from resource name
|
||||
if (wsComponents.resourceName) {
|
||||
var _wsComponents$resourc = wsComponents.resourceName.split('?'),
|
||||
_wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
|
||||
path = _wsComponents$resourc2[0],
|
||||
query = _wsComponents$resourc2[1];
|
||||
|
||||
wsComponents.path = path && path !== '/' ? path : undefined;
|
||||
wsComponents.query = query;
|
||||
wsComponents.resourceName = undefined;
|
||||
}
|
||||
//forbid fragment component
|
||||
wsComponents.fragment = undefined;
|
||||
return wsComponents;
|
||||
}
|
||||
};
|
||||
|
||||
var handler$3 = {
|
||||
scheme: "wss",
|
||||
domainHost: handler$2.domainHost,
|
||||
parse: handler$2.parse,
|
||||
serialize: handler$2.serialize
|
||||
};
|
||||
|
||||
var O = {};
|
||||
var isIRI = true;
|
||||
//RFC 3986
|
||||
@@ -6461,7 +6505,7 @@ function decodeUnreserved(str) {
|
||||
var decStr = pctDecChars(str);
|
||||
return !decStr.match(UNRESERVED) ? str : decStr;
|
||||
}
|
||||
var handler$2 = {
|
||||
var handler$4 = {
|
||||
scheme: "mailto",
|
||||
parse: function parse$$1(components, options) {
|
||||
var mailtoComponents = components;
|
||||
@@ -6549,7 +6593,7 @@ var handler$2 = {
|
||||
|
||||
var URN_PARSE = /^([^\:]+)\:(.*)/;
|
||||
//RFC 2141
|
||||
var handler$3 = {
|
||||
var handler$5 = {
|
||||
scheme: "urn",
|
||||
parse: function parse$$1(components, options) {
|
||||
var matches = components.path && components.path.match(URN_PARSE);
|
||||
@@ -6588,7 +6632,7 @@ var handler$3 = {
|
||||
|
||||
var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
|
||||
//RFC 4122
|
||||
var handler$4 = {
|
||||
var handler$6 = {
|
||||
scheme: "urn:uuid",
|
||||
parse: function parse(urnComponents, options) {
|
||||
var uuidComponents = urnComponents;
|
||||
@@ -6612,6 +6656,8 @@ SCHEMES[handler$1.scheme] = handler$1;
|
||||
SCHEMES[handler$2.scheme] = handler$2;
|
||||
SCHEMES[handler$3.scheme] = handler$3;
|
||||
SCHEMES[handler$4.scheme] = handler$4;
|
||||
SCHEMES[handler$5.scheme] = handler$5;
|
||||
SCHEMES[handler$6.scheme] = handler$6;
|
||||
|
||||
exports.SCHEMES = SCHEMES;
|
||||
exports.pctEncChar = pctEncChar;
|
||||
|
4
node_modules/ajv/dist/ajv.min.js
generated
vendored
4
node_modules/ajv/dist/ajv.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/ajv/dist/ajv.min.js.map
generated
vendored
2
node_modules/ajv/dist/ajv.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/ajv/lib/ajv.d.ts
generated
vendored
1
node_modules/ajv/lib/ajv.d.ts
generated
vendored
@@ -137,6 +137,7 @@ declare namespace ajv {
|
||||
*/
|
||||
errorsText(errors?: Array<ErrorObject> | null, options?: ErrorsTextOptions): string;
|
||||
errors?: Array<ErrorObject> | null;
|
||||
_opts: Options;
|
||||
}
|
||||
|
||||
interface CustomLogger {
|
||||
|
8
node_modules/ajv/lib/compile/formats.js
generated
vendored
8
node_modules/ajv/lib/compile/formats.js
generated
vendored
@@ -13,8 +13,8 @@ var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|
|
||||
// For the source: https://gist.github.com/dperini/729294
|
||||
// For test cases: https://mathiasbynens.be/demo/url-regex
|
||||
// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.
|
||||
// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
|
||||
var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
|
||||
// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
|
||||
var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
|
||||
var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
||||
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
||||
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
||||
@@ -36,8 +36,8 @@ formats.fast = {
|
||||
time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
|
||||
'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,
|
||||
// uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
|
||||
uri: /^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i,
|
||||
'uri-reference': /^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
||||
uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
|
||||
'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
||||
'uri-template': URITEMPLATE,
|
||||
url: URL,
|
||||
// email (sources from jsen validator):
|
||||
|
46
node_modules/ajv/lib/dot/coerce.def
generated
vendored
46
node_modules/ajv/lib/dot/coerce.def
generated
vendored
@@ -4,55 +4,45 @@
|
||||
, $coerced = 'coerced' + $lvl;
|
||||
}}
|
||||
var {{=$dataType}} = typeof {{=$data}};
|
||||
{{? it.opts.coerceTypes == 'array'}}
|
||||
if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array';
|
||||
{{?}}
|
||||
|
||||
var {{=$coerced}} = undefined;
|
||||
|
||||
{{ var $bracesCoercion = ''; }}
|
||||
{{? it.opts.coerceTypes == 'array' }}
|
||||
if ({{=$dataType}} == 'object' && Array.isArray({{=$data}}) && {{=$data}}.length == 1) {
|
||||
{{=$data}} = {{=$data}}[0];
|
||||
{{=$dataType}} = typeof {{=$data}};
|
||||
if ({{=it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)}}) {{=$coerced}} = {{=$data}};
|
||||
}
|
||||
{{?}}
|
||||
|
||||
if ({{=$coerced}} !== undefined) ;
|
||||
{{~ $coerceToTypes:$type:$i }}
|
||||
{{? $i }}
|
||||
if ({{=$coerced}} === undefined) {
|
||||
{{ $bracesCoercion += '}'; }}
|
||||
{{?}}
|
||||
|
||||
{{? it.opts.coerceTypes == 'array' && $type != 'array' }}
|
||||
if ({{=$dataType}} == 'array' && {{=$data}}.length == 1) {
|
||||
{{=$coerced}} = {{=$data}} = {{=$data}}[0];
|
||||
{{=$dataType}} = typeof {{=$data}};
|
||||
/*if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array';*/
|
||||
}
|
||||
{{?}}
|
||||
|
||||
{{? $type == 'string' }}
|
||||
if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean')
|
||||
else if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean')
|
||||
{{=$coerced}} = '' + {{=$data}};
|
||||
else if ({{=$data}} === null) {{=$coerced}} = '';
|
||||
{{?? $type == 'number' || $type == 'integer' }}
|
||||
if ({{=$dataType}} == 'boolean' || {{=$data}} === null
|
||||
else if ({{=$dataType}} == 'boolean' || {{=$data}} === null
|
||||
|| ({{=$dataType}} == 'string' && {{=$data}} && {{=$data}} == +{{=$data}}
|
||||
{{? $type == 'integer' }} && !({{=$data}} % 1){{?}}))
|
||||
{{=$coerced}} = +{{=$data}};
|
||||
{{?? $type == 'boolean' }}
|
||||
if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null)
|
||||
else if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null)
|
||||
{{=$coerced}} = false;
|
||||
else if ({{=$data}} === 'true' || {{=$data}} === 1)
|
||||
{{=$coerced}} = true;
|
||||
{{?? $type == 'null' }}
|
||||
if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false)
|
||||
else if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false)
|
||||
{{=$coerced}} = null;
|
||||
{{?? it.opts.coerceTypes == 'array' && $type == 'array' }}
|
||||
if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null)
|
||||
else if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null)
|
||||
{{=$coerced}} = [{{=$data}}];
|
||||
{{?}}
|
||||
{{~}}
|
||||
|
||||
{{= $bracesCoercion }}
|
||||
|
||||
if ({{=$coerced}} === undefined) {
|
||||
else {
|
||||
{{# def.error:'type' }}
|
||||
} else {
|
||||
}
|
||||
|
||||
if ({{=$coerced}} !== undefined) {
|
||||
{{# def.setParentData }}
|
||||
{{=$data}} = {{=$coerced}};
|
||||
{{? !$dataLvl }}if ({{=$parentData}} !== undefined){{?}}
|
||||
|
3
node_modules/ajv/lib/dot/definitions.def
generated
vendored
3
node_modules/ajv/lib/dot/definitions.def
generated
vendored
@@ -64,7 +64,8 @@
|
||||
|
||||
{{## def.nonEmptySchema:_schema:
|
||||
(it.opts.strictKeywords
|
||||
? typeof _schema == 'object' && Object.keys(_schema).length > 0
|
||||
? (typeof _schema == 'object' && Object.keys(_schema).length > 0)
|
||||
|| _schema === false
|
||||
: it.util.schemaHasRules(_schema, it.RULES.all))
|
||||
#}}
|
||||
|
||||
|
2
node_modules/ajv/lib/dot/validate.jst
generated
vendored
2
node_modules/ajv/lib/dot/validate.jst
generated
vendored
@@ -81,7 +81,7 @@
|
||||
it.baseId = it.baseId || it.rootId;
|
||||
delete it.isTop;
|
||||
|
||||
it.dataPathArr = [undefined];
|
||||
it.dataPathArr = [""];
|
||||
|
||||
if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
|
||||
var $defaultMsg = 'default is ignored in the schema root';
|
||||
|
2
node_modules/ajv/lib/dotjs/allOf.js
generated
vendored
2
node_modules/ajv/lib/dotjs/allOf.js
generated
vendored
@@ -17,7 +17,7 @@ module.exports = function generate_allOf(it, $keyword, $ruleType) {
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
$allSchemasEmpty = false;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
|
2
node_modules/ajv/lib/dotjs/anyOf.js
generated
vendored
2
node_modules/ajv/lib/dotjs/anyOf.js
generated
vendored
@@ -15,7 +15,7 @@ module.exports = function generate_anyOf(it, $keyword, $ruleType) {
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $noEmptySchema = $schema.every(function($sch) {
|
||||
return (it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all));
|
||||
return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all));
|
||||
});
|
||||
if ($noEmptySchema) {
|
||||
var $currentBaseId = $it.baseId;
|
||||
|
2
node_modules/ajv/lib/dotjs/contains.js
generated
vendored
2
node_modules/ajv/lib/dotjs/contains.js
generated
vendored
@@ -18,7 +18,7 @@ module.exports = function generate_contains(it, $keyword, $ruleType) {
|
||||
$dataNxt = $it.dataLevel = it.dataLevel + 1,
|
||||
$nextData = 'data' + $dataNxt,
|
||||
$currentBaseId = it.baseId,
|
||||
$nonEmptySchema = (it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all));
|
||||
$nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all));
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
|
||||
if ($nonEmptySchema) {
|
||||
var $wasComposite = it.compositeRule;
|
||||
|
2
node_modules/ajv/lib/dotjs/dependencies.js
generated
vendored
2
node_modules/ajv/lib/dotjs/dependencies.js
generated
vendored
@@ -143,7 +143,7 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
|
||||
var $currentBaseId = $it.baseId;
|
||||
for (var $property in $schemaDeps) {
|
||||
var $sch = $schemaDeps[$property];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
|
||||
if ($ownProperties) {
|
||||
out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
|
||||
|
4
node_modules/ajv/lib/dotjs/if.js
generated
vendored
4
node_modules/ajv/lib/dotjs/if.js
generated
vendored
@@ -15,8 +15,8 @@ module.exports = function generate_if(it, $keyword, $ruleType) {
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $thenSch = it.schema['then'],
|
||||
$elseSch = it.schema['else'],
|
||||
$thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? typeof $thenSch == 'object' && Object.keys($thenSch).length > 0 : it.util.schemaHasRules($thenSch, it.RULES.all)),
|
||||
$elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? typeof $elseSch == 'object' && Object.keys($elseSch).length > 0 : it.util.schemaHasRules($elseSch, it.RULES.all)),
|
||||
$thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)),
|
||||
$elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)),
|
||||
$currentBaseId = $it.baseId;
|
||||
if ($thenPresent || $elsePresent) {
|
||||
var $ifClause;
|
||||
|
6
node_modules/ajv/lib/dotjs/items.js
generated
vendored
6
node_modules/ajv/lib/dotjs/items.js
generated
vendored
@@ -66,7 +66,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { ';
|
||||
var $passData = $data + '[' + $i + ']';
|
||||
$it.schema = $sch;
|
||||
@@ -89,7 +89,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0 : it.util.schemaHasRules($additionalItems, it.RULES.all))) {
|
||||
if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) {
|
||||
$it.schema = $additionalItems;
|
||||
$it.schemaPath = it.schemaPath + '.additionalItems';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
@@ -113,7 +113,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
} else if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
} else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
|
2
node_modules/ajv/lib/dotjs/not.js
generated
vendored
2
node_modules/ajv/lib/dotjs/not.js
generated
vendored
@@ -12,7 +12,7 @@ module.exports = function generate_not(it, $keyword, $ruleType) {
|
||||
var $it = it.util.copy(it);
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
|
2
node_modules/ajv/lib/dotjs/oneOf.js
generated
vendored
2
node_modules/ajv/lib/dotjs/oneOf.js
generated
vendored
@@ -26,7 +26,7 @@ module.exports = function generate_oneOf(it, $keyword, $ruleType) {
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
|
4
node_modules/ajv/lib/dotjs/properties.js
generated
vendored
4
node_modules/ajv/lib/dotjs/properties.js
generated
vendored
@@ -189,7 +189,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
while (i3 < l3) {
|
||||
$propertyKey = arr3[i3 += 1];
|
||||
var $sch = $schema[$propertyKey];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
var $prop = it.util.getProperty($propertyKey),
|
||||
$passData = $data + $prop,
|
||||
$hasDefault = $useDefaults && $sch.default !== undefined;
|
||||
@@ -292,7 +292,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
while (i4 < l4) {
|
||||
$pProperty = arr4[i4 += 1];
|
||||
var $sch = $pProperties[$pProperty];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
|
||||
$it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);
|
||||
|
2
node_modules/ajv/lib/dotjs/propertyNames.js
generated
vendored
2
node_modules/ajv/lib/dotjs/propertyNames.js
generated
vendored
@@ -14,7 +14,7 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
out += 'var ' + ($errs) + ' = errors;';
|
||||
if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
|
2
node_modules/ajv/lib/dotjs/required.js
generated
vendored
2
node_modules/ajv/lib/dotjs/required.js
generated
vendored
@@ -28,7 +28,7 @@ module.exports = function generate_required(it, $keyword, $ruleType) {
|
||||
while (i1 < l1) {
|
||||
$property = arr1[i1 += 1];
|
||||
var $propertySch = it.schema.properties[$property];
|
||||
if (!($propertySch && (it.opts.strictKeywords ? typeof $propertySch == 'object' && Object.keys($propertySch).length > 0 : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
|
||||
if (!($propertySch && (it.opts.strictKeywords ? (typeof $propertySch == 'object' && Object.keys($propertySch).length > 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
|
||||
$required[$required.length] = $property;
|
||||
}
|
||||
}
|
||||
|
30
node_modules/ajv/lib/dotjs/validate.js
generated
vendored
30
node_modules/ajv/lib/dotjs/validate.js
generated
vendored
@@ -91,7 +91,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema));
|
||||
it.baseId = it.baseId || it.rootId;
|
||||
delete it.isTop;
|
||||
it.dataPathArr = [undefined];
|
||||
it.dataPathArr = [""];
|
||||
if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
|
||||
var $defaultMsg = 'default is ignored in the schema root';
|
||||
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
|
||||
@@ -153,43 +153,35 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
if ($coerceToTypes) {
|
||||
var $dataType = 'dataType' + $lvl,
|
||||
$coerced = 'coerced' + $lvl;
|
||||
out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; ';
|
||||
out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; ';
|
||||
if (it.opts.coerceTypes == 'array') {
|
||||
out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ')) ' + ($dataType) + ' = \'array\'; ';
|
||||
out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ') && ' + ($data) + '.length == 1) { ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; if (' + (it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)) + ') ' + ($coerced) + ' = ' + ($data) + '; } ';
|
||||
}
|
||||
out += ' var ' + ($coerced) + ' = undefined; ';
|
||||
var $bracesCoercion = '';
|
||||
out += ' if (' + ($coerced) + ' !== undefined) ; ';
|
||||
var arr1 = $coerceToTypes;
|
||||
if (arr1) {
|
||||
var $type, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$type = arr1[$i += 1];
|
||||
if ($i) {
|
||||
out += ' if (' + ($coerced) + ' === undefined) { ';
|
||||
$bracesCoercion += '}';
|
||||
}
|
||||
if (it.opts.coerceTypes == 'array' && $type != 'array') {
|
||||
out += ' if (' + ($dataType) + ' == \'array\' && ' + ($data) + '.length == 1) { ' + ($coerced) + ' = ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; } ';
|
||||
}
|
||||
if ($type == 'string') {
|
||||
out += ' if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
|
||||
out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
|
||||
} else if ($type == 'number' || $type == 'integer') {
|
||||
out += ' if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
|
||||
out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
|
||||
if ($type == 'integer') {
|
||||
out += ' && !(' + ($data) + ' % 1)';
|
||||
}
|
||||
out += ')) ' + ($coerced) + ' = +' + ($data) + '; ';
|
||||
} else if ($type == 'boolean') {
|
||||
out += ' if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
|
||||
out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
|
||||
} else if ($type == 'null') {
|
||||
out += ' if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
|
||||
out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
|
||||
} else if (it.opts.coerceTypes == 'array' && $type == 'array') {
|
||||
out += ' if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
|
||||
out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
|
||||
}
|
||||
}
|
||||
}
|
||||
out += ' ' + ($bracesCoercion) + ' if (' + ($coerced) + ' === undefined) { ';
|
||||
out += ' else { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
@@ -229,7 +221,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } else { ';
|
||||
out += ' } if (' + ($coerced) + ' !== undefined) { ';
|
||||
var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
|
||||
$parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
|
||||
out += ' ' + ($data) + ' = ' + ($coerced) + '; ';
|
||||
|
20
node_modules/ajv/package.json
generated
vendored
20
node_modules/ajv/package.json
generated
vendored
@@ -1,26 +1,26 @@
|
||||
{
|
||||
"_from": "ajv@^6.5.5",
|
||||
"_id": "ajv@6.12.3",
|
||||
"_from": "ajv@^6.12.3",
|
||||
"_id": "ajv@6.12.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==",
|
||||
"_integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||
"_location": "/ajv",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ajv@^6.5.5",
|
||||
"raw": "ajv@^6.12.3",
|
||||
"name": "ajv",
|
||||
"escapedName": "ajv",
|
||||
"rawSpec": "^6.5.5",
|
||||
"rawSpec": "^6.12.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^6.5.5"
|
||||
"fetchSpec": "^6.12.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/har-validator"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz",
|
||||
"_shasum": "18c5af38a111ddeb4f2697bd78d68abc1cabd706",
|
||||
"_spec": "ajv@^6.5.5",
|
||||
"_resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||
"_shasum": "baf5a62e802b07d977034586f8c3baf5adf26df4",
|
||||
"_spec": "ajv@^6.12.3",
|
||||
"_where": "D:\\Projects\\minifyfromhtml\\node_modules\\har-validator",
|
||||
"author": {
|
||||
"name": "Evgeny Poberezkin"
|
||||
@@ -129,5 +129,5 @@
|
||||
},
|
||||
"tonicExampleFilename": ".tonic_example.js",
|
||||
"typings": "lib/ajv.d.ts",
|
||||
"version": "6.12.3"
|
||||
"version": "6.12.6"
|
||||
}
|
||||
|
3
node_modules/aws4/.github/FUNDING.yml
generated
vendored
Normal file
3
node_modules/aws4/.github/FUNDING.yml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: mhart
|
23
node_modules/aws4/README.md
generated
vendored
23
node_modules/aws4/README.md
generated
vendored
@@ -20,11 +20,11 @@ Example
|
||||
-------
|
||||
|
||||
```javascript
|
||||
var http = require('https')
|
||||
var https = require('https')
|
||||
var aws4 = require('aws4')
|
||||
|
||||
// to illustrate usage, we'll create a utility function to request and pipe to stdout
|
||||
function request(opts) { http.request(opts, function(res) { res.pipe(process.stdout) }).end(opts.body || '') }
|
||||
function request(opts) { https.request(opts, function(res) { res.pipe(process.stdout) }).end(opts.body || '') }
|
||||
|
||||
// aws4 will sign an options object as you'd pass to http.request, with an AWS service and region
|
||||
var opts = { host: 'my-bucket.s3.us-west-1.amazonaws.com', path: '/my-object', service: 's3', region: 'us-west-1' }
|
||||
@@ -94,6 +94,15 @@ request(aws4.sign({
|
||||
...
|
||||
*/
|
||||
|
||||
// The raw RequestSigner can be used to generate CodeCommit Git passwords
|
||||
var signer = new aws4.RequestSigner({
|
||||
service: 'codecommit',
|
||||
host: 'git-codecommit.us-east-1.amazonaws.com',
|
||||
method: 'GIT',
|
||||
path: '/v1/repos/MyAwesomeRepo',
|
||||
})
|
||||
var password = signer.getDateTime() + 'Z' + signer.signature()
|
||||
|
||||
// see example.js for examples with other services
|
||||
```
|
||||
|
||||
@@ -102,11 +111,10 @@ API
|
||||
|
||||
### aws4.sign(requestOptions, [credentials])
|
||||
|
||||
This calculates and populates the `Authorization` header of
|
||||
`requestOptions`, and any other necessary AWS headers and/or request
|
||||
options. Returns `requestOptions` as a convenience for chaining.
|
||||
Calculates and populates any necessary AWS headers and/or request
|
||||
options on `requestOptions`. Returns `requestOptions` as a convenience for chaining.
|
||||
|
||||
`requestOptions` is an object holding the same options that the node.js
|
||||
`requestOptions` is an object holding the same options that the Node.js
|
||||
[http.request](https://nodejs.org/docs/latest/api/http.html#http_http_request_options_callback)
|
||||
function takes.
|
||||
|
||||
@@ -119,6 +127,7 @@ populated if they don't already exist:
|
||||
- `body` (will use `''` if not given)
|
||||
- `service` (will try to be calculated from `hostname` or `host` if not given)
|
||||
- `region` (will try to be calculated from `hostname` or `host` or use `'us-east-1'` if not given)
|
||||
- `signQuery` (to sign the query instead of adding an `Authorization` header, defaults to false)
|
||||
- `headers['Host']` (will use `hostname` or `host` or be calculated if not given)
|
||||
- `headers['Content-Type']` (will use `'application/x-www-form-urlencoded; charset=utf-8'`
|
||||
if not given and there is a `body`)
|
||||
@@ -170,5 +179,5 @@ Thanks to [@jed](https://github.com/jed) for his
|
||||
committed and subsequently extracted this code.
|
||||
|
||||
Also thanks to the
|
||||
[official node.js AWS SDK](https://github.com/aws/aws-sdk-js) for giving
|
||||
[official Node.js AWS SDK](https://github.com/aws/aws-sdk-js) for giving
|
||||
me a start on implementing the v4 signature.
|
||||
|
18
node_modules/aws4/aws4.js
generated
vendored
18
node_modules/aws4/aws4.js
generated
vendored
@@ -26,6 +26,20 @@ function encodeRfc3986Full(str) {
|
||||
return encodeRfc3986(encodeURIComponent(str))
|
||||
}
|
||||
|
||||
// A bit of a combination of:
|
||||
// https://github.com/aws/aws-sdk-java-v2/blob/dc695de6ab49ad03934e1b02e7263abbd2354be0/core/auth/src/main/java/software/amazon/awssdk/auth/signer/internal/AbstractAws4Signer.java#L59
|
||||
// https://github.com/aws/aws-sdk-js/blob/18cb7e5b463b46239f9fdd4a65e2ff8c81831e8f/lib/signers/v4.js#L191-L199
|
||||
// https://github.com/mhart/aws4fetch/blob/b3aed16b6f17384cf36ea33bcba3c1e9f3bdfefd/src/main.js#L25-L34
|
||||
var HEADERS_TO_IGNORE = {
|
||||
'authorization': true,
|
||||
'connection': true,
|
||||
'x-amzn-trace-id': true,
|
||||
'user-agent': true,
|
||||
'expect': true,
|
||||
'presigned-expires': true,
|
||||
'range': true,
|
||||
}
|
||||
|
||||
// request: { path | body, [host], [method], [headers], [service], [region] }
|
||||
// credentials: { accessKeyId, secretAccessKey, [sessionToken] }
|
||||
function RequestSigner(request, credentials) {
|
||||
@@ -259,7 +273,7 @@ RequestSigner.prototype.canonicalString = function() {
|
||||
if (normalizePath && piece === '..') {
|
||||
path.pop()
|
||||
} else if (!normalizePath || piece !== '.') {
|
||||
if (decodePath) piece = decodeURIComponent(piece).replace(/\+/g, ' ')
|
||||
if (decodePath) piece = decodeURIComponent(piece.replace(/\+/g, ' '))
|
||||
path.push(encodeRfc3986Full(piece))
|
||||
}
|
||||
return path
|
||||
@@ -284,6 +298,7 @@ RequestSigner.prototype.canonicalHeaders = function() {
|
||||
return header.toString().trim().replace(/\s+/g, ' ')
|
||||
}
|
||||
return Object.keys(headers)
|
||||
.filter(function(key) { return HEADERS_TO_IGNORE[key.toLowerCase()] == null })
|
||||
.sort(function(a, b) { return a.toLowerCase() < b.toLowerCase() ? -1 : 1 })
|
||||
.map(function(key) { return key.toLowerCase() + ':' + trimAll(headers[key]) })
|
||||
.join('\n')
|
||||
@@ -292,6 +307,7 @@ RequestSigner.prototype.canonicalHeaders = function() {
|
||||
RequestSigner.prototype.signedHeaders = function() {
|
||||
return Object.keys(this.request.headers)
|
||||
.map(function(key) { return key.toLowerCase() })
|
||||
.filter(function(key) { return HEADERS_TO_IGNORE[key] == null })
|
||||
.sort()
|
||||
.join(';')
|
||||
}
|
||||
|
14
node_modules/aws4/package.json
generated
vendored
14
node_modules/aws4/package.json
generated
vendored
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"_from": "aws4@^1.8.0",
|
||||
"_id": "aws4@1.10.0",
|
||||
"_id": "aws4@1.11.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==",
|
||||
"_integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==",
|
||||
"_location": "/aws4",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
@@ -18,8 +18,8 @@
|
||||
"_requiredBy": [
|
||||
"/request"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz",
|
||||
"_shasum": "a17b3a8ea811060e74d47d306122400ad4497ae2",
|
||||
"_resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
|
||||
"_shasum": "d61f46d83b2519250e2784daf5b09479a8b41c59",
|
||||
"_spec": "aws4@^1.8.0",
|
||||
"_where": "D:\\Projects\\minifyfromhtml\\node_modules\\request",
|
||||
"author": {
|
||||
@@ -34,8 +34,8 @@
|
||||
"deprecated": false,
|
||||
"description": "Signs and prepares requests using AWS Signature Version 4",
|
||||
"devDependencies": {
|
||||
"mocha": "^7.1.2",
|
||||
"should": "^13.2.3"
|
||||
"mocha": "^2.5.3",
|
||||
"should": "^8.4.0"
|
||||
},
|
||||
"homepage": "https://github.com/mhart/aws4#readme",
|
||||
"license": "MIT",
|
||||
@@ -49,5 +49,5 @@
|
||||
"integration": "node ./test/slow.js",
|
||||
"test": "mocha ./test/fast.js -R list"
|
||||
},
|
||||
"version": "1.10.0"
|
||||
"version": "1.11.0"
|
||||
}
|
||||
|
62
node_modules/clean-css/History.md
generated
vendored
62
node_modules/clean-css/History.md
generated
vendored
@@ -1,3 +1,63 @@
|
||||
[5.1.2 / 2021-03-19](https://github.com/jakubpawlowicz/clean-css/compare/v5.1.1...v5.1.2)
|
||||
==================
|
||||
|
||||
* Fixed issue [#996](https://github.com/jakubpawlowicz/clean-css/issues/996) - space removed from pseudo classes.
|
||||
|
||||
[5.1.1 / 2021-03-03](https://github.com/jakubpawlowicz/clean-css/compare/v5.1.0...v5.1.1)
|
||||
==================
|
||||
|
||||
* Fixed issue [#1156](https://github.com/jakubpawlowicz/clean-css/issues/1156) - invalid hsl/hsla validation in level 2 optimizations.
|
||||
|
||||
[5.1.0 / 2021-02-18](https://github.com/jakubpawlowicz/clean-css/compare/5.0...v5.1.0)
|
||||
==================
|
||||
|
||||
* Fixes stripping '%' from inside color functions.
|
||||
* Improves tokenization speed by ~30%.
|
||||
* Fixed issue [#1143](https://github.com/jakubpawlowicz/clean-css/issues/1143) - some missing level 1 value optimizations.
|
||||
|
||||
|
||||
[5.0.1 / 2021-01-29](https://github.com/jakubpawlowicz/clean-css/compare/v5.0.0...v5.0.1)
|
||||
==================
|
||||
|
||||
* Fixed issue [#1139](https://github.com/jakubpawlowicz/clean-css/issues/1139) - overriding & merging properties without `canOverride` set.
|
||||
|
||||
[5.0.0 / 2021-01-29](https://github.com/jakubpawlowicz/clean-css/compare/4.2...v5.0.0)
|
||||
==================
|
||||
|
||||
* Adds a way process input files without bundling it into one big output file.
|
||||
* Adds level 1 and level 2 optimization plugins.
|
||||
* Disables URL rebasing by default.
|
||||
* Disables URL unquoting by default.
|
||||
* Drops support for Node.js 6 & 8 to support last 3 Node.js releases: 10, 12, and 14.
|
||||
* Fixed issue [#889](https://github.com/jakubpawlowicz/clean-css/issues/889) - whitelisted level 1 optimizations.
|
||||
* Fixed issue [#975](https://github.com/jakubpawlowicz/clean-css/issues/975) - incorrect block name optimization.
|
||||
* Fixed issue [#1009](https://github.com/jakubpawlowicz/clean-css/issues/1009) - whitespace around comments.
|
||||
* Fixed issue [#1021](https://github.com/jakubpawlowicz/clean-css/issues/1021) - allow one- and two-letter property names.
|
||||
* Fixed issue [#1022](https://github.com/jakubpawlowicz/clean-css/issues/1022) - merging into shorthands new property positioning.
|
||||
* Fixed issue [#1032](https://github.com/jakubpawlowicz/clean-css/issues/1032) - wrong order of merged shorthands with inherit.
|
||||
* Fixed issue [#1043](https://github.com/jakubpawlowicz/clean-css/issues/1043) - `calc` fallback removed within other function.
|
||||
* Fixed issue [#1045](https://github.com/jakubpawlowicz/clean-css/issues/1045) - non-standard protocol-less URL first slash removed.
|
||||
* Fixed issue [#1050](https://github.com/jakubpawlowicz/clean-css/issues/1050) - correctly keeps default animation duration if delay is also set.
|
||||
* Fixed issue [#1053](https://github.com/jakubpawlowicz/clean-css/issues/1053) - treats `calc()` as first class width value.
|
||||
* Fixed issue [#1055](https://github.com/jakubpawlowicz/clean-css/issues/1055) - supports 4- and 8-character hex with alpha color notation.
|
||||
* Fixed issue [#1057](https://github.com/jakubpawlowicz/clean-css/issues/1057) - level 2 optimizations and quoted font family name.
|
||||
* Fixed issue [#1059](https://github.com/jakubpawlowicz/clean-css/issues/1059) - animation time units as CSS expressions.
|
||||
* Fixed issue [#1060](https://github.com/jakubpawlowicz/clean-css/issues/1060) - variable removed when shorthand's only value.
|
||||
* Fixed issue [#1062](https://github.com/jakubpawlowicz/clean-css/issues/1062) - wrong optimization of CSS pseudo-classes with selector list.
|
||||
* Fixed issue [#1073](https://github.com/jakubpawlowicz/clean-css/issues/1073) - adds support for non-standard `rpx` units.
|
||||
* Fixed issue [#1075](https://github.com/jakubpawlowicz/clean-css/issues/1075) - media merging and variables.
|
||||
* Fixed issue [#1087](https://github.com/jakubpawlowicz/clean-css/issues/1087) - allow units with any case.
|
||||
* Fixed issue [#1088](https://github.com/jakubpawlowicz/clean-css/issues/1088) - building source maps with source preserved via comments.
|
||||
* Fixed issue [#1090](https://github.com/jakubpawlowicz/clean-css/issues/1090) - edge case in merging for `border` and `border-image`.
|
||||
* Fixed issue [#1103](https://github.com/jakubpawlowicz/clean-css/issues/1103) - don't allow merging longhand into `unset` shorthand.
|
||||
* Fixed issue [#1115](https://github.com/jakubpawlowicz/clean-css/issues/1115) - incorrect multiplex longhand into shorthand merging.
|
||||
* Fixed issue [#1117](https://github.com/jakubpawlowicz/clean-css/issues/1117) - don't change zero values inside `min`, `max`, and `clamp` functions.
|
||||
* Fixed issue [#1122](https://github.com/jakubpawlowicz/clean-css/issues/1122) - don't wrap data URI in single quotes.
|
||||
* Fixed issue [#1125](https://github.com/jakubpawlowicz/clean-css/issues/1125) - quotes stripped from withing `@supports` clause.
|
||||
* Fixed issue [#1128](https://github.com/jakubpawlowicz/clean-css/issues/1128) - take variables into account when reordering properties.
|
||||
* Fixed issue [#1132](https://github.com/jakubpawlowicz/clean-css/issues/1132) - vendor-prefixed classes inside `:not()`.
|
||||
* Reworks all level 1 optimizations to conform to plugin style.
|
||||
|
||||
[4.2.3 / 2020-01-28](https://github.com/jakubpawlowicz/clean-css/compare/v4.2.2...v4.2.3)
|
||||
==================
|
||||
|
||||
@@ -16,7 +76,7 @@
|
||||
|
||||
* Fixes giving `breakWith` option via a string.
|
||||
|
||||
[4.2.0 / 2018-08-02](https://github.com/jakubpawlowicz/clean-css/compare/4.1...4.2.0)
|
||||
[4.2.0 / 2018-08-02](https://github.com/jakubpawlowicz/clean-css/compare/4.1...v4.2.0)
|
||||
==================
|
||||
|
||||
* Adds `process` method for compatibility with optimize-css-assets-webpack-plugin.
|
||||
|
198
node_modules/clean-css/README.md
generated
vendored
198
node_modules/clean-css/README.md
generated
vendored
@@ -5,12 +5,11 @@
|
||||
<br/>
|
||||
</h1>
|
||||
|
||||
[](https://www.npmjs.com/package/clean-css)
|
||||
[](https://travis-ci.org/jakubpawlowicz/clean-css)
|
||||
[](https://ci.appveyor.com/project/jakubpawlowicz/clean-css/branch/master)
|
||||
[](https://www.npmjs.com/package/clean-css)
|
||||
[](https://github.com/jakubpawlowicz/clean-css/actions?query=workflow%3ATests+branch%3Amaster)
|
||||
[](https://travis-ci.org/jakubpawlowicz/clean-css)
|
||||
[](https://david-dm.org/jakubpawlowicz/clean-css)
|
||||
[](https://npmcharts.com/compare/clean-css?minimal=true)
|
||||
[](https://twitter.com/cleancss)
|
||||
[](https://npmcharts.com/compare/clean-css?minimal=true)
|
||||
|
||||
clean-css is a fast and efficient CSS optimizer for [Node.js](http://nodejs.org/) platform and [any modern browser](https://jakubpawlowicz.github.io/clean-css).
|
||||
|
||||
@@ -21,9 +20,10 @@ According to [tests](http://goalsmashers.github.io/css-minification-benchmark/)
|
||||
- [Node.js version support](#nodejs-version-support)
|
||||
- [Install](#install)
|
||||
- [Use](#use)
|
||||
* [Important: 4.0 breaking changes](#important-40-breaking-changes)
|
||||
* [What's new in version 4.1](#whats-new-in-version-41)
|
||||
* [What's new in version 5.0](#whats-new-in-version-50)
|
||||
* [What's new in version 4.2](#whats-new-in-version-42)
|
||||
* [What's new in version 4.1](#whats-new-in-version-41)
|
||||
* [Important: 4.0 breaking changes](#important-40-breaking-changes)
|
||||
* [Constructor options](#constructor-options)
|
||||
* [Compatibility modes](#compatibility-modes)
|
||||
* [Fetch option](#fetch-option)
|
||||
@@ -33,11 +33,13 @@ According to [tests](http://goalsmashers.github.io/css-minification-benchmark/)
|
||||
+ [Level 0 optimizations](#level-0-optimizations)
|
||||
+ [Level 1 optimizations](#level-1-optimizations)
|
||||
+ [Level 2 optimizations](#level-2-optimizations)
|
||||
* [Plugins](#plugins)
|
||||
* [Minify method](#minify-method)
|
||||
* [Promise interface](#promise-interface)
|
||||
* [CLI utility](#cli-utility)
|
||||
- [FAQ](#faq)
|
||||
* [How to optimize multiple files?](#how-to-optimize-multiple-files)
|
||||
* [How to process multiple files without concatenating them into one output file?](#how-to-process-multiple-files-without-concatenating-them-into-one-output-file)
|
||||
* [How to process remote `@import`s correctly?](#how-to-process-remote-imports-correctly)
|
||||
* [How to apply arbitrary transformations to CSS properties?](#how-to-apply-arbitrary-transformations-to-css-properties)
|
||||
* [How to specify a custom rounding precision?](#how-to-specify-a-custom-rounding-precision)
|
||||
@@ -56,7 +58,7 @@ According to [tests](http://goalsmashers.github.io/css-minification-benchmark/)
|
||||
|
||||
# Node.js version support
|
||||
|
||||
clean-css requires Node.js 4.0+ (tested on Linux, OS X, and Windows)
|
||||
clean-css requires Node.js 6.0+ (tested on Linux, OS X, and Windows)
|
||||
|
||||
# Install
|
||||
|
||||
@@ -73,6 +75,49 @@ var options = { /* options */ };
|
||||
var output = new CleanCSS(options).minify(input);
|
||||
```
|
||||
|
||||
## What's new in version 5.0
|
||||
|
||||
clean-css 5.0 will introduce some breaking changes:
|
||||
|
||||
* Node.js 6.x and 8.x are officially no longer supported;
|
||||
* `transform` callback in level-1 optimizations is removed in favor of new [plugins](#plugins) interface;
|
||||
* changes default Internet Explorer compatibility from 10+ to >11, to revert the old default use `{ compatibility: 'ie10' }` flag;
|
||||
* changes default `rebase` option from `true` to `false` so URLs are not rebased by default. Please note that if you set `rebaseTo` option it still counts as setting `rebase: true` to preserve some of the backward compatibility.
|
||||
|
||||
And on the new features side of things:
|
||||
|
||||
* format options now accepts numerical values for all breaks, which will allow you to have more control over output formatting, e.g. `format: {breaks: {afterComment: 2}}` means clean-css will add two line breaks after each comment
|
||||
* a new `batch` option (defaults to `false`) is added, when set to `true` it will process all inputs, given either as an array or a hash, without concatenating them.
|
||||
|
||||
## What's new in version 4.2
|
||||
|
||||
clean-css 4.2 introduces the following changes / features:
|
||||
|
||||
* Adds `process` method for compatibility with optimize-css-assets-webpack-plugin;
|
||||
* new `transition` property optimizer;
|
||||
* preserves any CSS content between `/* clean-css ignore:start */` and `/* clean-css ignore:end */` comments;
|
||||
* allows filtering based on selector in `transform` callback, see [example](#how-to-apply-arbitrary-transformations-to-css-properties);
|
||||
* adds configurable line breaks via `format: { breakWith: 'lf' }` option.
|
||||
|
||||
## What's new in version 4.1
|
||||
|
||||
clean-css 4.1 introduces the following changes / features:
|
||||
|
||||
* `inline: false` as an alias to `inline: ['none']`;
|
||||
* `multiplePseudoMerging` compatibility flag controlling merging of rules with multiple pseudo classes / elements;
|
||||
* `removeEmpty` flag in level 1 optimizations controlling removal of rules and nested blocks;
|
||||
* `removeEmpty` flag in level 2 optimizations controlling removal of rules and nested blocks;
|
||||
* `compatibility: { selectors: { mergeLimit: <number> } }` flag in compatibility settings controlling maximum number of selectors in a single rule;
|
||||
* `minify` method improved signature accepting a list of hashes for a predictable traversal;
|
||||
* `selectorsSortingMethod` level 1 optimization allows `false` or `'none'` for disabling selector sorting;
|
||||
* `fetch` option controlling a function for handling remote requests;
|
||||
* new `font` shorthand and `font-*` longhand optimizers;
|
||||
* removal of `optimizeFont` flag in level 1 optimizations due to new `font` shorthand optimizer;
|
||||
* `skipProperties` flag in level 2 optimizations controlling which properties won't be optimized;
|
||||
* new `animation` shorthand and `animation-*` longhand optimizers;
|
||||
* `removeUnusedAtRules` level 2 optimization controlling removal of unused `@counter-style`, `@font-face`, `@keyframes`, and `@namespace` at rules;
|
||||
* the [web interface](https://jakubpawlowicz.github.io/clean-css) gets an improved settings panel with "reset to defaults", instant option changes, and settings being persisted across sessions.
|
||||
|
||||
## Important: 4.0 breaking changes
|
||||
|
||||
clean-css 4.0 introduces some breaking changes:
|
||||
@@ -95,35 +140,6 @@ clean-css 4.0 introduces some breaking changes:
|
||||
* `sourceMap` option has to be a boolean from now on - to specify an input source map pass it a 2nd argument to `minify` method or via a hash instead;
|
||||
* `aggressiveMerging` option is removed as aggressive merging is replaced by smarter override merging.
|
||||
|
||||
## What's new in version 4.1
|
||||
|
||||
clean-css 4.1 introduces the following changes / features:
|
||||
|
||||
* `inline: false` as an alias to `inline: ['none']`;
|
||||
* `multiplePseudoMerging` compatibility flag controlling merging of rules with multiple pseudo classes / elements;
|
||||
* `removeEmpty` flag in level 1 optimizations controlling removal of rules and nested blocks;
|
||||
* `removeEmpty` flag in level 2 optimizations controlling removal of rules and nested blocks;
|
||||
* `compatibility: { selectors: { mergeLimit: <number> } }` flag in compatibility settings controlling maximum number of selectors in a single rule;
|
||||
* `minify` method improved signature accepting a list of hashes for a predictable traversal;
|
||||
* `selectorsSortingMethod` level 1 optimization allows `false` or `'none'` for disabling selector sorting;
|
||||
* `fetch` option controlling a function for handling remote requests;
|
||||
* new `font` shorthand and `font-*` longhand optimizers;
|
||||
* removal of `optimizeFont` flag in level 1 optimizations due to new `font` shorthand optimizer;
|
||||
* `skipProperties` flag in level 2 optimizations controlling which properties won't be optimized;
|
||||
* new `animation` shorthand and `animation-*` longhand optimizers;
|
||||
* `removeUnusedAtRules` level 2 optimization controlling removal of unused `@counter-style`, `@font-face`, `@keyframes`, and `@namespace` at rules;
|
||||
* the [web interface](https://jakubpawlowicz.github.io/clean-css) gets an improved settings panel with "reset to defaults", instant option changes, and settings being persisted across sessions.
|
||||
|
||||
## What's new in version 4.2
|
||||
|
||||
clean-css 4.2 introduces the following changes / features:
|
||||
|
||||
* Adds `process` method for compatibility with optimize-css-assets-webpack-plugin;
|
||||
* new `transition` property optimizer;
|
||||
* preserves any CSS content between `/* clean-css ignore:start */` and `/* clean-css ignore:end */` comments;
|
||||
* allows filtering based on selector in `transform` callback, see [example](#how-to-apply-arbitrary-transformations-to-css-properties);
|
||||
* adds configurable line breaks via `format: { breakWith: 'lf' }` option.
|
||||
|
||||
## Constructor options
|
||||
|
||||
clean-css constructor accepts a hash as a parameter with the following options available:
|
||||
@@ -135,7 +151,7 @@ clean-css constructor accepts a hash as a parameter with the following options a
|
||||
* `inlineRequest` - controls extra options for inlining remote `@import` rules, can be any of [HTTP(S) request options](https://nodejs.org/api/http.html#http_http_request_options_callback);
|
||||
* `inlineTimeout` - controls number of milliseconds after which inlining a remote `@import` fails; defaults to 5000;
|
||||
* `level` - controls optimization level used; defaults to `1`; see [optimization levels](#optimization-levels) for examples;
|
||||
* `rebase` - controls URL rebasing; defaults to `true`;
|
||||
* `rebase` - controls URL rebasing; defaults to `false`;
|
||||
* `rebaseTo` - controls a directory to which all URLs are rebased, most likely the directory under which the output file will live; defaults to the current directory;
|
||||
* `returnPromise` - controls whether `minify` method returns a Promise object or not; defaults to `false`; see [promise interface](#promise-interface) for examples;
|
||||
* `sourceMap` - controls whether an output source map is built; defaults to `false`;
|
||||
@@ -156,6 +172,7 @@ Each of these modes is an alias to a [fine grained configuration](https://github
|
||||
new CleanCSS({
|
||||
compatibility: {
|
||||
colors: {
|
||||
hexAlpha: false, // controls 4- and 8-character hex color support
|
||||
opacity: true // controls `rgba()` / `hsla()` color support
|
||||
},
|
||||
properties: {
|
||||
@@ -170,7 +187,7 @@ new CleanCSS({
|
||||
merging: true, // controls property merging based on understandability
|
||||
shorterLengthUnits: false, // controls shortening pixel units into `pc`, `pt`, or `in` units
|
||||
spaceAfterClosingBrace: true, // controls keeping space after closing brace - `url() no-repeat` into `url()no-repeat`
|
||||
urlQuotes: false, // controls keeping quoting inside `url()`
|
||||
urlQuotes: true, // controls keeping quoting inside `url()`
|
||||
zeroUnits: true // controls removal of units `0` value
|
||||
},
|
||||
selectors: {
|
||||
@@ -273,11 +290,34 @@ new CleanCSS({
|
||||
beforeBlockBegins: false, // controls if a space comes before a block begins; e.g. `.block {`; defaults to `false`
|
||||
beforeValue: false // controls if a space comes before a value; e.g. `width: 1rem`; defaults to `false`
|
||||
},
|
||||
wrapAt: false // controls maximum line length; defaults to `false`
|
||||
wrapAt: false, // controls maximum line length; defaults to `false`
|
||||
semicolonAfterLastProperty: false // controls removing trailing semicolons in rule; defaults to `false` - means remove
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
Also since clean-css 5.0 you can use numerical values for all line breaks, which will repeat a line break that many times, e.g:
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
format: {
|
||||
breaks: {
|
||||
afterAtRule: 2,
|
||||
afterBlockBegins: 1, // 1 is synonymous with `true`
|
||||
afterBlockEnds: 2,
|
||||
afterComment: 1,
|
||||
afterProperty: 1,
|
||||
afterRuleBegins: 1,
|
||||
afterRuleEnds: 1,
|
||||
beforeBlockEnds: 1,
|
||||
betweenSelectors: 0 // 0 is synonymous with `false`
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
which will add nicer spacing between at rules and blocks.
|
||||
|
||||
## Inlining options
|
||||
|
||||
`inline` option whitelists which `@import` rules will be processed, e.g.
|
||||
@@ -368,9 +408,7 @@ new CleanCSS({
|
||||
specialComments: 'all', // denotes a number of /*! ... */ comments preserved; defaults to `all`
|
||||
tidyAtRules: true, // controls at-rules (e.g. `@charset`, `@import`) optimizing; defaults to `true`
|
||||
tidyBlockScopes: true, // controls block scopes (e.g. `@media`) optimizing; defaults to `true`
|
||||
tidySelectors: true, // controls selectors optimizing; defaults to `true`,
|
||||
semicolonAfterLastProperty: false, // controls removing trailing semicolons in rule; defaults to `false` - means remove
|
||||
transform: function () {} // defines a callback for fine-grained property optimization; defaults to no-op
|
||||
tidySelectors: true, // controls selectors optimizing; defaults to `true`
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -433,6 +471,31 @@ new CleanCSS({
|
||||
});
|
||||
```
|
||||
|
||||
## Plugins
|
||||
|
||||
In clean-css version 5 and above you can define plugins which run alongside level 1 and level 2 optimizations, e.g.
|
||||
|
||||
```js
|
||||
var myPlugin = {
|
||||
level1: {
|
||||
property: function removeRepeatedBackgroundRepeat(_rule, property, _options) {
|
||||
// So `background-repeat:no-repeat no-repeat` becomes `background-repeat:no-repeat`
|
||||
if (property.name == 'background-repeat' && property.value.length == 2 && property.value[0][1] == property.value[1][1]) {
|
||||
property.value.pop();
|
||||
property.dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new CleanCSS({plugins: [myPlugin]})
|
||||
|
||||
```
|
||||
|
||||
Search `test\module-test.js` for `plugins` or check out `lib/optimizer/level-1/property-optimizers` and `lib/optimizer/level-1/value-optimizers` for more examples.
|
||||
|
||||
__Important__: To rewrite your old `transform` as a plugin, check out [this commit](https://github.com/jakubpawlowicz/clean-css/commit/b6ddc523267fc42cf0f6bd1626a79cad97319e17#diff-a71ef45f934725cdb25860dc0b606bcd59e3acee9788cd6df4f9d05339e8a153).
|
||||
|
||||
## Minify method
|
||||
|
||||
Once configured clean-css provides a `minify` method to optimize a given CSS, e.g.
|
||||
@@ -515,6 +578,16 @@ Passing an array of hashes allows you to explicitly specify the order in which t
|
||||
|
||||
Important note - any `@import` rules already present in the hash will be resolved in memory.
|
||||
|
||||
## How to process multiple files without concatenating them into one output file?
|
||||
|
||||
Since clean-css 5.0 you can, when passing an array of paths, hash, or array of hashes (see above), ask clean-css not to join styles into one output, but instead return stylesheets optimized one by one, e.g.
|
||||
|
||||
```js
|
||||
var output = new CleanCSS({ batch: true }).minify(['path/to/file/one', 'path/to/file/two']);
|
||||
var outputOfFile1 = output['path/to/file/one'].styles // all other fields, like errors, warnings, or stats are there too
|
||||
var outputOfFile2 = output['path/to/file/two'].styles
|
||||
```
|
||||
|
||||
## How to process remote `@import`s correctly?
|
||||
|
||||
In order to inline remote `@import` statements you need to provide a callback to minify method as fetching remote assets is an asynchronous operation, e.g.:
|
||||
@@ -530,26 +603,7 @@ If you don't provide a callback, then remote `@import`s will be left as is.
|
||||
|
||||
## How to apply arbitrary transformations to CSS properties?
|
||||
|
||||
If clean-css doesn't perform a particular property optimization, you can use `transform` callback to apply it:
|
||||
|
||||
```js
|
||||
var source = '.block{background-image:url(/path/to/image.png)}';
|
||||
var output = new CleanCSS({
|
||||
level: {
|
||||
1: {
|
||||
transform: function (propertyName, propertyValue, selector /* `selector` available since 4.2.0-pre */) {
|
||||
if (propertyName == 'background-image' && propertyValue.indexOf('/path/to') > -1) {
|
||||
return propertyValue.replace('/path/to', '../valid/path/to');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}).minify(source);
|
||||
|
||||
console.log(output.styles); # => .block{background-image:url(../valid/path/to/image.png)}
|
||||
```
|
||||
|
||||
Note: returning `false` from `transform` callback will drop a property.
|
||||
Please see [plugins](#plugins).
|
||||
|
||||
## How to specify a custom rounding precision?
|
||||
|
||||
@@ -567,9 +621,25 @@ new CleanCSS({
|
||||
|
||||
which sets all units rounding precision to 3 digits except `px` unit precision of 5 digits.
|
||||
|
||||
## How to optimize a stylesheet with custom `rpx` units?
|
||||
|
||||
Since `rpx` is a non standard unit (see [#1074](https://github.com/jakubpawlowicz/clean-css/issues/1074)), it will be dropped by default as an invalid value.
|
||||
|
||||
However you can treat `rpx` units as regular ones:
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
compatibility: {
|
||||
customUnits: {
|
||||
rpx: true
|
||||
}
|
||||
}
|
||||
}).minify(source)
|
||||
```
|
||||
|
||||
## How to keep a CSS fragment intact?
|
||||
|
||||
Note: available in the current master, to be released in 4.2.0.
|
||||
Note: available since 4.2.0.
|
||||
|
||||
Wrap the CSS fragment in special comments which instruct clean-css to preserve it, e.g.
|
||||
|
||||
|
80
node_modules/clean-css/lib/clean.js
generated
vendored
80
node_modules/clean-css/lib/clean.js
generated
vendored
@@ -18,6 +18,7 @@ var inlineRequestFrom = require('./options/inline-request');
|
||||
var inlineTimeoutFrom = require('./options/inline-timeout');
|
||||
var OptimizationLevel = require('./options/optimization-level').OptimizationLevel;
|
||||
var optimizationLevelFrom = require('./options/optimization-level').optimizationLevelFrom;
|
||||
var pluginsFrom = require('./options/plugins');
|
||||
var rebaseFrom = require('./options/rebase');
|
||||
var rebaseToFrom = require('./options/rebase-to');
|
||||
|
||||
@@ -31,14 +32,17 @@ var CleanCSS = module.exports = function CleanCSS(options) {
|
||||
options = options || {};
|
||||
|
||||
this.options = {
|
||||
batch: !!options.batch,
|
||||
compatibility: compatibilityFrom(options.compatibility),
|
||||
explicitRebaseTo: 'rebaseTo' in options,
|
||||
fetch: fetchFrom(options.fetch),
|
||||
format: formatFrom(options.format),
|
||||
inline: inlineFrom(options.inline),
|
||||
inlineRequest: inlineRequestFrom(options.inlineRequest),
|
||||
inlineTimeout: inlineTimeoutFrom(options.inlineTimeout),
|
||||
level: optimizationLevelFrom(options.level),
|
||||
rebase: rebaseFrom(options.rebase),
|
||||
plugins: pluginsFrom(options.plugins),
|
||||
rebase: rebaseFrom(options.rebase, options.rebaseTo),
|
||||
rebaseTo: rebaseToFrom(options.rebaseTo),
|
||||
returnPromise: !!options.returnPromise,
|
||||
sourceMap: !!options.sourceMap,
|
||||
@@ -67,17 +71,78 @@ CleanCSS.prototype.minify = function (input, maybeSourceMap, maybeCallback) {
|
||||
|
||||
if (options.returnPromise) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
minify(input, options, maybeSourceMap, function (errors, output) {
|
||||
minifyAll(input, options, maybeSourceMap, function (errors, output) {
|
||||
return errors ?
|
||||
reject(errors) :
|
||||
resolve(output);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return minify(input, options, maybeSourceMap, maybeCallback);
|
||||
return minifyAll(input, options, maybeSourceMap, maybeCallback);
|
||||
}
|
||||
};
|
||||
|
||||
function minifyAll(input, options, maybeSourceMap, maybeCallback) {
|
||||
if (options.batch && Array.isArray(input)) {
|
||||
return minifyInBatchesFromArray(input, options, maybeSourceMap, maybeCallback);
|
||||
} else if (options.batch && (typeof input == 'object')) {
|
||||
return minifyInBatchesFromHash(input, options, maybeSourceMap, maybeCallback);
|
||||
} else {
|
||||
return minify(input, options, maybeSourceMap, maybeCallback);
|
||||
}
|
||||
}
|
||||
|
||||
function minifyInBatchesFromArray(input, options, maybeSourceMap, maybeCallback) {
|
||||
var callback = typeof maybeCallback == 'function' ?
|
||||
maybeCallback :
|
||||
(typeof maybeSourceMap == 'function' ? maybeSourceMap : null);
|
||||
var errors = [];
|
||||
var outputAsHash = {};
|
||||
var inputValue;
|
||||
var i, l;
|
||||
|
||||
function whenHashBatchDone(innerErrors, output) {
|
||||
outputAsHash = Object.assign(outputAsHash, output);
|
||||
errors.concat(innerErrors);
|
||||
}
|
||||
|
||||
for (i = 0, l = input.length; i < l; i++) {
|
||||
if (typeof input[i] == 'object') {
|
||||
minifyInBatchesFromHash(input[i], options, whenHashBatchDone);
|
||||
} else {
|
||||
inputValue = input[i];
|
||||
|
||||
outputAsHash[inputValue] = minify([inputValue], options);
|
||||
errors.concat(outputAsHash[inputValue].errors);
|
||||
}
|
||||
}
|
||||
|
||||
return callback ?
|
||||
callback(errors.length > 0 ? errors : null, outputAsHash) :
|
||||
outputAsHash;
|
||||
}
|
||||
|
||||
function minifyInBatchesFromHash(input, options, maybeSourceMap, maybeCallback) {
|
||||
var callback = typeof maybeCallback == 'function' ?
|
||||
maybeCallback :
|
||||
(typeof maybeSourceMap == 'function' ? maybeSourceMap : null);
|
||||
var errors = [];
|
||||
var outputAsHash = {};
|
||||
var inputKey;
|
||||
var inputValue;
|
||||
|
||||
for (inputKey in input) {
|
||||
inputValue = input[inputKey];
|
||||
|
||||
outputAsHash[inputKey] = minify(inputValue.styles, options, inputValue.sourceMap);
|
||||
errors.concat(outputAsHash[inputKey].errors);
|
||||
}
|
||||
|
||||
return callback ?
|
||||
callback(errors.length > 0 ? errors : null, outputAsHash) :
|
||||
outputAsHash;
|
||||
}
|
||||
|
||||
function minify(input, options, maybeSourceMap, maybeCallback) {
|
||||
var sourceMap = typeof maybeSourceMap != 'function' ?
|
||||
maybeSourceMap :
|
||||
@@ -106,11 +171,20 @@ function minify(input, options, maybeSourceMap, maybeCallback) {
|
||||
validator: validator(options.compatibility),
|
||||
warnings: []
|
||||
};
|
||||
var implicitRebaseToWarning;
|
||||
|
||||
if (sourceMap) {
|
||||
context.inputSourceMapTracker.track(undefined, sourceMap);
|
||||
}
|
||||
|
||||
if (options.rebase && !options.explicitRebaseTo) {
|
||||
implicitRebaseToWarning =
|
||||
'You have set `rebase: true` without giving `rebaseTo` option, which, in this case, defaults to the current working directory. ' +
|
||||
'You are then warned this can lead to unexpected URL rebasing (aka here be dragons)! ' +
|
||||
'If you are OK with the clean-css output, then you can get rid of this warning by giving clean-css a `rebaseTo: process.cwd()` option.';
|
||||
context.warnings.push(implicitRebaseToWarning);
|
||||
}
|
||||
|
||||
return runner(context.localOnly)(function () {
|
||||
return readSources(input, context, function (tokens) {
|
||||
var serialize = context.options.sourceMap ?
|
||||
|
@@ -1,6 +1,6 @@
|
||||
var wrapSingle = require('../wrap-for-optimizing').single;
|
||||
var wrapSingle = require('./wrap-for-optimizing').single;
|
||||
|
||||
var Token = require('../../tokenizer/token');
|
||||
var Token = require('../tokenizer/token');
|
||||
|
||||
function deep(property) {
|
||||
var cloned = shallow(property);
|
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
var InvalidPropertyError = require('./invalid-property-error');
|
||||
var InvalidPropertyError = require('../invalid-property-error');
|
||||
|
||||
var wrapSingle = require('../wrap-for-optimizing').single;
|
||||
|
||||
@@ -31,8 +31,8 @@ function _styleFilter(validator) {
|
||||
};
|
||||
}
|
||||
|
||||
function _wrapDefault(name, property, compactable) {
|
||||
var descriptor = compactable[name];
|
||||
function _wrapDefault(name, property, configuration) {
|
||||
var descriptor = configuration[name];
|
||||
if (descriptor.doubleValues && descriptor.defaultValue.length == 2) {
|
||||
return wrapSingle([
|
||||
Token.PROPERTY,
|
||||
@@ -58,21 +58,21 @@ function _wrapDefault(name, property, compactable) {
|
||||
function _widthFilter(validator) {
|
||||
return function (value) {
|
||||
return value[1] != 'inherit' &&
|
||||
(validator.isWidth(value[1]) || validator.isUnit(value[1]) && !validator.isDynamicUnit(value[1])) &&
|
||||
(validator.isWidth(value[1]) || validator.isUnit(value[1]) || validator.isDynamicUnit(value[1])) &&
|
||||
!validator.isStyleKeyword(value[1]) &&
|
||||
!validator.isColorFunction(value[1]);
|
||||
};
|
||||
}
|
||||
|
||||
function animation(property, compactable, validator) {
|
||||
var duration = _wrapDefault(property.name + '-duration', property, compactable);
|
||||
var timing = _wrapDefault(property.name + '-timing-function', property, compactable);
|
||||
var delay = _wrapDefault(property.name + '-delay', property, compactable);
|
||||
var iteration = _wrapDefault(property.name + '-iteration-count', property, compactable);
|
||||
var direction = _wrapDefault(property.name + '-direction', property, compactable);
|
||||
var fill = _wrapDefault(property.name + '-fill-mode', property, compactable);
|
||||
var play = _wrapDefault(property.name + '-play-state', property, compactable);
|
||||
var name = _wrapDefault(property.name + '-name', property, compactable);
|
||||
function animation(property, configuration, validator) {
|
||||
var duration = _wrapDefault(property.name + '-duration', property, configuration);
|
||||
var timing = _wrapDefault(property.name + '-timing-function', property, configuration);
|
||||
var delay = _wrapDefault(property.name + '-delay', property, configuration);
|
||||
var iteration = _wrapDefault(property.name + '-iteration-count', property, configuration);
|
||||
var direction = _wrapDefault(property.name + '-direction', property, configuration);
|
||||
var fill = _wrapDefault(property.name + '-fill-mode', property, configuration);
|
||||
var play = _wrapDefault(property.name + '-play-state', property, configuration);
|
||||
var name = _wrapDefault(property.name + '-name', property, configuration);
|
||||
var components = [duration, timing, delay, iteration, direction, fill, play, name];
|
||||
var values = property.value;
|
||||
var value;
|
||||
@@ -131,15 +131,15 @@ function animation(property, compactable, validator) {
|
||||
return components;
|
||||
}
|
||||
|
||||
function background(property, compactable, validator) {
|
||||
var image = _wrapDefault('background-image', property, compactable);
|
||||
var position = _wrapDefault('background-position', property, compactable);
|
||||
var size = _wrapDefault('background-size', property, compactable);
|
||||
var repeat = _wrapDefault('background-repeat', property, compactable);
|
||||
var attachment = _wrapDefault('background-attachment', property, compactable);
|
||||
var origin = _wrapDefault('background-origin', property, compactable);
|
||||
var clip = _wrapDefault('background-clip', property, compactable);
|
||||
var color = _wrapDefault('background-color', property, compactable);
|
||||
function background(property, configuration, validator) {
|
||||
var image = _wrapDefault('background-image', property, configuration);
|
||||
var position = _wrapDefault('background-position', property, configuration);
|
||||
var size = _wrapDefault('background-size', property, configuration);
|
||||
var repeat = _wrapDefault('background-repeat', property, configuration);
|
||||
var attachment = _wrapDefault('background-attachment', property, configuration);
|
||||
var origin = _wrapDefault('background-origin', property, configuration);
|
||||
var clip = _wrapDefault('background-clip', property, configuration);
|
||||
var color = _wrapDefault('background-color', property, configuration);
|
||||
var components = [image, position, size, repeat, attachment, origin, clip, color];
|
||||
var values = property.value;
|
||||
|
||||
@@ -207,7 +207,7 @@ function background(property, compactable, validator) {
|
||||
positionSet = true;
|
||||
}
|
||||
anyValueSet = true;
|
||||
} else if ((color.value[0][1] == compactable[color.name].defaultValue || color.value[0][1] == 'none') && (validator.isColor(value[1]) || validator.isPrefixed(value[1]))) {
|
||||
} else if ((color.value[0][1] == configuration[color.name].defaultValue || color.value[0][1] == 'none') && (validator.isColor(value[1]) || validator.isPrefixed(value[1]))) {
|
||||
color.value = [value];
|
||||
anyValueSet = true;
|
||||
} else if (validator.isUrl(value[1]) || validator.isFunction(value[1])) {
|
||||
@@ -226,7 +226,7 @@ function background(property, compactable, validator) {
|
||||
return components;
|
||||
}
|
||||
|
||||
function borderRadius(property, compactable) {
|
||||
function borderRadius(property, configuration) {
|
||||
var values = property.value;
|
||||
var splitAt = -1;
|
||||
|
||||
@@ -241,17 +241,17 @@ function borderRadius(property, compactable) {
|
||||
throw new InvalidPropertyError('Invalid border-radius value at ' + formatPosition(values[0][2][0]) + '. Ignoring.');
|
||||
}
|
||||
|
||||
var target = _wrapDefault(property.name, property, compactable);
|
||||
var target = _wrapDefault(property.name, property, configuration);
|
||||
target.value = splitAt > -1 ?
|
||||
values.slice(0, splitAt) :
|
||||
values.slice(0);
|
||||
target.components = fourValues(target, compactable);
|
||||
target.components = fourValues(target, configuration);
|
||||
|
||||
var remainder = _wrapDefault(property.name, property, compactable);
|
||||
var remainder = _wrapDefault(property.name, property, configuration);
|
||||
remainder.value = splitAt > -1 ?
|
||||
values.slice(splitAt + 1) :
|
||||
values.slice(0);
|
||||
remainder.components = fourValues(remainder, compactable);
|
||||
remainder.components = fourValues(remainder, configuration);
|
||||
|
||||
for (var j = 0; j < 4; j++) {
|
||||
target.components[j].multiplex = true;
|
||||
@@ -261,14 +261,14 @@ function borderRadius(property, compactable) {
|
||||
return target.components;
|
||||
}
|
||||
|
||||
function font(property, compactable, validator) {
|
||||
var style = _wrapDefault('font-style', property, compactable);
|
||||
var variant = _wrapDefault('font-variant', property, compactable);
|
||||
var weight = _wrapDefault('font-weight', property, compactable);
|
||||
var stretch = _wrapDefault('font-stretch', property, compactable);
|
||||
var size = _wrapDefault('font-size', property, compactable);
|
||||
var height = _wrapDefault('line-height', property, compactable);
|
||||
var family = _wrapDefault('font-family', property, compactable);
|
||||
function font(property, configuration, validator) {
|
||||
var style = _wrapDefault('font-style', property, configuration);
|
||||
var variant = _wrapDefault('font-variant', property, configuration);
|
||||
var weight = _wrapDefault('font-weight', property, configuration);
|
||||
var stretch = _wrapDefault('font-stretch', property, configuration);
|
||||
var size = _wrapDefault('font-size', property, configuration);
|
||||
var height = _wrapDefault('line-height', property, configuration);
|
||||
var family = _wrapDefault('font-family', property, configuration);
|
||||
var components = [style, variant, weight, stretch, size, height, family];
|
||||
var values = property.value;
|
||||
var fuzzyMatched = 4; // style, variant, weight, and stretch
|
||||
@@ -403,7 +403,7 @@ function _anyIsFontFamily(values, validator) {
|
||||
for (i = 0, l = values.length; i < l; i++) {
|
||||
value = values[i];
|
||||
|
||||
if (validator.isIdentifier(value[1])) {
|
||||
if (validator.isIdentifier(value[1]) || validator.isQuotedText(value[1])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -411,8 +411,8 @@ function _anyIsFontFamily(values, validator) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function fourValues(property, compactable) {
|
||||
var componentNames = compactable[property.name].components;
|
||||
function fourValues(property, configuration) {
|
||||
var componentNames = configuration[property.name].components;
|
||||
var components = [];
|
||||
var value = property.value;
|
||||
|
||||
@@ -439,7 +439,7 @@ function fourValues(property, compactable) {
|
||||
}
|
||||
|
||||
function multiplex(splitWith) {
|
||||
return function (property, compactable, validator) {
|
||||
return function (property, configuration, validator) {
|
||||
var splitsAt = [];
|
||||
var values = property.value;
|
||||
var i, j, l, m;
|
||||
@@ -451,7 +451,7 @@ function multiplex(splitWith) {
|
||||
}
|
||||
|
||||
if (splitsAt.length === 0)
|
||||
return splitWith(property, compactable, validator);
|
||||
return splitWith(property, configuration, validator);
|
||||
|
||||
var splitComponents = [];
|
||||
|
||||
@@ -460,10 +460,10 @@ function multiplex(splitWith) {
|
||||
var from = i === 0 ? 0 : splitsAt[i - 1] + 1;
|
||||
var to = i < l ? splitsAt[i] : values.length;
|
||||
|
||||
var _property = _wrapDefault(property.name, property, compactable);
|
||||
var _property = _wrapDefault(property.name, property, configuration);
|
||||
_property.value = values.slice(from, to);
|
||||
|
||||
splitComponents.push(splitWith(_property, compactable, validator));
|
||||
splitComponents.push(splitWith(_property, configuration, validator));
|
||||
}
|
||||
|
||||
var components = splitComponents[0];
|
||||
@@ -482,10 +482,10 @@ function multiplex(splitWith) {
|
||||
};
|
||||
}
|
||||
|
||||
function listStyle(property, compactable, validator) {
|
||||
var type = _wrapDefault('list-style-type', property, compactable);
|
||||
var position = _wrapDefault('list-style-position', property, compactable);
|
||||
var image = _wrapDefault('list-style-image', property, compactable);
|
||||
function listStyle(property, configuration, validator) {
|
||||
var type = _wrapDefault('list-style-type', property, configuration);
|
||||
var position = _wrapDefault('list-style-position', property, configuration);
|
||||
var image = _wrapDefault('list-style-image', property, configuration);
|
||||
var components = [type, position, image];
|
||||
|
||||
if (property.value.length == 1 && property.value[0][1] == 'inherit') {
|
||||
@@ -523,11 +523,11 @@ function listStyle(property, compactable, validator) {
|
||||
return components;
|
||||
}
|
||||
|
||||
function transition(property, compactable, validator) {
|
||||
var prop = _wrapDefault(property.name + '-property', property, compactable);
|
||||
var duration = _wrapDefault(property.name + '-duration', property, compactable);
|
||||
var timing = _wrapDefault(property.name + '-timing-function', property, compactable);
|
||||
var delay = _wrapDefault(property.name + '-delay', property, compactable);
|
||||
function transition(property, configuration, validator) {
|
||||
var prop = _wrapDefault(property.name + '-property', property, configuration);
|
||||
var duration = _wrapDefault(property.name + '-duration', property, configuration);
|
||||
var timing = _wrapDefault(property.name + '-timing-function', property, configuration);
|
||||
var delay = _wrapDefault(property.name + '-delay', property, configuration);
|
||||
var components = [prop, duration, timing, delay];
|
||||
var values = property.value;
|
||||
var value;
|
||||
@@ -570,12 +570,12 @@ function transition(property, compactable, validator) {
|
||||
return components;
|
||||
}
|
||||
|
||||
function widthStyleColor(property, compactable, validator) {
|
||||
var descriptor = compactable[property.name];
|
||||
function widthStyleColor(property, configuration, validator) {
|
||||
var descriptor = configuration[property.name];
|
||||
var components = [
|
||||
_wrapDefault(descriptor.components[0], property, compactable),
|
||||
_wrapDefault(descriptor.components[1], property, compactable),
|
||||
_wrapDefault(descriptor.components[2], property, compactable)
|
||||
_wrapDefault(descriptor.components[0], property, configuration),
|
||||
_wrapDefault(descriptor.components[1], property, configuration),
|
||||
_wrapDefault(descriptor.components[2], property, configuration)
|
||||
];
|
||||
var color, style, width;
|
||||
|
@@ -28,7 +28,14 @@ function areSameFunction(validator, value1, value2) {
|
||||
var function1Name = value1.substring(0, value1.indexOf('('));
|
||||
var function2Name = value2.substring(0, value2.indexOf('('));
|
||||
|
||||
return function1Name === function2Name;
|
||||
var function1Value = value1.substring(function1Name.length + 1, value1.length - 1);
|
||||
var function2Value = value2.substring(function2Name.length + 1, value2.length - 1);
|
||||
|
||||
if (validator.isFunction(function1Value) || validator.isFunction(function2Value)) {
|
||||
return function1Name === function2Name && areSameFunction(validator, function1Value, function2Value);
|
||||
} else {
|
||||
return function1Name === function2Name;
|
||||
}
|
||||
}
|
||||
|
||||
function backgroundPosition(validator, value1, value2) {
|
||||
@@ -64,6 +71,8 @@ function color(validator, value1, value2) {
|
||||
return false;
|
||||
} else if (!validator.colorOpacity && (validator.isRgbColor(value2) || validator.isHslColor(value2))) {
|
||||
return false;
|
||||
} else if (!validator.colorHexAlpha && (validator.isHexAlphaColor(value1) || validator.isHexAlphaColor(value2))) {
|
||||
return false;
|
||||
} else if (validator.isColor(value1) && validator.isColor(value2)) {
|
||||
return true;
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
var sameVendorPrefixes = require('./vendor-prefixes').same;
|
||||
var sameVendorPrefixes = require('../../vendor-prefixes').same;
|
||||
|
||||
function understandable(validator, value1, value2, _position, isPaired) {
|
||||
if (!sameVendorPrefixes(value1, value2)) {
|
@@ -1,4 +1,4 @@
|
||||
var shallowClone = require('./clone').shallow;
|
||||
var shallowClone = require('../clone').shallow;
|
||||
|
||||
var Token = require('../../tokenizer/token');
|
||||
var Marker = require('../../tokenizer/marker');
|
||||
@@ -14,7 +14,7 @@ function isInheritOnly(values) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function background(property, compactable, lastInMultiplex) {
|
||||
function background(property, configuration, lastInMultiplex) {
|
||||
var components = property.components;
|
||||
var restored = [];
|
||||
var needsOne, needsBoth;
|
||||
@@ -24,7 +24,7 @@ function background(property, compactable, lastInMultiplex) {
|
||||
}
|
||||
|
||||
function isDefaultValue(component) {
|
||||
var descriptor = compactable[component.name];
|
||||
var descriptor = configuration[component.name];
|
||||
|
||||
if (descriptor.doubleValues && descriptor.defaultValue.length == 1) {
|
||||
return component.value[0][1] == descriptor.defaultValue[0] && (component.value[1] ? component.value[1][1] == descriptor.defaultValue[0] : true);
|
||||
@@ -79,7 +79,7 @@ function background(property, compactable, lastInMultiplex) {
|
||||
|
||||
i--;
|
||||
} else {
|
||||
if (isDefault || compactable[component.name].multiplexLastOnly && !lastInMultiplex)
|
||||
if (isDefault || configuration[component.name].multiplexLastOnly && !lastInMultiplex)
|
||||
continue;
|
||||
|
||||
restoreValue(component);
|
||||
@@ -90,7 +90,7 @@ function background(property, compactable, lastInMultiplex) {
|
||||
restored.push(property.value[0]);
|
||||
|
||||
if (restored.length === 0)
|
||||
restored.push([Token.PROPERTY_VALUE, compactable[property.name].defaultValue]);
|
||||
restored.push([Token.PROPERTY_VALUE, configuration[property.name].defaultValue]);
|
||||
|
||||
if (isInheritOnly(restored))
|
||||
return [restored[0]];
|
||||
@@ -98,7 +98,7 @@ function background(property, compactable, lastInMultiplex) {
|
||||
return restored;
|
||||
}
|
||||
|
||||
function borderRadius(property, compactable) {
|
||||
function borderRadius(property, configuration) {
|
||||
if (property.multiplex) {
|
||||
var horizontal = shallowClone(property);
|
||||
var vertical = shallowClone(property);
|
||||
@@ -118,8 +118,8 @@ function borderRadius(property, compactable) {
|
||||
vertical.components.push(verticalComponent);
|
||||
}
|
||||
|
||||
var horizontalValues = fourValues(horizontal, compactable);
|
||||
var verticalValues = fourValues(vertical, compactable);
|
||||
var horizontalValues = fourValues(horizontal, configuration);
|
||||
var verticalValues = fourValues(vertical, configuration);
|
||||
|
||||
if (horizontalValues.length == verticalValues.length &&
|
||||
horizontalValues[0][1] == verticalValues[0][1] &&
|
||||
@@ -131,11 +131,11 @@ function borderRadius(property, compactable) {
|
||||
return horizontalValues.concat([[Token.PROPERTY_VALUE, Marker.FORWARD_SLASH]]).concat(verticalValues);
|
||||
}
|
||||
} else {
|
||||
return fourValues(property, compactable);
|
||||
return fourValues(property, configuration);
|
||||
}
|
||||
}
|
||||
|
||||
function font(property, compactable) {
|
||||
function font(property, configuration) {
|
||||
var components = property.components;
|
||||
var restored = [];
|
||||
var component;
|
||||
@@ -151,7 +151,7 @@ function font(property, compactable) {
|
||||
while (componentIndex < 4) {
|
||||
component = components[componentIndex];
|
||||
|
||||
if (component.value[0][1] != compactable[component.name].defaultValue) {
|
||||
if (component.value[0][1] != configuration[component.name].defaultValue) {
|
||||
Array.prototype.push.apply(restored, component.value);
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ function font(property, compactable) {
|
||||
componentIndex++;
|
||||
|
||||
// then may come line-height
|
||||
if (components[componentIndex].value[0][1] != compactable[components[componentIndex].name].defaultValue) {
|
||||
if (components[componentIndex].value[0][1] != configuration[components[componentIndex].name].defaultValue) {
|
||||
Array.prototype.push.apply(restored, [[Token.PROPERTY_VALUE, Marker.FORWARD_SLASH]]);
|
||||
Array.prototype.push.apply(restored, components[componentIndex].value);
|
||||
}
|
||||
@@ -207,9 +207,9 @@ function fourValues(property) {
|
||||
}
|
||||
|
||||
function multiplex(restoreWith) {
|
||||
return function (property, compactable) {
|
||||
return function (property, configuration) {
|
||||
if (!property.multiplex)
|
||||
return restoreWith(property, compactable, true);
|
||||
return restoreWith(property, configuration, true);
|
||||
|
||||
var multiplexSize = 0;
|
||||
var restored = [];
|
||||
@@ -245,7 +245,7 @@ function multiplex(restoreWith) {
|
||||
|
||||
// No we can restore shorthand value
|
||||
var lastInMultiplex = i == multiplexSize;
|
||||
var _restored = restoreWith(_property, compactable, lastInMultiplex);
|
||||
var _restored = restoreWith(_property, configuration, lastInMultiplex);
|
||||
Array.prototype.push.apply(restored, _restored);
|
||||
|
||||
if (i < multiplexSize)
|
||||
@@ -256,21 +256,21 @@ function multiplex(restoreWith) {
|
||||
};
|
||||
}
|
||||
|
||||
function withoutDefaults(property, compactable) {
|
||||
function withoutDefaults(property, configuration) {
|
||||
var components = property.components;
|
||||
var restored = [];
|
||||
|
||||
for (var i = components.length - 1; i >= 0; i--) {
|
||||
var component = components[i];
|
||||
var descriptor = compactable[component.name];
|
||||
var descriptor = configuration[component.name];
|
||||
|
||||
if (component.value[0][1] != descriptor.defaultValue || ('keepUnlessDefault' in descriptor) && !isDefault(components, compactable, descriptor.keepUnlessDefault)) {
|
||||
if (component.value[0][1] != descriptor.defaultValue || ('keepUnlessDefault' in descriptor) && !isDefault(components, configuration, descriptor.keepUnlessDefault)) {
|
||||
restored.unshift(component.value[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (restored.length === 0)
|
||||
restored.push([Token.PROPERTY_VALUE, compactable[property.name].defaultValue]);
|
||||
restored.push([Token.PROPERTY_VALUE, configuration[property.name].defaultValue]);
|
||||
|
||||
if (isInheritOnly(restored))
|
||||
return [restored[0]];
|
||||
@@ -278,14 +278,14 @@ function withoutDefaults(property, compactable) {
|
||||
return restored;
|
||||
}
|
||||
|
||||
function isDefault(components, compactable, propertyName) {
|
||||
function isDefault(components, configuration, propertyName) {
|
||||
var component;
|
||||
var i, l;
|
||||
|
||||
for (i = 0, l = components.length; i < l; i++) {
|
||||
component = components[i];
|
||||
|
||||
if (component.name == propertyName && component.value[0][1] == compactable[propertyName].defaultValue) {
|
||||
if (component.name == propertyName && component.value[0][1] == configuration[propertyName].defaultValue) {
|
||||
return true;
|
||||
}
|
||||
}
|
466
node_modules/clean-css/lib/optimizer/level-1/optimize.js
generated
vendored
466
node_modules/clean-css/lib/optimizer/level-1/optimize.js
generated
vendored
@@ -1,6 +1,3 @@
|
||||
var shortenHex = require('./shorten-hex');
|
||||
var shortenHsl = require('./shorten-hsl');
|
||||
var shortenRgb = require('./shorten-rgb');
|
||||
var sortSelectors = require('./sort-selectors');
|
||||
var tidyRules = require('./tidy-rules');
|
||||
var tidyBlock = require('./tidy-block');
|
||||
@@ -11,399 +8,85 @@ var removeUnused = require('../remove-unused');
|
||||
var restoreFromOptimizing = require('../restore-from-optimizing');
|
||||
var wrapForOptimizing = require('../wrap-for-optimizing').all;
|
||||
|
||||
var configuration = require('../configuration');
|
||||
var optimizers = require('./value-optimizers');
|
||||
|
||||
var OptimizationLevel = require('../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var Token = require('../../tokenizer/token');
|
||||
var Marker = require('../../tokenizer/marker');
|
||||
|
||||
var formatPosition = require('../../utils/format-position');
|
||||
var split = require('../../utils/split');
|
||||
|
||||
var serializeRules = require('../../writer/one-time').rules;
|
||||
|
||||
var IgnoreProperty = 'ignore-property';
|
||||
|
||||
var CHARSET_TOKEN = '@charset';
|
||||
var CHARSET_REGEXP = new RegExp('^' + CHARSET_TOKEN, 'i');
|
||||
|
||||
var DEFAULT_ROUNDING_PRECISION = require('../../options/rounding-precision').DEFAULT;
|
||||
|
||||
var WHOLE_PIXEL_VALUE = /(?:^|\s|\()(-?\d+)px/;
|
||||
var TIME_VALUE = /^(\-?[\d\.]+)(m?s)$/;
|
||||
|
||||
var HEX_VALUE_PATTERN = /[0-9a-f]/i;
|
||||
var PROPERTY_NAME_PATTERN = /^(?:\-chrome\-|\-[\w\-]+\w|\w[\w\-]+\w|\-\-\S+)$/;
|
||||
var PROPERTY_NAME_PATTERN = /^(?:\-chrome\-|\-[\w\-]+\w|\w[\w\-]+\w|\w{1,}|\-\-\S+)$/;
|
||||
var IMPORT_PREFIX_PATTERN = /^@import/i;
|
||||
var QUOTED_PATTERN = /^('.*'|".*")$/;
|
||||
var QUOTED_BUT_SAFE_PATTERN = /^['"][a-zA-Z][a-zA-Z\d\-_]+['"]$/;
|
||||
var URL_PREFIX_PATTERN = /^url\(/i;
|
||||
var LOCAL_PREFIX_PATTERN = /^local\(/i;
|
||||
var VARIABLE_NAME_PATTERN = /^--\S+$/;
|
||||
|
||||
function isLocal(value){
|
||||
return LOCAL_PREFIX_PATTERN.test(value);
|
||||
}
|
||||
|
||||
function isNegative(value) {
|
||||
return value && value[1][0] == '-' && parseFloat(value[1]) < 0;
|
||||
}
|
||||
|
||||
function isQuoted(value) {
|
||||
return QUOTED_PATTERN.test(value);
|
||||
}
|
||||
|
||||
function isUrl(value) {
|
||||
function startsAsUrl(value) {
|
||||
return URL_PREFIX_PATTERN.test(value);
|
||||
}
|
||||
|
||||
function normalizeUrl(value) {
|
||||
return value
|
||||
.replace(URL_PREFIX_PATTERN, 'url(')
|
||||
.replace(/\\?\n|\\?\r\n/g, '');
|
||||
function isImport(token) {
|
||||
return IMPORT_PREFIX_PATTERN.test(token[1]);
|
||||
}
|
||||
|
||||
function optimizeBackground(property) {
|
||||
var values = property.value;
|
||||
function isLegacyFilter(property) {
|
||||
var value;
|
||||
|
||||
if (values.length == 1 && values[0][1] == 'none') {
|
||||
values[0][1] = '0 0';
|
||||
}
|
||||
if (property.name == 'filter' || property.name == '-ms-filter') {
|
||||
value = property.value[0][1];
|
||||
|
||||
if (values.length == 1 && values[0][1] == 'transparent') {
|
||||
values[0][1] = '0 0';
|
||||
}
|
||||
}
|
||||
|
||||
function optimizeBorderRadius(property) {
|
||||
var values = property.value;
|
||||
var spliceAt;
|
||||
|
||||
if (values.length == 3 && values[1][1] == '/' && values[0][1] == values[2][1]) {
|
||||
spliceAt = 1;
|
||||
} else if (values.length == 5 && values[2][1] == '/' && values[0][1] == values[3][1] && values[1][1] == values[4][1]) {
|
||||
spliceAt = 2;
|
||||
} else if (values.length == 7 && values[3][1] == '/' && values[0][1] == values[4][1] && values[1][1] == values[5][1] && values[2][1] == values[6][1]) {
|
||||
spliceAt = 3;
|
||||
} else if (values.length == 9 && values[4][1] == '/' && values[0][1] == values[5][1] && values[1][1] == values[6][1] && values[2][1] == values[7][1] && values[3][1] == values[8][1]) {
|
||||
spliceAt = 4;
|
||||
}
|
||||
|
||||
if (spliceAt) {
|
||||
property.value.splice(spliceAt);
|
||||
property.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {string} value
|
||||
* @param {Object} compatibility
|
||||
* @return {string}
|
||||
*/
|
||||
function optimizeColors(name, value, compatibility) {
|
||||
if (!value.match(/#|rgb|hsl/gi)) {
|
||||
return shortenHex(value);
|
||||
}
|
||||
|
||||
value = value
|
||||
.replace(/(rgb|hsl)a?\((\-?\d+),(\-?\d+\%?),(\-?\d+\%?),(0*[1-9]+[0-9]*(\.?\d*)?)\)/gi, function (match, colorFn, p1, p2, p3, alpha) {
|
||||
return (parseInt(alpha, 10) >= 1 ? colorFn + '(' + [p1,p2,p3].join(',') + ')' : match);
|
||||
})
|
||||
.replace(/rgb\((\-?\d+),(\-?\d+),(\-?\d+)\)/gi, function (match, red, green, blue) {
|
||||
return shortenRgb(red, green, blue);
|
||||
})
|
||||
.replace(/hsl\((-?\d+),(-?\d+)%?,(-?\d+)%?\)/gi, function (match, hue, saturation, lightness) {
|
||||
return shortenHsl(hue, saturation, lightness);
|
||||
})
|
||||
.replace(/(^|[^='"])#([0-9a-f]{6})/gi, function (match, prefix, color, at, inputValue) {
|
||||
var suffix = inputValue[at + match.length];
|
||||
|
||||
if (suffix && HEX_VALUE_PATTERN.test(suffix)) {
|
||||
return match;
|
||||
} else if (color[0] == color[1] && color[2] == color[3] && color[4] == color[5]) {
|
||||
return (prefix + '#' + color[0] + color[2] + color[4]).toLowerCase();
|
||||
} else {
|
||||
return (prefix + '#' + color).toLowerCase();
|
||||
}
|
||||
})
|
||||
.replace(/(^|[^='"])#([0-9a-f]{3})/gi, function (match, prefix, color) {
|
||||
return prefix + '#' + color.toLowerCase();
|
||||
})
|
||||
.replace(/(rgb|rgba|hsl|hsla)\(([^\)]+)\)/gi, function (match, colorFunction, colorDef) {
|
||||
var tokens = colorDef.split(',');
|
||||
var colorFnLowercase = colorFunction && colorFunction.toLowerCase();
|
||||
var applies = (colorFnLowercase == 'hsl' && tokens.length == 3) ||
|
||||
(colorFnLowercase == 'hsla' && tokens.length == 4) ||
|
||||
(colorFnLowercase == 'rgb' && tokens.length === 3 && colorDef.indexOf('%') > 0) ||
|
||||
(colorFnLowercase == 'rgba' && tokens.length == 4 && colorDef.indexOf('%') > 0);
|
||||
|
||||
if (!applies) {
|
||||
return match;
|
||||
}
|
||||
|
||||
if (tokens[1].indexOf('%') == -1) {
|
||||
tokens[1] += '%';
|
||||
}
|
||||
|
||||
if (tokens[2].indexOf('%') == -1) {
|
||||
tokens[2] += '%';
|
||||
}
|
||||
|
||||
return colorFunction + '(' + tokens.join(',') + ')';
|
||||
});
|
||||
|
||||
if (compatibility.colors.opacity && name.indexOf('background') == -1) {
|
||||
value = value.replace(/(?:rgba|hsla)\(0,0%?,0%?,0\)/g, function (match) {
|
||||
if (split(value, ',').pop().indexOf('gradient(') > -1) {
|
||||
return match;
|
||||
}
|
||||
|
||||
return 'transparent';
|
||||
});
|
||||
}
|
||||
|
||||
return shortenHex(value);
|
||||
}
|
||||
|
||||
function optimizeFilter(property) {
|
||||
if (property.value.length == 1) {
|
||||
property.value[0][1] = property.value[0][1].replace(/progid:DXImageTransform\.Microsoft\.(Alpha|Chroma)(\W)/, function (match, filter, suffix) {
|
||||
return filter.toLowerCase() + suffix;
|
||||
});
|
||||
}
|
||||
|
||||
property.value[0][1] = property.value[0][1]
|
||||
.replace(/,(\S)/g, ', $1')
|
||||
.replace(/ ?= ?/g, '=');
|
||||
}
|
||||
|
||||
function optimizeFontWeight(property, atIndex) {
|
||||
var value = property.value[atIndex][1];
|
||||
|
||||
if (value == 'normal') {
|
||||
value = '400';
|
||||
} else if (value == 'bold') {
|
||||
value = '700';
|
||||
}
|
||||
|
||||
property.value[atIndex][1] = value;
|
||||
}
|
||||
|
||||
function optimizeMultipleZeros(property) {
|
||||
var values = property.value;
|
||||
var spliceAt;
|
||||
|
||||
if (values.length == 4 && values[0][1] === '0' && values[1][1] === '0' && values[2][1] === '0' && values[3][1] === '0') {
|
||||
if (property.name.indexOf('box-shadow') > -1) {
|
||||
spliceAt = 2;
|
||||
} else {
|
||||
spliceAt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (spliceAt) {
|
||||
property.value.splice(spliceAt);
|
||||
property.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
function optimizeOutline(property) {
|
||||
var values = property.value;
|
||||
|
||||
if (values.length == 1 && values[0][1] == 'none') {
|
||||
values[0][1] = '0';
|
||||
}
|
||||
}
|
||||
|
||||
function optimizePixelLengths(_, value, compatibility) {
|
||||
if (!WHOLE_PIXEL_VALUE.test(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.replace(WHOLE_PIXEL_VALUE, function (match, val) {
|
||||
var newValue;
|
||||
var intVal = parseInt(val);
|
||||
|
||||
if (intVal === 0) {
|
||||
return match;
|
||||
}
|
||||
|
||||
if (compatibility.properties.shorterLengthUnits && compatibility.units.pt && intVal * 3 % 4 === 0) {
|
||||
newValue = intVal * 3 / 4 + 'pt';
|
||||
}
|
||||
|
||||
if (compatibility.properties.shorterLengthUnits && compatibility.units.pc && intVal % 16 === 0) {
|
||||
newValue = intVal / 16 + 'pc';
|
||||
}
|
||||
|
||||
if (compatibility.properties.shorterLengthUnits && compatibility.units.in && intVal % 96 === 0) {
|
||||
newValue = intVal / 96 + 'in';
|
||||
}
|
||||
|
||||
if (newValue) {
|
||||
newValue = match.substring(0, match.indexOf(val)) + newValue;
|
||||
}
|
||||
|
||||
return newValue && newValue.length < match.length ? newValue : match;
|
||||
});
|
||||
}
|
||||
|
||||
function optimizePrecision(_, value, precisionOptions) {
|
||||
if (!precisionOptions.enabled || value.indexOf('.') === -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(precisionOptions.decimalPointMatcher, '$1$2$3')
|
||||
.replace(precisionOptions.zeroMatcher, function (match, integerPart, fractionPart, unit) {
|
||||
var multiplier = precisionOptions.units[unit].multiplier;
|
||||
var parsedInteger = parseInt(integerPart);
|
||||
var integer = isNaN(parsedInteger) ? 0 : parsedInteger;
|
||||
var fraction = parseFloat(fractionPart);
|
||||
|
||||
return Math.round((integer + fraction) * multiplier) / multiplier + unit;
|
||||
});
|
||||
}
|
||||
|
||||
function optimizeTimeUnits(_, value) {
|
||||
if (!TIME_VALUE.test(value))
|
||||
return value;
|
||||
|
||||
return value.replace(TIME_VALUE, function (match, val, unit) {
|
||||
var newValue;
|
||||
|
||||
if (unit == 'ms') {
|
||||
newValue = parseInt(val) / 1000 + 's';
|
||||
} else if (unit == 's') {
|
||||
newValue = parseFloat(val) * 1000 + 'ms';
|
||||
}
|
||||
|
||||
return newValue.length < match.length ? newValue : match;
|
||||
});
|
||||
}
|
||||
|
||||
function optimizeUnits(name, value, unitsRegexp) {
|
||||
if (/^(?:\-moz\-calc|\-webkit\-calc|calc|rgb|hsl|rgba|hsla)\(/.test(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (name == 'flex' || name == '-ms-flex' || name == '-webkit-flex' || name == 'flex-basis' || name == '-webkit-flex-basis') {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf('%') > 0 && (name == 'height' || name == 'max-height' || name == 'width' || name == 'max-width')) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(unitsRegexp, '$1' + '0' + '$2')
|
||||
.replace(unitsRegexp, '$1' + '0' + '$2');
|
||||
}
|
||||
|
||||
function optimizeWhitespace(name, value) {
|
||||
if (name.indexOf('filter') > -1 || value.indexOf(' ') == -1 || value.indexOf('expression') === 0) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf(Marker.SINGLE_QUOTE) > -1 || value.indexOf(Marker.DOUBLE_QUOTE) > -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
value = value.replace(/\s+/g, ' ');
|
||||
|
||||
if (value.indexOf('calc') > -1) {
|
||||
value = value.replace(/\) ?\/ ?/g, ')/ ');
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(/(\(;?)\s+/g, '$1')
|
||||
.replace(/\s+(;?\))/g, '$1')
|
||||
.replace(/, /g, ',');
|
||||
}
|
||||
|
||||
function optimizeZeroDegUnit(_, value) {
|
||||
if (value.indexOf('0deg') == -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.replace(/\(0deg\)/g, '(0)');
|
||||
}
|
||||
|
||||
function optimizeZeroUnits(name, value) {
|
||||
if (value.indexOf('0') == -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf('-') > -1) {
|
||||
value = value
|
||||
.replace(/([^\w\d\-]|^)\-0([^\.]|$)/g, '$10$2')
|
||||
.replace(/([^\w\d\-]|^)\-0([^\.]|$)/g, '$10$2');
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(/(^|\s)0+([1-9])/g, '$1$2')
|
||||
.replace(/(^|\D)\.0+(\D|$)/g, '$10$2')
|
||||
.replace(/(^|\D)\.0+(\D|$)/g, '$10$2')
|
||||
.replace(/\.([1-9]*)0+(\D|$)/g, function (match, nonZeroPart, suffix) {
|
||||
return (nonZeroPart.length > 0 ? '.' : '') + nonZeroPart + suffix;
|
||||
})
|
||||
.replace(/(^|\D)0\.(\d)/g, '$1.$2');
|
||||
}
|
||||
|
||||
function removeQuotes(name, value) {
|
||||
if (name == 'content' || name.indexOf('font-variation-settings') > -1 || name.indexOf('font-feature-settings') > -1 || name == 'grid' || name.indexOf('grid-') > -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return QUOTED_BUT_SAFE_PATTERN.test(value) ?
|
||||
value.substring(1, value.length - 1) :
|
||||
value;
|
||||
}
|
||||
|
||||
function removeUrlQuotes(value) {
|
||||
return /^url\(['"].+['"]\)$/.test(value) && !/^url\(['"].*[\*\s\(\)'"].*['"]\)$/.test(value) && !/^url\(['"]data:[^;]+;charset/.test(value) ?
|
||||
value.replace(/["']/g, '') :
|
||||
value;
|
||||
}
|
||||
|
||||
function transformValue(propertyName, propertyValue, rule, transformCallback) {
|
||||
var selector = serializeRules(rule);
|
||||
var transformedValue = transformCallback(propertyName, propertyValue, selector);
|
||||
|
||||
if (transformedValue === undefined) {
|
||||
return propertyValue;
|
||||
} else if (transformedValue === false) {
|
||||
return IgnoreProperty;
|
||||
return value.indexOf('progid') > -1 ||
|
||||
value.indexOf('alpha') === 0 ||
|
||||
value.indexOf('chroma') === 0;
|
||||
} else {
|
||||
return transformedValue;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
function noop() {}
|
||||
|
||||
function optimizeBody(rule, properties, context) {
|
||||
var options = context.options;
|
||||
var levelOptions = options.level[OptimizationLevel.One];
|
||||
var valueOptimizers;
|
||||
var property, name, type, value;
|
||||
var valueIsUrl;
|
||||
var propertyToken;
|
||||
var _properties = wrapForOptimizing(properties, true);
|
||||
var propertyOptimizer;
|
||||
var serializedRule = serializeRules(rule);
|
||||
var _properties = wrapForOptimizing(properties);
|
||||
var pluginValueOptimizers = context.options.plugins.level1Value;
|
||||
var pluginPropertyOptimizers = context.options.plugins.level1Property;
|
||||
var i, l;
|
||||
|
||||
propertyLoop:
|
||||
for (var i = 0, l = _properties.length; i < l; i++) {
|
||||
for (i = 0, l = _properties.length; i < l; i++) {
|
||||
var j, k, m, n;
|
||||
|
||||
property = _properties[i];
|
||||
name = property.name;
|
||||
propertyOptimizer = configuration[name] && configuration[name].propertyOptimizer || noop;
|
||||
valueOptimizers = configuration[name] && configuration[name].valueOptimizers || [optimizers.whiteSpace];
|
||||
|
||||
if (!PROPERTY_NAME_PATTERN.test(name)) {
|
||||
propertyToken = property.all[property.position];
|
||||
context.warnings.push('Invalid property name \'' + name + '\' at ' + formatPosition(propertyToken[1][2][0]) + '. Ignoring.');
|
||||
property.unused = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (property.value.length === 0) {
|
||||
propertyToken = property.all[property.position];
|
||||
context.warnings.push('Empty property \'' + name + '\' at ' + formatPosition(propertyToken[1][2][0]) + '. Ignoring.');
|
||||
property.unused = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (property.hack && (
|
||||
@@ -411,17 +94,11 @@ function optimizeBody(rule, properties, context) {
|
||||
property.hack[0] == Hack.BACKSLASH && !options.compatibility.properties.ieSuffixHack ||
|
||||
property.hack[0] == Hack.BANG && !options.compatibility.properties.ieBangHack)) {
|
||||
property.unused = true;
|
||||
}
|
||||
|
||||
if (levelOptions.removeNegativePaddings && name.indexOf('padding') === 0 && (isNegative(property.value[0]) || isNegative(property.value[1]) || isNegative(property.value[2]) || isNegative(property.value[3]))) {
|
||||
property.unused = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!options.compatibility.properties.ieFilters && isLegacyFilter(property)) {
|
||||
property.unused = true;
|
||||
}
|
||||
|
||||
if (property.unused) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -434,10 +111,10 @@ function optimizeBody(rule, properties, context) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (var j = 0, m = property.value.length; j < m; j++) {
|
||||
valuesLoop:
|
||||
for (j = 0, m = property.value.length; j < m; j++) {
|
||||
type = property.value[j][0];
|
||||
value = property.value[j][1];
|
||||
valueIsUrl = isUrl(value);
|
||||
|
||||
if (type == Token.PROPERTY_BLOCK) {
|
||||
property.unused = true;
|
||||
@@ -445,70 +122,27 @@ function optimizeBody(rule, properties, context) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (valueIsUrl && !context.validator.isUrl(value)) {
|
||||
if (startsAsUrl(value) && !context.validator.isUrl(value)) {
|
||||
property.unused = true;
|
||||
context.warnings.push('Broken URL \'' + value + '\' at ' + formatPosition(property.value[j][2][0]) + '. Ignoring.');
|
||||
break;
|
||||
}
|
||||
|
||||
if (valueIsUrl) {
|
||||
value = levelOptions.normalizeUrls ?
|
||||
normalizeUrl(value) :
|
||||
value;
|
||||
value = !options.compatibility.properties.urlQuotes ?
|
||||
removeUrlQuotes(value) :
|
||||
value;
|
||||
} else if (isQuoted(value) || isLocal(value)) {
|
||||
value = levelOptions.removeQuotes ?
|
||||
removeQuotes(name, value) :
|
||||
value;
|
||||
} else {
|
||||
value = levelOptions.removeWhitespace ?
|
||||
optimizeWhitespace(name, value) :
|
||||
value;
|
||||
value = optimizePrecision(name, value, options.precision);
|
||||
value = optimizePixelLengths(name, value, options.compatibility);
|
||||
value = levelOptions.replaceTimeUnits ?
|
||||
optimizeTimeUnits(name, value) :
|
||||
value;
|
||||
value = levelOptions.replaceZeroUnits ?
|
||||
optimizeZeroUnits(name, value) :
|
||||
value;
|
||||
|
||||
if (options.compatibility.properties.zeroUnits) {
|
||||
value = optimizeZeroDegUnit(name, value);
|
||||
value = optimizeUnits(name, value, options.unitsRegexp);
|
||||
}
|
||||
|
||||
if (options.compatibility.properties.colors) {
|
||||
value = optimizeColors(name, value, options.compatibility);
|
||||
}
|
||||
for (k = 0, n = valueOptimizers.length; k < n; k++) {
|
||||
value = valueOptimizers[k](name, value, options);
|
||||
}
|
||||
|
||||
value = transformValue(name, value, rule, levelOptions.transform);
|
||||
|
||||
if (value === IgnoreProperty) {
|
||||
property.unused = true;
|
||||
continue propertyLoop;
|
||||
for (k = 0, n = pluginValueOptimizers.length; k < n; k++) {
|
||||
value = pluginValueOptimizers[k](name, value, options);
|
||||
}
|
||||
|
||||
property.value[j][1] = value;
|
||||
}
|
||||
|
||||
if (levelOptions.replaceMultipleZeros) {
|
||||
optimizeMultipleZeros(property);
|
||||
}
|
||||
propertyOptimizer(serializedRule, property, options);
|
||||
|
||||
if (name == 'background' && levelOptions.optimizeBackground) {
|
||||
optimizeBackground(property);
|
||||
} else if (name.indexOf('border') === 0 && name.indexOf('radius') > 0 && levelOptions.optimizeBorderRadius) {
|
||||
optimizeBorderRadius(property);
|
||||
} else if (name == 'filter'&& levelOptions.optimizeFilter && options.compatibility.properties.ieFilters) {
|
||||
optimizeFilter(property);
|
||||
} else if (name == 'font-weight' && levelOptions.optimizeFontWeight) {
|
||||
optimizeFontWeight(property, 0);
|
||||
} else if (name == 'outline' && levelOptions.optimizeOutline) {
|
||||
optimizeOutline(property);
|
||||
for (j = 0, m = pluginPropertyOptimizers.length; j < m; j++) {
|
||||
pluginPropertyOptimizers[j](serializedRule, property, options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -613,24 +247,6 @@ function buildPrecisionOptions(roundingPrecision) {
|
||||
return precisionOptions;
|
||||
}
|
||||
|
||||
function isImport(token) {
|
||||
return IMPORT_PREFIX_PATTERN.test(token[1]);
|
||||
}
|
||||
|
||||
function isLegacyFilter(property) {
|
||||
var value;
|
||||
|
||||
if (property.name == 'filter' || property.name == '-ms-filter') {
|
||||
value = property.value[0][1];
|
||||
|
||||
return value.indexOf('progid') > -1 ||
|
||||
value.indexOf('alpha') === 0 ||
|
||||
value.indexOf('chroma') === 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function level1Optimize(tokens, context) {
|
||||
var options = context.options;
|
||||
var levelOptions = options.level[OptimizationLevel.One];
|
||||
|
10
node_modules/clean-css/lib/optimizer/level-1/property-optimizers.js
generated
vendored
Normal file
10
node_modules/clean-css/lib/optimizer/level-1/property-optimizers.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
background: require('./property-optimizers/background').level1.property,
|
||||
boxShadow: require('./property-optimizers/box-shadow').level1.property,
|
||||
borderRadius: require('./property-optimizers/border-radius').level1.property,
|
||||
filter: require('./property-optimizers/filter').level1.property,
|
||||
fontWeight: require('./property-optimizers/font-weight').level1.property,
|
||||
margin: require('./property-optimizers/margin').level1.property,
|
||||
outline: require('./property-optimizers/outline').level1.property,
|
||||
padding: require('./property-optimizers/padding').level1.property
|
||||
};
|
23
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/background.js
generated
vendored
Normal file
23
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/background.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
property: function background(_rule, property, options) {
|
||||
var values = property.value;
|
||||
|
||||
if (!options.level[OptimizationLevel.One].optimizeBackground) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (values.length == 1 && values[0][1] == 'none') {
|
||||
values[0][1] = '0 0';
|
||||
}
|
||||
|
||||
if (values.length == 1 && values[0][1] == 'transparent') {
|
||||
values[0][1] = '0 0';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
29
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/border-radius.js
generated
vendored
Normal file
29
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/border-radius.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
property: function borderRadius(_rule, property, options) {
|
||||
var values = property.value;
|
||||
|
||||
if (!options.level[OptimizationLevel.One].optimizeBorderRadius) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (values.length == 3 && values[1][1] == '/' && values[0][1] == values[2][1]) {
|
||||
property.value.splice(1);
|
||||
property.dirty = true;
|
||||
} else if (values.length == 5 && values[2][1] == '/' && values[0][1] == values[3][1] && values[1][1] == values[4][1]) {
|
||||
property.value.splice(2);
|
||||
property.dirty = true;
|
||||
} else if (values.length == 7 && values[3][1] == '/' && values[0][1] == values[4][1] && values[1][1] == values[5][1] && values[2][1] == values[6][1]) {
|
||||
property.value.splice(3);
|
||||
property.dirty = true;
|
||||
} else if (values.length == 9 && values[4][1] == '/' && values[0][1] == values[5][1] && values[1][1] == values[6][1] && values[2][1] == values[7][1] && values[3][1] == values[8][1]) {
|
||||
property.value.splice(4);
|
||||
property.dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
15
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/box-shadow.js
generated
vendored
Normal file
15
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/box-shadow.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var plugin = {
|
||||
level1: {
|
||||
property: function boxShadow(_rule, property) {
|
||||
var values = property.value;
|
||||
|
||||
// remove multiple zeros
|
||||
if (values.length == 4 && values[0][1] === '0' && values[1][1] === '0' && values[2][1] === '0' && values[3][1] === '0') {
|
||||
property.value.splice(2);
|
||||
property.dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
31
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/filter.js
generated
vendored
Normal file
31
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/filter.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var ALPHA_OR_CHROMA_FILTER_PATTERN = /progid:DXImageTransform\.Microsoft\.(Alpha|Chroma)(\W)/;
|
||||
var NO_SPACE_AFTER_COMMA_PATTERN = /,(\S)/g;
|
||||
var WHITESPACE_AROUND_EQUALS_PATTERN = / ?= ?/g;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
property: function filter(_rule, property, options) {
|
||||
if (!options.compatibility.properties.ieFilters) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!options.level[OptimizationLevel.One].optimizeFilter) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (property.value.length == 1) {
|
||||
property.value[0][1] = property.value[0][1].replace(ALPHA_OR_CHROMA_FILTER_PATTERN, function (match, filter, suffix) {
|
||||
return filter.toLowerCase() + suffix;
|
||||
});
|
||||
}
|
||||
|
||||
property.value[0][1] = property.value[0][1]
|
||||
.replace(NO_SPACE_AFTER_COMMA_PATTERN, ', $1')
|
||||
.replace(WHITESPACE_AROUND_EQUALS_PATTERN, '=');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
23
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/font-weight.js
generated
vendored
Normal file
23
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/font-weight.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
property: function fontWeight(_rule, property, options) {
|
||||
var value = property.value[0][1];
|
||||
|
||||
if (!options.level[OptimizationLevel.One].optimizeFontWeight) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (value == 'normal') {
|
||||
value = '400';
|
||||
} else if (value == 'bold') {
|
||||
value = '700';
|
||||
}
|
||||
|
||||
property.value[0][1] = value;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
21
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/margin.js
generated
vendored
Normal file
21
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/margin.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
property: function margin(_rule, property, options) {
|
||||
var values = property.value;
|
||||
|
||||
if (!options.level[OptimizationLevel.One].replaceMultipleZeros) {
|
||||
return;
|
||||
}
|
||||
|
||||
// remove multiple zeros
|
||||
if (values.length == 4 && values[0][1] === '0' && values[1][1] === '0' && values[2][1] === '0' && values[3][1] === '0') {
|
||||
property.value.splice(1);
|
||||
property.dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
19
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/outline.js
generated
vendored
Normal file
19
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/outline.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
property: function outline(_rule, property, options) {
|
||||
var values = property.value;
|
||||
|
||||
if (!options.level[OptimizationLevel.One].optimizeOutline) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (values.length == 1 && values[0][1] == 'none') {
|
||||
values[0][1] = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
26
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/padding.js
generated
vendored
Normal file
26
node_modules/clean-css/lib/optimizer/level-1/property-optimizers/padding.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
function isNegative(value) {
|
||||
return value && value[1][0] == '-' && parseFloat(value[1]) < 0;
|
||||
}
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
property: function padding(_rule, property, options) {
|
||||
var values = property.value;
|
||||
|
||||
// remove multiple zeros
|
||||
if (values.length == 4 && values[0][1] === '0' && values[1][1] === '0' && values[2][1] === '0' && values[3][1] === '0') {
|
||||
property.value.splice(1);
|
||||
property.dirty = true;
|
||||
}
|
||||
|
||||
// remove negative paddings
|
||||
if (options.level[OptimizationLevel.One].removeNegativePaddings && (isNegative(property.value[0]) || isNegative(property.value[1]) || isNegative(property.value[2]) || isNegative(property.value[3]))) {
|
||||
property.unused = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
19
node_modules/clean-css/lib/optimizer/level-1/tidy-block.js
generated
vendored
19
node_modules/clean-css/lib/optimizer/level-1/tidy-block.js
generated
vendored
@@ -1,20 +1,31 @@
|
||||
var SUPPORTED_COMPACT_BLOCK_MATCHER = /^@media\W/;
|
||||
var SUPPORTED_QUOTE_REMOVAL_MATCHER = /^@(?:keyframes|-moz-keyframes|-o-keyframes|-webkit-keyframes)\W/;
|
||||
|
||||
function tidyBlock(values, spaceAfterClosingBrace) {
|
||||
var withoutSpaceAfterClosingBrace;
|
||||
var withoutQuotes;
|
||||
var i;
|
||||
|
||||
for (i = values.length - 1; i >= 0; i--) {
|
||||
withoutSpaceAfterClosingBrace = !spaceAfterClosingBrace && SUPPORTED_COMPACT_BLOCK_MATCHER.test(values[i][1]);
|
||||
withoutQuotes = SUPPORTED_QUOTE_REMOVAL_MATCHER.test(values[i][1]);
|
||||
|
||||
values[i][1] = values[i][1]
|
||||
.replace(/\n|\r\n/g, ' ')
|
||||
.replace(/\s+/g, ' ')
|
||||
.replace(/(,|:|\() /g, '$1')
|
||||
.replace(/ \)/g, ')')
|
||||
.replace(/'([a-zA-Z][a-zA-Z\d\-_]+)'/, '$1')
|
||||
.replace(/"([a-zA-Z][a-zA-Z\d\-_]+)"/, '$1')
|
||||
.replace(withoutSpaceAfterClosingBrace ? /\) /g : null, ')');
|
||||
.replace(/ \)/g, ')');
|
||||
|
||||
if (withoutQuotes) {
|
||||
values[i][1] = values[i][1]
|
||||
.replace(/'([a-zA-Z][a-zA-Z\d\-_]+)'/, '$1')
|
||||
.replace(/"([a-zA-Z][a-zA-Z\d\-_]+)"/, '$1');
|
||||
}
|
||||
|
||||
if (withoutSpaceAfterClosingBrace) {
|
||||
values[i][1] = values[i][1]
|
||||
.replace(/\) /g, ')');
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
|
28
node_modules/clean-css/lib/optimizer/level-1/tidy-rules.js
generated
vendored
28
node_modules/clean-css/lib/optimizer/level-1/tidy-rules.js
generated
vendored
@@ -16,6 +16,18 @@ var ASTERISK_PLUS_HTML_HACK = '*+html ';
|
||||
var ASTERISK_FIRST_CHILD_PLUS_HTML_HACK = '*:first-child+html ';
|
||||
var LESS_THAN = '<';
|
||||
|
||||
var PSEUDO_CLASSES_WITH_SELECTORS = [
|
||||
':current',
|
||||
':future',
|
||||
':has',
|
||||
':host',
|
||||
':host-context',
|
||||
':is',
|
||||
':not',
|
||||
':past',
|
||||
':where'
|
||||
];
|
||||
|
||||
function hasInvalidCharacters(value) {
|
||||
var isEscaped;
|
||||
var isInvalid = false;
|
||||
@@ -57,7 +69,9 @@ function removeWhitespace(value, format) {
|
||||
var isAttribute;
|
||||
var isRelation;
|
||||
var isWhitespace;
|
||||
var isSpaceAwarePseudoClass;
|
||||
var roundBracketLevel = 0;
|
||||
var wasComma = false;
|
||||
var wasRelation = false;
|
||||
var wasWhitespace = false;
|
||||
var withCaseAttribute = CASE_ATTRIBUTE_PATTERN.test(value);
|
||||
@@ -72,6 +86,9 @@ function removeWhitespace(value, format) {
|
||||
isQuoted = isSingleQuoted || isDoubleQuoted;
|
||||
isRelation = !isAttribute && !isEscaped && roundBracketLevel === 0 && RELATION_PATTERN.test(character);
|
||||
isWhitespace = WHITESPACE_PATTERN.test(character);
|
||||
isSpaceAwarePseudoClass = roundBracketLevel == 1 && character == Marker.CLOSE_ROUND_BRACKET ?
|
||||
false :
|
||||
isSpaceAwarePseudoClass || (roundBracketLevel === 0 && character == Marker.COLON && isPseudoClassWithSelectors(value, i));
|
||||
|
||||
if (wasEscaped && isQuoted && isNewLineWin) {
|
||||
// swallow escaped new windows lines in comments
|
||||
@@ -111,6 +128,10 @@ function removeWhitespace(value, format) {
|
||||
} else if (!isWhitespace && wasRelation && spaceAroundRelation) {
|
||||
stripped.push(Marker.SPACE);
|
||||
stripped.push(character);
|
||||
} else if (isWhitespace && !wasWhitespace && wasComma && roundBracketLevel > 0 && isSpaceAwarePseudoClass) {
|
||||
// skip space
|
||||
} else if (isWhitespace && !wasWhitespace && roundBracketLevel > 0 && isSpaceAwarePseudoClass) {
|
||||
stripped.push(character);
|
||||
} else if (isWhitespace && (isAttribute || roundBracketLevel > 0) && !isQuoted) {
|
||||
// skip space
|
||||
} else if (isWhitespace && wasWhitespace && !isQuoted) {
|
||||
@@ -133,6 +154,7 @@ function removeWhitespace(value, format) {
|
||||
isEscaped = character == Marker.BACK_SLASH;
|
||||
wasRelation = isRelation;
|
||||
wasWhitespace = isWhitespace;
|
||||
wasComma = character == Marker.COMMA;
|
||||
}
|
||||
|
||||
return withCaseAttribute ?
|
||||
@@ -140,6 +162,12 @@ function removeWhitespace(value, format) {
|
||||
stripped.join('');
|
||||
}
|
||||
|
||||
function isPseudoClassWithSelectors(value, colonPosition) {
|
||||
var pseudoClass = value.substring(colonPosition, value.indexOf(Marker.OPEN_ROUND_BRACKET, colonPosition));
|
||||
|
||||
return PSEUDO_CLASSES_WITH_SELECTORS.indexOf(pseudoClass) > -1;
|
||||
}
|
||||
|
||||
function removeQuotes(value) {
|
||||
if (value.indexOf('\'') == -1 && value.indexOf('"') == -1) {
|
||||
return value;
|
||||
|
14
node_modules/clean-css/lib/optimizer/level-1/value-optimizers.js
generated
vendored
Normal file
14
node_modules/clean-css/lib/optimizer/level-1/value-optimizers.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
module.exports = {
|
||||
color: require('./value-optimizers/color').level1.value,
|
||||
degrees: require('./value-optimizers/degrees').level1.value,
|
||||
fraction: require('./value-optimizers/fraction').level1.value,
|
||||
precision: require('./value-optimizers/precision').level1.value,
|
||||
textQuotes: require('./value-optimizers/text-quotes').level1.value,
|
||||
time: require('./value-optimizers/time').level1.value,
|
||||
unit: require('./value-optimizers/unit').level1.value,
|
||||
urlPrefix: require('./value-optimizers/url-prefix').level1.value,
|
||||
urlQuotes: require('./value-optimizers/url-quotes').level1.value,
|
||||
urlWhiteSpace: require('./value-optimizers/url-whitespace').level1.value,
|
||||
whiteSpace: require('./value-optimizers/whitespace').level1.value,
|
||||
zero: require('./value-optimizers/zero').level1.value
|
||||
};
|
90
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/color.js
generated
vendored
Normal file
90
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/color.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
var shortenHex = require('./color/shorten-hex');
|
||||
var shortenHsl = require('./color/shorten-hsl');
|
||||
var shortenRgb = require('./color/shorten-rgb');
|
||||
|
||||
var split = require('../../../utils/split');
|
||||
|
||||
var ANY_COLOR_FUNCTION_PATTERN = /(rgb|rgba|hsl|hsla)\(([^\(\)]+)\)/gi;
|
||||
var COLOR_PREFIX_PATTERN = /#|rgb|hsl/gi;
|
||||
var HEX_LONG_PATTERN = /(^|[^='"])#([0-9a-f]{6})/gi;
|
||||
var HEX_SHORT_PATTERN = /(^|[^='"])#([0-9a-f]{3})/gi;
|
||||
var HEX_VALUE_PATTERN = /[0-9a-f]/i;
|
||||
var HSL_PATTERN = /hsl\((-?\d+),(-?\d+)%?,(-?\d+)%?\)/gi;
|
||||
var RGBA_HSLA_PATTERN = /(rgb|hsl)a?\((\-?\d+),(\-?\d+\%?),(\-?\d+\%?),(0*[1-9]+[0-9]*(\.?\d*)?)\)/gi;
|
||||
var RGB_PATTERN = /rgb\((\-?\d+),(\-?\d+),(\-?\d+)\)/gi;
|
||||
var TRANSPARENT_FUNCTION_PATTERN = /(?:rgba|hsla)\(0,0%?,0%?,0\)/g;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
value: function color(name, value, options) {
|
||||
if (!options.compatibility.properties.colors) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (!value.match(COLOR_PREFIX_PATTERN)) {
|
||||
return shortenHex(value);
|
||||
}
|
||||
|
||||
value = value
|
||||
.replace(RGBA_HSLA_PATTERN, function (match, colorFn, p1, p2, p3, alpha) {
|
||||
return (parseInt(alpha, 10) >= 1 ? colorFn + '(' + [p1,p2,p3].join(',') + ')' : match);
|
||||
})
|
||||
.replace(RGB_PATTERN, function (match, red, green, blue) {
|
||||
return shortenRgb(red, green, blue);
|
||||
})
|
||||
.replace(HSL_PATTERN, function (match, hue, saturation, lightness) {
|
||||
return shortenHsl(hue, saturation, lightness);
|
||||
})
|
||||
.replace(HEX_LONG_PATTERN, function (match, prefix, color, at, inputValue) {
|
||||
var suffix = inputValue[at + match.length];
|
||||
|
||||
if (suffix && HEX_VALUE_PATTERN.test(suffix)) {
|
||||
return match;
|
||||
} else if (color[0] == color[1] && color[2] == color[3] && color[4] == color[5]) {
|
||||
return (prefix + '#' + color[0] + color[2] + color[4]).toLowerCase();
|
||||
} else {
|
||||
return (prefix + '#' + color).toLowerCase();
|
||||
}
|
||||
})
|
||||
.replace(HEX_SHORT_PATTERN, function (match, prefix, color) {
|
||||
return prefix + '#' + color.toLowerCase();
|
||||
})
|
||||
.replace(ANY_COLOR_FUNCTION_PATTERN, function (match, colorFunction, colorDef) {
|
||||
var tokens = colorDef.split(',');
|
||||
var colorFnLowercase = colorFunction && colorFunction.toLowerCase();
|
||||
var applies = (colorFnLowercase == 'hsl' && tokens.length == 3) ||
|
||||
(colorFnLowercase == 'hsla' && tokens.length == 4) ||
|
||||
(colorFnLowercase == 'rgb' && tokens.length === 3 && colorDef.indexOf('%') > 0) ||
|
||||
(colorFnLowercase == 'rgba' && tokens.length == 4 && colorDef.indexOf('%') > 0);
|
||||
|
||||
if (!applies) {
|
||||
return match;
|
||||
}
|
||||
|
||||
if (tokens[1].indexOf('%') == -1) {
|
||||
tokens[1] += '%';
|
||||
}
|
||||
|
||||
if (tokens[2].indexOf('%') == -1) {
|
||||
tokens[2] += '%';
|
||||
}
|
||||
|
||||
return colorFunction + '(' + tokens.join(',') + ')';
|
||||
});
|
||||
|
||||
if (options.compatibility.colors.opacity && name.indexOf('background') == -1) {
|
||||
value = value.replace(TRANSPARENT_FUNCTION_PATTERN, function (match) {
|
||||
if (split(value, ',').pop().indexOf('gradient(') > -1) {
|
||||
return match;
|
||||
}
|
||||
|
||||
return 'transparent';
|
||||
});
|
||||
}
|
||||
|
||||
return shortenHex(value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
19
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/degrees.js
generated
vendored
Normal file
19
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/degrees.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
var ZERO_DEG_PATTERN = /\(0deg\)/g;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
value: function degrees(_name, value, options) {
|
||||
if (!options.compatibility.properties.zeroUnits) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf('0deg') == -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.replace(ZERO_DEG_PATTERN, '(0)');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
43
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/fraction.js
generated
vendored
Normal file
43
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/fraction.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
var startsAsUrl = require('./starts-as-url');
|
||||
|
||||
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var DOT_ZERO_PATTERN = /(^|\D)\.0+(\D|$)/g;
|
||||
var FRACTION_PATTERN = /\.([1-9]*)0+(\D|$)/g;
|
||||
var LEADING_ZERO_FRACTION_PATTERN = /(^|\D)0\.(\d)/g;
|
||||
var MINUS_ZERO_FRACTION_PATTERN = /([^\w\d\-]|^)\-0([^\.]|$)/g;
|
||||
var ZERO_PREFIXED_UNIT_PATTERN = /(^|\s)0+([1-9])/g;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
value: function fraction(name, value, options) {
|
||||
if (!options.level[OptimizationLevel.One].replaceZeroUnits) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (startsAsUrl(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf('0') == -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf('-') > -1) {
|
||||
value = value
|
||||
.replace(MINUS_ZERO_FRACTION_PATTERN, '$10$2')
|
||||
.replace(MINUS_ZERO_FRACTION_PATTERN, '$10$2');
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(ZERO_PREFIXED_UNIT_PATTERN, '$1$2')
|
||||
.replace(DOT_ZERO_PATTERN, '$10$2')
|
||||
.replace(FRACTION_PATTERN, function (match, nonZeroPart, suffix) {
|
||||
return (nonZeroPart.length > 0 ? '.' : '') + nonZeroPart + suffix;
|
||||
})
|
||||
.replace(LEADING_ZERO_FRACTION_PATTERN, '$1.$2');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
22
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/precision.js
generated
vendored
Normal file
22
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/precision.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
var plugin = {
|
||||
level1: {
|
||||
value: function precision(_name, value, options) {
|
||||
if (!options.precision.enabled || value.indexOf('.') === -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(options.precision.decimalPointMatcher, '$1$2$3')
|
||||
.replace(options.precision.zeroMatcher, function (match, integerPart, fractionPart, unit) {
|
||||
var multiplier = options.precision.units[unit].multiplier;
|
||||
var parsedInteger = parseInt(integerPart);
|
||||
var integer = isNaN(parsedInteger) ? 0 : parsedInteger;
|
||||
var fraction = parseFloat(fractionPart);
|
||||
|
||||
return Math.round((integer + fraction) * multiplier) / multiplier + unit;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
7
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/starts-as-url.js
generated
vendored
Normal file
7
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/starts-as-url.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
var URL_PREFIX_PATTERN = /^url\(/i;
|
||||
|
||||
function startsAsUrl(value) {
|
||||
return URL_PREFIX_PATTERN.test(value);
|
||||
}
|
||||
|
||||
module.exports = startsAsUrl;
|
25
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/text-quotes.js
generated
vendored
Normal file
25
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/text-quotes.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var LOCAL_PREFIX_PATTERN = /^local\(/i;
|
||||
var QUOTED_PATTERN = /^('.*'|".*")$/;
|
||||
var QUOTED_BUT_SAFE_PATTERN = /^['"][a-zA-Z][a-zA-Z\d\-_]+['"]$/;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
value: function textQuotes(_name, value, options) {
|
||||
if (!options.level[OptimizationLevel.One].removeQuotes) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (!QUOTED_PATTERN.test(value) && !LOCAL_PREFIX_PATTERN.test(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return QUOTED_BUT_SAFE_PATTERN.test(value) ?
|
||||
value.substring(1, value.length - 1) :
|
||||
value;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
31
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/time.js
generated
vendored
Normal file
31
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/time.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var TIME_VALUE = /^(\-?[\d\.]+)(m?s)$/;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
value: function time(name, value, options) {
|
||||
if (!options.level[OptimizationLevel.One].replaceTimeUnits) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (!TIME_VALUE.test(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.replace(TIME_VALUE, function (match, val, unit) {
|
||||
var newValue;
|
||||
|
||||
if (unit == 'ms') {
|
||||
newValue = parseInt(val) / 1000 + 's';
|
||||
} else if (unit == 's') {
|
||||
newValue = parseFloat(val) * 1000 + 'ms';
|
||||
}
|
||||
|
||||
return newValue.length < match.length ? newValue : match;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
40
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/unit.js
generated
vendored
Normal file
40
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/unit.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
var WHOLE_PIXEL_VALUE = /(?:^|\s|\()(-?\d+)px/;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
value: function unit(_name, value, options) {
|
||||
if (!WHOLE_PIXEL_VALUE.test(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.replace(WHOLE_PIXEL_VALUE, function (match, val) {
|
||||
var newValue;
|
||||
var intVal = parseInt(val);
|
||||
|
||||
if (intVal === 0) {
|
||||
return match;
|
||||
}
|
||||
|
||||
if (options.compatibility.properties.shorterLengthUnits && options.compatibility.units.pt && intVal * 3 % 4 === 0) {
|
||||
newValue = intVal * 3 / 4 + 'pt';
|
||||
}
|
||||
|
||||
if (options.compatibility.properties.shorterLengthUnits && options.compatibility.units.pc && intVal % 16 === 0) {
|
||||
newValue = intVal / 16 + 'pc';
|
||||
}
|
||||
|
||||
if (options.compatibility.properties.shorterLengthUnits && options.compatibility.units.in && intVal % 96 === 0) {
|
||||
newValue = intVal / 96 + 'in';
|
||||
}
|
||||
|
||||
if (newValue) {
|
||||
newValue = match.substring(0, match.indexOf(val)) + newValue;
|
||||
}
|
||||
|
||||
return newValue && newValue.length < match.length ? newValue : match;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
23
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/url-prefix.js
generated
vendored
Normal file
23
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/url-prefix.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
var startsAsUrl = require('./starts-as-url');
|
||||
|
||||
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var URL_PREFIX_PATTERN = /^url\(/i;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
value: function urlPrefix(_name, value, options) {
|
||||
if (!options.level[OptimizationLevel.One].normalizeUrls) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (!startsAsUrl(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.replace(URL_PREFIX_PATTERN, 'url(');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
20
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/url-quotes.js
generated
vendored
Normal file
20
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/url-quotes.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
var QUOTED_URL_PATTERN = /^url\(['"].+['"]\)$/;
|
||||
var QUOTED_URL_WITH_WHITESPACE_PATTERN = /^url\(['"].*[\*\s\(\)'"].*['"]\)$/;
|
||||
var QUOTES_PATTERN = /["']/g;
|
||||
var URL_DATA_PATTERN = /^url\(['"]data:[^;]+;charset/;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
value: function urlQuotes(_name, value, options) {
|
||||
if (options.compatibility.properties.urlQuotes) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return QUOTED_URL_PATTERN.test(value) && !QUOTED_URL_WITH_WHITESPACE_PATTERN.test(value) && !URL_DATA_PATTERN.test(value) ?
|
||||
value.replace(QUOTES_PATTERN, '') :
|
||||
value;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
17
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/url-whitespace.js
generated
vendored
Normal file
17
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/url-whitespace.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
var startsAsUrl = require('./starts-as-url');
|
||||
|
||||
var WHITESPACE_PATTERN = /\\?\n|\\?\r\n/g;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
value: function urlWhitespace(_name, value) {
|
||||
if (!startsAsUrl(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.replace(WHITESPACE_PATTERN, '');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
40
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/whitespace.js
generated
vendored
Normal file
40
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/whitespace.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var Marker = require('../../../tokenizer/marker');
|
||||
|
||||
var CALC_DIVISION_WHITESPACE_PATTERN = /\) ?\/ ?/g;
|
||||
var COMMA_AND_SPACE_PATTERN = /, /g;
|
||||
var MULTI_WHITESPACE_PATTERN = /\s+/g;
|
||||
var FUNCTION_CLOSING_BRACE_WHITESPACE_PATTERN = /\s+(;?\))/g;
|
||||
var FUNCTION_OPENING_BRACE_WHITESPACE_PATTERN = /(\(;?)\s+/g;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
value: function whitespace(name, value, options) {
|
||||
if (!options.level[OptimizationLevel.One].removeWhitespace) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf(' ') == -1 || value.indexOf('expression') === 0) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf(Marker.SINGLE_QUOTE) > -1 || value.indexOf(Marker.DOUBLE_QUOTE) > -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
value = value.replace(MULTI_WHITESPACE_PATTERN, ' ');
|
||||
|
||||
if (value.indexOf('calc') > -1) {
|
||||
value = value.replace(CALC_DIVISION_WHITESPACE_PATTERN, ')/ ');
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(FUNCTION_OPENING_BRACE_WHITESPACE_PATTERN, '$1')
|
||||
.replace(FUNCTION_CLOSING_BRACE_WHITESPACE_PATTERN, '$1')
|
||||
.replace(COMMA_AND_SPACE_PATTERN, ',');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
25
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/zero.js
generated
vendored
Normal file
25
node_modules/clean-css/lib/optimizer/level-1/value-optimizers/zero.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
var FUNCTION_PATTERN = /^(?:\-moz\-calc|\-webkit\-calc|calc|rgb|hsl|rgba|hsla|min|max|clamp)\(/;
|
||||
|
||||
var plugin = {
|
||||
level1: {
|
||||
value: function zero(name, value, options) {
|
||||
if (!options.compatibility.properties.zeroUnits) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (FUNCTION_PATTERN.test(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf('%') > 0 && (name == 'height' || name == 'max-height' || name == 'width' || name == 'max-width')) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(options.unitsRegexp, '$1' + '0' + '$2')
|
||||
.replace(options.unitsRegexp, '$1' + '0' + '$2');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = plugin;
|
3
node_modules/clean-css/lib/optimizer/level-2/extract-properties.js
generated
vendored
3
node_modules/clean-css/lib/optimizer/level-2/extract-properties.js
generated
vendored
@@ -27,9 +27,6 @@ function extractProperties(token) {
|
||||
if (name.length === 0)
|
||||
continue;
|
||||
|
||||
if (name.indexOf('--') === 0)
|
||||
continue;
|
||||
|
||||
value = serializeValue(property, i);
|
||||
|
||||
properties.push([
|
||||
|
7
node_modules/clean-css/lib/optimizer/level-2/is-mergeable.js
generated
vendored
7
node_modules/clean-css/lib/optimizer/level-2/is-mergeable.js
generated
vendored
@@ -3,6 +3,8 @@ var split = require('../../utils/split');
|
||||
|
||||
var DEEP_SELECTOR_PATTERN = /\/deep\//;
|
||||
var DOUBLE_COLON_PATTERN = /^::/;
|
||||
var VENDOR_PREFIXED_PATTERN = /:(-moz-|-ms-|-o-|-webkit-)/;
|
||||
|
||||
var NOT_PSEUDO = ':not';
|
||||
var PSEUDO_CLASSES_WITH_ARGUMENTS = [
|
||||
':dir',
|
||||
@@ -44,6 +46,7 @@ function isMergeable(selector, mergeablePseudoClasses, mergeablePseudoElements,
|
||||
|
||||
if (singleSelector.length === 0 ||
|
||||
isDeepSelector(singleSelector) ||
|
||||
isVendorPrefixed(singleSelector) ||
|
||||
(singleSelector.indexOf(Marker.COLON) > -1 && !areMergeable(singleSelector, extractPseudoFrom(singleSelector), mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging))) {
|
||||
return false;
|
||||
}
|
||||
@@ -56,6 +59,10 @@ function isDeepSelector(selector) {
|
||||
return DEEP_SELECTOR_PATTERN.test(selector);
|
||||
}
|
||||
|
||||
function isVendorPrefixed(selector) {
|
||||
return VENDOR_PREFIXED_PATTERN.test(selector);
|
||||
}
|
||||
|
||||
function extractPseudoFrom(selector) {
|
||||
var list = [];
|
||||
var character;
|
||||
|
5
node_modules/clean-css/lib/optimizer/level-2/optimize.js
generated
vendored
5
node_modules/clean-css/lib/optimizer/level-2/optimize.js
generated
vendored
@@ -70,6 +70,7 @@ function recursivelyOptimizeProperties(tokens, context) {
|
||||
|
||||
function level2Optimize(tokens, context, withRestructuring) {
|
||||
var levelOptions = context.options.level[OptimizationLevel.Two];
|
||||
var level2Plugins = context.options.plugins.level2Block;
|
||||
var reduced;
|
||||
var i;
|
||||
|
||||
@@ -124,6 +125,10 @@ function level2Optimize(tokens, context, withRestructuring) {
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < level2Plugins.length; i++) {
|
||||
level2Plugins[i](tokens);
|
||||
}
|
||||
|
||||
if (levelOptions.removeEmpty) {
|
||||
removeEmpty(tokens);
|
||||
}
|
||||
|
4
node_modules/clean-css/lib/optimizer/level-2/properties/find-component-in.js
generated
vendored
4
node_modules/clean-css/lib/optimizer/level-2/properties/find-component-in.js
generated
vendored
@@ -1,4 +1,4 @@
|
||||
var compactable = require('../compactable');
|
||||
var configuration = require('../../configuration');
|
||||
|
||||
function findComponentIn(shorthand, longhand) {
|
||||
var comparator = nameComparator(longhand);
|
||||
@@ -21,7 +21,7 @@ function findInSubComponents(shorthand, comparator) {
|
||||
var longhandMatch;
|
||||
var i, l;
|
||||
|
||||
if (!compactable[shorthand.name].shorthandComponents) {
|
||||
if (!configuration[shorthand.name].shorthandComponents) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
14
node_modules/clean-css/lib/optimizer/level-2/properties/has-same-values.js
generated
vendored
Normal file
14
node_modules/clean-css/lib/optimizer/level-2/properties/has-same-values.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
function hasSameValues(property) {
|
||||
var firstValue = property.value[0][1];
|
||||
var i, l;
|
||||
|
||||
for (i = 1, l = property.value.length; i < l; i++) {
|
||||
if (property.value[i][1] != firstValue) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = hasSameValues;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user