From 7f7af7582ea85f50458d879d851c28a44037d14f Mon Sep 17 00:00:00 2001 From: Conventional Changelog Action Date: Fri, 30 Oct 2020 22:27:33 +0000 Subject: [PATCH] chore(release): v3.4.1 --- CHANGELOG.md | 19 +- .../license => @actions/core/LICENSE.md} | 6 +- node_modules/@actions/core/README.md | 3 +- node_modules/@actions/core/lib/command.d.ts | 5 - node_modules/@actions/core/lib/command.js | 19 +- node_modules/@actions/core/lib/command.js.map | 2 +- node_modules/@actions/core/lib/core.js | 22 +- node_modules/@actions/core/lib/core.js.map | 2 +- .../@actions/core/lib/file-command.d.ts | 1 + .../@actions/core/lib/file-command.js | 29 + .../@actions/core/lib/file-command.js.map | 1 + node_modules/@actions/core/lib/utils.d.ts | 5 + node_modules/@actions/core/lib/utils.js | 19 + node_modules/@actions/core/lib/utils.js.map | 1 + node_modules/@actions/core/package.json | 15 +- node_modules/arrify/index.d.ts | 38 - node_modules/arrify/index.js | 21 +- node_modules/arrify/license | 20 +- node_modules/arrify/package.json | 70 +- node_modules/arrify/readme.md | 15 +- .../node_modules/camelcase/index.d.ts | 63 - .../node_modules/camelcase/index.js | 76 - .../node_modules/camelcase/license | 9 - .../node_modules/camelcase/package.json | 47 - .../node_modules/camelcase/readme.md | 99 - node_modules/camelcase/index.d.ts | 74 +- node_modules/camelcase/index.js | 27 +- node_modules/camelcase/license | 2 +- node_modules/camelcase/package.json | 17 +- node_modules/camelcase/readme.md | 38 +- node_modules/compare-func/package.json | 12 +- .../CHANGELOG.md | 11 + .../conventional-changelog-angular/README.md | 2 +- .../package.json | 12 +- .../CHANGELOG.md | 23 + .../README.md | 34 + .../conventional-changelog.js | 2 +- .../package.json | 12 +- .../templates/commit.hbs | 4 +- .../conventional-changelog-core/CHANGELOG.md | 19 + .../conventional-changelog-core/README.md | 6 + .../lib/merge-config.js | 3 +- .../conventional-changelog-core/package.json | 14 +- .../CHANGELOG.md | 11 + .../package.json | 12 +- .../CHANGELOG.md | 11 + .../node_modules/.bin/semver | 1 + .../node_modules/semver/CHANGELOG.md | 70 + .../node_modules/semver/LICENSE | 15 + .../node_modules/semver/README.md | 443 ++++ .../node_modules/semver/bin/semver.js | 174 ++ .../node_modules/semver/package.json | 32 + .../node_modules/semver/range.bnf | 16 + .../node_modules}/semver/semver.js | 0 .../package.json | 12 +- .../conventional-changelog/CHANGELOG.md | 16 + .../conventional-changelog/package.json | 18 +- .../CHANGELOG.md | 8 + .../package.json | 12 +- node_modules/dot-prop/index.d.ts | 101 + node_modules/dot-prop/index.js | 181 +- node_modules/dot-prop/license | 20 +- node_modules/dot-prop/package.json | 92 +- node_modules/dot-prop/readme.md | 81 +- node_modules/function-bind/.editorconfig | 20 + node_modules/function-bind/.eslintrc | 15 + node_modules/function-bind/.jscs.json | 176 ++ node_modules/function-bind/.npmignore | 22 + node_modules/function-bind/.travis.yml | 168 ++ .../arrify/license => function-bind/LICENSE} | 5 +- node_modules/function-bind/README.md | 48 + node_modules/function-bind/implementation.js | 52 + node_modules/function-bind/index.js | 5 + node_modules/function-bind/package.json | 67 + node_modules/function-bind/test/.eslintrc | 9 + node_modules/function-bind/test/index.js | 252 ++ .../node_modules/arrify/index.js | 8 - .../node_modules/arrify/license | 21 - .../node_modules/arrify/package.json | 37 - .../node_modules/arrify/readme.md | 36 - node_modules/git-semver-tags/CHANGELOG.md | 11 + node_modules/git-semver-tags/index.js | 7 + .../git-semver-tags/node_modules/.bin/semver | 1 + .../node_modules/semver/CHANGELOG.md | 70 + .../node_modules/semver/LICENSE | 15 + .../node_modules/semver/README.md | 443 ++++ .../node_modules/semver/bin/semver.js | 174 ++ .../node_modules/semver/package.json | 32 + .../node_modules/semver/range.bnf | 16 + .../node_modules/semver/semver.js | 1596 +++++++++++++ node_modules/git-semver-tags/package.json | 10 +- node_modules/has/LICENSE-MIT | 22 + node_modules/has/README.md | 18 + node_modules/has/package.json | 52 + node_modules/has/src/index.js | 5 + node_modules/has/test/index.js | 10 + node_modules/is-core-module/.eslintrc | 18 + .../is-core-module/.github/FUNDING.yml | 12 + .../.github/workflows/rebase.yml | 15 + .../.github/workflows/require-allow-edits.yml | 14 + node_modules/is-core-module/.travis.yml | 15 + node_modules/is-core-module/CHANGELOG.md | 41 + node_modules/is-core-module/LICENSE | 20 + node_modules/is-core-module/README.md | 37 + node_modules/is-core-module/core.json | 79 + node_modules/is-core-module/index.js | 69 + node_modules/is-core-module/package.json | 67 + node_modules/is-core-module/test/index.js | 83 + node_modules/is-obj/index.d.ts | 22 + node_modules/is-obj/index.js | 7 +- node_modules/is-obj/license | 20 +- node_modules/is-obj/package.json | 69 +- node_modules/is-obj/readme.md | 15 +- .../CHANGELOG.md | 50 + .../json-parse-even-better-errors/LICENSE.md | 25 + .../json-parse-even-better-errors/README.md | 96 + .../json-parse-even-better-errors/index.js | 121 + .../package.json | 37 + node_modules/lodash/README.md | 4 +- node_modules/lodash/_baseClone.js | 3 +- node_modules/lodash/_baseOrderBy.js | 19 +- node_modules/lodash/_baseSet.js | 4 + node_modules/lodash/_baseSortedIndexBy.js | 11 +- node_modules/lodash/_equalArrays.js | 9 +- node_modules/lodash/_equalObjects.js | 9 +- node_modules/lodash/core.js | 54 +- node_modules/lodash/core.min.js | 51 +- node_modules/lodash/filter.js | 4 + node_modules/lodash/lodash.js | 6 +- node_modules/lodash/lodash.min.js | 2 +- node_modules/lodash/matches.js | 7 + node_modules/lodash/matchesProperty.js | 7 + node_modules/lodash/overEvery.js | 4 + node_modules/lodash/overSome.js | 7 + node_modules/lodash/package.json | 8 +- node_modules/lodash/sortBy.js | 6 +- node_modules/lodash/template.js | 8 +- node_modules/meow/index.d.ts | 25 +- node_modules/meow/index.js | 35 +- node_modules/meow/package.json | 12 +- node_modules/meow/readme.md | 2 +- .../node_modules/arrify/index.js | 8 - .../node_modules/arrify/package.json | 37 - .../node_modules/arrify/readme.md | 36 - node_modules/object-path/.npmignore | 7 - node_modules/object-path/.travis.yml | 7 +- node_modules/object-path/README.md | 5 +- node_modules/object-path/index.js | 15 +- node_modules/object-path/package.json | 25 +- node_modules/object-path/test.js | 1480 ++++++------ node_modules/parse-json/index.js | 4 +- node_modules/parse-json/license | 2 +- node_modules/parse-json/package.json | 13 +- node_modules/parse-json/readme.md | 5 +- node_modules/resolve/.editorconfig | 24 +- node_modules/resolve/lib/async.js | 8 +- node_modules/resolve/lib/core.js | 4 +- node_modules/resolve/lib/core.json | 8 +- node_modules/resolve/lib/is-core.js | 4 +- node_modules/resolve/lib/sync.js | 8 +- node_modules/resolve/package.json | 24 +- node_modules/resolve/readme.markdown | 16 +- node_modules/resolve/test/core.js | 12 +- node_modules/resolve/test/symlinks.js | 5 +- node_modules/semver/CHANGELOG.md | 41 + node_modules/semver/README.md | 173 +- node_modules/semver/bin/semver.js | 157 +- node_modules/semver/classes/comparator.js | 139 ++ node_modules/semver/classes/index.js | 5 + node_modules/semver/classes/range.js | 463 ++++ node_modules/semver/classes/semver.js | 290 +++ node_modules/semver/functions/clean.js | 6 + node_modules/semver/functions/cmp.js | 48 + node_modules/semver/functions/coerce.js | 51 + .../semver/functions/compare-build.js | 7 + .../semver/functions/compare-loose.js | 3 + node_modules/semver/functions/compare.js | 5 + node_modules/semver/functions/diff.js | 23 + node_modules/semver/functions/eq.js | 3 + node_modules/semver/functions/gt.js | 3 + node_modules/semver/functions/gte.js | 3 + node_modules/semver/functions/inc.js | 15 + node_modules/semver/functions/lt.js | 3 + node_modules/semver/functions/lte.js | 3 + node_modules/semver/functions/major.js | 3 + node_modules/semver/functions/minor.js | 3 + node_modules/semver/functions/neq.js | 3 + node_modules/semver/functions/parse.js | 37 + node_modules/semver/functions/patch.js | 3 + node_modules/semver/functions/prerelease.js | 6 + node_modules/semver/functions/rcompare.js | 3 + node_modules/semver/functions/rsort.js | 3 + node_modules/semver/functions/satisfies.js | 10 + node_modules/semver/functions/sort.js | 3 + node_modules/semver/functions/valid.js | 6 + node_modules/semver/index.js | 48 + node_modules/semver/internal/constants.js | 17 + node_modules/semver/internal/debug.js | 9 + node_modules/semver/internal/identifiers.js | 23 + node_modules/semver/internal/re.js | 182 ++ node_modules/semver/package.json | 28 +- node_modules/semver/preload.js | 2 + node_modules/semver/ranges/gtr.js | 4 + node_modules/semver/ranges/intersects.js | 7 + node_modules/semver/ranges/ltr.js | 4 + node_modules/semver/ranges/max-satisfying.js | 25 + node_modules/semver/ranges/min-satisfying.js | 24 + node_modules/semver/ranges/min-version.js | 57 + node_modules/semver/ranges/outside.js | 80 + node_modules/semver/ranges/simplify.js | 44 + node_modules/semver/ranges/subset.js | 155 ++ node_modules/semver/ranges/to-comparators.js | 8 + node_modules/semver/ranges/valid.js | 11 + node_modules/spdx-license-ids/deprecated.json | 2 + node_modules/spdx-license-ids/index.json | 48 +- node_modules/spdx-license-ids/package.json | 10 +- node_modules/uglify-js/README.md | 40 +- node_modules/uglify-js/bin/uglifyjs | 13 +- node_modules/uglify-js/lib/ast.js | 135 +- node_modules/uglify-js/lib/compress.js | 2103 +++++++++++------ node_modules/uglify-js/lib/minify.js | 10 +- node_modules/uglify-js/lib/output.js | 446 ++-- node_modules/uglify-js/lib/parse.js | 212 +- node_modules/uglify-js/lib/propmangle.js | 144 +- node_modules/uglify-js/lib/scope.js | 294 ++- node_modules/uglify-js/lib/transform.js | 2 +- node_modules/uglify-js/lib/utils.js | 52 +- node_modules/uglify-js/package.json | 8 +- node_modules/uglify-js/tools/domprops.html | 456 ++++ node_modules/uglify-js/tools/domprops.json | 1475 ++++++++++++ node_modules/uglify-js/tools/props.html | 540 ----- .../node_modules/camelcase/index.d.ts | 63 - .../node_modules/camelcase/index.js | 76 - .../node_modules/camelcase/package.json | 47 - .../node_modules/camelcase/readme.md | 99 - package.json | 2 +- 236 files changed, 13076 insertions(+), 4104 deletions(-) rename node_modules/{yargs-parser/node_modules/camelcase/license => @actions/core/LICENSE.md} (91%) create mode 100644 node_modules/@actions/core/lib/file-command.d.ts create mode 100644 node_modules/@actions/core/lib/file-command.js create mode 100644 node_modules/@actions/core/lib/file-command.js.map create mode 100644 node_modules/@actions/core/lib/utils.d.ts create mode 100644 node_modules/@actions/core/lib/utils.js create mode 100644 node_modules/@actions/core/lib/utils.js.map delete mode 100644 node_modules/arrify/index.d.ts delete mode 100644 node_modules/camelcase-keys/node_modules/camelcase/index.d.ts delete mode 100644 node_modules/camelcase-keys/node_modules/camelcase/index.js delete mode 100644 node_modules/camelcase-keys/node_modules/camelcase/license delete mode 100644 node_modules/camelcase-keys/node_modules/camelcase/package.json delete mode 100644 node_modules/camelcase-keys/node_modules/camelcase/readme.md create mode 120000 node_modules/conventional-changelog-writer/node_modules/.bin/semver create mode 100644 node_modules/conventional-changelog-writer/node_modules/semver/CHANGELOG.md create mode 100644 node_modules/conventional-changelog-writer/node_modules/semver/LICENSE create mode 100644 node_modules/conventional-changelog-writer/node_modules/semver/README.md create mode 100755 node_modules/conventional-changelog-writer/node_modules/semver/bin/semver.js create mode 100644 node_modules/conventional-changelog-writer/node_modules/semver/package.json create mode 100644 node_modules/conventional-changelog-writer/node_modules/semver/range.bnf rename node_modules/{ => conventional-changelog-writer/node_modules}/semver/semver.js (100%) create mode 100644 node_modules/dot-prop/index.d.ts create mode 100644 node_modules/function-bind/.editorconfig create mode 100644 node_modules/function-bind/.eslintrc create mode 100644 node_modules/function-bind/.jscs.json create mode 100644 node_modules/function-bind/.npmignore create mode 100644 node_modules/function-bind/.travis.yml rename node_modules/{minimist-options/node_modules/arrify/license => function-bind/LICENSE} (91%) create mode 100644 node_modules/function-bind/README.md create mode 100644 node_modules/function-bind/implementation.js create mode 100644 node_modules/function-bind/index.js create mode 100644 node_modules/function-bind/package.json create mode 100644 node_modules/function-bind/test/.eslintrc create mode 100644 node_modules/function-bind/test/index.js delete mode 100644 node_modules/git-raw-commits/node_modules/arrify/index.js delete mode 100644 node_modules/git-raw-commits/node_modules/arrify/license delete mode 100644 node_modules/git-raw-commits/node_modules/arrify/package.json delete mode 100644 node_modules/git-raw-commits/node_modules/arrify/readme.md create mode 120000 node_modules/git-semver-tags/node_modules/.bin/semver create mode 100644 node_modules/git-semver-tags/node_modules/semver/CHANGELOG.md create mode 100644 node_modules/git-semver-tags/node_modules/semver/LICENSE create mode 100644 node_modules/git-semver-tags/node_modules/semver/README.md create mode 100755 node_modules/git-semver-tags/node_modules/semver/bin/semver.js create mode 100644 node_modules/git-semver-tags/node_modules/semver/package.json create mode 100644 node_modules/git-semver-tags/node_modules/semver/range.bnf create mode 100644 node_modules/git-semver-tags/node_modules/semver/semver.js create mode 100644 node_modules/has/LICENSE-MIT create mode 100644 node_modules/has/README.md create mode 100644 node_modules/has/package.json create mode 100644 node_modules/has/src/index.js create mode 100644 node_modules/has/test/index.js create mode 100644 node_modules/is-core-module/.eslintrc create mode 100644 node_modules/is-core-module/.github/FUNDING.yml create mode 100644 node_modules/is-core-module/.github/workflows/rebase.yml create mode 100644 node_modules/is-core-module/.github/workflows/require-allow-edits.yml create mode 100644 node_modules/is-core-module/.travis.yml create mode 100644 node_modules/is-core-module/CHANGELOG.md create mode 100644 node_modules/is-core-module/LICENSE create mode 100644 node_modules/is-core-module/README.md create mode 100644 node_modules/is-core-module/core.json create mode 100644 node_modules/is-core-module/index.js create mode 100644 node_modules/is-core-module/package.json create mode 100644 node_modules/is-core-module/test/index.js create mode 100644 node_modules/is-obj/index.d.ts create mode 100644 node_modules/json-parse-even-better-errors/CHANGELOG.md create mode 100644 node_modules/json-parse-even-better-errors/LICENSE.md create mode 100644 node_modules/json-parse-even-better-errors/README.md create mode 100644 node_modules/json-parse-even-better-errors/index.js create mode 100644 node_modules/json-parse-even-better-errors/package.json delete mode 100644 node_modules/minimist-options/node_modules/arrify/index.js delete mode 100644 node_modules/minimist-options/node_modules/arrify/package.json delete mode 100644 node_modules/minimist-options/node_modules/arrify/readme.md delete mode 100755 node_modules/object-path/.npmignore create mode 100644 node_modules/semver/classes/comparator.js create mode 100644 node_modules/semver/classes/index.js create mode 100644 node_modules/semver/classes/range.js create mode 100644 node_modules/semver/classes/semver.js create mode 100644 node_modules/semver/functions/clean.js create mode 100644 node_modules/semver/functions/cmp.js create mode 100644 node_modules/semver/functions/coerce.js create mode 100644 node_modules/semver/functions/compare-build.js create mode 100644 node_modules/semver/functions/compare-loose.js create mode 100644 node_modules/semver/functions/compare.js create mode 100644 node_modules/semver/functions/diff.js create mode 100644 node_modules/semver/functions/eq.js create mode 100644 node_modules/semver/functions/gt.js create mode 100644 node_modules/semver/functions/gte.js create mode 100644 node_modules/semver/functions/inc.js create mode 100644 node_modules/semver/functions/lt.js create mode 100644 node_modules/semver/functions/lte.js create mode 100644 node_modules/semver/functions/major.js create mode 100644 node_modules/semver/functions/minor.js create mode 100644 node_modules/semver/functions/neq.js create mode 100644 node_modules/semver/functions/parse.js create mode 100644 node_modules/semver/functions/patch.js create mode 100644 node_modules/semver/functions/prerelease.js create mode 100644 node_modules/semver/functions/rcompare.js create mode 100644 node_modules/semver/functions/rsort.js create mode 100644 node_modules/semver/functions/satisfies.js create mode 100644 node_modules/semver/functions/sort.js create mode 100644 node_modules/semver/functions/valid.js create mode 100644 node_modules/semver/index.js create mode 100644 node_modules/semver/internal/constants.js create mode 100644 node_modules/semver/internal/debug.js create mode 100644 node_modules/semver/internal/identifiers.js create mode 100644 node_modules/semver/internal/re.js create mode 100644 node_modules/semver/preload.js create mode 100644 node_modules/semver/ranges/gtr.js create mode 100644 node_modules/semver/ranges/intersects.js create mode 100644 node_modules/semver/ranges/ltr.js create mode 100644 node_modules/semver/ranges/max-satisfying.js create mode 100644 node_modules/semver/ranges/min-satisfying.js create mode 100644 node_modules/semver/ranges/min-version.js create mode 100644 node_modules/semver/ranges/outside.js create mode 100644 node_modules/semver/ranges/simplify.js create mode 100644 node_modules/semver/ranges/subset.js create mode 100644 node_modules/semver/ranges/to-comparators.js create mode 100644 node_modules/semver/ranges/valid.js create mode 100644 node_modules/uglify-js/tools/domprops.html delete mode 100644 node_modules/uglify-js/tools/props.html delete mode 100644 node_modules/yargs-parser/node_modules/camelcase/index.d.ts delete mode 100644 node_modules/yargs-parser/node_modules/camelcase/index.js delete mode 100644 node_modules/yargs-parser/node_modules/camelcase/package.json delete mode 100644 node_modules/yargs-parser/node_modules/camelcase/readme.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 94ad0159..fba95ca1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [3.4.1](https://github.com/TriPSs/conventional-changelog-action/compare/v3.4.0...v3.4.1) (2020-10-30) + + +### Bug Fixes + +* Check if repo is shallow before unshallowing ([c5bb2b1](https://github.com/TriPSs/conventional-changelog-action/commit/c5bb2b18afb00739c65c2bee9fc9bb6da52a8c90)) + + + # [3.4.0](https://github.com/TriPSs/conventional-changelog-action/compare/v3.3.0...v3.4.0) (2020-08-17) @@ -49,13 +58,3 @@ -## [3.1.1](https://github.com/TriPSs/conventional-changelog-action/compare/v3.1.0...v3.1.1) (2020-07-13) - - -### Bug Fixes - -* Changed yarn --prod to npm ci --prod ([5ba044f](https://github.com/TriPSs/conventional-changelog-action/commit/5ba044f581579411517848e186a425258f30556a)) -* Removed node_modules so rerelease could add them again ([1bac915](https://github.com/TriPSs/conventional-changelog-action/commit/1bac915367fb7a9aef99bf8df172e524b4614909)) - - - diff --git a/node_modules/yargs-parser/node_modules/camelcase/license b/node_modules/@actions/core/LICENSE.md similarity index 91% rename from node_modules/yargs-parser/node_modules/camelcase/license rename to node_modules/@actions/core/LICENSE.md index e7af2f77..dbae2edb 100644 --- a/node_modules/yargs-parser/node_modules/camelcase/license +++ b/node_modules/@actions/core/LICENSE.md @@ -1,9 +1,9 @@ -MIT License +The MIT License (MIT) -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright 2019 GitHub Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/@actions/core/README.md b/node_modules/@actions/core/README.md index 5ad27eed..95428cf3 100644 --- a/node_modules/@actions/core/README.md +++ b/node_modules/@actions/core/README.md @@ -89,6 +89,7 @@ try { } // Do stuff + core.info('Output to the actions build log') } catch (err) { core.error(`Error ${err}, action may still succeed though`); @@ -143,4 +144,4 @@ const core = require('@actions/core'); var pid = core.getState("pidToKill"); process.kill(pid); -``` \ No newline at end of file +``` diff --git a/node_modules/@actions/core/lib/command.d.ts b/node_modules/@actions/core/lib/command.d.ts index 94d5e449..89eff668 100644 --- a/node_modules/@actions/core/lib/command.d.ts +++ b/node_modules/@actions/core/lib/command.d.ts @@ -13,9 +13,4 @@ interface CommandProperties { */ export declare function issueCommand(command: string, properties: CommandProperties, message: any): void; export declare function issue(name: string, message?: string): void; -/** - * Sanitizes an input into a string so it can be passed into issueCommand safely - * @param input input to sanitize into a string - */ -export declare function toCommandValue(input: any): string; export {}; diff --git a/node_modules/@actions/core/lib/command.js b/node_modules/@actions/core/lib/command.js index af28d2b1..10bf3ebb 100644 --- a/node_modules/@actions/core/lib/command.js +++ b/node_modules/@actions/core/lib/command.js @@ -8,6 +8,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const os = __importStar(require("os")); +const utils_1 = require("./utils"); /** * Commands * @@ -61,28 +62,14 @@ class Command { return cmdStr; } } -/** - * Sanitizes an input into a string so it can be passed into issueCommand safely - * @param input input to sanitize into a string - */ -function toCommandValue(input) { - if (input === null || input === undefined) { - return ''; - } - else if (typeof input === 'string' || input instanceof String) { - return input; - } - return JSON.stringify(input); -} -exports.toCommandValue = toCommandValue; function escapeData(s) { - return toCommandValue(s) + return utils_1.toCommandValue(s) .replace(/%/g, '%25') .replace(/\r/g, '%0D') .replace(/\n/g, '%0A'); } function escapeProperty(s) { - return toCommandValue(s) + return utils_1.toCommandValue(s) .replace(/%/g, '%25') .replace(/\r/g, '%0D') .replace(/\n/g, '%0A') diff --git a/node_modules/@actions/core/lib/command.js.map b/node_modules/@actions/core/lib/command.js.map index ae755652..a95b303b 100644 --- a/node_modules/@actions/core/lib/command.js.map +++ b/node_modules/@actions/core/lib/command.js.map @@ -1 +1 @@ -{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AAWxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC;AAED,SAAS,UAAU,CAAC,CAAM;IACxB,OAAO,cAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,cAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"} \ No newline at end of file +{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AACxB,mCAAsC;AAWtC;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAM;IACxB,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"} \ No newline at end of file diff --git a/node_modules/@actions/core/lib/core.js b/node_modules/@actions/core/lib/core.js index c838f4e2..8b331108 100644 --- a/node_modules/@actions/core/lib/core.js +++ b/node_modules/@actions/core/lib/core.js @@ -17,6 +17,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const command_1 = require("./command"); +const file_command_1 = require("./file-command"); +const utils_1 = require("./utils"); const os = __importStar(require("os")); const path = __importStar(require("path")); /** @@ -43,9 +45,17 @@ var ExitCode; */ // eslint-disable-next-line @typescript-eslint/no-explicit-any function exportVariable(name, val) { - const convertedVal = command_1.toCommandValue(val); + const convertedVal = utils_1.toCommandValue(val); process.env[name] = convertedVal; - command_1.issueCommand('set-env', { name }, convertedVal); + const filePath = process.env['GITHUB_ENV'] || ''; + if (filePath) { + const delimiter = '_GitHubActionsFileCommandDelimeter_'; + const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; + file_command_1.issueCommand('ENV', commandValue); + } + else { + command_1.issueCommand('set-env', { name }, convertedVal); + } } exports.exportVariable = exportVariable; /** @@ -61,7 +71,13 @@ exports.setSecret = setSecret; * @param inputPath */ function addPath(inputPath) { - command_1.issueCommand('add-path', {}, inputPath); + const filePath = process.env['GITHUB_PATH'] || ''; + if (filePath) { + file_command_1.issueCommand('PATH', inputPath); + } + else { + command_1.issueCommand('add-path', {}, inputPath); + } process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; } exports.addPath = addPath; diff --git a/node_modules/@actions/core/lib/core.js.map b/node_modules/@actions/core/lib/core.js.map index 68e9f313..7e7cbcca 100644 --- a/node_modules/@actions/core/lib/core.js.map +++ b/node_modules/@actions/core/lib/core.js.map @@ -1 +1 @@ -{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6D;AAE7D,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,8DAA8D;AAC9D,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAQ;IACnD,MAAM,YAAY,GAAG,wBAAc,CAAC,GAAG,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAA;IAChC,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,YAAY,CAAC,CAAA;AAC/C,CAAC;AAJD,wCAIC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,OAAgB;IAC7C,eAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AACvC,CAAC;AAFD,wCAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAuB;IAC/C,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IAEnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAJD,8BAIC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,GAAG,CAAA;AAC5C,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAuB;IAC3C,eAAK,CAAC,OAAO,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AACzE,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAuB;IAC7C,eAAK,CAAC,SAAS,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AAC3E,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"} \ No newline at end of file +{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAC7C,iDAA+D;AAC/D,mCAAsC;AAEtC,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,8DAA8D;AAC9D,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAQ;IACnD,MAAM,YAAY,GAAG,sBAAc,CAAC,GAAG,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAA;IAEhC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;IAChD,IAAI,QAAQ,EAAE;QACZ,MAAM,SAAS,GAAG,qCAAqC,CAAA;QACvD,MAAM,YAAY,GAAG,GAAG,IAAI,KAAK,SAAS,GAAG,EAAE,CAAC,GAAG,GAAG,YAAY,GAAG,EAAE,CAAC,GAAG,GAAG,SAAS,EAAE,CAAA;QACzF,2BAAgB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;KACtC;SAAM;QACL,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,YAAY,CAAC,CAAA;KAC9C;AACH,CAAC;AAZD,wCAYC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAA;IACjD,IAAI,QAAQ,EAAE;QACZ,2BAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;KACpC;SAAM;QACL,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;KACxC;IACD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AARD,0BAQC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,OAAgB;IAC7C,eAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AACvC,CAAC;AAFD,wCAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAuB;IAC/C,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IAEnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAJD,8BAIC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,GAAG,CAAA;AAC5C,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAuB;IAC3C,eAAK,CAAC,OAAO,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AACzE,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAuB;IAC7C,eAAK,CAAC,SAAS,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AAC3E,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"} \ No newline at end of file diff --git a/node_modules/@actions/core/lib/file-command.d.ts b/node_modules/@actions/core/lib/file-command.d.ts new file mode 100644 index 00000000..ed408eb1 --- /dev/null +++ b/node_modules/@actions/core/lib/file-command.d.ts @@ -0,0 +1 @@ +export declare function issueCommand(command: string, message: any): void; diff --git a/node_modules/@actions/core/lib/file-command.js b/node_modules/@actions/core/lib/file-command.js new file mode 100644 index 00000000..10783c0c --- /dev/null +++ b/node_modules/@actions/core/lib/file-command.js @@ -0,0 +1,29 @@ +"use strict"; +// For internal use, subject to change. +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +// We use any as a valid input type +/* eslint-disable @typescript-eslint/no-explicit-any */ +const fs = __importStar(require("fs")); +const os = __importStar(require("os")); +const utils_1 = require("./utils"); +function issueCommand(command, message) { + const filePath = process.env[`GITHUB_${command}`]; + if (!filePath) { + throw new Error(`Unable to find environment variable for file command ${command}`); + } + if (!fs.existsSync(filePath)) { + throw new Error(`Missing file at path: ${filePath}`); + } + fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { + encoding: 'utf8' + }); +} +exports.issueCommand = issueCommand; +//# sourceMappingURL=file-command.js.map \ No newline at end of file diff --git a/node_modules/@actions/core/lib/file-command.js.map b/node_modules/@actions/core/lib/file-command.js.map new file mode 100644 index 00000000..45fd8c4b --- /dev/null +++ b/node_modules/@actions/core/lib/file-command.js.map @@ -0,0 +1 @@ +{"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,mCAAsC;AAEtC,SAAgB,YAAY,CAAC,OAAe,EAAE,OAAY;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,oCAcC"} \ No newline at end of file diff --git a/node_modules/@actions/core/lib/utils.d.ts b/node_modules/@actions/core/lib/utils.d.ts new file mode 100644 index 00000000..b39c9be9 --- /dev/null +++ b/node_modules/@actions/core/lib/utils.d.ts @@ -0,0 +1,5 @@ +/** + * Sanitizes an input into a string so it can be passed into issueCommand safely + * @param input input to sanitize into a string + */ +export declare function toCommandValue(input: any): string; diff --git a/node_modules/@actions/core/lib/utils.js b/node_modules/@actions/core/lib/utils.js new file mode 100644 index 00000000..97cea339 --- /dev/null +++ b/node_modules/@actions/core/lib/utils.js @@ -0,0 +1,19 @@ +"use strict"; +// We use any as a valid input type +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Sanitizes an input into a string so it can be passed into issueCommand safely + * @param input input to sanitize into a string + */ +function toCommandValue(input) { + if (input === null || input === undefined) { + return ''; + } + else if (typeof input === 'string' || input instanceof String) { + return input; + } + return JSON.stringify(input); +} +exports.toCommandValue = toCommandValue; +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/@actions/core/lib/utils.js.map b/node_modules/@actions/core/lib/utils.js.map new file mode 100644 index 00000000..ce43f037 --- /dev/null +++ b/node_modules/@actions/core/lib/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;AAEvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC"} \ No newline at end of file diff --git a/node_modules/@actions/core/package.json b/node_modules/@actions/core/package.json index dd01abb8..11ba6f06 100644 --- a/node_modules/@actions/core/package.json +++ b/node_modules/@actions/core/package.json @@ -1,13 +1,13 @@ { "name": "@actions/core", - "version": "1.2.4", + "version": "1.2.6", "description": "Actions core lib", "keywords": [ "github", "actions", "core" ], - "homepage": "https://github.com/actions/toolkit/tree/master/packages/core", + "homepage": "https://github.com/actions/toolkit/tree/main/packages/core", "license": "MIT", "main": "lib/core.js", "types": "lib/core.d.ts", @@ -16,7 +16,8 @@ "test": "__tests__" }, "files": [ - "lib" + "lib", + "!.DS_Store" ], "publishConfig": { "access": "public" @@ -27,7 +28,7 @@ "directory": "packages/core" }, "scripts": { - "audit-moderate": "npm install && npm audit --audit-level=moderate", + "audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json", "test": "echo \"Error: run tests from root\" && exit 1", "tsc": "tsc" }, @@ -38,7 +39,7 @@ "@types/node": "^12.0.2" } -,"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz" -,"_integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==" -,"_from": "@actions/core@1.2.4" +,"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz" +,"_integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" +,"_from": "@actions/core@1.2.6" } \ No newline at end of file diff --git a/node_modules/arrify/index.d.ts b/node_modules/arrify/index.d.ts deleted file mode 100644 index bfd0cf5e..00000000 --- a/node_modules/arrify/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** -Convert a value to an array. - -_Supplying `null` or `undefined` results in an empty array._ - -@example -``` -import arrify = require('arrify'); - -arrify('🦄'); -//=> ['🦄'] - -arrify(['🦄']); -//=> ['🦄'] - -arrify(new Set(['🦄'])); -//=> ['🦄'] - -arrify(null); -//=> [] - -arrify(undefined); -//=> [] -``` -*/ -declare function arrify( - value: ValueType -): ValueType extends (null | undefined) - ? [] - : ValueType extends string - ? [string] - : ValueType extends ReadonlyArray // TODO: Use 'readonly unknown[]' in the next major version - ? ValueType - : ValueType extends Iterable - ? T[] - : [ValueType]; - -export = arrify; diff --git a/node_modules/arrify/index.js b/node_modules/arrify/index.js index 49a5c9ad..2a2fdeeb 100644 --- a/node_modules/arrify/index.js +++ b/node_modules/arrify/index.js @@ -1,23 +1,8 @@ 'use strict'; - -const arrify = value => { - if (value === null || value === undefined) { +module.exports = function (val) { + if (val === null || val === undefined) { return []; } - if (Array.isArray(value)) { - return value; - } - - if (typeof value === 'string') { - return [value]; - } - - if (typeof value[Symbol.iterator] === 'function') { - return [...value]; - } - - return [value]; + return Array.isArray(val) ? val : [val]; }; - -module.exports = arrify; diff --git a/node_modules/arrify/license b/node_modules/arrify/license index e7af2f77..654d0bfe 100644 --- a/node_modules/arrify/license +++ b/node_modules/arrify/license @@ -1,9 +1,21 @@ -MIT License +The MIT License (MIT) Copyright (c) Sindre Sorhus (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/arrify/package.json b/node_modules/arrify/package.json index 5a1a8c0b..bfc8621c 100644 --- a/node_modules/arrify/package.json +++ b/node_modules/arrify/package.json @@ -1,39 +1,37 @@ { - "name": "arrify", - "version": "2.0.1", - "description": "Convert a value to an array", - "license": "MIT", - "repository": "sindresorhus/arrify", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "array", - "arrify", - "arrayify", - "convert", - "value", - "ensure" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } + "name": "arrify", + "version": "1.0.1", + "description": "Convert a value to an array", + "license": "MIT", + "repository": "sindresorhus/arrify", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "array", + "arr", + "arrify", + "arrayify", + "convert", + "value" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + } -,"_resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz" -,"_integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==" -,"_from": "arrify@2.0.1" +,"_resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" +,"_integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" +,"_from": "arrify@1.0.1" } \ No newline at end of file diff --git a/node_modules/arrify/readme.md b/node_modules/arrify/readme.md index b3dfc837..183d0757 100644 --- a/node_modules/arrify/readme.md +++ b/node_modules/arrify/readme.md @@ -6,7 +6,7 @@ ## Install ``` -$ npm install arrify +$ npm install --save arrify ``` @@ -15,14 +15,11 @@ $ npm install arrify ```js const arrify = require('arrify'); -arrify('🦄'); -//=> ['🦄'] +arrify('unicorn'); +//=> ['unicorn'] -arrify(['🦄']); -//=> ['🦄'] - -arrify(new Set(['🦄'])); -//=> ['🦄'] +arrify(['unicorn']); +//=> ['unicorn'] arrify(null); //=> [] @@ -36,4 +33,4 @@ arrify(undefined); ## License -MIT © [Sindre Sorhus](https://sindresorhus.com) +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/camelcase-keys/node_modules/camelcase/index.d.ts b/node_modules/camelcase-keys/node_modules/camelcase/index.d.ts deleted file mode 100644 index 58f2069a..00000000 --- a/node_modules/camelcase-keys/node_modules/camelcase/index.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -declare namespace camelcase { - interface Options { - /** - Uppercase the first character: `foo-bar` → `FooBar`. - - @default false - */ - readonly pascalCase?: boolean; - } -} - -declare const camelcase: { - /** - Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`. - - @param input - String to convert to camel case. - - @example - ``` - import camelCase = require('camelcase'); - - camelCase('foo-bar'); - //=> 'fooBar' - - camelCase('foo_bar'); - //=> 'fooBar' - - camelCase('Foo-Bar'); - //=> 'fooBar' - - camelCase('Foo-Bar', {pascalCase: true}); - //=> 'FooBar' - - camelCase('--foo.bar', {pascalCase: false}); - //=> 'fooBar' - - camelCase('foo bar'); - //=> 'fooBar' - - console.log(process.argv[3]); - //=> '--foo-bar' - camelCase(process.argv[3]); - //=> 'fooBar' - - camelCase(['foo', 'bar']); - //=> 'fooBar' - - camelCase(['__foo__', '--bar'], {pascalCase: true}); - //=> 'FooBar' - ``` - */ - (input: string | ReadonlyArray, options?: camelcase.Options): string; - - // TODO: Remove this for the next major release, refactor the whole definition to: - // declare function camelcase( - // input: string | ReadonlyArray, - // options?: camelcase.Options - // ): string; - // export = camelcase; - default: typeof camelcase; -}; - -export = camelcase; diff --git a/node_modules/camelcase-keys/node_modules/camelcase/index.js b/node_modules/camelcase-keys/node_modules/camelcase/index.js deleted file mode 100644 index 579f99b4..00000000 --- a/node_modules/camelcase-keys/node_modules/camelcase/index.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; - -const preserveCamelCase = string => { - let isLastCharLower = false; - let isLastCharUpper = false; - let isLastLastCharUpper = false; - - for (let i = 0; i < string.length; i++) { - const character = string[i]; - - if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) { - string = string.slice(0, i) + '-' + string.slice(i); - isLastCharLower = false; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = true; - i++; - } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) { - string = string.slice(0, i - 1) + '-' + string.slice(i - 1); - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = false; - isLastCharLower = true; - } else { - isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character; - } - } - - return string; -}; - -const camelCase = (input, options) => { - if (!(typeof input === 'string' || Array.isArray(input))) { - throw new TypeError('Expected the input to be `string | string[]`'); - } - - options = Object.assign({ - pascalCase: false - }, options); - - const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x; - - if (Array.isArray(input)) { - input = input.map(x => x.trim()) - .filter(x => x.length) - .join('-'); - } else { - input = input.trim(); - } - - if (input.length === 0) { - return ''; - } - - if (input.length === 1) { - return options.pascalCase ? input.toUpperCase() : input.toLowerCase(); - } - - const hasUpperCase = input !== input.toLowerCase(); - - if (hasUpperCase) { - input = preserveCamelCase(input); - } - - input = input - .replace(/^[_.\- ]+/, '') - .toLowerCase() - .replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase()) - .replace(/\d+(\w|$)/g, m => m.toUpperCase()); - - return postProcess(input); -}; - -module.exports = camelCase; -// TODO: Remove this for the next major release -module.exports.default = camelCase; diff --git a/node_modules/camelcase-keys/node_modules/camelcase/license b/node_modules/camelcase-keys/node_modules/camelcase/license deleted file mode 100644 index e7af2f77..00000000 --- a/node_modules/camelcase-keys/node_modules/camelcase/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/camelcase-keys/node_modules/camelcase/package.json b/node_modules/camelcase-keys/node_modules/camelcase/package.json deleted file mode 100644 index 07bc8fe9..00000000 --- a/node_modules/camelcase-keys/node_modules/camelcase/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "camelcase", - "version": "5.3.1", - "description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`", - "license": "MIT", - "repository": "sindresorhus/camelcase", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=6" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "camelcase", - "camel-case", - "camel", - "case", - "dash", - "hyphen", - "dot", - "underscore", - "separator", - "string", - "text", - "convert", - "pascalcase", - "pascal-case" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - } - -,"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz" -,"_integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" -,"_from": "camelcase@5.3.1" -} \ No newline at end of file diff --git a/node_modules/camelcase-keys/node_modules/camelcase/readme.md b/node_modules/camelcase-keys/node_modules/camelcase/readme.md deleted file mode 100644 index fde27261..00000000 --- a/node_modules/camelcase-keys/node_modules/camelcase/readme.md +++ /dev/null @@ -1,99 +0,0 @@ -# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase) - -> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar` - ---- - -
- - Get professional support for 'camelcase' with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
- ---- - -## Install - -``` -$ npm install camelcase -``` - - -## Usage - -```js -const camelCase = require('camelcase'); - -camelCase('foo-bar'); -//=> 'fooBar' - -camelCase('foo_bar'); -//=> 'fooBar' - -camelCase('Foo-Bar'); -//=> 'fooBar' - -camelCase('Foo-Bar', {pascalCase: true}); -//=> 'FooBar' - -camelCase('--foo.bar', {pascalCase: false}); -//=> 'fooBar' - -camelCase('foo bar'); -//=> 'fooBar' - -console.log(process.argv[3]); -//=> '--foo-bar' -camelCase(process.argv[3]); -//=> 'fooBar' - -camelCase(['foo', 'bar']); -//=> 'fooBar' - -camelCase(['__foo__', '--bar'], {pascalCase: true}); -//=> 'FooBar' -``` - - -## API - -### camelCase(input, [options]) - -#### input - -Type: `string` `string[]` - -String to convert to camel case. - -#### options - -Type: `Object` - -##### pascalCase - -Type: `boolean`
-Default: `false` - -Uppercase the first character: `foo-bar` → `FooBar` - - -## Security - -To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. - - -## Related - -- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module -- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase -- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string -- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/camelcase/index.d.ts b/node_modules/camelcase/index.d.ts index 51d2ba2d..58f2069a 100644 --- a/node_modules/camelcase/index.d.ts +++ b/node_modules/camelcase/index.d.ts @@ -9,53 +9,55 @@ declare namespace camelcase { } } -/** -Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`. +declare const camelcase: { + /** + Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`. -Correctly handles Unicode strings. + @param input - String to convert to camel case. -@param input - String to convert to camel case. + @example + ``` + import camelCase = require('camelcase'); -@example -``` -import camelCase = require('camelcase'); + camelCase('foo-bar'); + //=> 'fooBar' -camelCase('foo-bar'); -//=> 'fooBar' + camelCase('foo_bar'); + //=> 'fooBar' -camelCase('foo_bar'); -//=> 'fooBar' + camelCase('Foo-Bar'); + //=> 'fooBar' -camelCase('Foo-Bar'); -//=> 'fooBar' + camelCase('Foo-Bar', {pascalCase: true}); + //=> 'FooBar' -camelCase('розовый_пушистый_единороги'); -//=> 'розовыйПушистыйЕдинороги' + camelCase('--foo.bar', {pascalCase: false}); + //=> 'fooBar' -camelCase('Foo-Bar', {pascalCase: true}); -//=> 'FooBar' + camelCase('foo bar'); + //=> 'fooBar' -camelCase('--foo.bar', {pascalCase: false}); -//=> 'fooBar' + console.log(process.argv[3]); + //=> '--foo-bar' + camelCase(process.argv[3]); + //=> 'fooBar' -camelCase('foo bar'); -//=> 'fooBar' + camelCase(['foo', 'bar']); + //=> 'fooBar' -console.log(process.argv[3]); -//=> '--foo-bar' -camelCase(process.argv[3]); -//=> 'fooBar' + camelCase(['__foo__', '--bar'], {pascalCase: true}); + //=> 'FooBar' + ``` + */ + (input: string | ReadonlyArray, options?: camelcase.Options): string; -camelCase(['foo', 'bar']); -//=> 'fooBar' - -camelCase(['__foo__', '--bar'], {pascalCase: true}); -//=> 'FooBar' -``` -*/ -declare function camelcase( - input: string | readonly string[], - options?: camelcase.Options -): string; + // TODO: Remove this for the next major release, refactor the whole definition to: + // declare function camelcase( + // input: string | ReadonlyArray, + // options?: camelcase.Options + // ): string; + // export = camelcase; + default: typeof camelcase; +}; export = camelcase; diff --git a/node_modules/camelcase/index.js b/node_modules/camelcase/index.js index dd2c490e..579f99b4 100644 --- a/node_modules/camelcase/index.js +++ b/node_modules/camelcase/index.js @@ -8,21 +8,21 @@ const preserveCamelCase = string => { for (let i = 0; i < string.length; i++) { const character = string[i]; - if (isLastCharLower && /[\p{Lu}]/u.test(character)) { + if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) { string = string.slice(0, i) + '-' + string.slice(i); isLastCharLower = false; isLastLastCharUpper = isLastCharUpper; isLastCharUpper = true; i++; - } else if (isLastCharUpper && isLastLastCharUpper && /[\p{Ll}]/u.test(character)) { + } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) { string = string.slice(0, i - 1) + '-' + string.slice(i - 1); isLastLastCharUpper = isLastCharUpper; isLastCharUpper = false; isLastCharLower = true; } else { - isLastCharLower = character.toLocaleLowerCase() === character && character.toLocaleUpperCase() !== character; + isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character; isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = character.toLocaleUpperCase() === character && character.toLocaleLowerCase() !== character; + isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character; } } @@ -34,12 +34,11 @@ const camelCase = (input, options) => { throw new TypeError('Expected the input to be `string | string[]`'); } - options = { - ...{pascalCase: false}, - ...options - }; + options = Object.assign({ + pascalCase: false + }, options); - const postProcess = x => options.pascalCase ? x.charAt(0).toLocaleUpperCase() + x.slice(1) : x; + const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x; if (Array.isArray(input)) { input = input.map(x => x.trim()) @@ -54,10 +53,10 @@ const camelCase = (input, options) => { } if (input.length === 1) { - return options.pascalCase ? input.toLocaleUpperCase() : input.toLocaleLowerCase(); + return options.pascalCase ? input.toUpperCase() : input.toLowerCase(); } - const hasUpperCase = input !== input.toLocaleLowerCase(); + const hasUpperCase = input !== input.toLowerCase(); if (hasUpperCase) { input = preserveCamelCase(input); @@ -65,9 +64,9 @@ const camelCase = (input, options) => { input = input .replace(/^[_.\- ]+/, '') - .toLocaleLowerCase() - .replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toLocaleUpperCase()) - .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toLocaleUpperCase()); + .toLowerCase() + .replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase()) + .replace(/\d+(\w|$)/g, m => m.toUpperCase()); return postProcess(input); }; diff --git a/node_modules/camelcase/license b/node_modules/camelcase/license index fa7ceba3..e7af2f77 100644 --- a/node_modules/camelcase/license +++ b/node_modules/camelcase/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (https://sindresorhus.com) +Copyright (c) Sindre Sorhus (sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/node_modules/camelcase/package.json b/node_modules/camelcase/package.json index 9e8d568e..07bc8fe9 100644 --- a/node_modules/camelcase/package.json +++ b/node_modules/camelcase/package.json @@ -1,17 +1,16 @@ { "name": "camelcase", - "version": "6.0.0", + "version": "5.3.1", "description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`", "license": "MIT", "repository": "sindresorhus/camelcase", - "funding": "https://github.com/sponsors/sindresorhus", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" + "url": "sindresorhus.com" }, "engines": { - "node": ">=10" + "node": ">=6" }, "scripts": { "test": "xo && ava && tsd" @@ -38,11 +37,11 @@ ], "devDependencies": { "ava": "^1.4.1", - "tsd": "^0.11.0", - "xo": "^0.28.3" + "tsd": "^0.7.1", + "xo": "^0.24.0" } -,"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.0.0.tgz" -,"_integrity": "sha512-8KMDF1Vz2gzOq54ONPJS65IvTUaB1cHJ2DMM7MbPmLZljDH1qpzzLsWdiN9pHh6qvkRVDTi/07+eNGch/oLU4w==" -,"_from": "camelcase@6.0.0" +,"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz" +,"_integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" +,"_from": "camelcase@5.3.1" } \ No newline at end of file diff --git a/node_modules/camelcase/readme.md b/node_modules/camelcase/readme.md index 72529052..fde27261 100644 --- a/node_modules/camelcase/readme.md +++ b/node_modules/camelcase/readme.md @@ -2,7 +2,19 @@ > Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar` -Correctly handles Unicode strings. +--- + +
+ + Get professional support for 'camelcase' with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
+ +--- ## Install @@ -10,6 +22,7 @@ Correctly handles Unicode strings. $ npm install camelcase ``` + ## Usage ```js @@ -24,9 +37,6 @@ camelCase('foo_bar'); camelCase('Foo-Bar'); //=> 'fooBar' -camelCase('розовый_пушистый_единороги'); -//=> 'розовыйПушистыйЕдинороги' - camelCase('Foo-Bar', {pascalCase: true}); //=> 'FooBar' @@ -48,32 +58,33 @@ camelCase(['__foo__', '--bar'], {pascalCase: true}); //=> 'FooBar' ``` + ## API -### camelCase(input, options?) +### camelCase(input, [options]) #### input -Type: `string | string[]` +Type: `string` `string[]` String to convert to camel case. #### options -Type: `object` +Type: `Object` ##### pascalCase -Type: `boolean`\ +Type: `boolean`
Default: `false` Uppercase the first character: `foo-bar` → `FooBar` -## camelcase for enterprise -Available as part of the Tidelift Subscription. +## Security + +To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. -The maintainers of camelcase and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-camelcase?utm_source=npm-camelcase&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) ## Related @@ -81,3 +92,8 @@ The maintainers of camelcase and thousands of other packages are working with Ti - [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase - [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string - [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/compare-func/package.json b/node_modules/compare-func/package.json index 45bf13a8..24f6cafb 100644 --- a/node_modules/compare-func/package.json +++ b/node_modules/compare-func/package.json @@ -1,6 +1,6 @@ { "name": "compare-func", - "version": "1.3.4", + "version": "2.0.0", "description": "Get a compare function for array to sort", "homepage": "https://github.com/stevemao/compare-func", "author": { @@ -30,14 +30,14 @@ ], "dependencies": { "array-ify": "^1.0.0", - "dot-prop": "^3.0.0" + "dot-prop": "^5.1.0" }, "devDependencies": { "coveralls": "^2.11.2", "istanbul": "^0.4.4", "jscs": "^3.0.5", "jshint": "^2.7.0", - "mocha": "^2.5.1" + "mocha": "^7.1.2" }, "scripts": { "coverage": "istanbul cover _mocha -- -R spec && rm -rf ./coverage", @@ -45,7 +45,7 @@ "test": "npm run-script lint && mocha" } -,"_resolved": "https://registry.npmjs.org/compare-func/-/compare-func-1.3.4.tgz" -,"_integrity": "sha512-sq2sWtrqKPkEXAC8tEJA1+BqAH9GbFkGBtUOqrUX57VSfwp8xyktctk+uLoRy5eccTdxzDcVIztlYDpKs3Jv1Q==" -,"_from": "compare-func@1.3.4" +,"_resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz" +,"_integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==" +,"_from": "compare-func@2.0.0" } \ No newline at end of file diff --git a/node_modules/conventional-changelog-angular/CHANGELOG.md b/node_modules/conventional-changelog-angular/CHANGELOG.md index fad689cb..519edc3c 100644 --- a/node_modules/conventional-changelog-angular/CHANGELOG.md +++ b/node_modules/conventional-changelog-angular/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [5.0.11](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-angular@5.0.10...conventional-changelog-angular@5.0.11) (2020-06-20) + + +### Bug Fixes + +* **deps:** update dependency compare-func to v2 ([#647](https://github.com/conventional-changelog/conventional-changelog/issues/647)) ([de4f630](https://github.com/conventional-changelog/conventional-changelog/commit/de4f6309403ca0d46b7c6235052f4dca61ea15bc)) + + + + + ## [5.0.10](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-angular@5.0.6...conventional-changelog-angular@5.0.10) (2020-05-08) **Note:** Version bump only for package conventional-changelog-angular diff --git a/node_modules/conventional-changelog-angular/README.md b/node_modules/conventional-changelog-angular/README.md index f8c2b2ee..566141e2 100644 --- a/node_modules/conventional-changelog-angular/README.md +++ b/node_modules/conventional-changelog-angular/README.md @@ -91,7 +91,7 @@ reference GitHub issues that this commit **Closes**. **Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this. -A detailed explanation can be found in this [document][commit-message-format]. +A detailed explanation can be found in this [document](#commit-message-format). [npm-image]: https://badge.fury.io/js/conventional-changelog-angular.svg [npm-url]: https://npmjs.org/package/conventional-changelog-angular diff --git a/node_modules/conventional-changelog-angular/package.json b/node_modules/conventional-changelog-angular/package.json index 0a74df64..40da9325 100644 --- a/node_modules/conventional-changelog-angular/package.json +++ b/node_modules/conventional-changelog-angular/package.json @@ -1,6 +1,6 @@ { "name": "conventional-changelog-angular", - "version": "5.0.10", + "version": "5.0.11", "description": "conventional-changelog angular preset", "main": "index.js", "scripts": { @@ -33,12 +33,12 @@ }, "homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular#readme", "dependencies": { - "compare-func": "^1.3.1", + "compare-func": "^2.0.0", "q": "^1.5.1" }, - "gitHead": "83643c5a0d2c4d7c9ba14cbf990ffbc577a51e8c" + "gitHead": "3dedddc397e7cbcf5a2ff971ca933992b9e4d11f" -,"_resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.10.tgz" -,"_integrity": "sha512-k7RPPRs0vp8+BtPsM9uDxRl6KcgqtCJmzRD1wRtgqmhQ96g8ifBGo9O/TZBG23jqlXS/rg8BKRDELxfnQQGiaA==" -,"_from": "conventional-changelog-angular@5.0.10" +,"_resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.11.tgz" +,"_integrity": "sha512-nSLypht/1yEflhuTogC03i7DX7sOrXGsRn14g131Potqi6cbGbGEE9PSDEHKldabB6N76HiSyw9Ph+kLmC04Qw==" +,"_from": "conventional-changelog-angular@5.0.11" } \ No newline at end of file diff --git a/node_modules/conventional-changelog-conventionalcommits/CHANGELOG.md b/node_modules/conventional-changelog-conventionalcommits/CHANGELOG.md index 198bb98e..ead5735e 100644 --- a/node_modules/conventional-changelog-conventionalcommits/CHANGELOG.md +++ b/node_modules/conventional-changelog-conventionalcommits/CHANGELOG.md @@ -3,6 +3,29 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.4.0](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.3.1...conventional-changelog-conventionalcommits@4.4.0) (2020-08-12) + + +### Features + +* **templates:** if hash is nullish, do not display in CHANGELOG ([#664](https://github.com/conventional-changelog/conventional-changelog/issues/664)) ([f10256c](https://github.com/conventional-changelog/conventional-changelog/commit/f10256c635687de0a85c4db2bf06292902924f77)) + + + + + +## [4.3.1](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.3.0...conventional-changelog-conventionalcommits@4.3.1) (2020-06-20) + + +### Bug Fixes + +* **deps:** update dependency compare-func to v2 ([#647](https://github.com/conventional-changelog/conventional-changelog/issues/647)) ([de4f630](https://github.com/conventional-changelog/conventional-changelog/commit/de4f6309403ca0d46b7c6235052f4dca61ea15bc)) +* pass config to parserOpts and writerOpts ([73c7a1b](https://github.com/conventional-changelog/conventional-changelog/commit/73c7a1b92c2a47c498f42972acbffa156172a341)) + + + + + # [4.3.0](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.2.3...conventional-changelog-conventionalcommits@4.3.0) (2020-05-08) diff --git a/node_modules/conventional-changelog-conventionalcommits/README.md b/node_modules/conventional-changelog-conventionalcommits/README.md index 7be0de8c..81d7c24e 100644 --- a/node_modules/conventional-changelog-conventionalcommits/README.md +++ b/node_modules/conventional-changelog-conventionalcommits/README.md @@ -6,6 +6,40 @@ A concrete implementation of the specification described at [conventionalcommits.org](https://conventionalcommits.org/) for automated CHANGELOG generation and version management. + +## Indirect Usage (as preset) + +Use the [Conventional Changelog CLI Quick Start](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli#quick-start) with the `-p conventionalcommits` option. + +## Direct Usage (as a base preset so you can customize it) + +If you want to use this package directly and pass options, you can use the [Conventional Changelog CLI Quick Start](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli#quick-start) and with the `--config` or `-n` parameter, pass a js config that looks like this +``` +'use strict' +const config = require('conventional-changelog-conventionalcommits') + +module.exports = config({ + "issuePrefixes": ["TEST-"], + "issueUrlFormat": "myBugTracker.com/{prefix}{id}" +}) +``` + +or json config like that: +``` +{ + "options": { + "preset": { + "name": "conventionalchangelog", + "issuePrefixes": ["TEST-"], + "issueUrlFormat": "myBugTracker.com/{prefix}{id}" + } + } +} +``` +This last json config way passes the `preset` object to the `conventional-changelog-preset-loader` package, that in turn, passes this same `preset` object as the config for the `conventional-changelog-conventionalcommits`. + + + See [conventional-changelog-config-spec](https://github.com/conventional-changelog/conventional-changelog-config-spec) for available configuration options. diff --git a/node_modules/conventional-changelog-conventionalcommits/conventional-changelog.js b/node_modules/conventional-changelog-conventionalcommits/conventional-changelog.js index 8c6352ad..8eccff12 100644 --- a/node_modules/conventional-changelog-conventionalcommits/conventional-changelog.js +++ b/node_modules/conventional-changelog-conventionalcommits/conventional-changelog.js @@ -5,7 +5,7 @@ const parserOpts = require('./parser-opts') const writerOpts = require('./writer-opts') module.exports = function (config) { - return Q.all([parserOpts, writerOpts]) + return Q.all([parserOpts(config), writerOpts(config)]) .spread((parserOpts, writerOpts) => { return { parserOpts, writerOpts } }) diff --git a/node_modules/conventional-changelog-conventionalcommits/package.json b/node_modules/conventional-changelog-conventionalcommits/package.json index ec842c25..9015f27d 100644 --- a/node_modules/conventional-changelog-conventionalcommits/package.json +++ b/node_modules/conventional-changelog-conventionalcommits/package.json @@ -1,6 +1,6 @@ { "name": "conventional-changelog-conventionalcommits", - "version": "4.3.0", + "version": "4.4.0", "description": "conventional-changelog conventionalcommits.org preset", "main": "index.js", "scripts": { @@ -34,13 +34,13 @@ }, "homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular#readme", "dependencies": { - "compare-func": "^1.3.1", + "compare-func": "^2.0.0", "lodash": "^4.17.15", "q": "^1.5.1" }, - "gitHead": "83643c5a0d2c4d7c9ba14cbf990ffbc577a51e8c" + "gitHead": "be1246c68f5dc4e6f28996129951a75bbf1cf307" -,"_resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.3.0.tgz" -,"_integrity": "sha512-oYHydvZKU+bS8LnGqTMlNrrd7769EsuEHKy4fh1oMdvvDi7fem8U+nvfresJ1IDB8K00Mn4LpiA/lR+7Gs6rgg==" -,"_from": "conventional-changelog-conventionalcommits@4.3.0" +,"_resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.4.0.tgz" +,"_integrity": "sha512-ybvx76jTh08tpaYrYn/yd0uJNLt5yMrb1BphDe4WBredMlvPisvMghfpnJb6RmRNcqXeuhR6LfGZGewbkRm9yA==" +,"_from": "conventional-changelog-conventionalcommits@4.4.0" } \ No newline at end of file diff --git a/node_modules/conventional-changelog-conventionalcommits/templates/commit.hbs b/node_modules/conventional-changelog-conventionalcommits/templates/commit.hbs index b724b204..641c2f37 100644 --- a/node_modules/conventional-changelog-conventionalcommits/templates/commit.hbs +++ b/node_modules/conventional-changelog-conventionalcommits/templates/commit.hbs @@ -5,11 +5,11 @@ {{~header}} {{~/if}} -{{~!-- commit link --}} {{#if @root.linkReferences~}} +{{~!-- commit link --}}{{~#if hash}} {{#if @root.linkReferences~}} ([{{shortHash}}]({{commitUrlFormat}})) {{~else}} {{~shortHash}} -{{~/if}} +{{~/if}}{{~/if}} {{~!-- commit references --}} {{~#if references~}} diff --git a/node_modules/conventional-changelog-core/CHANGELOG.md b/node_modules/conventional-changelog-core/CHANGELOG.md index 6699b932..00b5956a 100644 --- a/node_modules/conventional-changelog-core/CHANGELOG.md +++ b/node_modules/conventional-changelog-core/CHANGELOG.md @@ -3,6 +3,25 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.2.0](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-core@4.1.8...conventional-changelog-core@4.2.0) (2020-08-12) + + +### Features + +* add support for '--skip-unstable' option ([#656](https://github.com/conventional-changelog/conventional-changelog/issues/656)) ([#656](https://github.com/conventional-changelog/conventional-changelog/issues/656)) ([0679d7a](https://github.com/conventional-changelog/conventional-changelog/commit/0679d7a1d7a8715918326f31ec3f6168c2341fd6)) + + + + + +## [4.1.8](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-core@4.1.7...conventional-changelog-core@4.1.8) (2020-06-20) + +**Note:** Version bump only for package conventional-changelog-core + + + + + ## [4.1.7](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-core@4.1.6...conventional-changelog-core@4.1.7) (2020-05-08) **Note:** Version bump only for package conventional-changelog-core diff --git a/node_modules/conventional-changelog-core/README.md b/node_modules/conventional-changelog-core/README.md index 81f269f6..8254b18f 100644 --- a/node_modules/conventional-changelog-core/README.md +++ b/node_modules/conventional-changelog-core/README.md @@ -64,6 +64,12 @@ Type: `number` Default: `1` How many releases of changelog you want to generate. It counts from the upcoming release. Useful when you forgot to generate any previous changelog. Set to `0` to regenerate all. +##### skipUnstable + +Type: `boolean` Default: `false` + +If set, unstable release tags will be skipped, e.g., x.x.x-rc. + ##### debug Type: `function` Default: `function() {}` diff --git a/node_modules/conventional-changelog-core/lib/merge-config.js b/node_modules/conventional-changelog-core/lib/merge-config.js index 54b95e72..7f767bb4 100644 --- a/node_modules/conventional-changelog-core/lib/merge-config.js +++ b/node_modules/conventional-changelog-core/lib/merge-config.js @@ -21,7 +21,7 @@ var rhosts = /github|bitbucket|gitlab/i function semverTagsPromise (options) { return Q.Promise(function (resolve, reject) { - gitSemverTags({ lernaTags: !!options.lernaPackage, package: options.lernaPackage, tagPrefix: options.tagPrefix }, function (err, result) { + gitSemverTags({ lernaTags: !!options.lernaPackage, package: options.lernaPackage, tagPrefix: options.tagPrefix, skipUnstable: options.skipUnstable }, function (err, result) { if (err) { reject(err) } else { @@ -70,6 +70,7 @@ function mergeConfig (options, context, gitRawCommitsOpts, parserOpts, writerOpt }, append: false, releaseCount: 1, + skipUnstable: false, debug: function () {}, transform: function (commit, cb) { if (_.isString(commit.gitTags)) { diff --git a/node_modules/conventional-changelog-core/package.json b/node_modules/conventional-changelog-core/package.json index c5635f08..5459ebe5 100644 --- a/node_modules/conventional-changelog-core/package.json +++ b/node_modules/conventional-changelog-core/package.json @@ -1,6 +1,6 @@ { "name": "conventional-changelog-core", - "version": "4.1.7", + "version": "4.2.0", "description": "conventional-changelog core", "repository": { "type": "git", @@ -27,13 +27,13 @@ "homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-core#readme", "dependencies": { "add-stream": "^1.0.0", - "conventional-changelog-writer": "^4.0.16", + "conventional-changelog-writer": "^4.0.17", "conventional-commits-parser": "^3.1.0", "dateformat": "^3.0.0", "get-pkg-repo": "^1.0.0", "git-raw-commits": "2.0.0", "git-remote-origin-url": "^2.0.0", - "git-semver-tags": "^4.0.0", + "git-semver-tags": "^4.1.0", "lodash": "^4.17.15", "normalize-package-data": "^2.3.5", "q": "^1.5.1", @@ -45,9 +45,9 @@ "scripts": { "test-windows": "mocha --timeout 30000" }, - "gitHead": "c5ae3ab67c59e04f79eb19d317c92800df618435" + "gitHead": "be1246c68f5dc4e6f28996129951a75bbf1cf307" -,"_resolved": "https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-4.1.7.tgz" -,"_integrity": "sha512-UBvSrQR2RdKbSQKh7RhueiiY4ZAIOW3+CSWdtKOwRv+KxIMNFKm1rOcGBFx0eA8AKhGkkmmacoTWJTqyz7Q0VA==" -,"_from": "conventional-changelog-core@4.1.7" +,"_resolved": "https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-4.2.0.tgz" +,"_integrity": "sha512-8+xMvN6JvdDtPbGBqA7oRNyZD4od1h/SIzrWqHcKZjitbVXrFpozEeyn4iI4af1UwdrabQpiZMaV07fPUTGd4w==" +,"_from": "conventional-changelog-core@4.2.0" } \ No newline at end of file diff --git a/node_modules/conventional-changelog-jshint/CHANGELOG.md b/node_modules/conventional-changelog-jshint/CHANGELOG.md index f3a3d618..b846ddfc 100644 --- a/node_modules/conventional-changelog-jshint/CHANGELOG.md +++ b/node_modules/conventional-changelog-jshint/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.0.8](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-jshint@2.0.7...conventional-changelog-jshint@2.0.8) (2020-06-20) + + +### Bug Fixes + +* **deps:** update dependency compare-func to v2 ([#647](https://github.com/conventional-changelog/conventional-changelog/issues/647)) ([de4f630](https://github.com/conventional-changelog/conventional-changelog/commit/de4f6309403ca0d46b7c6235052f4dca61ea15bc)) + + + + + ## [2.0.7](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-jshint@2.0.3...conventional-changelog-jshint@2.0.7) (2020-05-08) **Note:** Version bump only for package conventional-changelog-jshint diff --git a/node_modules/conventional-changelog-jshint/package.json b/node_modules/conventional-changelog-jshint/package.json index 8fc94344..66f6dccb 100644 --- a/node_modules/conventional-changelog-jshint/package.json +++ b/node_modules/conventional-changelog-jshint/package.json @@ -1,6 +1,6 @@ { "name": "conventional-changelog-jshint", - "version": "2.0.7", + "version": "2.0.8", "description": "conventional-changelog jshint preset", "main": "index.js", "scripts": { @@ -33,12 +33,12 @@ }, "homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-jshint#readme", "dependencies": { - "compare-func": "^1.3.1", + "compare-func": "^2.0.0", "q": "^1.5.1" }, - "gitHead": "83643c5a0d2c4d7c9ba14cbf990ffbc577a51e8c" + "gitHead": "3dedddc397e7cbcf5a2ff971ca933992b9e4d11f" -,"_resolved": "https://registry.npmjs.org/conventional-changelog-jshint/-/conventional-changelog-jshint-2.0.7.tgz" -,"_integrity": "sha512-qHA8rmwUnLiIxANJbz650+NVzqDIwNtc0TcpIa0+uekbmKHttidvQ1dGximU3vEDdoJVKFgR3TXFqYuZmYy9ZQ==" -,"_from": "conventional-changelog-jshint@2.0.7" +,"_resolved": "https://registry.npmjs.org/conventional-changelog-jshint/-/conventional-changelog-jshint-2.0.8.tgz" +,"_integrity": "sha512-hB/iI0IiZwnZ+seYI+qEQ4b+EMQSEC8jGIvhO2Vpz1E5p8FgLz75OX8oB1xJWl+s4xBMB6f8zJr0tC/BL7YOjw==" +,"_from": "conventional-changelog-jshint@2.0.8" } \ No newline at end of file diff --git a/node_modules/conventional-changelog-writer/CHANGELOG.md b/node_modules/conventional-changelog-writer/CHANGELOG.md index 4dca3695..de0150b4 100644 --- a/node_modules/conventional-changelog-writer/CHANGELOG.md +++ b/node_modules/conventional-changelog-writer/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [4.0.17](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-writer@4.0.16...conventional-changelog-writer@4.0.17) (2020-06-20) + + +### Bug Fixes + +* **deps:** update dependency compare-func to v2 ([#647](https://github.com/conventional-changelog/conventional-changelog/issues/647)) ([de4f630](https://github.com/conventional-changelog/conventional-changelog/commit/de4f6309403ca0d46b7c6235052f4dca61ea15bc)) + + + + + ## [4.0.16](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-writer@4.0.15...conventional-changelog-writer@4.0.16) (2020-05-08) diff --git a/node_modules/conventional-changelog-writer/node_modules/.bin/semver b/node_modules/conventional-changelog-writer/node_modules/.bin/semver new file mode 120000 index 00000000..5aaadf42 --- /dev/null +++ b/node_modules/conventional-changelog-writer/node_modules/.bin/semver @@ -0,0 +1 @@ +../semver/bin/semver.js \ No newline at end of file diff --git a/node_modules/conventional-changelog-writer/node_modules/semver/CHANGELOG.md b/node_modules/conventional-changelog-writer/node_modules/semver/CHANGELOG.md new file mode 100644 index 00000000..f567dd3f --- /dev/null +++ b/node_modules/conventional-changelog-writer/node_modules/semver/CHANGELOG.md @@ -0,0 +1,70 @@ +# changes log + +## 6.2.0 + +* Coerce numbers to strings when passed to semver.coerce() +* Add `rtl` option to coerce from right to left + +## 6.1.3 + +* Handle X-ranges properly in includePrerelease mode + +## 6.1.2 + +* Do not throw when testing invalid version strings + +## 6.1.1 + +* Add options support for semver.coerce() +* Handle undefined version passed to Range.test + +## 6.1.0 + +* Add semver.compareBuild function +* Support `*` in semver.intersects + +## 6.0 + +* Fix `intersects` logic. + + This is technically a bug fix, but since it is also a change to behavior + that may require users updating their code, it is marked as a major + version increment. + +## 5.7 + +* Add `minVersion` method + +## 5.6 + +* Move boolean `loose` param to an options object, with + backwards-compatibility protection. +* Add ability to opt out of special prerelease version handling with + the `includePrerelease` option flag. + +## 5.5 + +* Add version coercion capabilities + +## 5.4 + +* Add intersection checking + +## 5.3 + +* Add `minSatisfying` method + +## 5.2 + +* Add `prerelease(v)` that returns prerelease components + +## 5.1 + +* Add Backus-Naur for ranges +* Remove excessively cute inspection methods + +## 5.0 + +* Remove AMD/Browserified build artifacts +* Fix ltr and gtr when using the `*` range +* Fix for range `*` with a prerelease identifier diff --git a/node_modules/conventional-changelog-writer/node_modules/semver/LICENSE b/node_modules/conventional-changelog-writer/node_modules/semver/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/conventional-changelog-writer/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/conventional-changelog-writer/node_modules/semver/README.md b/node_modules/conventional-changelog-writer/node_modules/semver/README.md new file mode 100644 index 00000000..2293a14f --- /dev/null +++ b/node_modules/conventional-changelog-writer/node_modules/semver/README.md @@ -0,0 +1,443 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.minVersion('>=1.0.0') // '1.0.0' +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +As a command-line utility: + +``` +$ semver -h + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +--rtl + Coerce version strings right to left + +--ltr + Coerce version strings left to right (default) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` which specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional, but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. The +version `3.4.5` *would* satisfy the range, because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose for this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range matching +semantics. + +Second, a user who has opted into using a prerelease version has +clearly indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +Note that this behavior can be suppressed (treating all prerelease +versions as if they were normal versions, for the purpose of range +matching) by setting the `includePrerelease` flag on the options +object to any +[functions](https://github.com/npm/node-semver#functions) that do +range matching. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any version satisfies) +* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero element in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0` +* `^0.2.3` := `>=0.2.3 <0.3.0` +* `^0.0.3` := `>=0.0.3 <0.0.4` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0` +* `^0.0.x` := `>=0.0.0 <0.1.0` +* `^0.0` := `>=0.0.0 <0.1.0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0` +* `^0.x` := `>=0.0.0 <1.0.0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `options` object argument. All +options in this object are `false` by default. The options supported +are: + +- `loose` Be more forgiving about not-quite-valid semver strings. + (Any resulting output will always be 100% strict compliant, of + course.) For backwards compatibility reasons, if the `options` + argument is a boolean value instead of an object, it is interpreted + to be the `loose` param. +- `includePrerelease` Set to suppress the [default + behavior](https://github.com/npm/node-semver#prerelease-tags) of + excluding prerelease tagged versions from ranges unless they are + explicitly opted into. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release)`: Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, the `prerelease` will work the + same as `prepatch`. It increments the patch version, then makes a + prerelease. If the input version is already a prerelease it simply + increments it. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. +* `parse(v)`: Attempt to parse a string as a semantic version, returning either + a `SemVer` object or `null`. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions + are equal. Sorts in ascending order if passed to `Array.sort()`. + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `diff(v1, v2)`: Returns difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `minVersion(range)`: Return the lowest version that can possibly match + the given range. +* `gtr(version, range)`: Return `true` if version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the ranges comparators intersect + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version, options)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver string to +semver. It looks for the first digit in a string, and consumes all +remaining characters which satisfy at least a partial semver (e.g., `1`, +`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer +versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All +surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes +`3.4.0`). Only text which lacks digits will fail coercion (`version one` +is not valid). The maximum length for any semver component considered for +coercion is 16 characters; longer components will be ignored +(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any +semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +components are invalid (`9999999999999999.4.7.4` is likely invalid). + +If the `options.rtl` flag is set, then `coerce` will return the right-most +coercible tuple that does not share an ending index with a longer coercible +tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not +`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of +any other overlapping SemVer tuple. + +### Clean + +* `clean(version)`: Clean a string to be a valid semver if possible + +This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges. + +ex. +* `s.clean(' = v 2.1.5foo')`: `null` +* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean(' = v 2.1.5-foo')`: `null` +* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean('=v2.1.5')`: `'2.1.5'` +* `s.clean(' =v2.1.5')`: `2.1.5` +* `s.clean(' 2.1.5 ')`: `'2.1.5'` +* `s.clean('~1.0.0')`: `null` diff --git a/node_modules/conventional-changelog-writer/node_modules/semver/bin/semver.js b/node_modules/conventional-changelog-writer/node_modules/semver/bin/semver.js new file mode 100755 index 00000000..666034a7 --- /dev/null +++ b/node_modules/conventional-changelog-writer/node_modules/semver/bin/semver.js @@ -0,0 +1,174 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + +var versions = [] + +var range = [] + +var inc = null + +var version = require('../package.json').version + +var loose = false + +var includePrerelease = false + +var coerce = false + +var rtl = false + +var identifier + +var semver = require('../semver') + +var reverse = false + +var options = {} + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a = argv.shift() + var indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + a = a.slice(0, indexOfEqualSign) + argv.unshift(a.slice(indexOfEqualSign + 1)) + } + switch (a) { + case '-rv': case '-rev': case '--rev': case '--reverse': + reverse = true + break + case '-l': case '--loose': + loose = true + break + case '-p': case '--include-prerelease': + includePrerelease = true + break + case '-v': case '--version': + versions.push(argv.shift()) + break + case '-i': case '--inc': case '--increment': + switch (argv[0]) { + case 'major': case 'minor': case 'patch': case 'prerelease': + case 'premajor': case 'preminor': case 'prepatch': + inc = argv.shift() + break + default: + inc = 'patch' + break + } + break + case '--preid': + identifier = argv.shift() + break + case '-r': case '--range': + range.push(argv.shift()) + break + case '-c': case '--coerce': + coerce = true + break + case '--rtl': + rtl = true + break + case '--ltr': + rtl = false + break + case '-h': case '--help': case '-?': + return help() + default: + versions.push(a) + break + } + } + + var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } + + versions = versions.map(function (v) { + return coerce ? (semver.coerce(v, options) || { version: v }).version : v + }).filter(function (v) { + return semver.valid(v) + }) + if (!versions.length) return fail() + if (inc && (versions.length !== 1 || range.length)) { return failInc() } + + for (var i = 0, l = range.length; i < l; i++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i], options) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function failInc () { + console.error('--inc can only be used on a single version with no range') + fail() +} + +function fail () { process.exit(1) } + +function success () { + var compare = reverse ? 'rcompare' : 'compare' + versions.sort(function (a, b) { + return semver[compare](a, b, options) + }).map(function (v) { + return semver.clean(v, options) + }).map(function (v) { + return inc ? semver.inc(v, inc, options, identifier) : v + }).forEach(function (v, i, _) { console.log(v) }) +} + +function help () { + console.log(['SemVer ' + version, + '', + 'A JavaScript implementation of the https://semver.org/ specification', + 'Copyright Isaac Z. Schlueter', + '', + 'Usage: semver [options] [ [...]]', + 'Prints valid versions sorted by SemVer precedence', + '', + 'Options:', + '-r --range ', + ' Print versions that match the specified range.', + '', + '-i --increment []', + ' Increment a version by the specified level. Level can', + ' be one of: major, minor, patch, premajor, preminor,', + " prepatch, or prerelease. Default level is 'patch'.", + ' Only one version may be specified.', + '', + '--preid ', + ' Identifier to be used to prefix premajor, preminor,', + ' prepatch or prerelease version increments.', + '', + '-l --loose', + ' Interpret versions and ranges loosely', + '', + '-p --include-prerelease', + ' Always include prerelease versions in range matching', + '', + '-c --coerce', + ' Coerce a string into SemVer if possible', + ' (does not imply --loose)', + '', + '--rtl', + ' Coerce version strings right to left', + '', + '--ltr', + ' Coerce version strings left to right (default)', + '', + 'Program exits successfully if any valid version satisfies', + 'all supplied ranges, and prints all satisfying versions.', + '', + 'If no satisfying versions are found, then exits failure.', + '', + 'Versions are printed in ascending order, so supplying', + 'multiple versions to the utility will just sort them.' + ].join('\n')) +} diff --git a/node_modules/conventional-changelog-writer/node_modules/semver/package.json b/node_modules/conventional-changelog-writer/node_modules/semver/package.json new file mode 100644 index 00000000..13030769 --- /dev/null +++ b/node_modules/conventional-changelog-writer/node_modules/semver/package.json @@ -0,0 +1,32 @@ +{ + "name": "semver", + "version": "6.3.0", + "description": "The semantic version parser used by npm.", + "main": "semver.js", + "scripts": { + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags" + }, + "devDependencies": { + "tap": "^14.3.1" + }, + "license": "ISC", + "repository": "https://github.com/npm/node-semver", + "bin": { + "semver": "./bin/semver.js" + }, + "files": [ + "bin", + "range.bnf", + "semver.js" + ], + "tap": { + "check-coverage": true + } + +,"_resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz" +,"_integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" +,"_from": "semver@6.3.0" +} \ No newline at end of file diff --git a/node_modules/conventional-changelog-writer/node_modules/semver/range.bnf b/node_modules/conventional-changelog-writer/node_modules/semver/range.bnf new file mode 100644 index 00000000..d4c6ae0d --- /dev/null +++ b/node_modules/conventional-changelog-writer/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/node_modules/semver/semver.js b/node_modules/conventional-changelog-writer/node_modules/semver/semver.js similarity index 100% rename from node_modules/semver/semver.js rename to node_modules/conventional-changelog-writer/node_modules/semver/semver.js diff --git a/node_modules/conventional-changelog-writer/package.json b/node_modules/conventional-changelog-writer/package.json index a530783d..8e309bad 100644 --- a/node_modules/conventional-changelog-writer/package.json +++ b/node_modules/conventional-changelog-writer/package.json @@ -1,6 +1,6 @@ { "name": "conventional-changelog-writer", - "version": "4.0.16", + "version": "4.0.17", "description": "Write logs based on conventional commits and templates", "bugs": { "url": "https://github.com/conventional-changelog/conventional-changelog/issues" @@ -36,7 +36,7 @@ "logs" ], "dependencies": { - "compare-func": "^1.3.1", + "compare-func": "^2.0.0", "conventional-commits-filter": "^2.0.6", "dateformat": "^3.0.0", "handlebars": "^4.7.6", @@ -56,9 +56,9 @@ "devDependencies": { "forceable-tty": "^0.1.0" }, - "gitHead": "c5ae3ab67c59e04f79eb19d317c92800df618435" + "gitHead": "3dedddc397e7cbcf5a2ff971ca933992b9e4d11f" -,"_resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-4.0.16.tgz" -,"_integrity": "sha512-jmU1sDJDZpm/dkuFxBeRXvyNcJQeKhGtVcFFkwTphUAzyYWcwz2j36Wcv+Mv2hU3tpvLMkysOPXJTLO55AUrYQ==" -,"_from": "conventional-changelog-writer@4.0.16" +,"_resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-4.0.17.tgz" +,"_integrity": "sha512-IKQuK3bib/n032KWaSb8YlBFds+aLmzENtnKtxJy3+HqDq5kohu3g/UdNbIHeJWygfnEbZjnCKFxAW0y7ArZAw==" +,"_from": "conventional-changelog-writer@4.0.17" } \ No newline at end of file diff --git a/node_modules/conventional-changelog/CHANGELOG.md b/node_modules/conventional-changelog/CHANGELOG.md index ce68af1e..bdd7af54 100644 --- a/node_modules/conventional-changelog/CHANGELOG.md +++ b/node_modules/conventional-changelog/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.1.23](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog@3.1.22...conventional-changelog@3.1.23) (2020-08-12) + +**Note:** Version bump only for package conventional-changelog + + + + + +## [3.1.22](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog@3.1.21...conventional-changelog@3.1.22) (2020-06-20) + +**Note:** Version bump only for package conventional-changelog + + + + + ## [3.1.21](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog@3.1.20...conventional-changelog@3.1.21) (2020-05-08) **Note:** Version bump only for package conventional-changelog diff --git a/node_modules/conventional-changelog/package.json b/node_modules/conventional-changelog/package.json index e2d08361..05dd4d33 100644 --- a/node_modules/conventional-changelog/package.json +++ b/node_modules/conventional-changelog/package.json @@ -1,6 +1,6 @@ { "name": "conventional-changelog", - "version": "3.1.21", + "version": "3.1.23", "description": "Generate a changelog from git metadata", "repository": { "type": "git", @@ -35,24 +35,24 @@ }, "homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog#readme", "dependencies": { - "conventional-changelog-angular": "^5.0.10", + "conventional-changelog-angular": "^5.0.11", "conventional-changelog-atom": "^2.0.7", "conventional-changelog-codemirror": "^2.0.7", - "conventional-changelog-conventionalcommits": "^4.3.0", - "conventional-changelog-core": "^4.1.7", + "conventional-changelog-conventionalcommits": "^4.4.0", + "conventional-changelog-core": "^4.2.0", "conventional-changelog-ember": "^2.0.8", "conventional-changelog-eslint": "^3.0.8", "conventional-changelog-express": "^2.0.5", "conventional-changelog-jquery": "^3.0.10", - "conventional-changelog-jshint": "^2.0.7", + "conventional-changelog-jshint": "^2.0.8", "conventional-changelog-preset-loader": "^2.3.4" }, "scripts": { "test-windows": "mocha --timeout 30000" }, - "gitHead": "c5ae3ab67c59e04f79eb19d317c92800df618435" + "gitHead": "be1246c68f5dc4e6f28996129951a75bbf1cf307" -,"_resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-3.1.21.tgz" -,"_integrity": "sha512-ZGecVZPEo3aC75VVE4nu85589dDhpMyqfqgUM5Myq6wfKWiNqhDJLSDMsc8qKXshZoY7dqs1hR0H/15kI/G2jQ==" -,"_from": "conventional-changelog@3.1.21" +,"_resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-3.1.23.tgz" +,"_integrity": "sha512-sScUu2NHusjRC1dPc5p8/b3kT78OYr95/Bx7Vl8CPB8tF2mG1xei5iylDTRjONV5hTlzt+Cn/tBWrKdd299b7A==" +,"_from": "conventional-changelog@3.1.23" } \ No newline at end of file diff --git a/node_modules/conventional-recommended-bump/CHANGELOG.md b/node_modules/conventional-recommended-bump/CHANGELOG.md index 2d64d9d8..013e0be3 100644 --- a/node_modules/conventional-recommended-bump/CHANGELOG.md +++ b/node_modules/conventional-recommended-bump/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [6.0.10](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-recommended-bump@6.0.9...conventional-recommended-bump@6.0.10) (2020-08-12) + +**Note:** Version bump only for package conventional-recommended-bump + + + + + ## [6.0.9](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-recommended-bump@6.0.5...conventional-recommended-bump@6.0.9) (2020-05-08) diff --git a/node_modules/conventional-recommended-bump/package.json b/node_modules/conventional-recommended-bump/package.json index 6e2d8eb1..e7498e7c 100644 --- a/node_modules/conventional-recommended-bump/package.json +++ b/node_modules/conventional-recommended-bump/package.json @@ -1,6 +1,6 @@ { "name": "conventional-recommended-bump", - "version": "6.0.9", + "version": "6.0.10", "description": "Get a recommended version bump based on conventional commits", "bugs": { "url": "https://github.com/conventional-changelog/conventional-changelog/issues" @@ -36,7 +36,7 @@ "conventional-commits-filter": "^2.0.6", "conventional-commits-parser": "^3.1.0", "git-raw-commits": "2.0.0", - "git-semver-tags": "^4.0.0", + "git-semver-tags": "^4.1.0", "meow": "^7.0.0", "q": "^1.5.1" }, @@ -44,9 +44,9 @@ "test-windows": "mocha --timeout 30000 ./test/preset-resolver.spec.js" }, "bin": "cli.js", - "gitHead": "83643c5a0d2c4d7c9ba14cbf990ffbc577a51e8c" + "gitHead": "be1246c68f5dc4e6f28996129951a75bbf1cf307" -,"_resolved": "https://registry.npmjs.org/conventional-recommended-bump/-/conventional-recommended-bump-6.0.9.tgz" -,"_integrity": "sha512-DpRmW1k8CpRrcsXHOPGgHgOd4BMGiq2gtXAveGM8B9pSd9b4r4WKnqp1Fd0vkDtk8l973mIk8KKKUYnKRr9SFw==" -,"_from": "conventional-recommended-bump@6.0.9" +,"_resolved": "https://registry.npmjs.org/conventional-recommended-bump/-/conventional-recommended-bump-6.0.10.tgz" +,"_integrity": "sha512-2ibrqAFMN3ZA369JgVoSbajdD/BHN6zjY7DZFKTHzyzuQejDUCjQ85S5KHxCRxNwsbDJhTPD5hOKcis/jQhRgg==" +,"_from": "conventional-recommended-bump@6.0.10" } \ No newline at end of file diff --git a/node_modules/dot-prop/index.d.ts b/node_modules/dot-prop/index.d.ts new file mode 100644 index 00000000..861f5331 --- /dev/null +++ b/node_modules/dot-prop/index.d.ts @@ -0,0 +1,101 @@ +declare const dotProp: { + /** + @param object - Object to get the `path` value. + @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. + @param defaultValue - Default value. + + @example + ``` + import dotProp = require('dot-prop'); + + dotProp.get({foo: {bar: 'unicorn'}}, 'foo.bar'); + //=> 'unicorn' + + dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep'); + //=> undefined + + dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep', 'default value'); + //=> 'default value' + + dotProp.get({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\.dot'); + //=> 'unicorn' + ``` + */ + get( + object: {[key: string]: any} | undefined, + path: string + ): T | undefined; + get( + object: {[key: string]: any} | undefined, + path: string, + defaultValue: T + ): T; + + /** + @param object - Object to set the `path` value. + @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. + @param value - Value to set at `path`. + @returns The object. + + @example + ``` + import dotProp = require('dot-prop'); + + const object = {foo: {bar: 'a'}}; + dotProp.set(object, 'foo.bar', 'b'); + console.log(object); + //=> {foo: {bar: 'b'}} + + const foo = dotProp.set({}, 'foo.bar', 'c'); + console.log(foo); + //=> {foo: {bar: 'c'}} + + dotProp.set(object, 'foo.baz', 'x'); + console.log(object); + //=> {foo: {bar: 'b', baz: 'x'}} + ``` + */ + set( + object: T, + path: string, + value: unknown + ): T; + + /** + @param object - Object to test the `path` value. + @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. + + @example + ``` + import dotProp = require('dot-prop'); + + dotProp.has({foo: {bar: 'unicorn'}}, 'foo.bar'); + //=> true + ``` + */ + has(object: {[key: string]: any} | undefined, path: string): boolean; + + /** + @param object - Object to delete the `path` value. + @param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. + @returns A boolean of whether the property existed before being deleted. + + @example + ``` + import dotProp = require('dot-prop'); + + const object = {foo: {bar: 'a'}}; + dotProp.delete(object, 'foo.bar'); + console.log(object); + //=> {foo: {}} + + object.foo.bar = {x: 'y', y: 'x'}; + dotProp.delete(object, 'foo.bar.x'); + console.log(object); + //=> {foo: {bar: {y: 'x'}}} + ``` + */ + delete(object: {[key: string]: any}, path: string): boolean; +}; + +export = dotProp; diff --git a/node_modules/dot-prop/index.js b/node_modules/dot-prop/index.js index d20e40c7..a90f5995 100644 --- a/node_modules/dot-prop/index.js +++ b/node_modules/dot-prop/index.js @@ -1,111 +1,142 @@ 'use strict'; -var isObj = require('is-obj'); +const isObj = require('is-obj'); -module.exports.get = function (obj, path) { - if (!isObj(obj) || typeof path !== 'string') { - return obj; - } +const disallowedKeys = [ + '__proto__', + 'prototype', + 'constructor' +]; - var pathArr = getPathSegments(path); +const isValidPath = pathSegments => !pathSegments.some(segment => disallowedKeys.includes(segment)); - for (var i = 0; i < pathArr.length; i++) { - var descriptor = Object.getOwnPropertyDescriptor(obj, pathArr[i]) || Object.getOwnPropertyDescriptor(Object.prototype, pathArr[i]); - if (descriptor && !descriptor.enumerable) { - return; +function getPathSegments(path) { + const pathArray = path.split('.'); + const parts = []; + + for (let i = 0; i < pathArray.length; i++) { + let p = pathArray[i]; + + while (p[p.length - 1] === '\\' && pathArray[i + 1] !== undefined) { + p = p.slice(0, -1) + '.'; + p += pathArray[++i]; } - obj = obj[pathArr[i]]; + parts.push(p); + } - if (obj === undefined || obj === null) { - // `obj` is either `undefined` or `null` so we want to stop the loop, and - // if this is not the last bit of the path, and - // if it did't return `undefined` - // it would return `null` if `obj` is `null` - // but we want `get({foo: null}, 'foo.bar')` to equal `undefined` not `null` - if (i !== pathArr.length - 1) { - return undefined; - } + if (!isValidPath(parts)) { + return []; + } + + return parts; +} - break; +module.exports = { + get(object, path, value) { + if (!isObj(object) || typeof path !== 'string') { + return value === undefined ? object : value; } - } - return obj; -}; + const pathArray = getPathSegments(path); + if (pathArray.length === 0) { + return; + } -module.exports.set = function (obj, path, value) { - if (!isObj(obj) || typeof path !== 'string') { - return; - } + for (let i = 0; i < pathArray.length; i++) { + if (!Object.prototype.propertyIsEnumerable.call(object, pathArray[i])) { + return value; + } - var pathArr = getPathSegments(path); + object = object[pathArray[i]]; - for (var i = 0; i < pathArr.length; i++) { - var p = pathArr[i]; + if (object === undefined || object === null) { + // `object` is either `undefined` or `null` so we want to stop the loop, and + // if this is not the last bit of the path, and + // if it did't return `undefined` + // it would return `null` if `object` is `null` + // but we want `get({foo: null}, 'foo.bar')` to equal `undefined`, or the supplied value, not `null` + if (i !== pathArray.length - 1) { + return value; + } - if (!isObj(obj[p])) { - obj[p] = {}; + break; + } } - if (i === pathArr.length - 1) { - obj[p] = value; + return object; + }, + + set(object, path, value) { + if (!isObj(object) || typeof path !== 'string') { + return object; } - obj = obj[p]; - } -}; + const root = object; + const pathArray = getPathSegments(path); -module.exports.delete = function (obj, path) { - if (!isObj(obj) || typeof path !== 'string') { - return; - } + for (let i = 0; i < pathArray.length; i++) { + const p = pathArray[i]; - var pathArr = getPathSegments(path); + if (!isObj(object[p])) { + object[p] = {}; + } - for (var i = 0; i < pathArr.length; i++) { - var p = pathArr[i]; + if (i === pathArray.length - 1) { + object[p] = value; + } - if (i === pathArr.length - 1) { - delete obj[p]; - return; + object = object[p]; } - obj = obj[p]; - } -}; + return root; + }, -module.exports.has = function (obj, path) { - if (!isObj(obj) || typeof path !== 'string') { - return false; - } + delete(object, path) { + if (!isObj(object) || typeof path !== 'string') { + return false; + } - var pathArr = getPathSegments(path); + const pathArray = getPathSegments(path); - for (var i = 0; i < pathArr.length; i++) { - obj = obj[pathArr[i]]; + for (let i = 0; i < pathArray.length; i++) { + const p = pathArray[i]; - if (obj === undefined) { - return false; + if (i === pathArray.length - 1) { + delete object[p]; + return true; + } + + object = object[p]; + + if (!isObj(object)) { + return false; + } } - } + }, - return true; -}; + has(object, path) { + if (!isObj(object) || typeof path !== 'string') { + return false; + } -function getPathSegments(path) { - var pathArr = path.split('.'); - var parts = []; + const pathArray = getPathSegments(path); + if (pathArray.length === 0) { + return false; + } - for (var i = 0; i < pathArr.length; i++) { - var p = pathArr[i]; + // eslint-disable-next-line unicorn/no-for-loop + for (let i = 0; i < pathArray.length; i++) { + if (isObj(object)) { + if (!(pathArray[i] in object)) { + return false; + } - while (p[p.length - 1] === '\\' && pathArr[i + 1] !== undefined) { - p = p.slice(0, -1) + '.'; - p += pathArr[++i]; + object = object[pathArray[i]]; + } else { + return false; + } } - parts.push(p); + return true; } - - return parts; -} +}; diff --git a/node_modules/dot-prop/license b/node_modules/dot-prop/license index 654d0bfe..e7af2f77 100644 --- a/node_modules/dot-prop/license +++ b/node_modules/dot-prop/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/dot-prop/package.json b/node_modules/dot-prop/package.json index 60bd43c9..3057f3ba 100644 --- a/node_modules/dot-prop/package.json +++ b/node_modules/dot-prop/package.json @@ -1,49 +1,49 @@ { - "name": "dot-prop", - "version": "3.0.0", - "description": "Get, set, or delete a property from a nested object using a dot path", - "license": "MIT", - "repository": "sindresorhus/dot-prop", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "xo && ava", - "bench": "matcha bench.js" - }, - "files": [ - "index.js" - ], - "keywords": [ - "obj", - "object", - "prop", - "property", - "dot", - "path", - "get", - "set", - "delete", - "del", - "access", - "notation", - "dotty" - ], - "dependencies": { - "is-obj": "^1.0.0" - }, - "devDependencies": { - "ava": "*", - "matcha": "^0.7.0", - "xo": "*" - } + "name": "dot-prop", + "version": "5.3.0", + "description": "Get, set, or delete a property from a nested object using a dot path", + "license": "MIT", + "repository": "sindresorhus/dot-prop", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd", + "bench": "node bench.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "object", + "prop", + "property", + "dot", + "path", + "get", + "set", + "delete", + "access", + "notation", + "dotty" + ], + "dependencies": { + "is-obj": "^2.0.0" + }, + "devDependencies": { + "ava": "^2.1.0", + "benchmark": "^2.1.4", + "tsd": "^0.7.2", + "xo": "^0.25.3" + } -,"_resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-3.0.0.tgz" -,"_integrity": "sha1-G3CK8JSknJoOfbyteQq6U52sEXc=" -,"_from": "dot-prop@3.0.0" +,"_resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz" +,"_integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==" +,"_from": "dot-prop@5.3.0" } \ No newline at end of file diff --git a/node_modules/dot-prop/readme.md b/node_modules/dot-prop/readme.md index 4bea5839..4170565d 100644 --- a/node_modules/dot-prop/readme.md +++ b/node_modules/dot-prop/readme.md @@ -6,7 +6,7 @@ ## Install ``` -$ npm install --save dot-prop +$ npm install dot-prop ``` @@ -15,53 +15,72 @@ $ npm install --save dot-prop ```js const dotProp = require('dot-prop'); -// getter +// Getter dotProp.get({foo: {bar: 'unicorn'}}, 'foo.bar'); //=> 'unicorn' dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep'); //=> undefined +dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep', 'default value'); +//=> 'default value' + dotProp.get({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\.dot'); //=> 'unicorn' -// setter -const obj = {foo: {bar: 'a'}}; -dotProp.set(obj, 'foo.bar', 'b'); -console.log(obj); +// Setter +const object = {foo: {bar: 'a'}}; +dotProp.set(object, 'foo.bar', 'b'); +console.log(object); //=> {foo: {bar: 'b'}} -dotProp.set(obj, 'foo.baz', 'x'); -console.log(obj); +const foo = dotProp.set({}, 'foo.bar', 'c'); +console.log(foo); +//=> {foo: {bar: 'c'}} + +dotProp.set(object, 'foo.baz', 'x'); +console.log(object); //=> {foo: {bar: 'b', baz: 'x'}} -// deleter -const obj = {foo: {bar: 'a'}}; -dotProp.delete(obj, 'foo.bar'); -console.log(obj); +// Has +dotProp.has({foo: {bar: 'unicorn'}}, 'foo.bar'); +//=> true + +// Deleter +const object = {foo: {bar: 'a'}}; +dotProp.delete(object, 'foo.bar'); +console.log(object); //=> {foo: {}} -obj.foo.bar = {x: 'y', y: 'x'}; -dotProp.delete(obj, 'foo.bar.x'); -console.log(obj); +object.foo.bar = {x: 'y', y: 'x'}; +dotProp.delete(object, 'foo.bar.x'); +console.log(object); //=> {foo: {bar: {y: 'x'}}} ``` ## API -### get(obj, path) +### get(object, path, defaultValue?) + +### set(object, path, value) + +Returns the object. + +### has(object, path) -### set(obj, path, value) +### delete(object, path) -### delete(obj, path) +Returns a boolean of whether the property existed before being deleted. -#### obj +#### object -Type: `Object` +Type: `object` Object to get, set, or delete the `path` value. +You are allowed to pass in `undefined` as the object to the `get` and `has` functions. + #### path Type: `string` @@ -70,13 +89,29 @@ Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. +The following path components are invalid and results in `undefined` being returned: `__proto__`, `prototype`, `constructor`. + #### value -Type: `any` +Type: `unknown` Value to set at `path`. +#### defaultValue + +Type: `unknown` + +Default value. + -## License +--- -MIT © [Sindre Sorhus](https://sindresorhus.com) +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/function-bind/.editorconfig b/node_modules/function-bind/.editorconfig new file mode 100644 index 00000000..ac29adef --- /dev/null +++ b/node_modules/function-bind/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 120 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/node_modules/function-bind/.eslintrc b/node_modules/function-bind/.eslintrc new file mode 100644 index 00000000..9b33d8ed --- /dev/null +++ b/node_modules/function-bind/.eslintrc @@ -0,0 +1,15 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "indent": [2, 4], + "max-nested-callbacks": [2, 3], + "max-params": [2, 3], + "max-statements": [2, 20], + "no-new-func": [1], + "strict": [0] + } +} diff --git a/node_modules/function-bind/.jscs.json b/node_modules/function-bind/.jscs.json new file mode 100644 index 00000000..8c447948 --- /dev/null +++ b/node_modules/function-bind/.jscs.json @@ -0,0 +1,176 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": { + "allExcept": [], + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] + }, + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceAfterComma": false, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "ForInStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": { "allExcept": ["keywords"] }, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 8 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "disallowMultiLineTernary": true, + + "validateOrderInObjectKeys": "asc-insensitive", + + "disallowIdenticalDestructuringNames": true, + + "disallowNestedTernaries": { "maxLevel": 1 }, + + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, + "requireAlignedMultilineParams": false, + + "requireSpacesInGenerator": { + "afterStar": true + }, + + "disallowSpacesInGenerator": { + "beforeStar": true + }, + + "disallowVar": false, + + "requireArrayDestructuring": false, + + "requireEnhancedObjectLiterals": false, + + "requireObjectDestructuring": false, + + "requireEarlyReturn": false, + + "requireCapitalizedConstructorsNew": { + "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] + }, + + "requireImportAlphabetized": false, + + "requireSpaceBeforeObjectValues": true, + "requireSpaceBeforeDestructuredValues": true, + + "disallowSpacesInsideTemplateStringPlaceholders": true, + + "disallowArrayDestructuringReturn": false, + + "requireNewlineBeforeSingleStatementsInIf": false, + + "disallowUnusedVariables": true, + + "requireSpacesInsideImportedObjectBraces": true, + + "requireUseStrict": true +} + diff --git a/node_modules/function-bind/.npmignore b/node_modules/function-bind/.npmignore new file mode 100644 index 00000000..dbb555fd --- /dev/null +++ b/node_modules/function-bind/.npmignore @@ -0,0 +1,22 @@ +# gitignore +.DS_Store +.monitor +.*.swp +.nodemonignore +releases +*.log +*.err +fleet.json +public/browserify +bin/*.json +.bin +build +compile +.lock-wscript +coverage +node_modules + +# Only apps should have lockfiles +npm-shrinkwrap.json +package-lock.json +yarn.lock diff --git a/node_modules/function-bind/.travis.yml b/node_modules/function-bind/.travis.yml new file mode 100644 index 00000000..85f70d24 --- /dev/null +++ b/node_modules/function-bind/.travis.yml @@ -0,0 +1,168 @@ +language: node_js +os: + - linux +node_js: + - "8.4" + - "7.10" + - "6.11" + - "5.12" + - "4.8" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then npm install -g npm@1.3 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' + - 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then if [ "${TRAVIS_NODE_VERSION%${TRAVIS_NODE_VERSION#[0-9]}}" = "0" ] || [ "${TRAVIS_NODE_VERSION:0:4}" = "iojs" ]; then npm install -g npm@4.5 ; else npm install -g npm; fi; fi' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then nvm install 0.8 && npm install -g npm@1.3 && npm install -g npm@1.4.28 && npm install -g npm@2 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "node" + env: PRETEST=true + - node_js: "4" + env: COVERAGE=true + - node_js: "8.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true diff --git a/node_modules/minimist-options/node_modules/arrify/license b/node_modules/function-bind/LICENSE similarity index 91% rename from node_modules/minimist-options/node_modules/arrify/license rename to node_modules/function-bind/LICENSE index 654d0bfe..62d6d237 100644 --- a/node_modules/minimist-options/node_modules/arrify/license +++ b/node_modules/function-bind/LICENSE @@ -1,6 +1,4 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) 2013 Raynos. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -19,3 +17,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/function-bind/README.md b/node_modules/function-bind/README.md new file mode 100644 index 00000000..81862a02 --- /dev/null +++ b/node_modules/function-bind/README.md @@ -0,0 +1,48 @@ +# function-bind + + + + + +Implementation of function.prototype.bind + +## Example + +I mainly do this for unit tests I run on phantomjs. +PhantomJS does not have Function.prototype.bind :( + +```js +Function.prototype.bind = require("function-bind") +``` + +## Installation + +`npm install function-bind` + +## Contributors + + - Raynos + +## MIT Licenced + + [travis-svg]: https://travis-ci.org/Raynos/function-bind.svg + [travis-url]: https://travis-ci.org/Raynos/function-bind + [npm-badge-svg]: https://badge.fury.io/js/function-bind.svg + [npm-url]: https://npmjs.org/package/function-bind + [5]: https://coveralls.io/repos/Raynos/function-bind/badge.png + [6]: https://coveralls.io/r/Raynos/function-bind + [7]: https://gemnasium.com/Raynos/function-bind.png + [8]: https://gemnasium.com/Raynos/function-bind + [deps-svg]: https://david-dm.org/Raynos/function-bind.svg + [deps-url]: https://david-dm.org/Raynos/function-bind + [dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg + [dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies + [11]: https://ci.testling.com/Raynos/function-bind.png + [12]: https://ci.testling.com/Raynos/function-bind diff --git a/node_modules/function-bind/implementation.js b/node_modules/function-bind/implementation.js new file mode 100644 index 00000000..cc4daec1 --- /dev/null +++ b/node_modules/function-bind/implementation.js @@ -0,0 +1,52 @@ +'use strict'; + +/* eslint no-invalid-this: 1 */ + +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; +var slice = Array.prototype.slice; +var toStr = Object.prototype.toString; +var funcType = '[object Function]'; + +module.exports = function bind(that) { + var target = this; + if (typeof target !== 'function' || toStr.call(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slice.call(arguments, 1); + + var bound; + var binder = function () { + if (this instanceof bound) { + var result = target.apply( + this, + args.concat(slice.call(arguments)) + ); + if (Object(result) === result) { + return result; + } + return this; + } else { + return target.apply( + that, + args.concat(slice.call(arguments)) + ); + } + }; + + var boundLength = Math.max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs.push('$' + i); + } + + bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); + + if (target.prototype) { + var Empty = function Empty() {}; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + + return bound; +}; diff --git a/node_modules/function-bind/index.js b/node_modules/function-bind/index.js new file mode 100644 index 00000000..3bb6b960 --- /dev/null +++ b/node_modules/function-bind/index.js @@ -0,0 +1,5 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = Function.prototype.bind || implementation; diff --git a/node_modules/function-bind/package.json b/node_modules/function-bind/package.json new file mode 100644 index 00000000..426db8c4 --- /dev/null +++ b/node_modules/function-bind/package.json @@ -0,0 +1,67 @@ +{ + "name": "function-bind", + "version": "1.1.1", + "description": "Implementation of Function.prototype.bind", + "keywords": [ + "function", + "bind", + "shim", + "es5" + ], + "author": "Raynos ", + "repository": "git://github.com/Raynos/function-bind.git", + "main": "index", + "homepage": "https://github.com/Raynos/function-bind", + "contributors": [ + { + "name": "Raynos" + }, + { + "name": "Jordan Harband", + "url": "https://github.com/ljharb" + } + ], + "bugs": { + "url": "https://github.com/Raynos/function-bind/issues", + "email": "raynos2@gmail.com" + }, + "dependencies": {}, + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "covert": "^1.1.0", + "eslint": "^4.5.0", + "jscs": "^3.0.7", + "tape": "^4.8.0" + }, + "license": "MIT", + "scripts": { + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "npm run coverage -- --quiet", + "tests-only": "node test", + "coverage": "covert test/*.js", + "lint": "npm run jscs && npm run eslint", + "jscs": "jscs *.js */*.js", + "eslint": "eslint *.js */*.js" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "ie/8..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } + +,"_resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" +,"_integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" +,"_from": "function-bind@1.1.1" +} \ No newline at end of file diff --git a/node_modules/function-bind/test/.eslintrc b/node_modules/function-bind/test/.eslintrc new file mode 100644 index 00000000..8a56d5b7 --- /dev/null +++ b/node_modules/function-bind/test/.eslintrc @@ -0,0 +1,9 @@ +{ + "rules": { + "array-bracket-newline": 0, + "array-element-newline": 0, + "max-statements-per-line": [2, { "max": 2 }], + "no-invalid-this": 0, + "no-magic-numbers": 0, + } +} diff --git a/node_modules/function-bind/test/index.js b/node_modules/function-bind/test/index.js new file mode 100644 index 00000000..2edecce2 --- /dev/null +++ b/node_modules/function-bind/test/index.js @@ -0,0 +1,252 @@ +// jscs:disable requireUseStrict + +var test = require('tape'); + +var functionBind = require('../implementation'); +var getCurrentContext = function () { return this; }; + +test('functionBind is a function', function (t) { + t.equal(typeof functionBind, 'function'); + t.end(); +}); + +test('non-functions', function (t) { + var nonFunctions = [true, false, [], {}, 42, 'foo', NaN, /a/g]; + t.plan(nonFunctions.length); + for (var i = 0; i < nonFunctions.length; ++i) { + try { functionBind.call(nonFunctions[i]); } catch (ex) { + t.ok(ex instanceof TypeError, 'throws when given ' + String(nonFunctions[i])); + } + } + t.end(); +}); + +test('without a context', function (t) { + t.test('binds properly', function (st) { + var args, context; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }) + }; + namespace.func(1, 2, 3); + st.deepEqual(args, [1, 2, 3]); + st.equal(context, getCurrentContext.call()); + st.end(); + }); + + t.test('binds properly, and still supplies bound arguments', function (st) { + var args, context; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, undefined, 1, 2, 3) + }; + namespace.func(4, 5, 6); + st.deepEqual(args, [1, 2, 3, 4, 5, 6]); + st.equal(context, getCurrentContext.call()); + st.end(); + }); + + t.test('returns properly', function (st) { + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, null) + }; + var context = namespace.func(1, 2, 3); + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); + st.end(); + }); + + t.test('returns properly with bound arguments', function (st) { + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, null, 1, 2, 3) + }; + var context = namespace.func(4, 5, 6); + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); + st.end(); + }); + + t.test('called as a constructor', function (st) { + var thunkify = function (value) { + return function () { return value; }; + }; + st.test('returns object value', function (sst) { + var expectedReturnValue = [1, 2, 3]; + var Constructor = functionBind.call(thunkify(expectedReturnValue), null); + var result = new Constructor(); + sst.equal(result, expectedReturnValue); + sst.end(); + }); + + st.test('does not return primitive value', function (sst) { + var Constructor = functionBind.call(thunkify(42), null); + var result = new Constructor(); + sst.notEqual(result, 42); + sst.end(); + }); + + st.test('object from bound constructor is instance of original and bound constructor', function (sst) { + var A = function (x) { + this.name = x || 'A'; + }; + var B = functionBind.call(A, null, 'B'); + + var result = new B(); + sst.ok(result instanceof B, 'result is instance of bound constructor'); + sst.ok(result instanceof A, 'result is instance of original constructor'); + sst.end(); + }); + + st.end(); + }); + + t.end(); +}); + +test('with a context', function (t) { + t.test('with no bound arguments', function (st) { + var args, context; + var boundContext = {}; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, boundContext) + }; + namespace.func(1, 2, 3); + st.equal(context, boundContext, 'binds a context properly'); + st.deepEqual(args, [1, 2, 3], 'supplies passed arguments'); + st.end(); + }); + + t.test('with bound arguments', function (st) { + var args, context; + var boundContext = {}; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, boundContext, 1, 2, 3) + }; + namespace.func(4, 5, 6); + st.equal(context, boundContext, 'binds a context properly'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'supplies bound and passed arguments'); + st.end(); + }); + + t.test('returns properly', function (st) { + var boundContext = {}; + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, boundContext) + }; + var context = namespace.func(1, 2, 3); + st.equal(context, boundContext, 'returned context is bound context'); + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); + st.end(); + }); + + t.test('returns properly with bound arguments', function (st) { + var boundContext = {}; + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, boundContext, 1, 2, 3) + }; + var context = namespace.func(4, 5, 6); + st.equal(context, boundContext, 'returned context is bound context'); + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); + st.end(); + }); + + t.test('passes the correct arguments when called as a constructor', function (st) { + var expected = { name: 'Correct' }; + var namespace = { + Func: functionBind.call(function (arg) { + return arg; + }, { name: 'Incorrect' }) + }; + var returned = new namespace.Func(expected); + st.equal(returned, expected, 'returns the right arg when called as a constructor'); + st.end(); + }); + + t.test('has the new instance\'s context when called as a constructor', function (st) { + var actualContext; + var expectedContext = { foo: 'bar' }; + var namespace = { + Func: functionBind.call(function () { + actualContext = this; + }, expectedContext) + }; + var result = new namespace.Func(); + st.equal(result instanceof namespace.Func, true); + st.notEqual(actualContext, expectedContext); + st.end(); + }); + + t.end(); +}); + +test('bound function length', function (t) { + t.test('sets a correct length without thisArg', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }); + st.equal(subject.length, 3); + st.equal(subject(1, 2, 3), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}); + st.equal(subject.length, 3); + st.equal(subject(1, 2, 3), 6); + st.end(); + }); + + t.test('sets a correct length without thisArg and first argument', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1); + st.equal(subject.length, 2); + st.equal(subject(2, 3), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg and first argument', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1); + st.equal(subject.length, 2); + st.equal(subject(2, 3), 6); + st.end(); + }); + + t.test('sets a correct length without thisArg and too many arguments', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1, 2, 3, 4); + st.equal(subject.length, 0); + st.equal(subject(), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg and too many arguments', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1, 2, 3, 4); + st.equal(subject.length, 0); + st.equal(subject(), 6); + st.end(); + }); +}); diff --git a/node_modules/git-raw-commits/node_modules/arrify/index.js b/node_modules/git-raw-commits/node_modules/arrify/index.js deleted file mode 100644 index 2a2fdeeb..00000000 --- a/node_modules/git-raw-commits/node_modules/arrify/index.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; -module.exports = function (val) { - if (val === null || val === undefined) { - return []; - } - - return Array.isArray(val) ? val : [val]; -}; diff --git a/node_modules/git-raw-commits/node_modules/arrify/license b/node_modules/git-raw-commits/node_modules/arrify/license deleted file mode 100644 index 654d0bfe..00000000 --- a/node_modules/git-raw-commits/node_modules/arrify/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/git-raw-commits/node_modules/arrify/package.json b/node_modules/git-raw-commits/node_modules/arrify/package.json deleted file mode 100644 index bfc8621c..00000000 --- a/node_modules/git-raw-commits/node_modules/arrify/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "arrify", - "version": "1.0.1", - "description": "Convert a value to an array", - "license": "MIT", - "repository": "sindresorhus/arrify", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js" - ], - "keywords": [ - "array", - "arr", - "arrify", - "arrayify", - "convert", - "value" - ], - "devDependencies": { - "ava": "*", - "xo": "*" - } - -,"_resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" -,"_integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" -,"_from": "arrify@1.0.1" -} \ No newline at end of file diff --git a/node_modules/git-raw-commits/node_modules/arrify/readme.md b/node_modules/git-raw-commits/node_modules/arrify/readme.md deleted file mode 100644 index 183d0757..00000000 --- a/node_modules/git-raw-commits/node_modules/arrify/readme.md +++ /dev/null @@ -1,36 +0,0 @@ -# arrify [![Build Status](https://travis-ci.org/sindresorhus/arrify.svg?branch=master)](https://travis-ci.org/sindresorhus/arrify) - -> Convert a value to an array - - -## Install - -``` -$ npm install --save arrify -``` - - -## Usage - -```js -const arrify = require('arrify'); - -arrify('unicorn'); -//=> ['unicorn'] - -arrify(['unicorn']); -//=> ['unicorn'] - -arrify(null); -//=> [] - -arrify(undefined); -//=> [] -``` - -*Supplying `null` or `undefined` results in an empty array.* - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/git-semver-tags/CHANGELOG.md b/node_modules/git-semver-tags/CHANGELOG.md index 224aa70a..e13aa9ce 100644 --- a/node_modules/git-semver-tags/CHANGELOG.md +++ b/node_modules/git-semver-tags/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.1.0](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@4.0.0...git-semver-tags@4.1.0) (2020-08-12) + + +### Features + +* add support for '--skip-unstable' option ([#656](https://github.com/conventional-changelog/conventional-changelog/issues/656)) ([#656](https://github.com/conventional-changelog/conventional-changelog/issues/656)) ([0679d7a](https://github.com/conventional-changelog/conventional-changelog/commit/0679d7a1d7a8715918326f31ec3f6168c2341fd6)) + + + + + # [4.0.0](https://github.com/conventional-changelog/conventional-changelog/compare/git-semver-tags@3.0.1...git-semver-tags@4.0.0) (2020-05-08) diff --git a/node_modules/git-semver-tags/index.js b/node_modules/git-semver-tags/index.js index b2bafa61..e409da74 100644 --- a/node_modules/git-semver-tags/index.js +++ b/node_modules/git-semver-tags/index.js @@ -5,6 +5,7 @@ var exec = require('child_process').exec var semverValid = require('semver').valid var regex = /tag:\s*(.+?)[,)]/gi var cmd = 'git log --decorate --no-color' +var unstableTagTest = /.*-\w*\.\d$/ function lernaTag (tag, pkg) { if (pkg && !(new RegExp('^' + pkg + '@')).test(tag)) { @@ -41,6 +42,12 @@ module.exports = function gitSemverTags (opts, callback) { var match while ((match = regex.exec(decorations))) { var tag = match[1] + + if (options.skipUnstable && unstableTagTest.test(tag)) { + // skip unstable tag + continue + } + if (options.lernaTags) { if (lernaTag(tag, options.package)) { tags.push(tag) diff --git a/node_modules/git-semver-tags/node_modules/.bin/semver b/node_modules/git-semver-tags/node_modules/.bin/semver new file mode 120000 index 00000000..5aaadf42 --- /dev/null +++ b/node_modules/git-semver-tags/node_modules/.bin/semver @@ -0,0 +1 @@ +../semver/bin/semver.js \ No newline at end of file diff --git a/node_modules/git-semver-tags/node_modules/semver/CHANGELOG.md b/node_modules/git-semver-tags/node_modules/semver/CHANGELOG.md new file mode 100644 index 00000000..f567dd3f --- /dev/null +++ b/node_modules/git-semver-tags/node_modules/semver/CHANGELOG.md @@ -0,0 +1,70 @@ +# changes log + +## 6.2.0 + +* Coerce numbers to strings when passed to semver.coerce() +* Add `rtl` option to coerce from right to left + +## 6.1.3 + +* Handle X-ranges properly in includePrerelease mode + +## 6.1.2 + +* Do not throw when testing invalid version strings + +## 6.1.1 + +* Add options support for semver.coerce() +* Handle undefined version passed to Range.test + +## 6.1.0 + +* Add semver.compareBuild function +* Support `*` in semver.intersects + +## 6.0 + +* Fix `intersects` logic. + + This is technically a bug fix, but since it is also a change to behavior + that may require users updating their code, it is marked as a major + version increment. + +## 5.7 + +* Add `minVersion` method + +## 5.6 + +* Move boolean `loose` param to an options object, with + backwards-compatibility protection. +* Add ability to opt out of special prerelease version handling with + the `includePrerelease` option flag. + +## 5.5 + +* Add version coercion capabilities + +## 5.4 + +* Add intersection checking + +## 5.3 + +* Add `minSatisfying` method + +## 5.2 + +* Add `prerelease(v)` that returns prerelease components + +## 5.1 + +* Add Backus-Naur for ranges +* Remove excessively cute inspection methods + +## 5.0 + +* Remove AMD/Browserified build artifacts +* Fix ltr and gtr when using the `*` range +* Fix for range `*` with a prerelease identifier diff --git a/node_modules/git-semver-tags/node_modules/semver/LICENSE b/node_modules/git-semver-tags/node_modules/semver/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/git-semver-tags/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/git-semver-tags/node_modules/semver/README.md b/node_modules/git-semver-tags/node_modules/semver/README.md new file mode 100644 index 00000000..2293a14f --- /dev/null +++ b/node_modules/git-semver-tags/node_modules/semver/README.md @@ -0,0 +1,443 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.minVersion('>=1.0.0') // '1.0.0' +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +As a command-line utility: + +``` +$ semver -h + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +--rtl + Coerce version strings right to left + +--ltr + Coerce version strings left to right (default) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` which specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional, but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. The +version `3.4.5` *would* satisfy the range, because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose for this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range matching +semantics. + +Second, a user who has opted into using a prerelease version has +clearly indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +Note that this behavior can be suppressed (treating all prerelease +versions as if they were normal versions, for the purpose of range +matching) by setting the `includePrerelease` flag on the options +object to any +[functions](https://github.com/npm/node-semver#functions) that do +range matching. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any version satisfies) +* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero element in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0` +* `^0.2.3` := `>=0.2.3 <0.3.0` +* `^0.0.3` := `>=0.0.3 <0.0.4` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0` +* `^0.0.x` := `>=0.0.0 <0.1.0` +* `^0.0` := `>=0.0.0 <0.1.0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0` +* `^0.x` := `>=0.0.0 <1.0.0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `options` object argument. All +options in this object are `false` by default. The options supported +are: + +- `loose` Be more forgiving about not-quite-valid semver strings. + (Any resulting output will always be 100% strict compliant, of + course.) For backwards compatibility reasons, if the `options` + argument is a boolean value instead of an object, it is interpreted + to be the `loose` param. +- `includePrerelease` Set to suppress the [default + behavior](https://github.com/npm/node-semver#prerelease-tags) of + excluding prerelease tagged versions from ranges unless they are + explicitly opted into. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release)`: Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, the `prerelease` will work the + same as `prepatch`. It increments the patch version, then makes a + prerelease. If the input version is already a prerelease it simply + increments it. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. +* `parse(v)`: Attempt to parse a string as a semantic version, returning either + a `SemVer` object or `null`. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions + are equal. Sorts in ascending order if passed to `Array.sort()`. + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `diff(v1, v2)`: Returns difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `minVersion(range)`: Return the lowest version that can possibly match + the given range. +* `gtr(version, range)`: Return `true` if version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the ranges comparators intersect + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version, options)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver string to +semver. It looks for the first digit in a string, and consumes all +remaining characters which satisfy at least a partial semver (e.g., `1`, +`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer +versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All +surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes +`3.4.0`). Only text which lacks digits will fail coercion (`version one` +is not valid). The maximum length for any semver component considered for +coercion is 16 characters; longer components will be ignored +(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any +semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +components are invalid (`9999999999999999.4.7.4` is likely invalid). + +If the `options.rtl` flag is set, then `coerce` will return the right-most +coercible tuple that does not share an ending index with a longer coercible +tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not +`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of +any other overlapping SemVer tuple. + +### Clean + +* `clean(version)`: Clean a string to be a valid semver if possible + +This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges. + +ex. +* `s.clean(' = v 2.1.5foo')`: `null` +* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean(' = v 2.1.5-foo')`: `null` +* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean('=v2.1.5')`: `'2.1.5'` +* `s.clean(' =v2.1.5')`: `2.1.5` +* `s.clean(' 2.1.5 ')`: `'2.1.5'` +* `s.clean('~1.0.0')`: `null` diff --git a/node_modules/git-semver-tags/node_modules/semver/bin/semver.js b/node_modules/git-semver-tags/node_modules/semver/bin/semver.js new file mode 100755 index 00000000..666034a7 --- /dev/null +++ b/node_modules/git-semver-tags/node_modules/semver/bin/semver.js @@ -0,0 +1,174 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + +var versions = [] + +var range = [] + +var inc = null + +var version = require('../package.json').version + +var loose = false + +var includePrerelease = false + +var coerce = false + +var rtl = false + +var identifier + +var semver = require('../semver') + +var reverse = false + +var options = {} + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a = argv.shift() + var indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + a = a.slice(0, indexOfEqualSign) + argv.unshift(a.slice(indexOfEqualSign + 1)) + } + switch (a) { + case '-rv': case '-rev': case '--rev': case '--reverse': + reverse = true + break + case '-l': case '--loose': + loose = true + break + case '-p': case '--include-prerelease': + includePrerelease = true + break + case '-v': case '--version': + versions.push(argv.shift()) + break + case '-i': case '--inc': case '--increment': + switch (argv[0]) { + case 'major': case 'minor': case 'patch': case 'prerelease': + case 'premajor': case 'preminor': case 'prepatch': + inc = argv.shift() + break + default: + inc = 'patch' + break + } + break + case '--preid': + identifier = argv.shift() + break + case '-r': case '--range': + range.push(argv.shift()) + break + case '-c': case '--coerce': + coerce = true + break + case '--rtl': + rtl = true + break + case '--ltr': + rtl = false + break + case '-h': case '--help': case '-?': + return help() + default: + versions.push(a) + break + } + } + + var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } + + versions = versions.map(function (v) { + return coerce ? (semver.coerce(v, options) || { version: v }).version : v + }).filter(function (v) { + return semver.valid(v) + }) + if (!versions.length) return fail() + if (inc && (versions.length !== 1 || range.length)) { return failInc() } + + for (var i = 0, l = range.length; i < l; i++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i], options) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function failInc () { + console.error('--inc can only be used on a single version with no range') + fail() +} + +function fail () { process.exit(1) } + +function success () { + var compare = reverse ? 'rcompare' : 'compare' + versions.sort(function (a, b) { + return semver[compare](a, b, options) + }).map(function (v) { + return semver.clean(v, options) + }).map(function (v) { + return inc ? semver.inc(v, inc, options, identifier) : v + }).forEach(function (v, i, _) { console.log(v) }) +} + +function help () { + console.log(['SemVer ' + version, + '', + 'A JavaScript implementation of the https://semver.org/ specification', + 'Copyright Isaac Z. Schlueter', + '', + 'Usage: semver [options] [ [...]]', + 'Prints valid versions sorted by SemVer precedence', + '', + 'Options:', + '-r --range ', + ' Print versions that match the specified range.', + '', + '-i --increment []', + ' Increment a version by the specified level. Level can', + ' be one of: major, minor, patch, premajor, preminor,', + " prepatch, or prerelease. Default level is 'patch'.", + ' Only one version may be specified.', + '', + '--preid ', + ' Identifier to be used to prefix premajor, preminor,', + ' prepatch or prerelease version increments.', + '', + '-l --loose', + ' Interpret versions and ranges loosely', + '', + '-p --include-prerelease', + ' Always include prerelease versions in range matching', + '', + '-c --coerce', + ' Coerce a string into SemVer if possible', + ' (does not imply --loose)', + '', + '--rtl', + ' Coerce version strings right to left', + '', + '--ltr', + ' Coerce version strings left to right (default)', + '', + 'Program exits successfully if any valid version satisfies', + 'all supplied ranges, and prints all satisfying versions.', + '', + 'If no satisfying versions are found, then exits failure.', + '', + 'Versions are printed in ascending order, so supplying', + 'multiple versions to the utility will just sort them.' + ].join('\n')) +} diff --git a/node_modules/git-semver-tags/node_modules/semver/package.json b/node_modules/git-semver-tags/node_modules/semver/package.json new file mode 100644 index 00000000..13030769 --- /dev/null +++ b/node_modules/git-semver-tags/node_modules/semver/package.json @@ -0,0 +1,32 @@ +{ + "name": "semver", + "version": "6.3.0", + "description": "The semantic version parser used by npm.", + "main": "semver.js", + "scripts": { + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags" + }, + "devDependencies": { + "tap": "^14.3.1" + }, + "license": "ISC", + "repository": "https://github.com/npm/node-semver", + "bin": { + "semver": "./bin/semver.js" + }, + "files": [ + "bin", + "range.bnf", + "semver.js" + ], + "tap": { + "check-coverage": true + } + +,"_resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz" +,"_integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" +,"_from": "semver@6.3.0" +} \ No newline at end of file diff --git a/node_modules/git-semver-tags/node_modules/semver/range.bnf b/node_modules/git-semver-tags/node_modules/semver/range.bnf new file mode 100644 index 00000000..d4c6ae0d --- /dev/null +++ b/node_modules/git-semver-tags/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/node_modules/git-semver-tags/node_modules/semver/semver.js b/node_modules/git-semver-tags/node_modules/semver/semver.js new file mode 100644 index 00000000..636fa436 --- /dev/null +++ b/node_modules/git-semver-tags/node_modules/semver/semver.js @@ -0,0 +1,1596 @@ +exports = module.exports = SemVer + +var debug +/* istanbul ignore next */ +if (typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG)) { + debug = function () { + var args = Array.prototype.slice.call(arguments, 0) + args.unshift('SEMVER') + console.log.apply(console, args) + } +} else { + debug = function () {} +} + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0' + +var MAX_LENGTH = 256 +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +var MAX_SAFE_COMPONENT_LENGTH = 16 + +// The actual regexps go on exports.re +var re = exports.re = [] +var src = exports.src = [] +var t = exports.tokens = {} +var R = 0 + +function tok (n) { + t[n] = R++ +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +tok('NUMERICIDENTIFIER') +src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*' +tok('NUMERICIDENTIFIERLOOSE') +src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+' + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +tok('NONNUMERICIDENTIFIER') +src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' + +// ## Main Version +// Three dot-separated numeric identifiers. + +tok('MAINVERSION') +src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIER] + ')' + +tok('MAINVERSIONLOOSE') +src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')' + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +tok('PRERELEASEIDENTIFIER') +src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + + '|' + src[t.NONNUMERICIDENTIFIER] + ')' + +tok('PRERELEASEIDENTIFIERLOOSE') +src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + + '|' + src[t.NONNUMERICIDENTIFIER] + ')' + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +tok('PRERELEASE') +src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + + '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))' + +tok('PRERELEASELOOSE') +src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))' + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +tok('BUILDIDENTIFIER') +src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+' + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +tok('BUILD') +src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + + '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))' + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +tok('FULL') +tok('FULLPLAIN') +src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + + src[t.PRERELEASE] + '?' + + src[t.BUILD] + '?' + +src[t.FULL] = '^' + src[t.FULLPLAIN] + '$' + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +tok('LOOSEPLAIN') +src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + + src[t.PRERELEASELOOSE] + '?' + + src[t.BUILD] + '?' + +tok('LOOSE') +src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$' + +tok('GTLT') +src[t.GTLT] = '((?:<|>)?=?)' + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +tok('XRANGEIDENTIFIERLOOSE') +src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' +tok('XRANGEIDENTIFIER') +src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*' + +tok('XRANGEPLAIN') +src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:' + src[t.PRERELEASE] + ')?' + + src[t.BUILD] + '?' + + ')?)?' + +tok('XRANGEPLAINLOOSE') +src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[t.PRERELEASELOOSE] + ')?' + + src[t.BUILD] + '?' + + ')?)?' + +tok('XRANGE') +src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$' +tok('XRANGELOOSE') +src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$' + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +tok('COERCE') +src[t.COERCE] = '(^|[^\\d])' + + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:$|[^\\d])' +tok('COERCERTL') +re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g') + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +tok('LONETILDE') +src[t.LONETILDE] = '(?:~>?)' + +tok('TILDETRIM') +src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+' +re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g') +var tildeTrimReplace = '$1~' + +tok('TILDE') +src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$' +tok('TILDELOOSE') +src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$' + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +tok('LONECARET') +src[t.LONECARET] = '(?:\\^)' + +tok('CARETTRIM') +src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+' +re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g') +var caretTrimReplace = '$1^' + +tok('CARET') +src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$' +tok('CARETLOOSE') +src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$' + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +tok('COMPARATORLOOSE') +src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$' +tok('COMPARATOR') +src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$' + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +tok('COMPARATORTRIM') +src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + + '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')' + +// this one has to use the /g flag +re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g') +var comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +tok('HYPHENRANGE') +src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[t.XRANGEPLAIN] + ')' + + '\\s*$' + +tok('HYPHENRANGELOOSE') +src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[t.XRANGEPLAINLOOSE] + ')' + + '\\s*$' + +// Star ranges basically just allow anything at all. +tok('STAR') +src[t.STAR] = '(<|>)?=?\\s*\\*' + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]) + if (!re[i]) { + re[i] = new RegExp(src[i]) + } +} + +exports.parse = parse +function parse (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + var r = options.loose ? re[t.LOOSE] : re[t.FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +exports.valid = valid +function valid (version, options) { + var v = parse(version, options) + return v ? v.version : null +} + +exports.clean = clean +function clean (version, options) { + var s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} + +exports.SemVer = SemVer + +function SemVer (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === options.loose) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + } + + if (!(this instanceof SemVer)) { + return new SemVer(version, options) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + + var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + + if (!m) { + throw new TypeError('Invalid Version: ' + version) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() +} + +SemVer.prototype.format = function () { + this.version = this.major + '.' + this.minor + '.' + this.patch + if (this.prerelease.length) { + this.version += '-' + this.prerelease.join('.') + } + return this.version +} + +SemVer.prototype.toString = function () { + return this.version +} + +SemVer.prototype.compare = function (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return this.compareMain(other) || this.comparePre(other) +} + +SemVer.prototype.compareMain = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) +} + +SemVer.prototype.comparePre = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + var i = 0 + do { + var a = this.prerelease[i] + var b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +SemVer.prototype.compareBuild = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + var i = 0 + do { + var a = this.build[i] + var b = other.build[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + var i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break + + default: + throw new Error('invalid increment argument: ' + release) + } + this.format() + this.raw = this.version + return this +} + +exports.inc = inc +function inc (version, release, loose, identifier) { + if (typeof (loose) === 'string') { + identifier = loose + loose = undefined + } + + try { + return new SemVer(version, loose).inc(release, identifier).version + } catch (er) { + return null + } +} + +exports.diff = diff +function diff (version1, version2) { + if (eq(version1, version2)) { + return null + } else { + var v1 = parse(version1) + var v2 = parse(version2) + var prefix = '' + if (v1.prerelease.length || v2.prerelease.length) { + prefix = 'pre' + var defaultResult = 'prerelease' + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} + +exports.compareIdentifiers = compareIdentifiers + +var numeric = /^[0-9]+$/ +function compareIdentifiers (a, b) { + var anum = numeric.test(a) + var bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +exports.rcompareIdentifiers = rcompareIdentifiers +function rcompareIdentifiers (a, b) { + return compareIdentifiers(b, a) +} + +exports.major = major +function major (a, loose) { + return new SemVer(a, loose).major +} + +exports.minor = minor +function minor (a, loose) { + return new SemVer(a, loose).minor +} + +exports.patch = patch +function patch (a, loose) { + return new SemVer(a, loose).patch +} + +exports.compare = compare +function compare (a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)) +} + +exports.compareLoose = compareLoose +function compareLoose (a, b) { + return compare(a, b, true) +} + +exports.compareBuild = compareBuild +function compareBuild (a, b, loose) { + var versionA = new SemVer(a, loose) + var versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} + +exports.rcompare = rcompare +function rcompare (a, b, loose) { + return compare(b, a, loose) +} + +exports.sort = sort +function sort (list, loose) { + return list.sort(function (a, b) { + return exports.compareBuild(a, b, loose) + }) +} + +exports.rsort = rsort +function rsort (list, loose) { + return list.sort(function (a, b) { + return exports.compareBuild(b, a, loose) + }) +} + +exports.gt = gt +function gt (a, b, loose) { + return compare(a, b, loose) > 0 +} + +exports.lt = lt +function lt (a, b, loose) { + return compare(a, b, loose) < 0 +} + +exports.eq = eq +function eq (a, b, loose) { + return compare(a, b, loose) === 0 +} + +exports.neq = neq +function neq (a, b, loose) { + return compare(a, b, loose) !== 0 +} + +exports.gte = gte +function gte (a, b, loose) { + return compare(a, b, loose) >= 0 +} + +exports.lte = lte +function lte (a, b, loose) { + return compare(a, b, loose) <= 0 +} + +exports.cmp = cmp +function cmp (a, op, b, loose) { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError('Invalid operator: ' + op) + } +} + +exports.Comparator = Comparator +function Comparator (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + if (!(this instanceof Comparator)) { + return new Comparator(comp, options) + } + + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) +} + +var ANY = {} +Comparator.prototype.parse = function (comp) { + var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var m = comp.match(r) + + if (!m) { + throw new TypeError('Invalid comparator: ' + comp) + } + + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } +} + +Comparator.prototype.toString = function () { + return this.value +} + +Comparator.prototype.test = function (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY || version === ANY) { + return true + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + return cmp(version, this.operator, this.semver, this.options) +} + +Comparator.prototype.intersects = function (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + var rangeTmp + + if (this.operator === '') { + if (this.value === '') { + return true + } + rangeTmp = new Range(comp.value, options) + return satisfies(this.value, rangeTmp, options) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + rangeTmp = new Range(this.value, options) + return satisfies(comp.semver, rangeTmp, options) + } + + var sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + var sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + var sameSemVer = this.semver.version === comp.semver.version + var differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + var oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + ((this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<')) + var oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + ((this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>')) + + return sameDirectionIncreasing || sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || oppositeDirectionsGreaterThan +} + +exports.Range = Range +function Range (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (range instanceof Range) { + if (range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + return new Range(range.value, options) + } + + if (!(this instanceof Range)) { + return new Range(range, options) + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First, split based on boolean or || + this.raw = range + this.set = range.split(/\s*\|\|\s*/).map(function (range) { + return this.parseRange(range.trim()) + }, this).filter(function (c) { + // throw out any that are not relevant for whatever reason + return c.length + }) + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range) + } + + this.format() +} + +Range.prototype.format = function () { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim() + }).join('||').trim() + return this.range +} + +Range.prototype.toString = function () { + return this.range +} + +Range.prototype.parseRange = function (range) { + var loose = this.options.loose + range = range.trim() + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, re[t.COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[t.CARETTRIM], caretTrimReplace) + + // normalize spaces + range = range.split(/\s+/).join(' ') + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var set = range.split(' ').map(function (comp) { + return parseComparator(comp, this.options) + }, this).join(' ').split(/\s+/) + if (this.options.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function (comp) { + return !!comp.match(compRe) + }) + } + set = set.map(function (comp) { + return new Comparator(comp, this.options) + }, this) + + return set +} + +Range.prototype.intersects = function (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some(function (thisComparators) { + return ( + isSatisfiable(thisComparators, options) && + range.set.some(function (rangeComparators) { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every(function (thisComparator) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) +} + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +function isSatisfiable (comparators, options) { + var result = true + var remainingComparators = comparators.slice() + var testComparator = remainingComparators.pop() + + while (result && remainingComparators.length) { + result = remainingComparators.every(function (otherComparator) { + return testComparator.intersects(otherComparator, options) + }) + + testComparator = remainingComparators.pop() + } + + return result +} + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators +function toComparators (range, options) { + return new Range(range, options).set.map(function (comp) { + return comp.map(function (c) { + return c.value + }).join(' ').trim().split(' ') + }) +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator (comp, options) { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +function isX (id) { + return !id || id.toLowerCase() === 'x' || id === '*' +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceTilde(comp, options) + }).join(' ') +} + +function replaceTilde (comp, options) { + var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else if (pr) { + debug('replaceTilde pr', pr) + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceCaret(comp, options) + }).join(' ') +} + +function replaceCaret (comp, options) { + debug('caret', comp, options) + var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + if (M === '0') { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else { + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + (+M + 1) + '.0.0' + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0' + } + } + + debug('caret return', ret) + return ret + }) +} + +function replaceXRanges (comp, options) { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map(function (comp) { + return replaceXRange(comp, options) + }).join(' ') +} + +function replaceXRange (comp, options) { + comp = comp.trim() + var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + var xM = isX(M) + var xm = xM || isX(m) + var xp = xm || isX(p) + var anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + ret = gtlt + M + '.' + m + '.' + p + pr + } else if (xm) { + ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr + } else if (xp) { + ret = '>=' + M + '.' + m + '.0' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + pr + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars (comp, options) { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[t.STAR], '') +} + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = '>=' + fM + '.0.0' + } else if (isX(fp)) { + from = '>=' + fM + '.' + fm + '.0' + } else { + from = '>=' + from + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = '<' + (+tM + 1) + '.0.0' + } else if (isX(tp)) { + to = '<' + tM + '.' + (+tm + 1) + '.0' + } else if (tpr) { + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr + } else { + to = '<=' + to + } + + return (from + ' ' + to).trim() +} + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false +} + +function testSet (set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} + +exports.satisfies = satisfies +function satisfies (version, range, options) { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} + +exports.maxSatisfying = maxSatisfying +function maxSatisfying (versions, range, options) { + var max = null + var maxSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} + +exports.minSatisfying = minSatisfying +function minSatisfying (versions, range, options) { + var min = null + var minSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} + +exports.minVersion = minVersion +function minVersion (range, loose) { + range = new Range(range, loose) + + var minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + comparators.forEach(function (comparator) { + // Clone to avoid manipulating the comparator's semver object. + var compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error('Unexpected operation: ' + comparator.operator) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} + +exports.validRange = validRange +function validRange (range, options) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr +function ltr (version, range, options) { + return outside(version, range, '<', options) +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr +function gtr (version, range, options) { + return outside(version, range, '>', options) +} + +exports.outside = outside +function outside (version, range, hilo, options) { + version = new SemVer(version, options) + range = new Range(range, options) + + var gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + var high = null + var low = null + + comparators.forEach(function (comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +exports.prerelease = prerelease +function prerelease (version, options) { + var parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} + +exports.intersects = intersects +function intersects (r1, r2, options) { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} + +exports.coerce = coerce +function coerce (version, options) { + if (version instanceof SemVer) { + return version + } + + if (typeof version === 'number') { + version = String(version) + } + + if (typeof version !== 'string') { + return null + } + + options = options || {} + + var match = null + if (!options.rtl) { + match = version.match(re[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + var next + while ((next = re[t.COERCERTL].exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + re[t.COERCERTL].lastIndex = -1 + } + + if (match === null) { + return null + } + + return parse(match[2] + + '.' + (match[3] || '0') + + '.' + (match[4] || '0'), options) +} diff --git a/node_modules/git-semver-tags/package.json b/node_modules/git-semver-tags/package.json index 5d3f511a..83a40d45 100644 --- a/node_modules/git-semver-tags/package.json +++ b/node_modules/git-semver-tags/package.json @@ -1,6 +1,6 @@ { "name": "git-semver-tags", - "version": "4.0.0", + "version": "4.1.0", "description": "Get all git semver tags of your repository in reverse chronological order", "bugs": { "url": "https://github.com/conventional-changelog/conventional-changelog/issues" @@ -41,9 +41,9 @@ "bin": { "git-semver-tags": "cli.js" }, - "gitHead": "83643c5a0d2c4d7c9ba14cbf990ffbc577a51e8c" + "gitHead": "be1246c68f5dc4e6f28996129951a75bbf1cf307" -,"_resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-4.0.0.tgz" -,"_integrity": "sha512-LajaAWLYVBff+1NVircURJFL8TQ3EMIcLAfHisWYX/nPoMwnTYfWAznQDmMujlLqoD12VtLmoSrF1sQ5MhimEQ==" -,"_from": "git-semver-tags@4.0.0" +,"_resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-4.1.0.tgz" +,"_integrity": "sha512-TcxAGeo03HdErzKzi4fDD+xEL7gi8r2Y5YSxH6N2XYdVSV5UkBwfrt7Gqo1b+uSHCjy/sa9Y6BBBxxFLxfbhTg==" +,"_from": "git-semver-tags@4.1.0" } \ No newline at end of file diff --git a/node_modules/has/LICENSE-MIT b/node_modules/has/LICENSE-MIT new file mode 100644 index 00000000..ae7014d3 --- /dev/null +++ b/node_modules/has/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) 2013 Thiago de Arruda + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/has/README.md b/node_modules/has/README.md new file mode 100644 index 00000000..635e3a4b --- /dev/null +++ b/node_modules/has/README.md @@ -0,0 +1,18 @@ +# has + +> Object.prototype.hasOwnProperty.call shortcut + +## Installation + +```sh +npm install --save has +``` + +## Usage + +```js +var has = require('has'); + +has({}, 'hasOwnProperty'); // false +has(Object.prototype, 'hasOwnProperty'); // true +``` diff --git a/node_modules/has/package.json b/node_modules/has/package.json new file mode 100644 index 00000000..86203ce1 --- /dev/null +++ b/node_modules/has/package.json @@ -0,0 +1,52 @@ +{ + "name": "has", + "description": "Object.prototype.hasOwnProperty.call shortcut", + "version": "1.0.3", + "homepage": "https://github.com/tarruda/has", + "author": { + "name": "Thiago de Arruda", + "email": "tpadilha84@gmail.com" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "repository": { + "type": "git", + "url": "git://github.com/tarruda/has.git" + }, + "bugs": { + "url": "https://github.com/tarruda/has/issues" + }, + "license": "MIT", + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT" + } + ], + "main": "./src", + "dependencies": { + "function-bind": "^1.1.1" + }, + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "eslint": "^4.19.1", + "tape": "^4.9.0" + }, + "engines": { + "node": ">= 0.4.0" + }, + "scripts": { + "lint": "eslint .", + "pretest": "npm run lint", + "test": "tape test" + } + +,"_resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz" +,"_integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==" +,"_from": "has@1.0.3" +} \ No newline at end of file diff --git a/node_modules/has/src/index.js b/node_modules/has/src/index.js new file mode 100644 index 00000000..dd92dd90 --- /dev/null +++ b/node_modules/has/src/index.js @@ -0,0 +1,5 @@ +'use strict'; + +var bind = require('function-bind'); + +module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); diff --git a/node_modules/has/test/index.js b/node_modules/has/test/index.js new file mode 100644 index 00000000..43d480b2 --- /dev/null +++ b/node_modules/has/test/index.js @@ -0,0 +1,10 @@ +'use strict'; + +var test = require('tape'); +var has = require('../'); + +test('has', function (t) { + t.equal(has({}, 'hasOwnProperty'), false, 'object literal does not have own property "hasOwnProperty"'); + t.equal(has(Object.prototype, 'hasOwnProperty'), true, 'Object.prototype has own property "hasOwnProperty"'); + t.end(); +}); diff --git a/node_modules/is-core-module/.eslintrc b/node_modules/is-core-module/.eslintrc new file mode 100644 index 00000000..9c7d5168 --- /dev/null +++ b/node_modules/is-core-module/.eslintrc @@ -0,0 +1,18 @@ +{ + "extends": "@ljharb", + "root": true, + "rules": { + "func-style": 1, + "operator-linebreak": [2, "before"], + }, + "overrides": [ + { + "files": "test/**", + "rules": { + "global-require": 0, + "max-lines-per-function": 0, + "no-negated-condition": 0, + }, + }, + ], +} diff --git a/node_modules/is-core-module/.github/FUNDING.yml b/node_modules/is-core-module/.github/FUNDING.yml new file mode 100644 index 00000000..422ce9b0 --- /dev/null +++ b/node_modules/is-core-module/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/is-core-module +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/is-core-module/.github/workflows/rebase.yml b/node_modules/is-core-module/.github/workflows/rebase.yml new file mode 100644 index 00000000..0c2ad39b --- /dev/null +++ b/node_modules/is-core-module/.github/workflows/rebase.yml @@ -0,0 +1,15 @@ +name: Automatic Rebase + +on: [pull_request_target] + +jobs: + _: + name: "Automatic Rebase" + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: ljharb/rebase@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/node_modules/is-core-module/.github/workflows/require-allow-edits.yml b/node_modules/is-core-module/.github/workflows/require-allow-edits.yml new file mode 100644 index 00000000..aac42d3e --- /dev/null +++ b/node_modules/is-core-module/.github/workflows/require-allow-edits.yml @@ -0,0 +1,14 @@ +name: Require “Allow Edits” + +on: [pull_request_target] + +jobs: + _: + name: "Require “Allow Edits”" + + runs-on: ubuntu-latest + + steps: + - uses: ljharb/require-allow-edits@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/node_modules/is-core-module/.travis.yml b/node_modules/is-core-module/.travis.yml new file mode 100644 index 00000000..98ea5a34 --- /dev/null +++ b/node_modules/is-core-module/.travis.yml @@ -0,0 +1,15 @@ +version: ~> 1.0 +language: node_js +os: + - linux +import: + - ljharb/travis-ci:node/all.yml + - ljharb/travis-ci:node/pretest.yml + - ljharb/travis-ci:node/posttest.yml +matrix: + fast_finish: true + include: + - node_js: "0.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.5" + env: TEST=true ALLOW_FAILURE=true diff --git a/node_modules/is-core-module/CHANGELOG.md b/node_modules/is-core-module/CHANGELOG.md new file mode 100644 index 00000000..5cafa798 --- /dev/null +++ b/node_modules/is-core-module/CHANGELOG.md @@ -0,0 +1,41 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v2.0.0](https://github.com/meandavejustice/is-core-module/compare/v1.0.2...v2.0.0) - 2020-09-29 + +### Commits + +- v2 implementation [`865aeb5`](https://github.com/meandavejustice/is-core-module/commit/865aeb5ca0e90248a3dfff5d7622e4751fdeb9cd) +- Only apps should have lockfiles [`5a5e660`](https://github.com/meandavejustice/is-core-module/commit/5a5e660d568e37eb44e17fb1ebb12a105205fc2b) +- Initial commit for v2 [`5a51524`](https://github.com/meandavejustice/is-core-module/commit/5a51524e06f92adece5fbb138c69b7b9748a2348) +- Tests [`116eae4`](https://github.com/meandavejustice/is-core-module/commit/116eae4fccd01bc72c1fd3cc4b7561c387afc496) +- [meta] add `auto-changelog` [`c24388b`](https://github.com/meandavejustice/is-core-module/commit/c24388bee828d223040519d1f5b226ca35beee63) +- [actions] add "Automatic Rebase" and "require allow edits" actions [`34292db`](https://github.com/meandavejustice/is-core-module/commit/34292dbcbadae0868aff03c22dbd8b7b8a11558a) +- [Tests] add `npm run lint` [`4f9eeee`](https://github.com/meandavejustice/is-core-module/commit/4f9eeee7ddff10698bbf528620f4dc8d4fa3e697) +- [readme] fix travis badges, https all URLs [`e516a73`](https://github.com/meandavejustice/is-core-module/commit/e516a73b0dccce20938c432b1ba512eae8eff9e9) +- [meta] create FUNDING.yml [`1aabebc`](https://github.com/meandavejustice/is-core-module/commit/1aabebca98d01f8a04e46bc2e2520fa93cf21ac6) +- [Fix] `domain`: domain landed sometime > v0.7.7 and <= v0.7.12 [`2df7d37`](https://github.com/meandavejustice/is-core-module/commit/2df7d37595d41b15eeada732b706b926c2771655) +- [Fix] `sys`: worked in 0.6, not 0.7, and 0.8+ [`a75c134`](https://github.com/meandavejustice/is-core-module/commit/a75c134229e1e9441801f6b73f6a52489346eb65) + +## [v1.0.2](https://github.com/meandavejustice/is-core-module/compare/v1.0.1...v1.0.2) - 2014-09-28 + +### Commits + +- simpler [`66fe90f`](https://github.com/meandavejustice/is-core-module/commit/66fe90f9771581b9adc0c3900baa52c21b5baea2) + +## [v1.0.1](https://github.com/meandavejustice/is-core-module/compare/v1.0.0...v1.0.1) - 2014-09-28 + +### Commits + +- remove stupid [`f21f906`](https://github.com/meandavejustice/is-core-module/commit/f21f906f882c2bd656a5fc5ed6fbe48ddaffb2ac) +- update readme [`1eff0ec`](https://github.com/meandavejustice/is-core-module/commit/1eff0ec69798d1ec65771552d1562911e90a8027) + +## v1.0.0 - 2014-09-28 + +### Commits + +- init [`48e5e76`](https://github.com/meandavejustice/is-core-module/commit/48e5e76cac378fddb8c1f7d4055b8dfc943d6b96) diff --git a/node_modules/is-core-module/LICENSE b/node_modules/is-core-module/LICENSE new file mode 100644 index 00000000..2e502872 --- /dev/null +++ b/node_modules/is-core-module/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Dave Justice + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/is-core-module/README.md b/node_modules/is-core-module/README.md new file mode 100644 index 00000000..479d6d24 --- /dev/null +++ b/node_modules/is-core-module/README.md @@ -0,0 +1,37 @@ +# is-core-module [![Version Badge][2]][1] + +[![Build Status][3]][4] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +Is this specifier a node.js core module? Optionally provide a node version to check; defaults to the current node version. + +## Example + +```js +var isCore = require('is-core-module'); +var assert = require('assert'); +assert(isCore('fs')); +assert(!isCore('butts')); +``` + +## Tests +Clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-core-module +[2]: https://versionbadg.es/inspect-js/is-core-module.svg +[3]: https://travis-ci.com/inspect-js/is-core-module.svg +[4]: https://travis-ci.com/inspect-js/is-core-module +[5]: https://david-dm.org/inspect-js/is-core-module.svg +[6]: https://david-dm.org/inspect-js/is-core-module +[7]: https://david-dm.org/inspect-js/is-core-module/dev-status.svg +[8]: https://david-dm.org/inspect-js/is-core-module#info=devDependencies +[11]: https://nodei.co/npm/is-core-module.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/is-core-module.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/is-core-module.svg +[downloads-url]: https://npm-stat.com/charts.html?package=is-core-module diff --git a/node_modules/is-core-module/core.json b/node_modules/is-core-module/core.json new file mode 100644 index 00000000..915d0dcd --- /dev/null +++ b/node_modules/is-core-module/core.json @@ -0,0 +1,79 @@ +{ + "assert": true, + "assert/strict": ">= 15", + "async_hooks": ">= 8", + "buffer_ieee754": "< 0.9.7", + "buffer": true, + "child_process": true, + "cluster": true, + "console": true, + "constants": true, + "crypto": true, + "_debug_agent": ">= 1 && < 8", + "_debugger": "< 8", + "dgram": true, + "dns": true, + "dns/promises": ">= 15", + "domain": ">= 0.7.12", + "events": true, + "freelist": "< 6", + "fs": true, + "fs/promises": [">= 10 && < 10.1", ">= 14"], + "_http_agent": ">= 0.11.1", + "_http_client": ">= 0.11.1", + "_http_common": ">= 0.11.1", + "_http_incoming": ">= 0.11.1", + "_http_outgoing": ">= 0.11.1", + "_http_server": ">= 0.11.1", + "http": true, + "http2": ">= 8.8", + "https": true, + "inspector": ">= 8.0.0", + "_linklist": "< 8", + "module": true, + "net": true, + "node-inspect/lib/_inspect": ">= 7.6.0 && < 12", + "node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12", + "node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12", + "os": true, + "path": true, + "perf_hooks": ">= 8.5", + "process": ">= 1", + "punycode": true, + "querystring": true, + "readline": true, + "repl": true, + "smalloc": ">= 0.11.5 && < 3", + "_stream_duplex": ">= 0.9.4", + "_stream_transform": ">= 0.9.4", + "_stream_wrap": ">= 1.4.1", + "_stream_passthrough": ">= 0.9.4", + "_stream_readable": ">= 0.9.4", + "_stream_writable": ">= 0.9.4", + "stream": true, + "stream/promises": ">= 15", + "string_decoder": true, + "sys": [">= 0.6 && < 0.7", ">= 0.8"], + "timers": true, + "timers/promises": ">= 15", + "_tls_common": ">= 0.11.13", + "_tls_legacy": ">= 0.11.3 && < 10", + "_tls_wrap": ">= 0.11.3", + "tls": true, + "trace_events": ">= 10", + "tty": true, + "url": true, + "util": true, + "v8/tools/arguments": ">= 10 && < 12", + "v8/tools/codemap": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], + "v8/tools/consarray": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], + "v8/tools/csvparser": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], + "v8/tools/logreader": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], + "v8/tools/profile_view": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], + "v8/tools/splaytree": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], + "v8": ">= 1", + "vm": true, + "wasi": ">= 13.4 && < 13.5", + "worker_threads": ">= 11.7", + "zlib": true +} diff --git a/node_modules/is-core-module/index.js b/node_modules/is-core-module/index.js new file mode 100644 index 00000000..f5a69cf7 --- /dev/null +++ b/node_modules/is-core-module/index.js @@ -0,0 +1,69 @@ +'use strict'; + +var has = require('has'); + +function specifierIncluded(current, specifier) { + var nodeParts = current.split('.'); + var parts = specifier.split(' '); + var op = parts.length > 1 ? parts[0] : '='; + var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); + + for (var i = 0; i < 3; ++i) { + var cur = parseInt(nodeParts[i] || 0, 10); + var ver = parseInt(versionParts[i] || 0, 10); + if (cur === ver) { + continue; // eslint-disable-line no-restricted-syntax, no-continue + } + if (op === '<') { + return cur < ver; + } + if (op === '>=') { + return cur >= ver; + } + return false; + } + return op === '>='; +} + +function matchesRange(current, range) { + var specifiers = range.split(/ ?&& ?/); + if (specifiers.length === 0) { + return false; + } + for (var i = 0; i < specifiers.length; ++i) { + if (!specifierIncluded(current, specifiers[i])) { + return false; + } + } + return true; +} + +function versionIncluded(nodeVersion, specifierValue) { + if (typeof specifierValue === 'boolean') { + return specifierValue; + } + + var current = typeof nodeVersion === 'undefined' + ? process.versions && process.versions.node && process.versions.node + : nodeVersion; + + if (typeof current !== 'string') { + throw new TypeError(typeof nodeVersion === 'undefined' ? 'Unable to determine current node version' : 'If provided, a valid node version is required'); + } + + if (specifierValue && typeof specifierValue === 'object') { + for (var i = 0; i < specifierValue.length; ++i) { + if (matchesRange(current, specifierValue[i])) { + return true; + } + } + return false; + } + return matchesRange(current, specifierValue); +} + +var data = require('./core.json'); + +module.exports = function isCore(x, nodeVersion) { + return has(data, x) && versionIncluded(nodeVersion, data[x]); +}; diff --git a/node_modules/is-core-module/package.json b/node_modules/is-core-module/package.json new file mode 100644 index 00000000..af6b6f39 --- /dev/null +++ b/node_modules/is-core-module/package.json @@ -0,0 +1,67 @@ +{ + "name": "is-core-module", + "version": "2.0.0", + "description": "Is this specifier a node.js core module?", + "main": "index.js", + "exports": { + ".": [ + { + "default": "./index.js" + }, + "./index.js" + ], + "./package.json": "./package.json" + }, + "scripts": { + "lint": "eslint .", + "pretest": "npm run lint", + "tests-only": "tape test", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/is-core-module.git" + }, + "keywords": [ + "core", + "modules", + "module", + "npm", + "node", + "dependencies" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/is-core-module/issues" + }, + "homepage": "https://github.com/inspect-js/is-core-module", + "dependencies": { + "has": "^1.0.3" + }, + "devDependencies": { + "@ljharb/eslint-config": "^17.2.0", + "aud": "^1.1.2", + "auto-changelog": "^2.2.1", + "eslint": "^7.10.0", + "tape": "^5.0.1" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } + +,"_resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.0.0.tgz" +,"_integrity": "sha512-jq1AH6C8MuteOoBPwkxHafmByhL9j5q4OaPGdbuD+ZtQJVzH+i6E3BJDQcBA09k57i2Hh2yQbEG8yObZ0jdlWw==" +,"_from": "is-core-module@2.0.0" +} \ No newline at end of file diff --git a/node_modules/is-core-module/test/index.js b/node_modules/is-core-module/test/index.js new file mode 100644 index 00000000..99659bcf --- /dev/null +++ b/node_modules/is-core-module/test/index.js @@ -0,0 +1,83 @@ +'use strict'; + +var test = require('tape'); +var keys = require('object-keys'); +var isCore = require('../'); +var data = require('../core.json'); + +test('core modules', function (t) { + t.test('isCore()', function (st) { + st.ok(isCore('fs')); + st.ok(isCore('net')); + st.ok(isCore('http')); + + st.ok(!isCore('seq')); + st.ok(!isCore('../')); + + st.ok(!isCore('toString')); + + st.end(); + }); + + t.test('core list', function (st) { + var cores = keys(data); + st.plan(cores.length); + + for (var i = 0; i < cores.length; ++i) { + var mod = cores[i]; + var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func + if (isCore(mod)) { + st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw'); + } else { + st['throws'](requireFunc, mod + ' not supported; requiring throws'); + } + } + + st.end(); + }); + + t.test('core via repl module', { skip: !data.repl }, function (st) { + var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle + if (!libs) { + st.skip('module.builtinModules does not exist'); + } else { + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + st.ok(data[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + } + } + st.end(); + }); + + t.test('core via builtinModules list', { skip: !data.module }, function (st) { + var libs = require('module').builtinModules; + if (!libs) { + st.skip('module.builtinModules does not exist'); + } else { + var excludeList = [ + '_debug_agent', + 'v8/tools/tickprocessor-driver', + 'v8/tools/SourceMap', + 'v8/tools/tickprocessor', + 'v8/tools/profile' + ]; + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + if (excludeList.indexOf(mod) === -1) { + st.ok(data[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + } + } + } + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/is-obj/index.d.ts b/node_modules/is-obj/index.d.ts new file mode 100644 index 00000000..e8a985a9 --- /dev/null +++ b/node_modules/is-obj/index.d.ts @@ -0,0 +1,22 @@ +/** +Check if a value is an object. + +Keep in mind that array, function, regexp, etc, are objects in JavaScript. + +@example +``` +import isObject = require('is-obj'); + +isObject({foo: 'bar'}); +//=> true + +isObject([1, 2, 3]); +//=> true + +isObject('foo'); +//=> false +``` +*/ +declare function isObject(value: unknown): value is object; + +export = isObject; diff --git a/node_modules/is-obj/index.js b/node_modules/is-obj/index.js index 4d023bc6..c1755902 100644 --- a/node_modules/is-obj/index.js +++ b/node_modules/is-obj/index.js @@ -1,5 +1,6 @@ 'use strict'; -module.exports = function (x) { - var type = typeof x; - return x !== null && (type === 'object' || type === 'function'); + +module.exports = value => { + const type = typeof value; + return value !== null && (type === 'object' || type === 'function'); }; diff --git a/node_modules/is-obj/license b/node_modules/is-obj/license index 654d0bfe..e7af2f77 100644 --- a/node_modules/is-obj/license +++ b/node_modules/is-obj/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/is-obj/package.json b/node_modules/is-obj/package.json index edc8be4c..0db84658 100644 --- a/node_modules/is-obj/package.json +++ b/node_modules/is-obj/package.json @@ -1,37 +1,38 @@ { - "name": "is-obj", - "version": "1.0.1", - "description": "Check if a value is an object", - "license": "MIT", - "repository": "sindresorhus/is-obj", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js" - ], - "keywords": [ - "obj", - "object", - "is", - "check", - "test", - "type" - ], - "devDependencies": { - "ava": "*", - "xo": "*" - } + "name": "is-obj", + "version": "2.0.0", + "description": "Check if a value is an object", + "license": "MIT", + "repository": "sindresorhus/is-obj", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "object", + "is", + "check", + "test", + "type" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } -,"_resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz" -,"_integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=" -,"_from": "is-obj@1.0.1" +,"_resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz" +,"_integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==" +,"_from": "is-obj@2.0.0" } \ No newline at end of file diff --git a/node_modules/is-obj/readme.md b/node_modules/is-obj/readme.md index d3110264..127ee269 100644 --- a/node_modules/is-obj/readme.md +++ b/node_modules/is-obj/readme.md @@ -9,26 +9,31 @@ See [`is-plain-obj`](https://github.com/sindresorhus/is-plain-obj) if you want t ## Install ``` -$ npm install --save is-obj +$ npm install is-obj ``` ## Usage ```js -const isObj = require('is-obj'); +const isObject = require('is-obj'); -isObj({foo: 'bar'}); +isObject({foo: 'bar'}); //=> true -isObj([1, 2, 3]); +isObject([1, 2, 3]); //=> true -isObj('foo'); +isObject('foo'); //=> false ``` +## Related + +- [is](https://github.com/sindresorhus/is) - Type check values + + ## License MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/json-parse-even-better-errors/CHANGELOG.md b/node_modules/json-parse-even-better-errors/CHANGELOG.md new file mode 100644 index 00000000..dfd67330 --- /dev/null +++ b/node_modules/json-parse-even-better-errors/CHANGELOG.md @@ -0,0 +1,50 @@ +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## 2.0.0 + +* Add custom error classes + + +## [1.0.2](https://github.com/npm/json-parse-even-better-errors/compare/v1.0.1...v1.0.2) (2018-03-30) + + +### Bug Fixes + +* **messages:** More friendly messages for non-string ([#1](https://github.com/npm/json-parse-even-better-errors/issues/1)) ([a476d42](https://github.com/npm/json-parse-even-better-errors/commit/a476d42)) + + + + +## [1.0.1](https://github.com/npm/json-parse-even-better-errors/compare/v1.0.0...v1.0.1) (2017-08-16) + + +### Bug Fixes + +* **license:** oops. Forgot to update license.md ([efe2958](https://github.com/npm/json-parse-even-better-errors/commit/efe2958)) + + + + +# 1.0.0 (2017-08-15) + + +### Features + +* **init:** Initial Commit ([562c977](https://github.com/npm/json-parse-even-better-errors/commit/562c977)) + + +### BREAKING CHANGES + +* **init:** This is the first commit! + + + + +# 0.1.0 (2017-08-15) + + +### Features + +* **init:** Initial Commit ([9dd1a19](https://github.com/npm/json-parse-even-better-errors/commit/9dd1a19)) diff --git a/node_modules/json-parse-even-better-errors/LICENSE.md b/node_modules/json-parse-even-better-errors/LICENSE.md new file mode 100644 index 00000000..6991b7cb --- /dev/null +++ b/node_modules/json-parse-even-better-errors/LICENSE.md @@ -0,0 +1,25 @@ +Copyright 2017 Kat Marchán +Copyright npm, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +--- + +This library is a fork of 'better-json-errors' by Kat Marchán, extended and +distributed under the terms of the MIT license above. diff --git a/node_modules/json-parse-even-better-errors/README.md b/node_modules/json-parse-even-better-errors/README.md new file mode 100644 index 00000000..2799efe6 --- /dev/null +++ b/node_modules/json-parse-even-better-errors/README.md @@ -0,0 +1,96 @@ +# json-parse-even-better-errors + +[`json-parse-even-better-errors`](https://github.com/npm/json-parse-even-better-errors) +is a Node.js library for getting nicer errors out of `JSON.parse()`, +including context and position of the parse errors. + +It also preserves the newline and indentation styles of the JSON data, by +putting them in the object or array in the `Symbol.for('indent')` and +`Symbol.for('newline')` properties. + +## Install + +`$ npm install --save json-parse-even-better-errors` + +## Table of Contents + +* [Example](#example) +* [Features](#features) +* [Contributing](#contributing) +* [API](#api) + * [`parse`](#parse) + +### Example + +```javascript +const parseJson = require('json-parse-even-better-errors') + +parseJson('"foo"') // returns the string 'foo' +parseJson('garbage') // more useful error message +parseJson.noExceptions('garbage') // returns undefined +``` + +### Features + +* Like JSON.parse, but the errors are better. +* Strips a leading byte-order-mark that you sometimes get reading files. +* Has a `noExceptions` method that returns undefined rather than throwing. +* Attaches the newline character(s) used to the `Symbol.for('newline')` + property on objects and arrays. +* Attaches the indentation character(s) used to the `Symbol.for('indent')` + property on objects and arrays. + +## Indentation + +To preserve indentation when the file is saved back to disk, use +`data[Symbol.for('indent')]` as the third argument to `JSON.stringify`, and +if you want to preserve windows `\r\n` newlines, replace the `\n` chars in +the string with `data[Symbol.for('newline')]`. + +For example: + +```js +const txt = await readFile('./package.json', 'utf8') +const data = parseJsonEvenBetterErrors(txt) +const indent = Symbol.for('indent') +const newline = Symbol.for('newline') +// .. do some stuff to the data .. +const string = JSON.stringify(data, null, data[indent]) + '\n' +const eolFixed = data[newline] === '\n' ? string + : string.replace(/\n/g, data[newline]) +await writeFile('./package.json', eolFixed) +``` + +Indentation is determined by looking at the whitespace between the initial +`{` and `[` and the character that follows it. If you have lots of weird +inconsistent indentation, then it won't track that or give you any way to +preserve it. Whether this is a bug or a feature is debatable ;) + +### API + +#### `parse(txt, reviver = null, context = 20)` + +Works just like `JSON.parse`, but will include a bit more information when +an error happens, and attaches a `Symbol.for('indent')` and +`Symbol.for('newline')` on objects and arrays. This throws a +`JSONParseError`. + +#### `parse.noExceptions(txt, reviver = null)` + +Works just like `JSON.parse`, but will return `undefined` rather than +throwing an error. + +#### `class JSONParseError(er, text, context = 20, caller = null)` + +Extends the JavaScript `SyntaxError` class to parse the message and provide +better metadata. + +Pass in the error thrown by the built-in `JSON.parse`, and the text being +parsed, and it'll parse out the bits needed to be helpful. + +`context` defaults to 20. + +Set a `caller` function to trim internal implementation details out of the +stack trace. When calling `parseJson`, this is set to the `parseJson` +function. If not set, then the constructor defaults to itself, so the +stack trace will point to the spot where you call `new JSONParseError`. diff --git a/node_modules/json-parse-even-better-errors/index.js b/node_modules/json-parse-even-better-errors/index.js new file mode 100644 index 00000000..86a1fdc1 --- /dev/null +++ b/node_modules/json-parse-even-better-errors/index.js @@ -0,0 +1,121 @@ +'use strict' + +const hexify = char => { + const h = char.charCodeAt(0).toString(16).toUpperCase() + return '0x' + (h.length % 2 ? '0' : '') + h +} + +const parseError = (e, txt, context) => { + if (!txt) { + return { + message: e.message + ' while parsing empty string', + position: 0, + } + } + const badToken = e.message.match(/^Unexpected token (.) .*position\s+(\d+)/i) + const errIdx = badToken ? +badToken[2] + : e.message.match(/^Unexpected end of JSON.*/i) ? txt.length - 1 + : null + + const msg = badToken ? e.message.replace(/^Unexpected token ./, `Unexpected token ${ + JSON.stringify(badToken[1]) + } (${hexify(badToken[1])})`) + : e.message + + if (errIdx !== null && errIdx !== undefined) { + const start = errIdx <= context ? 0 + : errIdx - context + + const end = errIdx + context >= txt.length ? txt.length + : errIdx + context + + const slice = (start === 0 ? '' : '...') + + txt.slice(start, end) + + (end === txt.length ? '' : '...') + + const near = txt === slice ? '' : 'near ' + + return { + message: msg + ` while parsing ${near}${JSON.stringify(slice)}`, + position: errIdx, + } + } else { + return { + message: msg + ` while parsing '${txt.slice(0, context * 2)}'`, + position: 0, + } + } +} + +class JSONParseError extends SyntaxError { + constructor (er, txt, context, caller) { + context = context || 20 + const metadata = parseError(er, txt, context) + super(metadata.message) + Object.assign(this, metadata) + this.code = 'EJSONPARSE' + this.systemError = er + Error.captureStackTrace(this, caller || this.constructor) + } + get name () { return this.constructor.name } + set name (n) {} + get [Symbol.toStringTag] () { return this.constructor.name } +} + +const kIndent = Symbol.for('indent') +const kNewline = Symbol.for('newline') +// only respect indentation if we got a line break, otherwise squash it +// things other than objects and arrays aren't indented, so ignore those +// Important: in both of these regexps, the $1 capture group is the newline +// or undefined, and the $2 capture group is the indent, or undefined. +const formatRE = /^\s*[{\[]((?:\r?\n)+)([\s\t]*)/ +const emptyRE = /^(?:\{\}|\[\])((?:\r?\n)+)?$/ + +const parseJson = (txt, reviver, context) => { + const parseText = stripBOM(txt) + context = context || 20 + try { + // get the indentation so that we can save it back nicely + // if the file starts with {" then we have an indent of '', ie, none + // otherwise, pick the indentation of the next line after the first \n + // If the pattern doesn't match, then it means no indentation. + // JSON.stringify ignores symbols, so this is reasonably safe. + // if the string is '{}' or '[]', then use the default 2-space indent. + const [, newline = '\n', indent = ' '] = parseText.match(emptyRE) || + parseText.match(formatRE) || + [, '', ''] + + const result = JSON.parse(parseText, reviver) + if (result && typeof result === 'object') { + result[kNewline] = newline + result[kIndent] = indent + } + return result + } catch (e) { + if (typeof txt !== 'string' && !Buffer.isBuffer(txt)) { + const isEmptyArray = Array.isArray(txt) && txt.length === 0 + throw Object.assign(new TypeError( + `Cannot parse ${isEmptyArray ? 'an empty array' : String(txt)}` + ), { + code: 'EJSONPARSE', + systemError: e, + }) + } + + throw new JSONParseError(e, parseText, context, parseJson) + } +} + +// Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) +// because the buffer-to-string conversion in `fs.readFileSync()` +// translates it to FEFF, the UTF-16 BOM. +const stripBOM = txt => String(txt).replace(/^\uFEFF/, '') + +module.exports = parseJson +parseJson.JSONParseError = JSONParseError + +parseJson.noExceptions = (txt, reviver) => { + try { + return JSON.parse(stripBOM(txt), reviver) + } catch (e) {} +} diff --git a/node_modules/json-parse-even-better-errors/package.json b/node_modules/json-parse-even-better-errors/package.json new file mode 100644 index 00000000..263edab3 --- /dev/null +++ b/node_modules/json-parse-even-better-errors/package.json @@ -0,0 +1,37 @@ +{ + "name": "json-parse-even-better-errors", + "version": "2.3.1", + "description": "JSON.parse with context information on error", + "main": "index.js", + "files": [ + "*.js" + ], + "scripts": { + "preversion": "npm t", + "postversion": "npm publish", + "prepublishOnly": "git push --follow-tags", + "test": "tap", + "snap": "tap" + }, + "repository": "https://github.com/npm/json-parse-even-better-errors", + "keywords": [ + "JSON", + "parser" + ], + "author": { + "name": "Kat Marchán", + "email": "kzm@zkat.tech", + "twitter": "maybekatz" + }, + "license": "MIT", + "devDependencies": { + "tap": "^14.6.5" + }, + "tap": { + "check-coverage": true + } + +,"_resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz" +,"_integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" +,"_from": "json-parse-even-better-errors@2.3.1" +} \ No newline at end of file diff --git a/node_modules/lodash/README.md b/node_modules/lodash/README.md index a5733490..e1c99503 100644 --- a/node_modules/lodash/README.md +++ b/node_modules/lodash/README.md @@ -1,4 +1,4 @@ -# lodash v4.17.19 +# lodash v4.17.20 The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. @@ -28,7 +28,7 @@ var at = require('lodash/at'); var curryN = require('lodash/fp/curryN'); ``` -See the [package source](https://github.com/lodash/lodash/tree/4.17.19-npm) for more details. +See the [package source](https://github.com/lodash/lodash/tree/4.17.20-npm) for more details. **Note:**
Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL. diff --git a/node_modules/lodash/_baseClone.js b/node_modules/lodash/_baseClone.js index 290de927..69f87054 100644 --- a/node_modules/lodash/_baseClone.js +++ b/node_modules/lodash/_baseClone.js @@ -18,7 +18,8 @@ var Stack = require('./_Stack'), isMap = require('./isMap'), isObject = require('./isObject'), isSet = require('./isSet'), - keys = require('./keys'); + keys = require('./keys'), + keysIn = require('./keysIn'); /** Used to compose bitmasks for cloning. */ var CLONE_DEEP_FLAG = 1, diff --git a/node_modules/lodash/_baseOrderBy.js b/node_modules/lodash/_baseOrderBy.js index d8a46ab2..775a0174 100644 --- a/node_modules/lodash/_baseOrderBy.js +++ b/node_modules/lodash/_baseOrderBy.js @@ -1,10 +1,12 @@ var arrayMap = require('./_arrayMap'), + baseGet = require('./_baseGet'), baseIteratee = require('./_baseIteratee'), baseMap = require('./_baseMap'), baseSortBy = require('./_baseSortBy'), baseUnary = require('./_baseUnary'), compareMultiple = require('./_compareMultiple'), - identity = require('./identity'); + identity = require('./identity'), + isArray = require('./isArray'); /** * The base implementation of `_.orderBy` without param guards. @@ -16,8 +18,21 @@ var arrayMap = require('./_arrayMap'), * @returns {Array} Returns the new sorted array. */ function baseOrderBy(collection, iteratees, orders) { + if (iteratees.length) { + iteratees = arrayMap(iteratees, function(iteratee) { + if (isArray(iteratee)) { + return function(value) { + return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); + } + } + return iteratee; + }); + } else { + iteratees = [identity]; + } + var index = -1; - iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee)); + iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); var result = baseMap(collection, function(value, key, collection) { var criteria = arrayMap(iteratees, function(iteratee) { diff --git a/node_modules/lodash/_baseSet.js b/node_modules/lodash/_baseSet.js index 612a24cc..99f4fbf9 100644 --- a/node_modules/lodash/_baseSet.js +++ b/node_modules/lodash/_baseSet.js @@ -29,6 +29,10 @@ function baseSet(object, path, value, customizer) { var key = toKey(path[index]), newValue = value; + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return object; + } + if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; diff --git a/node_modules/lodash/_baseSortedIndexBy.js b/node_modules/lodash/_baseSortedIndexBy.js index bb22e36d..c247b377 100644 --- a/node_modules/lodash/_baseSortedIndexBy.js +++ b/node_modules/lodash/_baseSortedIndexBy.js @@ -22,11 +22,14 @@ var nativeFloor = Math.floor, * into `array`. */ function baseSortedIndexBy(array, value, iteratee, retHighest) { - value = iteratee(value); - var low = 0, - high = array == null ? 0 : array.length, - valIsNaN = value !== value, + high = array == null ? 0 : array.length; + if (high === 0) { + return 0; + } + + value = iteratee(value); + var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined; diff --git a/node_modules/lodash/_equalArrays.js b/node_modules/lodash/_equalArrays.js index f6a3b7c9..824228c7 100644 --- a/node_modules/lodash/_equalArrays.js +++ b/node_modules/lodash/_equalArrays.js @@ -27,10 +27,11 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } - // Assume cyclic values are equal. - var stacked = stack.get(array); - if (stacked && stack.get(other)) { - return stacked == other; + // Check that cyclic values are equal. + var arrStacked = stack.get(array); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array; } var index = -1, result = true, diff --git a/node_modules/lodash/_equalObjects.js b/node_modules/lodash/_equalObjects.js index 17421f37..cdaacd2d 100644 --- a/node_modules/lodash/_equalObjects.js +++ b/node_modules/lodash/_equalObjects.js @@ -39,10 +39,11 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { return false; } } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked && stack.get(other)) { - return stacked == other; + // Check that cyclic values are equal. + var objStacked = stack.get(object); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object; } var result = true; stack.set(object, other); diff --git a/node_modules/lodash/core.js b/node_modules/lodash/core.js index 31a2bc01..6d70dcaf 100644 --- a/node_modules/lodash/core.js +++ b/node_modules/lodash/core.js @@ -1,7 +1,7 @@ /** * @license * Lodash (Custom Build) - * Build: `lodash core exports="node" -o ./npm-package/core.js` + * Build: `lodash core -o ./dist/lodash.core.js` * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -13,7 +13,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.17.15'; + var VERSION = '4.17.20'; /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; @@ -1183,6 +1183,12 @@ if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } + // Check that cyclic values are equal. + var arrStacked = stack.get(array); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array; + } var index = -1, result = true, seen = (bitmask & COMPARE_UNORDERED_FLAG) ? [] : undefined; @@ -1293,6 +1299,12 @@ return false; } } + // Check that cyclic values are equal. + var objStacked = stack.get(object); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object; + } var result = true; var skipCtor = isPartial; @@ -1935,6 +1947,10 @@ * // The `_.property` iteratee shorthand. * _.filter(users, 'active'); * // => objects for ['barney'] + * + * // Combining several predicates using `_.overEvery` or `_.overSome`. + * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); + * // => objects for ['fred', 'barney'] */ function filter(collection, predicate) { return baseFilter(collection, baseIteratee(predicate)); @@ -2188,15 +2204,15 @@ * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, + * { 'user': 'fred', 'age': 30 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, [function(o) { return o.user; }]); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] * * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] + * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] */ function sortBy(collection, iteratee) { var index = 0; @@ -3503,6 +3519,9 @@ * values against any array or object value, respectively. See `_.isEqual` * for a list of supported value comparisons. * + * **Note:** Multiple values can be checked by combining several matchers + * using `_.overSome` + * * @static * @memberOf _ * @since 3.0.0 @@ -3518,6 +3537,10 @@ * * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); * // => [{ 'a': 4, 'b': 5, 'c': 6 }] + * + * // Checking for several possible values + * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); + * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matches(source) { return baseMatches(assign({}, source)); @@ -3826,10 +3849,29 @@ /*--------------------------------------------------------------------------*/ - if (freeModule) { + // Some AMD build optimizers, like r.js, check for condition patterns like: + if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { + // Expose Lodash on the global object to prevent errors when Lodash is + // loaded by a script tag in the presence of an AMD loader. + // See http://requirejs.org/docs/errors.html#mismatch for more details. + // Use `_.noConflict` to remove Lodash from the global object. + root._ = lodash; + + // Define as an anonymous module so, through path mapping, it can be + // referenced as the "underscore" module. + define(function() { + return lodash; + }); + } + // Check for `exports` after `define` in case a build optimizer adds it. + else if (freeModule) { // Export for Node.js. (freeModule.exports = lodash)._ = lodash; // Export for CommonJS support. freeExports._ = lodash; } + else { + // Export to the global object. + root._ = lodash; + } }.call(this)); diff --git a/node_modules/lodash/core.min.js b/node_modules/lodash/core.min.js index 64f14e48..f4095256 100644 --- a/node_modules/lodash/core.min.js +++ b/node_modules/lodash/core.min.js @@ -1,29 +1,30 @@ /** * @license * Lodash (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE - * Build: `lodash core exports="node" -o ./npm-package/core.js` + * Build: `lodash core -o ./dist/lodash.core.js` */ -;(function(){function n(n){return H(n)&&pn.call(n,"callee")&&!yn.call(n,"callee")}function t(n,t){return n.push.apply(n,t),n}function r(n){return function(t){return null==t?Z:t[n]}}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return j(t,function(t){return n[t]})}function o(n){return n instanceof i?n:new i(n)}function i(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function c(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function"); -return setTimeout(function(){n.apply(Z,r)},t)}function f(n,t){var r=true;return mn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function a(n,t,r){for(var e=-1,u=n.length;++et}function b(n,t,r,e,u){return n===t||(null==n||null==t||!H(n)&&!H(t)?n!==n&&t!==t:y(n,t,r,e,b,u))}function y(n,t,r,e,u,o){var i=Nn(n),c=Nn(t),f=i?"[object Array]":hn.call(n),a=c?"[object Array]":hn.call(t),f="[object Arguments]"==f?"[object Object]":f,a="[object Arguments]"==a?"[object Object]":a,l="[object Object]"==f,c="[object Object]"==a,a=f==a;o||(o=[]);var p=An(o,function(t){return t[0]==n}),s=An(o,function(n){ -return n[0]==t});if(p&&s)return p[1]==t;if(o.push([n,t]),o.push([t,n]),a&&!l){if(i)r=T(n,t,r,e,u,o);else n:{switch(f){case"[object Boolean]":case"[object Date]":case"[object Number]":r=J(+n,+t);break n;case"[object Error]":r=n.name==t.name&&n.message==t.message;break n;case"[object RegExp]":case"[object String]":r=n==t+"";break n}r=false}return o.pop(),r}return 1&r||(i=l&&pn.call(n,"__wrapped__"),f=c&&pn.call(t,"__wrapped__"),!i&&!f)?!!a&&(r=B(n,t,r,e,u,o),o.pop(),r):(i=i?n.value():n,f=f?t.value():t, -r=u(i,f,r,e,o),o.pop(),r)}function g(n){return typeof n=="function"?n:null==n?X:(typeof n=="object"?d:r)(n)}function _(n,t){return nt&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++ei))return false;for(var c=-1,f=true,a=2&r?[]:Z;++cr?jn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++rarguments.length,mn)}function G(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Fn(n), -function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=Z),r}}function J(n,t){return n===t||n!==n&&t!==t}function M(n){var t;return(t=null!=n)&&(t=n.length,t=typeof t=="number"&&-1=t),t&&!U(n)}function U(n){return!!V(n)&&(n=hn.call(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function V(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function H(n){return null!=n&&typeof n=="object"}function K(n){ -return typeof n=="number"||H(n)&&"[object Number]"==hn.call(n)}function L(n){return typeof n=="string"||!Nn(n)&&H(n)&&"[object String]"==hn.call(n)}function Q(n){return typeof n=="string"?n:null==n?"":n+""}function W(n){return null==n?[]:u(n,Dn(n))}function X(n){return n}function Y(n,r,e){var u=Dn(r),o=h(r,u);null!=e||V(r)&&(o.length||!u.length)||(e=r,r=n,n=this,o=h(r,Dn(r)));var i=!(V(e)&&"chain"in e&&!e.chain),c=U(n);return mn(o,function(e){var u=r[e];n[e]=u,c&&(n.prototype[e]=function(){var r=this.__chain__; -if(i||r){var e=n(this.__wrapped__);return(e.__actions__=A(this.__actions__)).push({func:u,args:arguments,thisArg:n}),e.__chain__=r,e}return u.apply(n,t([this.value()],arguments))})}),n}var Z,nn=1/0,tn=/[&<>"']/g,rn=RegExp(tn.source),en=/^(?:0|[1-9]\d*)$/,un=typeof self=="object"&&self&&self.Object===Object&&self,on=typeof global=="object"&&global&&global.Object===Object&&global||un||Function("return this")(),cn=(un=typeof exports=="object"&&exports&&!exports.nodeType&&exports)&&typeof module=="object"&&module&&!module.nodeType&&module,fn=function(n){ -return function(t){return null==n?Z:n[t]}}({"&":"&","<":"<",">":">",'"':""","'":"'"}),an=Array.prototype,ln=Object.prototype,pn=ln.hasOwnProperty,sn=0,hn=ln.toString,vn=on._,bn=Object.create,yn=ln.propertyIsEnumerable,gn=on.isFinite,_n=function(n,t){return function(r){return n(t(r))}}(Object.keys,Object),jn=Math.max,dn=function(){function n(){}return function(t){return V(t)?bn?bn(t):(n.prototype=t,t=new n,n.prototype=Z,t):{}}}();i.prototype=dn(o.prototype),i.prototype.constructor=i; -var mn=function(n,t){return function(r,e){if(null==r)return r;if(!M(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++or&&(r=jn(e+r,0));n:{for(t=g(t),e=n.length,r+=-1;++re||o&&c&&a||!u&&a||!i){r=1;break n}if(!o&&r0&&e(f)?r>1?y(f,r-1,e,u,o):n(o,f):u||(o[o.length]=f)}return o}function g(n,t){return n&&Vt(n,t,cr)}function _(n,t){return v(t,function(t){return Tn(n[t])})}function b(n){return W(n)}function j(n,t){return n>t}function d(n){return In(n)&&b(n)==ht}function m(n,t,r,e,u){return n===t||(null==n||null==t||!In(n)&&!In(t)?n!==n&&t!==t:O(n,t,r,e,m,u))}function O(n,t,r,e,u,o){ +var i=Zt(n),c=Zt(t),f=i?lt:b(n),a=c?lt:b(t);f=f==at?bt:f,a=a==at?bt:a;var l=f==bt,p=a==bt,s=f==a;o||(o=[]);var h=Lt(o,function(t){return t[0]==n}),v=Lt(o,function(n){return n[0]==t});if(h&&v)return h[1]==t;if(o.push([n,t]),o.push([t,n]),s&&!l){var y=i?J(n,t,r,e,u,o):M(n,t,f,r,e,u,o);return o.pop(),y}if(!(r&et)){var g=l&&Rt.call(n,"__wrapped__"),_=p&&Rt.call(t,"__wrapped__");if(g||_){var j=g?n.value():n,d=_?t.value():t,y=u(j,d,r,e,o);return o.pop(),y}}if(!s)return false;var y=U(n,t,r,e,u,o);return o.pop(), +y}function x(n){return In(n)&&b(n)==dt}function w(n){return typeof n=="function"?n:null==n?Hn:(typeof n=="object"?N:r)(n)}function A(n,t){return nu?0:u+t),r=r>u?u:r,r<0&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(u);++et||o&&i&&f&&!c&&!a||e&&i&&f||!r&&f||!u)return 1; +if(!e&&!o&&!a&&n1?r[u-1]:nt;for(o=n.length>3&&typeof o=="function"?(u--,o):nt,t=Object(t);++e-1?u[o?t[i]:i]:nt}}function G(n,t,r,e){function u(){for(var t=-1,c=arguments.length,f=-1,a=e.length,l=Array(a+c),p=this&&this!==kt&&this instanceof u?i:n;++fc))return false;var a=o.get(n),l=o.get(t);if(a&&l)return a==t&&l==n;for(var p=-1,s=true,h=r&ut?[]:nt;++p-1&&n%1==0&&n0&&(r=t.apply(this,arguments)),n<=1&&(t=nt),r}}function mn(n){if(typeof n!="function")throw new TypeError(rt);return function(){return!n.apply(this,arguments)}; +}function On(n){return dn(2,n)}function xn(n){return Bn(n)?Zt(n)?S(n):$(n,Gt(n)):n}function wn(n,t){return n===t||n!==n&&t!==t}function An(n){return null!=n&&Sn(n.length)&&!Tn(n)}function En(n){return n===true||n===false||In(n)&&b(n)==st}function Nn(n){return An(n)&&(Zt(n)||Dn(n)||Tn(n.splice)||Yt(n))?!n.length:!Gt(n).length}function kn(n,t){return m(n,t)}function Fn(n){return typeof n=="number"&&Ct(n)}function Tn(n){if(!Bn(n))return false;var t=b(n);return t==yt||t==gt||t==pt||t==jt}function Sn(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=ft; +}function Bn(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function In(n){return null!=n&&typeof n=="object"}function Rn(n){return qn(n)&&n!=+n}function $n(n){return null===n}function qn(n){return typeof n=="number"||In(n)&&b(n)==_t}function Dn(n){return typeof n=="string"||!Zt(n)&&In(n)&&b(n)==mt}function Pn(n){return n===nt}function zn(n){return An(n)?n.length?S(n):[]:Un(n)}function Cn(n){return typeof n=="string"?n:null==n?"":n+""}function Gn(n,t){var r=Mt(n);return null==t?r:ur(r,t); +}function Jn(n,t){return null!=n&&Rt.call(n,t)}function Mn(n,t,r){var e=null==n?nt:n[t];return e===nt&&(e=r),Tn(e)?e.call(n):e}function Un(n){return null==n?[]:o(n,cr(n))}function Vn(n){return n=Cn(n),n&&xt.test(n)?n.replace(Ot,St):n}function Hn(n){return n}function Kn(n){return N(ur({},n))}function Ln(t,r,e){var u=cr(r),o=_(r,u);null!=e||Bn(r)&&(o.length||!u.length)||(e=r,r=t,t=this,o=_(r,cr(r)));var i=!(Bn(e)&&"chain"in e&&!e.chain),c=Tn(t);return Ut(o,function(e){var u=r[e];t[e]=u,c&&(t.prototype[e]=function(){ +var r=this.__chain__;if(i||r){var e=t(this.__wrapped__);return(e.__actions__=S(this.__actions__)).push({func:u,args:arguments,thisArg:t}),e.__chain__=r,e}return u.apply(t,n([this.value()],arguments))})}),t}function Qn(){return kt._===this&&(kt._=Dt),this}function Wn(){}function Xn(n){var t=++$t;return Cn(n)+t}function Yn(n){return n&&n.length?h(n,Hn,j):nt}function Zn(n){return n&&n.length?h(n,Hn,A):nt}var nt,tt="4.17.20",rt="Expected a function",et=1,ut=2,ot=1,it=32,ct=1/0,ft=9007199254740991,at="[object Arguments]",lt="[object Array]",pt="[object AsyncFunction]",st="[object Boolean]",ht="[object Date]",vt="[object Error]",yt="[object Function]",gt="[object GeneratorFunction]",_t="[object Number]",bt="[object Object]",jt="[object Proxy]",dt="[object RegExp]",mt="[object String]",Ot=/[&<>"']/g,xt=RegExp(Ot.source),wt=/^(?:0|[1-9]\d*)$/,At={ +"&":"&","<":"<",">":">",'"':""","'":"'"},Et=typeof global=="object"&&global&&global.Object===Object&&global,Nt=typeof self=="object"&&self&&self.Object===Object&&self,kt=Et||Nt||Function("return this")(),Ft=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Tt=Ft&&typeof module=="object"&&module&&!module.nodeType&&module,St=e(At),Bt=Array.prototype,It=Object.prototype,Rt=It.hasOwnProperty,$t=0,qt=It.toString,Dt=kt._,Pt=Object.create,zt=It.propertyIsEnumerable,Ct=kt.isFinite,Gt=i(Object.keys,Object),Jt=Math.max,Mt=function(){ +function n(){}return function(t){if(!Bn(t))return{};if(Pt)return Pt(t);n.prototype=t;var r=new n;return n.prototype=nt,r}}();f.prototype=Mt(c.prototype),f.prototype.constructor=f;var Ut=D(g),Vt=P(),Ht=Wn,Kt=Hn,Lt=C(nn),Qt=F(function(n,t,r){return G(n,ot|it,t,r)}),Wt=F(function(n,t){return p(n,1,t)}),Xt=F(function(n,t,r){return p(n,er(t)||0,r)}),Yt=Ht(function(){return arguments}())?Ht:function(n){return In(n)&&Rt.call(n,"callee")&&!zt.call(n,"callee")},Zt=Array.isArray,nr=d,tr=x,rr=Number,er=Number,ur=q(function(n,t){ +$(t,Gt(t),n)}),or=q(function(n,t){$(t,Q(t),n)}),ir=F(function(n,t){n=Object(n);var r=-1,e=t.length,u=e>2?t[2]:nt;for(u&&L(t[0],t[1],u)&&(e=1);++r objects for ['barney'] + * + * // Combining several predicates using `_.overEvery` or `_.overSome`. + * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); + * // => objects for ['fred', 'barney'] */ function filter(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; diff --git a/node_modules/lodash/lodash.js b/node_modules/lodash/lodash.js index ab6dbe20..1fd7116f 100644 --- a/node_modules/lodash/lodash.js +++ b/node_modules/lodash/lodash.js @@ -12,7 +12,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.17.19'; + var VERSION = '4.17.20'; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; @@ -15588,7 +15588,7 @@ * // => [{ 'a': 4, 'b': 5, 'c': 6 }] * * // Checking for several possible values - * _.filter(users, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); + * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matches(source) { @@ -15625,7 +15625,7 @@ * // => { 'a': 4, 'b': 5, 'c': 6 } * * // Checking for several possible values - * _.filter(users, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); + * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matchesProperty(path, srcValue) { diff --git a/node_modules/lodash/lodash.min.js b/node_modules/lodash/lodash.min.js index e2303716..a078dd93 100644 --- a/node_modules/lodash/lodash.min.js +++ b/node_modules/lodash/lodash.min.js @@ -12,7 +12,7 @@ return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;) for(var u=r-1,i=n.length;++u-1;);return r}function W(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}function L(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;return e}function C(n){return"\\"+Gr[n]}function U(n,t){ return null==n?Y:n[t]}function B(n){return Dr.test(n)}function T(n){return Mr.test(n)}function $(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function D(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function M(n,t){return function(r){return n(t(r))}}function F(n,t){for(var r=-1,e=n.length,u=0,i=[];++r>>1,Un=[["ary",dn],["bind",sn],["bindKey",hn],["curry",_n],["curryRight",vn],["flip",wn],["partial",gn],["partialRight",yn],["rearg",bn]],Bn="[object Arguments]",Tn="[object Array]",$n="[object AsyncFunction]",Dn="[object Boolean]",Mn="[object Date]",Fn="[object DOMException]",Nn="[object Error]",Pn="[object Function]",qn="[object GeneratorFunction]",Zn="[object Map]",Kn="[object Number]",Vn="[object Null]",Gn="[object Object]",Hn="[object Promise]",Jn="[object Proxy]",Yn="[object RegExp]",Qn="[object Set]",Xn="[object String]",nt="[object Symbol]",tt="[object Undefined]",rt="[object WeakMap]",et="[object WeakSet]",ut="[object ArrayBuffer]",it="[object DataView]",ot="[object Float32Array]",ft="[object Float64Array]",ct="[object Int8Array]",at="[object Int16Array]",lt="[object Int32Array]",st="[object Uint8Array]",ht="[object Uint8ClampedArray]",pt="[object Uint16Array]",_t="[object Uint32Array]",vt=/\b__p \+= '';/g,gt=/\b(__p \+=) '' \+/g,yt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,dt=/&(?:amp|lt|gt|quot|#39);/g,bt=/[&<>"']/g,wt=RegExp(dt.source),mt=RegExp(bt.source),xt=/<%-([\s\S]+?)%>/g,jt=/<%([\s\S]+?)%>/g,At=/<%=([\s\S]+?)%>/g,kt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ot=/^\w*$/,It=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rt=/[\\^$.*+?()[\]{}|]/g,zt=RegExp(Rt.source),Et=/^\s+|\s+$/g,St=/^\s+/,Wt=/\s+$/,Lt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ct=/\{\n\/\* \[wrapped with (.+)\] \*/,Ut=/,? & /,Bt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Tt=/\\(\\)?/g,$t=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Dt=/\w*$/,Mt=/^[-+]0x[0-9a-f]+$/i,Ft=/^0b[01]+$/i,Nt=/^\[object .+?Constructor\]$/,Pt=/^0o[0-7]+$/i,qt=/^(?:0|[1-9]\d*)$/,Zt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kt=/($^)/,Vt=/['\n\r\u2028\u2029\\]/g,Gt="\\ud800-\\udfff",Ht="\\u0300-\\u036f",Jt="\\ufe20-\\ufe2f",Yt="\\u20d0-\\u20ff",Qt=Ht+Jt+Yt,Xt="\\u2700-\\u27bf",nr="a-z\\xdf-\\xf6\\xf8-\\xff",tr="\\xac\\xb1\\xd7\\xf7",rr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",er="\\u2000-\\u206f",ur=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ir="A-Z\\xc0-\\xd6\\xd8-\\xde",or="\\ufe0e\\ufe0f",fr=tr+rr+er+ur,cr="['\u2019]",ar="["+Gt+"]",lr="["+fr+"]",sr="["+Qt+"]",hr="\\d+",pr="["+Xt+"]",_r="["+nr+"]",vr="[^"+Gt+fr+hr+Xt+nr+ir+"]",gr="\\ud83c[\\udffb-\\udfff]",yr="(?:"+sr+"|"+gr+")",dr="[^"+Gt+"]",br="(?:\\ud83c[\\udde6-\\uddff]){2}",wr="[\\ud800-\\udbff][\\udc00-\\udfff]",mr="["+ir+"]",xr="\\u200d",jr="(?:"+_r+"|"+vr+")",Ar="(?:"+mr+"|"+vr+")",kr="(?:"+cr+"(?:d|ll|m|re|s|t|ve))?",Or="(?:"+cr+"(?:D|LL|M|RE|S|T|VE))?",Ir=yr+"?",Rr="["+or+"]?",zr="(?:"+xr+"(?:"+[dr,br,wr].join("|")+")"+Rr+Ir+")*",Er="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Sr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Wr=Rr+Ir+zr,Lr="(?:"+[pr,br,wr].join("|")+")"+Wr,Cr="(?:"+[dr+sr+"?",sr,br,wr,ar].join("|")+")",Ur=RegExp(cr,"g"),Br=RegExp(sr,"g"),Tr=RegExp(gr+"(?="+gr+")|"+Cr+Wr,"g"),$r=RegExp([mr+"?"+_r+"+"+kr+"(?="+[lr,mr,"$"].join("|")+")",Ar+"+"+Or+"(?="+[lr,mr+jr,"$"].join("|")+")",mr+"?"+jr+"+"+kr,mr+"+"+Or,Sr,Er,hr,Lr].join("|"),"g"),Dr=RegExp("["+xr+Gt+Qt+or+"]"),Mr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Fr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Nr=-1,Pr={}; +var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function q(n,t,r){for(var e=r-1,u=n.length;++e>>1,Un=[["ary",dn],["bind",sn],["bindKey",hn],["curry",_n],["curryRight",vn],["flip",wn],["partial",gn],["partialRight",yn],["rearg",bn]],Bn="[object Arguments]",Tn="[object Array]",$n="[object AsyncFunction]",Dn="[object Boolean]",Mn="[object Date]",Fn="[object DOMException]",Nn="[object Error]",Pn="[object Function]",qn="[object GeneratorFunction]",Zn="[object Map]",Kn="[object Number]",Vn="[object Null]",Gn="[object Object]",Hn="[object Promise]",Jn="[object Proxy]",Yn="[object RegExp]",Qn="[object Set]",Xn="[object String]",nt="[object Symbol]",tt="[object Undefined]",rt="[object WeakMap]",et="[object WeakSet]",ut="[object ArrayBuffer]",it="[object DataView]",ot="[object Float32Array]",ft="[object Float64Array]",ct="[object Int8Array]",at="[object Int16Array]",lt="[object Int32Array]",st="[object Uint8Array]",ht="[object Uint8ClampedArray]",pt="[object Uint16Array]",_t="[object Uint32Array]",vt=/\b__p \+= '';/g,gt=/\b(__p \+=) '' \+/g,yt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,dt=/&(?:amp|lt|gt|quot|#39);/g,bt=/[&<>"']/g,wt=RegExp(dt.source),mt=RegExp(bt.source),xt=/<%-([\s\S]+?)%>/g,jt=/<%([\s\S]+?)%>/g,At=/<%=([\s\S]+?)%>/g,kt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ot=/^\w*$/,It=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rt=/[\\^$.*+?()[\]{}|]/g,zt=RegExp(Rt.source),Et=/^\s+|\s+$/g,St=/^\s+/,Wt=/\s+$/,Lt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ct=/\{\n\/\* \[wrapped with (.+)\] \*/,Ut=/,? & /,Bt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Tt=/\\(\\)?/g,$t=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Dt=/\w*$/,Mt=/^[-+]0x[0-9a-f]+$/i,Ft=/^0b[01]+$/i,Nt=/^\[object .+?Constructor\]$/,Pt=/^0o[0-7]+$/i,qt=/^(?:0|[1-9]\d*)$/,Zt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kt=/($^)/,Vt=/['\n\r\u2028\u2029\\]/g,Gt="\\ud800-\\udfff",Ht="\\u0300-\\u036f",Jt="\\ufe20-\\ufe2f",Yt="\\u20d0-\\u20ff",Qt=Ht+Jt+Yt,Xt="\\u2700-\\u27bf",nr="a-z\\xdf-\\xf6\\xf8-\\xff",tr="\\xac\\xb1\\xd7\\xf7",rr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",er="\\u2000-\\u206f",ur=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ir="A-Z\\xc0-\\xd6\\xd8-\\xde",or="\\ufe0e\\ufe0f",fr=tr+rr+er+ur,cr="['\u2019]",ar="["+Gt+"]",lr="["+fr+"]",sr="["+Qt+"]",hr="\\d+",pr="["+Xt+"]",_r="["+nr+"]",vr="[^"+Gt+fr+hr+Xt+nr+ir+"]",gr="\\ud83c[\\udffb-\\udfff]",yr="(?:"+sr+"|"+gr+")",dr="[^"+Gt+"]",br="(?:\\ud83c[\\udde6-\\uddff]){2}",wr="[\\ud800-\\udbff][\\udc00-\\udfff]",mr="["+ir+"]",xr="\\u200d",jr="(?:"+_r+"|"+vr+")",Ar="(?:"+mr+"|"+vr+")",kr="(?:"+cr+"(?:d|ll|m|re|s|t|ve))?",Or="(?:"+cr+"(?:D|LL|M|RE|S|T|VE))?",Ir=yr+"?",Rr="["+or+"]?",zr="(?:"+xr+"(?:"+[dr,br,wr].join("|")+")"+Rr+Ir+")*",Er="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Sr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Wr=Rr+Ir+zr,Lr="(?:"+[pr,br,wr].join("|")+")"+Wr,Cr="(?:"+[dr+sr+"?",sr,br,wr,ar].join("|")+")",Ur=RegExp(cr,"g"),Br=RegExp(sr,"g"),Tr=RegExp(gr+"(?="+gr+")|"+Cr+Wr,"g"),$r=RegExp([mr+"?"+_r+"+"+kr+"(?="+[lr,mr,"$"].join("|")+")",Ar+"+"+Or+"(?="+[lr,mr+jr,"$"].join("|")+")",mr+"?"+jr+"+"+kr,mr+"+"+Or,Sr,Er,hr,Lr].join("|"),"g"),Dr=RegExp("["+xr+Gt+Qt+or+"]"),Mr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Fr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Nr=-1,Pr={}; Pr[ot]=Pr[ft]=Pr[ct]=Pr[at]=Pr[lt]=Pr[st]=Pr[ht]=Pr[pt]=Pr[_t]=!0,Pr[Bn]=Pr[Tn]=Pr[ut]=Pr[Dn]=Pr[it]=Pr[Mn]=Pr[Nn]=Pr[Pn]=Pr[Zn]=Pr[Kn]=Pr[Gn]=Pr[Yn]=Pr[Qn]=Pr[Xn]=Pr[rt]=!1;var qr={};qr[Bn]=qr[Tn]=qr[ut]=qr[it]=qr[Dn]=qr[Mn]=qr[ot]=qr[ft]=qr[ct]=qr[at]=qr[lt]=qr[Zn]=qr[Kn]=qr[Gn]=qr[Yn]=qr[Qn]=qr[Xn]=qr[nt]=qr[st]=qr[ht]=qr[pt]=qr[_t]=!0,qr[Nn]=qr[Pn]=qr[rt]=!1;var Zr={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a", "\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae", "\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g", diff --git a/node_modules/lodash/matches.js b/node_modules/lodash/matches.js index 11145db3..e10b3519 100644 --- a/node_modules/lodash/matches.js +++ b/node_modules/lodash/matches.js @@ -16,6 +16,9 @@ var CLONE_DEEP_FLAG = 1; * values against any array or object value, respectively. See `_.isEqual` * for a list of supported value comparisons. * + * **Note:** Multiple values can be checked by combining several matchers + * using `_.overSome` + * * @static * @memberOf _ * @since 3.0.0 @@ -31,6 +34,10 @@ var CLONE_DEEP_FLAG = 1; * * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); * // => [{ 'a': 4, 'b': 5, 'c': 6 }] + * + * // Checking for several possible values + * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); + * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matches(source) { return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); diff --git a/node_modules/lodash/matchesProperty.js b/node_modules/lodash/matchesProperty.js index cc062ac9..e6f1a882 100644 --- a/node_modules/lodash/matchesProperty.js +++ b/node_modules/lodash/matchesProperty.js @@ -13,6 +13,9 @@ var CLONE_DEEP_FLAG = 1; * `srcValue` values against any array or object value, respectively. See * `_.isEqual` for a list of supported value comparisons. * + * **Note:** Multiple values can be checked by combining several matchers + * using `_.overSome` + * * @static * @memberOf _ * @since 3.2.0 @@ -29,6 +32,10 @@ var CLONE_DEEP_FLAG = 1; * * _.find(objects, _.matchesProperty('a', 4)); * // => { 'a': 4, 'b': 5, 'c': 6 } + * + * // Checking for several possible values + * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); + * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matchesProperty(path, srcValue) { return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); diff --git a/node_modules/lodash/overEvery.js b/node_modules/lodash/overEvery.js index c115d153..fb19d13e 100644 --- a/node_modules/lodash/overEvery.js +++ b/node_modules/lodash/overEvery.js @@ -5,6 +5,10 @@ var arrayEvery = require('./_arrayEvery'), * Creates a function that checks if **all** of the `predicates` return * truthy when invoked with the arguments it receives. * + * Following shorthands are possible for providing predicates. + * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. + * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. + * * @static * @memberOf _ * @since 4.0.0 diff --git a/node_modules/lodash/overSome.js b/node_modules/lodash/overSome.js index f902907a..414ab66b 100644 --- a/node_modules/lodash/overSome.js +++ b/node_modules/lodash/overSome.js @@ -5,6 +5,10 @@ var arraySome = require('./_arraySome'), * Creates a function that checks if **any** of the `predicates` return * truthy when invoked with the arguments it receives. * + * Following shorthands are possible for providing predicates. + * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. + * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. + * * @static * @memberOf _ * @since 4.0.0 @@ -24,6 +28,9 @@ var arraySome = require('./_arraySome'), * * func(NaN); * // => false + * + * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }]) + * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]]) */ var overSome = createOver(arraySome); diff --git a/node_modules/lodash/package.json b/node_modules/lodash/package.json index 0c9e8e02..49def811 100644 --- a/node_modules/lodash/package.json +++ b/node_modules/lodash/package.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "4.17.19", + "version": "4.17.20", "description": "Lodash modular utilities.", "keywords": "modules, stdlib, util", "homepage": "https://lodash.com/", @@ -15,7 +15,7 @@ ], "scripts": { "test": "echo \"See https://travis-ci.org/lodash-archive/lodash-cli for testing details.\"" } -,"_resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz" -,"_integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" -,"_from": "lodash@4.17.19" +,"_resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz" +,"_integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" +,"_from": "lodash@4.17.20" } \ No newline at end of file diff --git a/node_modules/lodash/sortBy.js b/node_modules/lodash/sortBy.js index 4ba8f7a0..d756aba6 100644 --- a/node_modules/lodash/sortBy.js +++ b/node_modules/lodash/sortBy.js @@ -22,15 +22,15 @@ var baseFlatten = require('./_baseFlatten'), * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, + * { 'user': 'fred', 'age': 30 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, [function(o) { return o.user; }]); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] * * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] + * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] */ var sortBy = baseRest(function(collection, iteratees) { if (collection == null) { diff --git a/node_modules/lodash/template.js b/node_modules/lodash/template.js index f71d1302..1556a099 100644 --- a/node_modules/lodash/template.js +++ b/node_modules/lodash/template.js @@ -169,11 +169,11 @@ function template(string, options, guard) { // Use a sourceURL for easier debugging. // The sourceURL gets injected into the source that's eval-ed, so be careful - // with lookup (in case of e.g. prototype pollution), and strip newlines if any. - // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection. + // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in + // and escape the comment, thus injecting code that gets evaled. var sourceURL = hasOwnProperty.call(options, 'sourceURL') ? ('//# sourceURL=' + - (options.sourceURL + '').replace(/[\r\n]/g, ' ') + + (options.sourceURL + '').replace(/\s/g, ' ') + '\n') : ''; @@ -206,8 +206,6 @@ function template(string, options, guard) { // If `variable` is not specified wrap a with-statement around the generated // code to add the data object to the top of the scope chain. - // Like with sourceURL, we take care to not check the option's prototype, - // as this configuration is a code injection vector. var variable = hasOwnProperty.call(options, 'variable') && options.variable; if (!variable) { source = 'with (obj) {\n' + source + '\n}\n'; diff --git a/node_modules/meow/index.d.ts b/node_modules/meow/index.d.ts index e92d14a6..9602f555 100644 --- a/node_modules/meow/index.d.ts +++ b/node_modules/meow/index.d.ts @@ -25,7 +25,8 @@ declare namespace meow { type BooleanFlag = Flag<'boolean', boolean>; type NumberFlag = Flag<'number', number>; - type AnyFlags = {[key: string]: StringFlag | BooleanFlag | NumberFlag}; + type AnyFlag = StringFlag | BooleanFlag | NumberFlag; + type AnyFlags = {[key: string]: AnyFlag}; interface Options { /** @@ -37,7 +38,7 @@ declare namespace meow { - `alias`: Usually used to define a short flag alias. - `default`: Default value when the flag is not specified. - `isRequired`: Determine if the flag is required. - If it's only known at runtime whether the flag is requried or not you can pass a Function instead of a boolean, which based on the given flags and other non-flag arguments should decide if the flag is required. + If it's only known at runtime whether the flag is required or not you can pass a Function instead of a boolean, which based on the given flags and other non-flag arguments should decide if the flag is required. - `isMultiple`: Indicates a flag can be set multiple times. Values are turned into an array. (Default: false) @example @@ -195,14 +196,26 @@ declare namespace meow { readonly hardRejection?: boolean; } - type TypedFlags = { - [F in keyof Flags]: Flags[F] extends {type: 'number'} + type TypedFlag = + Flag extends {type: 'number'} ? number - : Flags[F] extends {type: 'string'} + : Flag extends {type: 'string'} ? string - : Flags[F] extends {type: 'boolean'} + : Flag extends {type: 'boolean'} ? boolean : unknown; + + type PossiblyOptionalFlag = + Flag extends {isRequired: true} + ? FlagType + : Flag extends {default: any} + ? FlagType + : FlagType | undefined; + + type TypedFlags = { + [F in keyof Flags]: Flags[F] extends {isMultiple: true} + ? PossiblyOptionalFlag>> + : PossiblyOptionalFlag> }; interface Result { diff --git a/node_modules/meow/index.js b/node_modules/meow/index.js index 7df0ff77..721eeb6a 100644 --- a/node_modules/meow/index.js +++ b/node_modules/meow/index.js @@ -1,20 +1,18 @@ 'use strict'; const path = require('path'); const buildParserOptions = require('minimist-options'); -const yargs = require('yargs-parser'); -const camelCase = require('camelcase'); -const camelcaseKeys = require('camelcase-keys'); +const parseArguments = require('yargs-parser'); +const camelCaseKeys = require('camelcase-keys'); const decamelizeKeys = require('decamelize-keys'); const trimNewlines = require('trim-newlines'); const redent = require('redent'); const readPkgUp = require('read-pkg-up'); const hardRejection = require('hard-rejection'); const normalizePackageData = require('normalize-package-data'); -const arrify = require('arrify'); // Prevent caching of this module so module.parent is always accurate delete require.cache[__filename]; -const parentDir = path.dirname(module.parent.filename); +const parentDir = path.dirname(module.parent && module.parent.filename ? module.parent.filename : '.'); const isFlagMissing = (flagName, definedFlags, receivedFlags, input) => { const flag = definedFlags[flagName]; @@ -69,7 +67,7 @@ const buildParserFlags = ({flags, booleanDefault}) => } if (flag.isMultiple) { - flag.type = 'array'; + flag.type = flag.type ? `${flag.type}-array` : 'array'; delete flag.isMultiple; } @@ -78,15 +76,6 @@ const buildParserFlags = ({flags, booleanDefault}) => return parserFlags; }, {}); -/** -Convert to alternative syntax for coercing values to expected type, according to https://github.com/yargs/yargs-parser#requireyargs-parserargs-opts. -*/ -const convertToTypedArrayOption = (arrayOption, flags) => - arrify(arrayOption).map(flagKey => ({ - key: flagKey, - [flags[camelCase(flagKey, '-')].type || 'string']: true - })); - const validateFlags = (flags, options) => { for (const [flagKey, flagValue] of Object.entries(options.flags)) { if (flagKey !== '--' && !flagValue.isMultiple && Array.isArray(flags[flagKey])) { @@ -142,15 +131,8 @@ const meow = (helpText, options) => { }; } - if (parserOptions.array !== undefined) { - // `yargs` supports 'string|number|boolean' arrays, - // but `minimist-options` only support 'string' as element type. - // Open issue to add support to `minimist-options`: https://github.com/vadimdemedes/minimist-options/issues/18. - parserOptions.array = convertToTypedArrayOption(parserOptions.array, options.flags); - } - const {pkg} = options; - const argv = yargs(options.argv, parserOptions); + const argv = parseArguments(options.argv, parserOptions); let help = redent(trimNewlines((options.help || '').replace(/\t+\n*$/, '')), 2); normalizePackageData(pkg); @@ -171,7 +153,7 @@ const meow = (helpText, options) => { const showVersion = () => { console.log(typeof options.version === 'string' ? options.version : pkg.version); - process.exit(); + process.exit(0); }; if (argv._.length === 0 && options.argv.length === 1) { @@ -187,7 +169,7 @@ const meow = (helpText, options) => { const input = argv._; delete argv._; - const flags = camelcaseKeys(argv, {exclude: ['--', /^\w$/]}); + const flags = camelCaseKeys(argv, {exclude: ['--', /^\w$/]}); const unnormalizedFlags = {...flags}; validateFlags(flags, options); @@ -196,10 +178,7 @@ const meow = (helpText, options) => { delete flags[flagValue.alias]; } - // Get a list of missing flags that are required const missingRequiredFlags = getMissingRequiredFlags(options.flags, flags, input); - - // Print error message for missing flags that are required if (missingRequiredFlags.length > 0) { reportMissingRequiredFlags(missingRequiredFlags); process.exit(2); diff --git a/node_modules/meow/package.json b/node_modules/meow/package.json index dccfbb26..f25edc88 100644 --- a/node_modules/meow/package.json +++ b/node_modules/meow/package.json @@ -1,6 +1,6 @@ { "name": "meow", - "version": "7.0.1", + "version": "7.1.1", "description": "CLI app helper", "license": "MIT", "repository": "sindresorhus/meow", @@ -41,12 +41,10 @@ ], "dependencies": { "@types/minimist": "^1.2.0", - "arrify": "^2.0.1", - "camelcase": "^6.0.0", "camelcase-keys": "^6.2.2", "decamelize-keys": "^1.1.0", "hard-rejection": "^2.1.0", - "minimist-options": "^4.0.2", + "minimist-options": "4.1.0", "normalize-package-data": "^2.5.0", "read-pkg-up": "^7.0.1", "redent": "^3.0.0", @@ -76,7 +74,7 @@ ] } -,"_resolved": "https://registry.npmjs.org/meow/-/meow-7.0.1.tgz" -,"_integrity": "sha512-tBKIQqVrAHqwit0vfuFPY3LlzJYkEOFyKa3bPgxzNl6q/RtN8KQ+ALYEASYuFayzSAsjlhXj/JZ10rH85Q6TUw==" -,"_from": "meow@7.0.1" +,"_resolved": "https://registry.npmjs.org/meow/-/meow-7.1.1.tgz" +,"_integrity": "sha512-GWHvA5QOcS412WCo8vwKDlTelGLsCGBVevQB5Kva961rmNfun0PCbv5+xta2kUMFJyR8/oWnn7ddeKdosbAPbA==" +,"_from": "meow@7.1.1" } \ No newline at end of file diff --git a/node_modules/meow/readme.md b/node_modules/meow/readme.md index 4f3fdf21..dd88d4c8 100644 --- a/node_modules/meow/readme.md +++ b/node_modules/meow/readme.md @@ -138,7 +138,7 @@ The key is the flag name and the value is an object with any of: - `alias`: Usually used to define a short flag alias. - `default`: Default value when the flag is not specified. - `isRequired`: Determine if the flag is required. (Default: false) - - If it's only known at runtime whether the flag is requried or not, you can pass a `Function` instead of a `boolean`, which based on the given flags and other non-flag arguments, should decide if the flag is required. Two arguments are passed to the function: + - If it's only known at runtime whether the flag is required or not, you can pass a `Function` instead of a `boolean`, which based on the given flags and other non-flag arguments, should decide if the flag is required. Two arguments are passed to the function: - The first argument is the **flags** object, which contains the flags converted to camel-case excluding aliases. - The second argument is the **input** string array, which contains the non-flag arguments. - The function should return a `boolean`, true if the flag is required, otherwise false. diff --git a/node_modules/minimist-options/node_modules/arrify/index.js b/node_modules/minimist-options/node_modules/arrify/index.js deleted file mode 100644 index 2a2fdeeb..00000000 --- a/node_modules/minimist-options/node_modules/arrify/index.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; -module.exports = function (val) { - if (val === null || val === undefined) { - return []; - } - - return Array.isArray(val) ? val : [val]; -}; diff --git a/node_modules/minimist-options/node_modules/arrify/package.json b/node_modules/minimist-options/node_modules/arrify/package.json deleted file mode 100644 index bfc8621c..00000000 --- a/node_modules/minimist-options/node_modules/arrify/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "arrify", - "version": "1.0.1", - "description": "Convert a value to an array", - "license": "MIT", - "repository": "sindresorhus/arrify", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js" - ], - "keywords": [ - "array", - "arr", - "arrify", - "arrayify", - "convert", - "value" - ], - "devDependencies": { - "ava": "*", - "xo": "*" - } - -,"_resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" -,"_integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" -,"_from": "arrify@1.0.1" -} \ No newline at end of file diff --git a/node_modules/minimist-options/node_modules/arrify/readme.md b/node_modules/minimist-options/node_modules/arrify/readme.md deleted file mode 100644 index 183d0757..00000000 --- a/node_modules/minimist-options/node_modules/arrify/readme.md +++ /dev/null @@ -1,36 +0,0 @@ -# arrify [![Build Status](https://travis-ci.org/sindresorhus/arrify.svg?branch=master)](https://travis-ci.org/sindresorhus/arrify) - -> Convert a value to an array - - -## Install - -``` -$ npm install --save arrify -``` - - -## Usage - -```js -const arrify = require('arrify'); - -arrify('unicorn'); -//=> ['unicorn'] - -arrify(['unicorn']); -//=> ['unicorn'] - -arrify(null); -//=> [] - -arrify(undefined); -//=> [] -``` - -*Supplying `null` or `undefined` results in an empty array.* - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/object-path/.npmignore b/node_modules/object-path/.npmignore deleted file mode 100755 index f35bd027..00000000 --- a/node_modules/object-path/.npmignore +++ /dev/null @@ -1,7 +0,0 @@ -node_modules -.settings -.idea -npm-debug.log -generated -coverage -.DS_Store diff --git a/node_modules/object-path/.travis.yml b/node_modules/object-path/.travis.yml index b4d505b8..ab914a6a 100755 --- a/node_modules/object-path/.travis.yml +++ b/node_modules/object-path/.travis.yml @@ -1,8 +1,7 @@ sudo: false language: node_js node_js: - - "0.12" - - "0.10" - - "4" - - "6" + - "10" + - "12" + - "14" after_script: NODE_ENV=test istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage diff --git a/node_modules/object-path/README.md b/node_modules/object-path/README.md index 0979d334..e72addf1 100644 --- a/node_modules/object-path/README.md +++ b/node_modules/object-path/README.md @@ -11,9 +11,12 @@ Access deep properties using a path [![devDependency Status](https://david-dm.org/mariocasciaro/object-path/dev-status.svg)](https://david-dm.org/mariocasciaro/object-path#info=devDependencies) ![Downloads](http://img.shields.io/npm/dm/object-path.svg) - ## Changelog +### 0.11.5 + +* **SECURITY FIX**. Fix a prototype pollution vulnerability in the `set()` function when using the "inherited props" mode (e.g. when a new `object-path` instance is created with the `includeInheritedProps` option set to `true` or when using the `withInheritedProps` default instance. The vulnerability does not exist in the default instance exposed by object path (e.g `objectPath.set()`). + ### 0.11.0 * Introduce ability to specify options and create new instances of `object-path` diff --git a/node_modules/object-path/index.js b/node_modules/object-path/index.js index bba7e3d7..2a0af823 100644 --- a/node_modules/object-path/index.js +++ b/node_modules/object-path/index.js @@ -83,8 +83,15 @@ }, {}); }; - function hasShallowProperty(obj, prop) { - return (options.includeInheritedProps || (typeof prop === 'number' && Array.isArray(obj)) || hasOwnProperty(obj, prop)) + var hasShallowProperty + if (options.includeInheritedProps) { + hasShallowProperty = function () { + return true + } + } else { + hasShallowProperty = function (obj, prop) { + return (typeof prop === 'number' && Array.isArray(obj)) || hasOwnProperty(obj, prop) + } } function getShallowProperty(obj, prop) { @@ -105,6 +112,10 @@ } var currentPath = path[0]; var currentValue = getShallowProperty(obj, currentPath); + if (options.includeInheritedProps && (currentPath === '__proto__' || + (currentPath === 'constructor' && typeof currentValue === 'function'))) { + throw new Error('For security reasons, object\'s magic properties cannot be set') + } if (path.length === 1) { if (currentValue === void 0 || !doNotReplace) { obj[currentPath] = value; diff --git a/node_modules/object-path/package.json b/node_modules/object-path/package.json index 1186413d..f503aafb 100644 --- a/node_modules/object-path/package.json +++ b/node_modules/object-path/package.json @@ -1,7 +1,7 @@ { "name": "object-path", "description": "Access deep object properties using a path", - "version": "0.11.4", + "version": "0.11.5", "author": { "name": "Mario Casciaro" }, @@ -11,18 +11,21 @@ "url": "git://github.com/mariocasciaro/object-path.git" }, "engines": { - "node": ">=0.10.0" + "node": ">= 10.12.0" }, "devDependencies": { "@mariocasciaro/benchpress": "^0.1.3", - "chai": "^3.5.0", - "coveralls": "^2.11.2", - "istanbul": "^0.4.4", - "mocha": "^2.2.4", - "mocha-lcov-reporter": "^1.2.0" + "chai": "^4.2.0", + "coveralls": "^3.1.0", + "nyc": "^15.1.0", + "mocha": "^8.1.3", + "mocha-lcov-reporter": "^1.3.0" }, "scripts": { - "test": "istanbul cover ./node_modules/mocha/bin/_mocha test.js --report html -- -R spec" + "test": "mocha test.js", + "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls", + "coverage": "nyc npm test", + "benchmark": "node benchmark.js" }, "keywords": [ "deep", @@ -43,7 +46,7 @@ ], "license": "MIT" -,"_resolved": "https://registry.npmjs.org/object-path/-/object-path-0.11.4.tgz" -,"_integrity": "sha1-NwrnUvvzfePqcKhhwju6iRVpGUk=" -,"_from": "object-path@0.11.4" +,"_resolved": "https://registry.npmjs.org/object-path/-/object-path-0.11.5.tgz" +,"_integrity": "sha512-jgSbThcoR/s+XumvGMTMf81QVBmah+/Q7K7YduKeKVWL7N111unR2d6pZZarSk6kY/caeNxUDyxOvMWyzoU2eg==" +,"_from": "object-path@0.11.5" } \ No newline at end of file diff --git a/node_modules/object-path/test.js b/node_modules/object-path/test.js index 44815a5c..c1503ccc 100644 --- a/node_modules/object-path/test.js +++ b/node_modules/object-path/test.js @@ -1,331 +1,368 @@ -'use strict'; +'use strict' var expect = require('chai').expect, - objectPath = require('./index.js'); + objectPath = require('./index.js') -function getTestObj() { +function getTestObj () { return { a: 'b', b: { c: [], d: ['a', 'b'], - e: [{},{f: 'g'}], + e: [{}, {f: 'g'}], f: 'i' } - }; + } } -describe('get', function() { - it('should return the value using unicode key', function() { +describe('get', function () { + it('should return the value using unicode key', function () { var obj = { '15\u00f8C': { '3\u0111': 1 } - }; - expect(objectPath.get(obj, '15\u00f8C.3\u0111')).to.be.equal(1); - expect(objectPath.get(obj, ['15\u00f8C','3\u0111'])).to.be.equal(1); - }); + } + expect(objectPath.get(obj, '15\u00f8C.3\u0111')).to.be.equal(1) + expect(objectPath.get(obj, ['15\u00f8C', '3\u0111'])).to.be.equal(1) + }) - it('should return the value using dot in key', function() { + it('should return the value using dot in key', function () { var obj = { 'a.b': { 'looks.like': 1 } - }; - expect(objectPath.get(obj, 'a.b.looks.like')).to.be.equal(void 0); - expect(objectPath.get(obj, ['a.b','looks.like'])).to.be.equal(1); - }); - - it('should return the value under shallow object', function() { - var obj = getTestObj(); - expect(objectPath.get(obj, 'a')).to.be.equal('b'); - expect(objectPath.get(obj, ['a'])).to.be.equal('b'); - }); - - it('should work with number path', function() { - var obj = getTestObj(); - expect(objectPath.get(obj.b.d, 0)).to.be.equal('a'); - expect(objectPath.get(obj.b, 0)).to.be.equal(void 0); - }); - - it('should return the value under deep object', function() { - var obj = getTestObj(); - expect(objectPath.get(obj, 'b.f')).to.be.equal('i'); - expect(objectPath.get(obj, ['b','f'])).to.be.equal('i'); - }); - - it('should return the value under array', function() { - var obj = getTestObj(); - expect(objectPath.get(obj, 'b.d.0')).to.be.equal('a'); - expect(objectPath.get(obj, ['b','d',0])).to.be.equal('a'); - }); - - it('should return the value under array deep', function() { - var obj = getTestObj(); - expect(objectPath.get(obj, 'b.e.1.f')).to.be.equal('g'); - expect(objectPath.get(obj, ['b','e',1,'f'])).to.be.equal('g'); - }); - - it('should return undefined for missing values under object', function() { - var obj = getTestObj(); - expect(objectPath.get(obj, 'a.b')).to.not.exist; - expect(objectPath.get(obj, ['a','b'])).to.not.exist; - }); - - it('should return undefined for missing values under array', function() { - var obj = getTestObj(); - expect(objectPath.get(obj, 'b.d.5')).to.not.exist; - expect(objectPath.get(obj, ['b','d','5'])).to.not.exist; - }); - - it('should return the value under integer-like key', function() { - var obj = { '1a': 'foo' }; - expect(objectPath.get(obj, '1a')).to.be.equal('foo'); - expect(objectPath.get(obj, ['1a'])).to.be.equal('foo'); - }); - - it('should return the default value when the key doesnt exist', function() { - var obj = { '1a': 'foo' }; - expect(objectPath.get(obj, '1b', null)).to.be.equal(null); - expect(objectPath.get(obj, ['1b'], null)).to.be.equal(null); - }); - - it('should return the default value when path is empty', function() { - var obj = { '1a': 'foo' }; - expect(objectPath.get(obj, '', null)).to.be.deep.equal({ '1a': 'foo' }); - expect(objectPath.get(obj, [])).to.be.deep.equal({ '1a': 'foo' }); - expect(objectPath.get({ }, ['1'])).to.be.equal(undefined); - }); - - it('should return the default value when object is null or undefined', function() { - expect(objectPath.get(null, 'test', 'a')).to.be.deep.equal('a'); - expect(objectPath.get(undefined, 'test', 'a')).to.be.deep.equal('a'); - }); + } + expect(objectPath.get(obj, 'a.b.looks.like')).to.be.equal(void 0) + expect(objectPath.get(obj, ['a.b', 'looks.like'])).to.be.equal(1) + }) + + it('should return the value under shallow object', function () { + var obj = getTestObj() + expect(objectPath.get(obj, 'a')).to.be.equal('b') + expect(objectPath.get(obj, ['a'])).to.be.equal('b') + }) + + it('should work with number path', function () { + var obj = getTestObj() + expect(objectPath.get(obj.b.d, 0)).to.be.equal('a') + expect(objectPath.get(obj.b, 0)).to.be.equal(void 0) + }) + + it('should return the value under deep object', function () { + var obj = getTestObj() + expect(objectPath.get(obj, 'b.f')).to.be.equal('i') + expect(objectPath.get(obj, ['b', 'f'])).to.be.equal('i') + }) + + it('should return the value under array', function () { + var obj = getTestObj() + expect(objectPath.get(obj, 'b.d.0')).to.be.equal('a') + expect(objectPath.get(obj, ['b', 'd', 0])).to.be.equal('a') + }) + + it('should return the value under array deep', function () { + var obj = getTestObj() + expect(objectPath.get(obj, 'b.e.1.f')).to.be.equal('g') + expect(objectPath.get(obj, ['b', 'e', 1, 'f'])).to.be.equal('g') + }) + + it('should return undefined for missing values under object', function () { + var obj = getTestObj() + expect(objectPath.get(obj, 'a.b')).to.not.exist + expect(objectPath.get(obj, ['a', 'b'])).to.not.exist + }) + + it('should return undefined for missing values under array', function () { + var obj = getTestObj() + expect(objectPath.get(obj, 'b.d.5')).to.not.exist + expect(objectPath.get(obj, ['b', 'd', '5'])).to.not.exist + }) + + it('should return the value under integer-like key', function () { + var obj = {'1a': 'foo'} + expect(objectPath.get(obj, '1a')).to.be.equal('foo') + expect(objectPath.get(obj, ['1a'])).to.be.equal('foo') + }) + + it('should return the default value when the key doesnt exist', function () { + var obj = {'1a': 'foo'} + expect(objectPath.get(obj, '1b', null)).to.be.equal(null) + expect(objectPath.get(obj, ['1b'], null)).to.be.equal(null) + }) + + it('should return the default value when path is empty', function () { + var obj = {'1a': 'foo'} + expect(objectPath.get(obj, '', null)).to.be.deep.equal({'1a': 'foo'}) + expect(objectPath.get(obj, [])).to.be.deep.equal({'1a': 'foo'}) + expect(objectPath.get({}, ['1'])).to.be.equal(undefined) + }) + + it('should return the default value when object is null or undefined', function () { + expect(objectPath.get(null, 'test', 'a')).to.be.deep.equal('a') + expect(objectPath.get(undefined, 'test', 'a')).to.be.deep.equal('a') + }) it( 'should not fail on an object with a null prototype', - function assertSuccessForObjWithNullProto(){ - var foo = 'FOO'; - var objWithNullProto = Object.create(null); - objWithNullProto.foo = foo; - expect(objectPath.get(objWithNullProto, 'foo')).to.equal(foo); + function assertSuccessForObjWithNullProto () { + var foo = 'FOO' + var objWithNullProto = Object.create(null) + objWithNullProto.foo = foo + expect(objectPath.get(objWithNullProto, 'foo')).to.equal(foo) } - ); + ) - it('should skip non own properties', function() { - var Base = function(enabled){ }; + it('should skip non own properties', function () { + var Base = function (enabled) { + } Base.prototype = { one: { two: true } - }; - var Extended = function(){ - Base.call(this, true); - }; - Extended.prototype = Object.create(Base.prototype); + } + var Extended = function () { + Base.call(this, true) + } + Extended.prototype = Object.create(Base.prototype) - var extended = new Extended(); + var extended = new Extended() - expect(objectPath.get(extended, ['one','two'])).to.be.equal(undefined); - extended.enabled = true; + expect(objectPath.get(extended, ['one', 'two'])).to.be.equal(undefined) + extended.enabled = true - expect(objectPath.get(extended, 'enabled')).to.be.equal(true); - expect(objectPath.get(extended, 'one')).to.be.equal(undefined); - }); -}); + expect(objectPath.get(extended, 'enabled')).to.be.equal(true) + expect(objectPath.get(extended, 'one')).to.be.equal(undefined) + }) +}) -describe('set', function() { - it('should set the value using unicode key', function() { +describe('set', function () { + it('should set the value using unicode key', function () { var obj = { '15\u00f8C': { '3\u0111': 1 } - }; - objectPath.set(obj, '15\u00f8C.3\u0111', 2); - expect(objectPath.get(obj, '15\u00f8C.3\u0111')).to.be.equal(2); - objectPath.set(obj, '15\u00f8C.3\u0111', 3); - expect(objectPath.get(obj, ['15\u00f8C','3\u0111'])).to.be.equal(3); - }); - - it('should set the value using dot in key', function() { + } + objectPath.set(obj, '15\u00f8C.3\u0111', 2) + expect(objectPath.get(obj, '15\u00f8C.3\u0111')).to.be.equal(2) + objectPath.set(obj, '15\u00f8C.3\u0111', 3) + expect(objectPath.get(obj, ['15\u00f8C', '3\u0111'])).to.be.equal(3) + }) + + it('should set the value using dot in key', function () { var obj = { 'a.b': { 'looks.like': 1 } - }; - objectPath.set(obj, ['a.b','looks.like'], 2); - expect(objectPath.get(obj, ['a.b','looks.like'])).to.be.equal(2); - }); - - it('should set value under shallow object', function() { - var obj = getTestObj(); - objectPath.set(obj, 'c', {m: 'o'}); - expect(obj).to.have.deep.property('c.m', 'o'); - obj = getTestObj(); - objectPath.set(obj, ['c'], {m: 'o'}); - expect(obj).to.have.deep.property('c.m', 'o'); - }); - - it('should set value using number path', function() { - var obj = getTestObj(); - objectPath.set(obj.b.d, 0, 'o'); - expect(obj).to.have.deep.property('b.d.0', 'o'); - }); - - it('should set value under deep object', function() { - var obj = getTestObj(); - objectPath.set(obj, 'b.c', 'o'); - expect(obj).to.have.deep.property('b.c', 'o'); - obj = getTestObj(); - objectPath.set(obj, ['b','c'], 'o'); - expect(obj).to.have.deep.property('b.c', 'o'); - }); - - it('should set value under array', function() { - var obj = getTestObj(); - objectPath.set(obj, 'b.e.1.g', 'f'); - expect(obj).to.have.deep.property('b.e.1.g', 'f'); - obj = getTestObj(); - objectPath.set(obj, ['b','e',1,'g'], 'f'); - expect(obj).to.have.deep.property('b.e.1.g', 'f'); + } + objectPath.set(obj, ['a.b', 'looks.like'], 2) + expect(objectPath.get(obj, ['a.b', 'looks.like'])).to.be.equal(2) + }) + + it('should set value under shallow object', function () { + var obj = getTestObj() + objectPath.set(obj, 'c', {m: 'o'}) + expect(obj).to.include.nested.property('c.m', 'o') + obj = getTestObj() + objectPath.set(obj, ['c'], {m: 'o'}) + expect(obj).to.include.nested.property('c.m', 'o') + }) + + it('should set value using number path', function () { + var obj = getTestObj() + objectPath.set(obj.b.d, 0, 'o') + expect(obj).to.have.nested.property('b.d.0', 'o') + }) + + it('should set value under deep object', function () { + var obj = getTestObj() + objectPath.set(obj, 'b.c', 'o') + expect(obj).to.have.nested.property('b.c', 'o') + obj = getTestObj() + objectPath.set(obj, ['b', 'c'], 'o') + expect(obj).to.have.nested.property('b.c', 'o') + }) + + it('should set value under array', function () { + var obj = getTestObj() + objectPath.set(obj, 'b.e.1.g', 'f') + expect(obj).to.have.nested.property('b.e.1.g', 'f') + obj = getTestObj() + objectPath.set(obj, ['b', 'e', 1, 'g'], 'f') + expect(obj).to.have.nested.property('b.e.1.g', 'f') obj = {} - objectPath.set(obj, 'b.0', 'a'); - objectPath.set(obj, 'b.1', 'b'); - expect(obj.b).to.be.deep.equal(['a', 'b']); - }); - - it('should create intermediate objects', function() { - var obj = getTestObj(); - objectPath.set(obj, 'c.d.e.f', 'l'); - expect(obj).to.have.deep.property('c.d.e.f', 'l'); - obj = getTestObj(); - objectPath.set(obj, ['c','d','e','f'], 'l'); - expect(obj).to.have.deep.property('c.d.e.f', 'l'); - }); - - it('should create intermediate arrays', function() { - var obj = getTestObj(); - objectPath.set(obj, 'c.0.1.m', 'l'); - expect(obj.c).to.be.an('array'); - expect(obj.c[0]).to.be.an('array'); - expect(obj).to.have.deep.property('c.0.1.m', 'l'); - obj = getTestObj(); - objectPath.set(obj, ['c','0', 1,'m'], 'l'); - expect(obj.c).to.be.an('object'); - expect(obj.c[0]).to.be.an('array'); - expect(obj).to.have.deep.property('c.0.1.m', 'l'); - }); - - it('should set value under integer-like key', function() { - var obj = getTestObj(); - objectPath.set(obj, '1a', 'foo'); - expect(obj).to.have.deep.property('1a', 'foo'); - obj = getTestObj(); - objectPath.set(obj, ['1a'], 'foo'); - expect(obj).to.have.deep.property('1a', 'foo'); - }); - - it('should set value under empty array', function() { - var obj = []; - objectPath.set(obj, [0], 'foo'); - expect(obj[0]).to.be.equal('foo'); - obj = []; - objectPath.set(obj, '0', 'foo'); - expect(obj[0]).to.be.equal('foo'); - }); -}); - - -describe('push', function() { - it('should push value to existing array using unicode key', function() { - var obj = getTestObj(); - objectPath.push(obj, 'b.\u1290c', 'l'); - expect(obj).to.have.deep.property('b.\u1290c.0', 'l'); - objectPath.push(obj, ['b','\u1290c'], 'l'); - expect(obj).to.have.deep.property('b.\u1290c.1', 'l'); - }); - - it('should push value to existing array using dot key', function() { - var obj = getTestObj(); - objectPath.push(obj, ['b','z.d'], 'l'); - expect(objectPath.get(obj, ['b','z.d', 0])).to.be.equal('l'); - }); - - it('should push value to existing array', function() { - var obj = getTestObj(); - objectPath.push(obj, 'b.c', 'l'); - expect(obj).to.have.deep.property('b.c.0', 'l'); - obj = getTestObj(); - objectPath.push(obj, ['b','c'], 'l'); - expect(obj).to.have.deep.property('b.c.0', 'l'); - }); - - it('should push value to new array', function() { - var obj = getTestObj(); - objectPath.push(obj, 'b.h', 'l'); - expect(obj).to.have.deep.property('b.h.0', 'l'); - obj = getTestObj(); - objectPath.push(obj, ['b','h'], 'l'); - expect(obj).to.have.deep.property('b.h.0', 'l'); - }); - - it('should push value to existing array using number path', function() { - var obj = getTestObj(); - objectPath.push(obj.b.e, 0, 'l'); - expect(obj).to.have.deep.property('b.e.0.0', 'l'); - }); - -}); - - -describe('ensureExists', function() { - it('should create the path if it does not exists', function() { - var obj = getTestObj(); - var oldVal = objectPath.ensureExists(obj, 'b.g.1.l', 'test'); - expect(oldVal).to.not.exist; - expect(obj).to.have.deep.property('b.g.1.l', 'test'); - oldVal = objectPath.ensureExists(obj, 'b.g.1.l', 'test1'); - expect(oldVal).to.be.equal('test'); - expect(obj).to.have.deep.property('b.g.1.l', 'test'); - oldVal = objectPath.ensureExists(obj, 'b.\u8210', 'ok'); - expect(oldVal).to.not.exist; - expect(obj).to.have.deep.property('b.\u8210', 'ok'); - oldVal = objectPath.ensureExists(obj, ['b','dot.dot'], 'ok'); - expect(oldVal).to.not.exist; - expect(objectPath.get(obj, ['b','dot.dot'])).to.be.equal('ok'); - }); - - - it('should return the object if path is empty', function() { - var obj = getTestObj(); - expect(objectPath.ensureExists(obj, [], 'test')).to.have.property('a', 'b'); - }); - - it('Issue #26', function() { - var any = {}; - objectPath.ensureExists(any, ['1','1'], {}); - expect(any).to.be.an('object'); - expect(any[1]).to.be.an('object'); - expect(any[1][1]).to.be.an('object'); - }); -}); - -describe('coalesce', function(){ - it('should return the first non-undefined value', function(){ + objectPath.set(obj, 'b.0', 'a') + objectPath.set(obj, 'b.1', 'b') + expect(obj.b).to.be.deep.equal(['a', 'b']) + }) + + it('should create intermediate objects', function () { + var obj = getTestObj() + objectPath.set(obj, 'c.d.e.f', 'l') + expect(obj).to.have.nested.property('c.d.e.f', 'l') + obj = getTestObj() + objectPath.set(obj, ['c', 'd', 'e', 'f'], 'l') + expect(obj).to.have.nested.property('c.d.e.f', 'l') + }) + + it('should create intermediate arrays', function () { + var obj = getTestObj() + objectPath.set(obj, 'c.0.1.m', 'l') + expect(obj.c).to.be.an('array') + expect(obj.c[0]).to.be.an('array') + expect(obj).to.have.nested.property('c.0.1.m', 'l') + obj = getTestObj() + objectPath.set(obj, ['c', '0', 1, 'm'], 'l') + expect(obj.c).to.be.an('object') + expect(obj.c[0]).to.be.an('array') + expect(obj).to.have.nested.property('c.0.1.m', 'l') + }) + + it('should set value under integer-like key', function () { + var obj = getTestObj() + objectPath.set(obj, '1a', 'foo') + expect(obj).to.have.nested.property('1a', 'foo') + obj = getTestObj() + objectPath.set(obj, ['1a'], 'foo') + expect(obj).to.have.nested.property('1a', 'foo') + }) + + it('should set value under empty array', function () { + var obj = [] + objectPath.set(obj, [0], 'foo') + expect(obj[0]).to.be.equal('foo') + obj = [] + objectPath.set(obj, '0', 'foo') + expect(obj[0]).to.be.equal('foo') + }) + + it('[security] should not set magic properties in default mode', function () { + objectPath.set({}, '__proto__.injected', 'this is bad') + expect(Object.prototype.injected).to.be.undefined + + function Clazz() {} + Clazz.prototype.test = 'original' + + objectPath.set(new Clazz(), '__proto__.test', 'this is bad') + expect(Clazz.prototype.test).to.be.equal('original') + + objectPath.set(new Clazz(), 'constructor.prototype.test', 'this is bad') + expect(Clazz.prototype.test).to.be.equal('original') + }) + + it('[security] should throw an exception if trying to set magic properties in inheritedProps mode', function () { + expect(function() {objectPath.withInheritedProps.set({}, '__proto__.injected', 'this is bad')}) + .to.throw('For security reasons') + expect(Object.prototype.injected).to.be.undefined + + function Clazz() {} + Clazz.prototype.test = 'original' + + expect(function() {objectPath.withInheritedProps.set(new Clazz(), '__proto__.test', 'this is bad')}) + .to.throw('For security reasons') + expect(Clazz.prototype.test).to.be.equal('original') + + expect(function() {objectPath.withInheritedProps.set(new Clazz(), 'constructor.prototype.test', 'this is bad')}) + .to.throw('For security reasons') + expect(Clazz.prototype.test).to.be.equal('original') + + const obj = {} + expect(function() {objectPath.withInheritedProps.set(obj, 'constructor.prototype.injected', 'this is OK')}) + .to.throw('For security reasons') + expect(Object.prototype.injected).to.be.undefined + }) +}) + + +describe('push', function () { + it('should push value to existing array using unicode key', function () { + var obj = getTestObj() + objectPath.push(obj, 'b.\u1290c', 'l') + expect(obj).to.have.nested.property('b.\u1290c.0', 'l') + objectPath.push(obj, ['b', '\u1290c'], 'l') + expect(obj).to.have.nested.property('b.\u1290c.1', 'l') + }) + + it('should push value to existing array using dot key', function () { + var obj = getTestObj() + objectPath.push(obj, ['b', 'z.d'], 'l') + expect(objectPath.get(obj, ['b', 'z.d', 0])).to.be.equal('l') + }) + + it('should push value to existing array', function () { + var obj = getTestObj() + objectPath.push(obj, 'b.c', 'l') + expect(obj).to.have.nested.property('b.c.0', 'l') + obj = getTestObj() + objectPath.push(obj, ['b', 'c'], 'l') + expect(obj).to.have.nested.property('b.c.0', 'l') + }) + + it('should push value to new array', function () { + var obj = getTestObj() + objectPath.push(obj, 'b.h', 'l') + expect(obj).to.have.nested.property('b.h.0', 'l') + obj = getTestObj() + objectPath.push(obj, ['b', 'h'], 'l') + expect(obj).to.have.nested.property('b.h.0', 'l') + }) + + it('should push value to existing array using number path', function () { + var obj = getTestObj() + objectPath.push(obj.b.e, 0, 'l') + expect(obj).to.have.nested.property('b.e.0.0', 'l') + }) + +}) + + +describe('ensureExists', function () { + it('should create the path if it does not exists', function () { + var obj = getTestObj() + var oldVal = objectPath.ensureExists(obj, 'b.g.1.l', 'test') + expect(oldVal).to.not.exist + expect(obj).to.have.nested.property('b.g.1.l', 'test') + oldVal = objectPath.ensureExists(obj, 'b.g.1.l', 'test1') + expect(oldVal).to.be.equal('test') + expect(obj).to.have.nested.property('b.g.1.l', 'test') + oldVal = objectPath.ensureExists(obj, 'b.\u8210', 'ok') + expect(oldVal).to.not.exist + expect(obj).to.have.nested.property('b.\u8210', 'ok') + oldVal = objectPath.ensureExists(obj, ['b', 'dot.dot'], 'ok') + expect(oldVal).to.not.exist + expect(objectPath.get(obj, ['b', 'dot.dot'])).to.be.equal('ok') + }) + + + it('should return the object if path is empty', function () { + var obj = getTestObj() + expect(objectPath.ensureExists(obj, [], 'test')).to.have.property('a', 'b') + }) + + it('Issue #26', function () { + var any = {} + objectPath.ensureExists(any, ['1', '1'], {}) + expect(any).to.be.an('object') + expect(any[1]).to.be.an('object') + expect(any[1][1]).to.be.an('object') + }) +}) + +describe('coalesce', function () { + it('should return the first non-undefined value', function () { var obj = { should: {have: 'prop'} - }; + } expect(objectPath.coalesce(obj, [ 'doesnt.exist', - ['might','not','exist'], + ['might', 'not', 'exist'], 'should.have' - ])).to.equal('prop'); - }); + ])).to.equal('prop') + }) - it('should work with falsy values (null, 0, \'\', false)', function(){ + it('should work with falsy values (null, 0, \'\', false)', function () { var obj = { is: { false: false, @@ -333,81 +370,82 @@ describe('coalesce', function(){ empty: '', zero: 0 } - }; + } expect(objectPath.coalesce(obj, [ 'doesnt.exist', 'is.zero' - ])).to.equal(0); + ])).to.equal(0) expect(objectPath.coalesce(obj, [ 'doesnt.exist', 'is.false' - ])).to.equal(false); + ])).to.equal(false) expect(objectPath.coalesce(obj, [ 'doesnt.exist', 'is.null' - ])).to.equal(null); + ])).to.equal(null) expect(objectPath.coalesce(obj, [ 'doesnt.exist', 'is.empty' - ])).to.equal(''); - }); + ])).to.equal('') + }) - it('returns defaultValue if no paths found', function(){ + it('returns defaultValue if no paths found', function () { var obj = { doesnt: 'matter' - }; + } - expect(objectPath.coalesce(obj, ['some.inexistant','path',['on','object']], 'false')).to.equal('false'); - }); + expect(objectPath.coalesce(obj, ['some.inexistant', 'path', ['on', 'object']], 'false')).to.equal('false') + }) - it('works with unicode and dot keys', function(){ + it('works with unicode and dot keys', function () { var obj = { '\u7591': true, 'dot.dot': false - }; + } - expect(objectPath.coalesce(obj, ['1', '\u7591', 'a.b'])).to.equal(true); - expect(objectPath.coalesce(obj, ['1', ['dot.dot'], '\u7591'])).to.equal(false); - }); -}); + expect(objectPath.coalesce(obj, ['1', '\u7591', 'a.b'])).to.equal(true) + expect(objectPath.coalesce(obj, ['1', ['dot.dot'], '\u7591'])).to.equal(false) + }) +}) -describe('empty', function(){ - it('should ignore invalid arguments safely', function(){ - var obj = {}; - expect(objectPath.empty()).to.equal(void 0); - expect(objectPath.empty(obj, 'path')).to.equal(void 0); - expect(objectPath.empty(obj, '')).to.equal(void 0); +describe('empty', function () { + it('should ignore invalid arguments safely', function () { + var obj = {} + expect(objectPath.empty()).to.equal(void 0) + expect(objectPath.empty(obj, 'path')).to.equal(void 0) + expect(objectPath.empty(obj, '')).to.equal(void 0) - obj.path = true; + obj.path = true - expect(objectPath.empty(obj, 'inexistant')).to.equal(void 0); + expect(objectPath.empty(obj, 'inexistant')).to.equal(void 0) - expect(objectPath.empty(null, 'path')).to.equal(void 0); - expect(objectPath.empty(void 0, 'path')).to.equal(void 0); - }); + expect(objectPath.empty(null, 'path')).to.equal(void 0) + expect(objectPath.empty(void 0, 'path')).to.equal(void 0) + }) - it('should empty each path according to their types', function(){ - function Instance(){ - this.notOwn = true; + it('should empty each path according to their types', function () { + function Instance () { + this.notOwn = true } /*istanbul ignore next: not part of code */ - Instance.prototype.test = function(){}; + Instance.prototype.test = function () { + } /*istanbul ignore next: not part of code */ - Instance.prototype.arr = []; + Instance.prototype.arr = [] var obj = { string: 'some string', - array: ['some','array',[1,2,3]], + array: ['some', 'array', [1, 2, 3]], number: 21, boolean: true, object: { - some:'property', + some: 'property', sub: { 'property': true }, @@ -415,533 +453,537 @@ describe('empty', function(){ undefinedProp: void 0 }, instance: new Instance() - }; + } /*istanbul ignore next: not part of code */ - obj['function'] = function(){}; + obj['function'] = function () { + } - objectPath.empty(obj, ['array','2']); - expect(obj.array[2]).to.deep.equal([]); + objectPath.empty(obj, ['array', '2']) + expect(obj.array[2]).to.deep.equal([]) - objectPath.empty(obj, 'object.sub'); - expect(obj.object.sub).to.deep.equal({}); + objectPath.empty(obj, 'object.sub') + expect(obj.object.sub).to.deep.equal({}) - objectPath.empty(obj, 'object.nullProp'); - expect(obj.object.nullProp).to.equal(null); + objectPath.empty(obj, 'object.nullProp') + expect(obj.object.nullProp).to.equal(null) - objectPath.empty(obj, 'object.undefinedProp'); - expect(obj.object.undefinedProp).to.equal(void 0); - expect(obj.object).to.have.property('undefinedProp'); + objectPath.empty(obj, 'object.undefinedProp') + expect(obj.object.undefinedProp).to.equal(void 0) + expect(obj.object).to.have.property('undefinedProp') - objectPath.empty(obj, 'object.notAProp'); - expect(obj.object.notAProp).to.equal(void 0); - expect(obj.object).to.not.have.property('notAProp'); + objectPath.empty(obj, 'object.notAProp') + expect(obj.object.notAProp).to.equal(void 0) + expect(obj.object).to.not.have.property('notAProp') - objectPath.empty(obj, 'instance.test'); + objectPath.empty(obj, 'instance.test') //instance.test is not own property, so it shouldn't be emptied - expect(obj.instance.test).to.be.a('function'); - expect(Instance.prototype.test).to.be.a('function'); - - objectPath.empty(obj, 'string'); - objectPath.empty(obj, 'number'); - objectPath.empty(obj, 'boolean'); - objectPath.empty(obj, 'function'); - objectPath.empty(obj, 'array'); - objectPath.empty(obj, 'object'); - objectPath.empty(obj, 'instance'); - - expect(obj.string).to.equal(''); - expect(obj.array).to.deep.equal([]); - expect(obj.number).to.equal(0); - expect(obj.boolean).to.equal(false); - expect(obj.object).to.deep.equal({}); - expect(obj.instance.notOwn).to.be.an('undefined'); - expect(obj.instance.arr).to.be.an('array'); - expect(obj['function']).to.equal(null); - }); -}); - -describe('del', function(){ - it('should work with number path', function(){ - var obj = getTestObj(); - objectPath.del(obj.b.d, 1); - expect(obj.b.d).to.deep.equal(['a']); - }); - - it('should remove null and undefined props (but not explode on nested)', function(){ - var obj = { nullProp: null, undefinedProp: void 0 }; - expect(obj).to.have.property('nullProp'); - expect(obj).to.have.property('undefinedProp'); - - objectPath.del(obj, 'nullProp.foo'); - objectPath.del(obj, 'undefinedProp.bar'); - expect(obj).to.have.property('nullProp'); - expect(obj).to.have.property('undefinedProp'); - expect(obj).to.deep.equal({ nullProp: null, undefinedProp: void 0 }); - - objectPath.del(obj, 'nullProp'); - objectPath.del(obj, 'undefinedProp'); - expect(obj).to.not.have.property('nullProp'); - expect(obj).to.not.have.property('undefinedProp'); - expect(obj).to.deep.equal({}); - }); - - it('should delete deep paths', function(){ - var obj = getTestObj(); - - expect(objectPath.del(obj)).to.be.equal(obj); - - objectPath.set(obj, 'b.g.1.0', 'test'); - objectPath.set(obj, 'b.g.1.1', 'test'); - objectPath.set(obj, 'b.h.az', 'test'); - objectPath.set(obj, 'b.\ubeef', 'test'); - objectPath.set(obj, ['b','dot.dot'], 'test'); - - expect(obj).to.have.deep.property('b.g.1.0','test'); - expect(obj).to.have.deep.property('b.g.1.1','test'); - expect(obj).to.have.deep.property('b.h.az','test'); - expect(obj).to.have.deep.property('b.\ubeef','test'); - - objectPath.del(obj, 'b.h.az'); - expect(obj).to.not.have.deep.property('b.h.az'); - expect(obj).to.have.deep.property('b.h'); - - objectPath.del(obj, 'b.g.1.1'); - expect(obj).to.not.have.deep.property('b.g.1.1'); - expect(obj).to.have.deep.property('b.g.1.0','test'); - - objectPath.del(obj, 'b.\ubeef'); - expect(obj).to.not.have.deep.property('b.\ubeef'); - - objectPath.del(obj, ['b','dot.dot']); - expect(objectPath.get(obj, ['b','dot.dot'])).to.be.equal(void 0); - - objectPath.del(obj, ['b','g','1','0']); - expect(obj).to.not.have.deep.property('b.g.1.0'); - expect(obj).to.have.deep.property('b.g.1'); - - expect(objectPath.del(obj, ['b'])).to.not.have.deep.property('b.g'); - expect(obj).to.be.deep.equal({'a':'b'}); - }); - - it('should remove items from existing array', function(){ - var obj = getTestObj(); - - objectPath.del(obj, 'b.d.0'); - expect(obj.b.d).to.have.length(1); - expect(obj.b.d).to.be.deep.equal(['b']); - - objectPath.del(obj, 'b.d.0'); - expect(obj.b.d).to.have.length(0); - expect(obj.b.d).to.be.deep.equal([]); - }); -}); - -describe('insert', function(){ - it('should insert value into existing array', function(){ - var obj = getTestObj(); - - objectPath.insert(obj, 'b.c', 'asdf'); - expect(obj).to.have.deep.property('b.c.0', 'asdf'); - expect(obj).to.not.have.deep.property('b.c.1'); - }); - - it('should create intermediary array', function(){ - var obj = getTestObj(); - - objectPath.insert(obj, 'b.c.0', 'asdf'); - expect(obj).to.have.deep.property('b.c.0.0', 'asdf'); - }); - - it('should insert in another index', function(){ - var obj = getTestObj(); - - objectPath.insert(obj, 'b.d', 'asdf', 1); - expect(obj).to.have.deep.property('b.d.1', 'asdf'); - expect(obj).to.have.deep.property('b.d.0', 'a'); - expect(obj).to.have.deep.property('b.d.2', 'b'); - }); - - it('should handle sparse array', function(){ - var obj = getTestObj(); - obj.b.d = new Array(4); - obj.b.d[0] = 'a'; - obj.b.d[1] = 'b'; - - objectPath.insert(obj, 'b.d', 'asdf', 3); + expect(obj.instance.test).to.be.a('function') + expect(Instance.prototype.test).to.be.a('function') + + objectPath.empty(obj, 'string') + objectPath.empty(obj, 'number') + objectPath.empty(obj, 'boolean') + objectPath.empty(obj, 'function') + objectPath.empty(obj, 'array') + objectPath.empty(obj, 'object') + objectPath.empty(obj, 'instance') + + expect(obj.string).to.equal('') + expect(obj.array).to.deep.equal([]) + expect(obj.number).to.equal(0) + expect(obj.boolean).to.equal(false) + expect(obj.object).to.deep.equal({}) + expect(obj.instance.notOwn).to.be.an('undefined') + expect(obj.instance.arr).to.be.an('array') + expect(obj['function']).to.equal(null) + }) +}) + +describe('del', function () { + it('should work with number path', function () { + var obj = getTestObj() + objectPath.del(obj.b.d, 1) + expect(obj.b.d).to.deep.equal(['a']) + }) + + it('should remove null and undefined props (but not explode on nested)', function () { + var obj = {nullProp: null, undefinedProp: void 0} + expect(obj).to.have.property('nullProp') + expect(obj).to.have.property('undefinedProp') + + objectPath.del(obj, 'nullProp.foo') + objectPath.del(obj, 'undefinedProp.bar') + expect(obj).to.have.property('nullProp') + expect(obj).to.have.property('undefinedProp') + expect(obj).to.deep.equal({nullProp: null, undefinedProp: void 0}) + + objectPath.del(obj, 'nullProp') + objectPath.del(obj, 'undefinedProp') + expect(obj).to.not.have.property('nullProp') + expect(obj).to.not.have.property('undefinedProp') + expect(obj).to.deep.equal({}) + }) + + it('should delete deep paths', function () { + var obj = getTestObj() + + expect(objectPath.del(obj)).to.be.equal(obj) + + objectPath.set(obj, 'b.g.1.0', 'test') + objectPath.set(obj, 'b.g.1.1', 'test') + objectPath.set(obj, 'b.h.az', 'test') + objectPath.set(obj, 'b.\ubeef', 'test') + objectPath.set(obj, ['b', 'dot.dot'], 'test') + + expect(obj).to.have.nested.property('b.g.1.0', 'test') + expect(obj).to.have.nested.property('b.g.1.1', 'test') + expect(obj).to.have.nested.property('b.h.az', 'test') + expect(obj).to.have.nested.property('b.\ubeef', 'test') + + objectPath.del(obj, 'b.h.az') + expect(obj).to.not.have.nested.property('b.h.az') + expect(obj).to.have.nested.property('b.h') + + objectPath.del(obj, 'b.g.1.1') + expect(obj).to.not.have.nested.property('b.g.1.1') + expect(obj).to.have.nested.property('b.g.1.0', 'test') + + objectPath.del(obj, 'b.\ubeef') + expect(obj).to.not.have.nested.property('b.\ubeef') + + objectPath.del(obj, ['b', 'dot.dot']) + expect(objectPath.get(obj, ['b', 'dot.dot'])).to.be.equal(void 0) + + objectPath.del(obj, ['b', 'g', '1', '0']) + expect(obj).to.not.have.nested.property('b.g.1.0') + expect(obj).to.have.nested.property('b.g.1') + + expect(objectPath.del(obj, ['b'])).to.not.have.nested.property('b.g') + expect(obj).to.be.deep.equal({'a': 'b'}) + }) + + it('should remove items from existing array', function () { + var obj = getTestObj() + + objectPath.del(obj, 'b.d.0') + expect(obj.b.d).to.have.length(1) + expect(obj.b.d).to.be.deep.equal(['b']) + + objectPath.del(obj, 'b.d.0') + expect(obj.b.d).to.have.length(0) + expect(obj.b.d).to.be.deep.equal([]) + }) +}) + +describe('insert', function () { + it('should insert value into existing array', function () { + var obj = getTestObj() + + objectPath.insert(obj, 'b.c', 'asdf') + expect(obj).to.have.nested.property('b.c.0', 'asdf') + expect(obj).to.not.have.nested.property('b.c.1') + }) + + it('should create intermediary array', function () { + var obj = getTestObj() + + objectPath.insert(obj, 'b.c.0', 'asdf') + expect(obj).to.have.nested.property('b.c.0.0', 'asdf') + }) + + it('should insert in another index', function () { + var obj = getTestObj() + + objectPath.insert(obj, 'b.d', 'asdf', 1) + expect(obj).to.have.nested.property('b.d.1', 'asdf') + expect(obj).to.have.nested.property('b.d.0', 'a') + expect(obj).to.have.nested.property('b.d.2', 'b') + }) + + it('should handle sparse array', function () { + var obj = getTestObj() + obj.b.d = new Array(4) + obj.b.d[0] = 'a' + obj.b.d[1] = 'b' + + objectPath.insert(obj, 'b.d', 'asdf', 3) expect(obj.b.d).to.have.members([ 'a', 'b', , , 'asdf' - ]); - }); -}); + ]) + }) +}) describe('has', function () { it('should return false for empty object', function () { - expect(objectPath.has({}, 'a')).to.be.equal(false); - }); + expect(objectPath.has({}, 'a')).to.be.equal(false) + }) it('should handle empty paths properly', function () { - var obj = getTestObj(); - expect(objectPath.has(obj, '')).to.be.equal(false); - expect(objectPath.has(obj, [''])).to.be.equal(false); + var obj = getTestObj() + expect(objectPath.has(obj, '')).to.be.equal(false) + expect(objectPath.has(obj, [''])).to.be.equal(false) obj[''] = 1 - expect(objectPath.has(obj, '')).to.be.equal(true); - expect(objectPath.has(obj, [''])).to.be.equal(true); - - expect(objectPath.has(obj, [])).to.be.equal(true); - expect(objectPath.has(null, [])).to.be.equal(false); - }); - - it('should test under shallow object', function() { - var obj = getTestObj(); - expect(objectPath.has(obj, 'a')).to.be.equal(true); - expect(objectPath.has(obj, ['a'])).to.be.equal(true); - expect(objectPath.has(obj, 'z')).to.be.equal(false); - expect(objectPath.has(obj, ['z'])).to.be.equal(false); - }); - - it('should work with number path', function() { - var obj = getTestObj(); - expect(objectPath.has(obj.b.d, 0)).to.be.equal(true); - expect(objectPath.has(obj.b, 0)).to.be.equal(false); - expect(objectPath.has(obj.b.d, 10)).to.be.equal(false); - expect(objectPath.has(obj.b, 10)).to.be.equal(false); - }); - - it('should test under deep object', function() { - var obj = getTestObj(); - expect(objectPath.has(obj, 'b.f')).to.be.equal(true); - expect(objectPath.has(obj, ['b','f'])).to.be.equal(true); - expect(objectPath.has(obj, 'b.g')).to.be.equal(false); - expect(objectPath.has(obj, ['b','g'])).to.be.equal(false); - }); - - it('should test value under array', function() { + expect(objectPath.has(obj, '')).to.be.equal(true) + expect(objectPath.has(obj, [''])).to.be.equal(true) + + expect(objectPath.has(obj, [])).to.be.equal(true) + expect(objectPath.has(null, [])).to.be.equal(false) + }) + + it('should test under shallow object', function () { + var obj = getTestObj() + expect(objectPath.has(obj, 'a')).to.be.equal(true) + expect(objectPath.has(obj, ['a'])).to.be.equal(true) + expect(objectPath.has(obj, 'z')).to.be.equal(false) + expect(objectPath.has(obj, ['z'])).to.be.equal(false) + }) + + it('should work with number path', function () { + var obj = getTestObj() + expect(objectPath.has(obj.b.d, 0)).to.be.equal(true) + expect(objectPath.has(obj.b, 0)).to.be.equal(false) + expect(objectPath.has(obj.b.d, 10)).to.be.equal(false) + expect(objectPath.has(obj.b, 10)).to.be.equal(false) + }) + + it('should test under deep object', function () { + var obj = getTestObj() + expect(objectPath.has(obj, 'b.f')).to.be.equal(true) + expect(objectPath.has(obj, ['b', 'f'])).to.be.equal(true) + expect(objectPath.has(obj, 'b.g')).to.be.equal(false) + expect(objectPath.has(obj, ['b', 'g'])).to.be.equal(false) + }) + + it('should test value under array', function () { var obj = { b: ['a'] - }; + } obj.b[3] = {o: 'a'} - expect(objectPath.has(obj, 'b.0')).to.be.equal(true); - expect(objectPath.has(obj, 'b.1')).to.be.equal(true); - expect(objectPath.has(obj, 'b.3.o')).to.be.equal(true); - expect(objectPath.has(obj, 'b.3.qwe')).to.be.equal(false); - expect(objectPath.has(obj, 'b.4')).to.be.equal(false); - }); - - it('should test the value under array deep', function() { - var obj = getTestObj(); - expect(objectPath.has(obj, 'b.e.1.f')).to.be.equal(true); - expect(objectPath.has(obj, ['b','e',1,'f'])).to.be.equal(true); - expect(objectPath.has(obj, 'b.e.1.f.g.h.i')).to.be.equal(false); - expect(objectPath.has(obj, ['b','e',1,'f','g','h','i'])).to.be.equal(false); - }); - - it('should test the value under integer-like key', function() { - var obj = { '1a': 'foo' }; - expect(objectPath.has(obj, '1a')).to.be.equal(true); - expect(objectPath.has(obj, ['1a'])).to.be.equal(true); - }); - - it('should distinct nonexistent key and key = undefined', function() { - var obj = {}; - expect(objectPath.has(obj, 'key')).to.be.equal(false); - - obj.key = undefined; - expect(objectPath.has(obj, 'key')).to.be.equal(true); - }); - - it('should work with deep undefined/null values', function() { - var obj = {}; - expect(objectPath.has(obj, 'missing.test')).to.be.equal(false); - - obj.missing = null; - expect(objectPath.has(obj, 'missing.test')).to.be.equal(false); + expect(objectPath.has(obj, 'b.0')).to.be.equal(true) + expect(objectPath.has(obj, 'b.1')).to.be.equal(true) + expect(objectPath.has(obj, 'b.3.o')).to.be.equal(true) + expect(objectPath.has(obj, 'b.3.qwe')).to.be.equal(false) + expect(objectPath.has(obj, 'b.4')).to.be.equal(false) + }) + + it('should test the value under array deep', function () { + var obj = getTestObj() + expect(objectPath.has(obj, 'b.e.1.f')).to.be.equal(true) + expect(objectPath.has(obj, ['b', 'e', 1, 'f'])).to.be.equal(true) + expect(objectPath.has(obj, 'b.e.1.f.g.h.i')).to.be.equal(false) + expect(objectPath.has(obj, ['b', 'e', 1, 'f', 'g', 'h', 'i'])).to.be.equal(false) + }) + + it('should test the value under integer-like key', function () { + var obj = {'1a': 'foo'} + expect(objectPath.has(obj, '1a')).to.be.equal(true) + expect(objectPath.has(obj, ['1a'])).to.be.equal(true) + }) + + it('should distinct nonexistent key and key = undefined', function () { + var obj = {} + expect(objectPath.has(obj, 'key')).to.be.equal(false) + + obj.key = undefined + expect(objectPath.has(obj, 'key')).to.be.equal(true) + }) + + it('should work with deep undefined/null values', function () { + var obj = {} + expect(objectPath.has(obj, 'missing.test')).to.be.equal(false) + + obj.missing = null + expect(objectPath.has(obj, 'missing.test')).to.be.equal(false) obj.sparseArray = [1, undefined, 3] - expect(objectPath.has(obj, 'sparseArray.1.test')).to.be.equal(false); - }); -}); - + expect(objectPath.has(obj, 'sparseArray.1.test')).to.be.equal(false) + }) +}) describe('bind object', function () { // just get one scenario from each feature, so whole functionality is proxied well - it('should return the value under shallow object', function() { - var obj = getTestObj(); - var model = objectPath(obj); - expect(model.get('a')).to.be.equal('b'); - expect(model.get(['a'])).to.be.equal('b'); - }); - - it('should set value under shallow object', function() { - var obj = getTestObj(); - var model = objectPath(obj); - model.set('c', {m: 'o'}); - expect(obj).to.have.deep.property('c.m', 'o'); - obj = getTestObj(); - model = objectPath(obj); - model.set(['c'], {m: 'o'}); - expect(obj).to.have.deep.property('c.m', 'o'); - }); - - it('should push value to existing array', function() { - var obj = getTestObj(); - var model = objectPath(obj); - model.push('b.c', 'l'); - expect(obj).to.have.deep.property('b.c.0', 'l'); - obj = getTestObj(); - model = objectPath(obj); - model.push(['b','c'], 'l'); - expect(obj).to.have.deep.property('b.c.0', 'l'); - }); - - it('should create the path if it does not exists', function() { - var obj = getTestObj(); - var model = objectPath(obj); - var oldVal = model.ensureExists('b.g.1.l', 'test'); - expect(oldVal).to.not.exist; - expect(obj).to.have.deep.property('b.g.1.l', 'test'); - oldVal = model.ensureExists('b.g.1.l', 'test1'); - expect(oldVal).to.be.equal('test'); - expect(obj).to.have.deep.property('b.g.1.l', 'test'); - }); - - it('should return the first non-undefined value', function(){ + it('should return the value under shallow object', function () { + var obj = getTestObj() + var model = objectPath(obj) + expect(model.get('a')).to.be.equal('b') + expect(model.get(['a'])).to.be.equal('b') + }) + + it('should set value under shallow object', function () { + var obj = getTestObj() + var model = objectPath(obj) + model.set('c', {m: 'o'}) + expect(obj).to.have.nested.property('c.m', 'o') + obj = getTestObj() + model = objectPath(obj) + model.set(['c'], {m: 'o'}) + expect(obj).to.have.nested.property('c.m', 'o') + }) + + it('should push value to existing array', function () { + var obj = getTestObj() + var model = objectPath(obj) + model.push('b.c', 'l') + expect(obj).to.have.nested.property('b.c.0', 'l') + obj = getTestObj() + model = objectPath(obj) + model.push(['b', 'c'], 'l') + expect(obj).to.have.nested.property('b.c.0', 'l') + }) + + it('should create the path if it does not exists', function () { + var obj = getTestObj() + var model = objectPath(obj) + var oldVal = model.ensureExists('b.g.1.l', 'test') + expect(oldVal).to.not.exist + expect(obj).to.have.nested.property('b.g.1.l', 'test') + oldVal = model.ensureExists('b.g.1.l', 'test1') + expect(oldVal).to.be.equal('test') + expect(obj).to.have.nested.property('b.g.1.l', 'test') + }) + + it('should return the first non-undefined value', function () { var obj = { should: {have: 'prop'} - }; - var model = objectPath(obj); + } + var model = objectPath(obj) expect(model.coalesce([ 'doesnt.exist', - ['might','not','exist'], + ['might', 'not', 'exist'], 'should.have' - ])).to.equal('prop'); - }); + ])).to.equal('prop') + }) - it('should empty each path according to their types', function(){ - function Instance(){ - this.notOwn = true; + it('should empty each path according to their types', function () { + function Instance () { + this.notOwn = true } /*istanbul ignore next: not part of code */ - Instance.prototype.test = function(){}; + Instance.prototype.test = function () { + } /*istanbul ignore next: not part of code */ - Instance.prototype.arr = []; + Instance.prototype.arr = [] var obj = { string: 'some string', - array: ['some','array',[1,2,3]], + array: ['some', 'array', [1, 2, 3]], number: 21, boolean: true, object: { - some:'property', + some: 'property', sub: { 'property': true } }, instance: new Instance() - }; + } /*istanbul ignore next: not part of code */ - obj['function'] = function(){}; + obj['function'] = function () { + } - var model = objectPath(obj); + var model = objectPath(obj) - model.empty(['array','2']); - expect(obj.array[2]).to.deep.equal([]); + model.empty(['array', '2']) + expect(obj.array[2]).to.deep.equal([]) - model.empty('object.sub'); - expect(obj.object.sub).to.deep.equal({}); + model.empty('object.sub') + expect(obj.object.sub).to.deep.equal({}) - model.empty('instance.test'); + model.empty('instance.test') //instance.test is not own property so it shouldn't be emptied - expect(obj.instance.test).to.be.a('function'); - expect(Instance.prototype.test).to.be.a('function'); - - model.empty('string'); - model.empty('number'); - model.empty('boolean'); - model.empty('function'); - model.empty('array'); - model.empty('object'); - model.empty('instance'); - - expect(obj.string).to.equal(''); - expect(obj.array).to.deep.equal([]); - expect(obj.number).to.equal(0); - expect(obj.boolean).to.equal(false); - expect(obj.object).to.deep.equal({}); - expect(obj.instance.notOwn).to.be.an('undefined'); - expect(obj.instance.arr).to.be.an('array'); - expect(obj['function']).to.equal(null); - }); - - it('should delete deep paths', function(){ - var obj = getTestObj(); - var model = objectPath(obj); - - expect(model.del()).to.be.equal(obj); - - model.set('b.g.1.0', 'test'); - model.set('b.g.1.1', 'test'); - model.set('b.h.az', 'test'); - - expect(obj).to.have.deep.property('b.g.1.0','test'); - expect(obj).to.have.deep.property('b.g.1.1','test'); - expect(obj).to.have.deep.property('b.h.az','test'); - - model.del('b.h.az'); - expect(obj).to.not.have.deep.property('b.h.az'); - expect(obj).to.have.deep.property('b.h'); - - model.del('b.g.1.1'); - expect(obj).to.not.have.deep.property('b.g.1.1'); - expect(obj).to.have.deep.property('b.g.1.0','test'); - - model.del(['b','g','1','0']); - expect(obj).to.not.have.deep.property('b.g.1.0'); - expect(obj).to.have.deep.property('b.g.1'); - - expect(model.del(['b'])).to.not.have.deep.property('b.g'); - expect(obj).to.be.deep.equal({'a':'b'}); - }); - - it('should insert value into existing array', function(){ - var obj = getTestObj(); - var model = objectPath(obj); - - model.insert('b.c', 'asdf'); - expect(obj).to.have.deep.property('b.c.0', 'asdf'); - expect(obj).to.not.have.deep.property('b.c.1'); - }); - - it('should test under shallow object', function() { - var obj = getTestObj(); - var model = objectPath(obj); - - expect(model.has('a')).to.be.equal(true); - expect(model.has(['a'])).to.be.equal(true); - expect(model.has('z')).to.be.equal(false); - expect(model.has(['z'])).to.be.equal(false); - }); -}); + expect(obj.instance.test).to.be.a('function') + expect(Instance.prototype.test).to.be.a('function') + + model.empty('string') + model.empty('number') + model.empty('boolean') + model.empty('function') + model.empty('array') + model.empty('object') + model.empty('instance') + + expect(obj.string).to.equal('') + expect(obj.array).to.deep.equal([]) + expect(obj.number).to.equal(0) + expect(obj.boolean).to.equal(false) + expect(obj.object).to.deep.equal({}) + expect(obj.instance.notOwn).to.be.an('undefined') + expect(obj.instance.arr).to.be.an('array') + expect(obj['function']).to.equal(null) + }) + + it('should delete deep paths', function () { + var obj = getTestObj() + var model = objectPath(obj) + + expect(model.del()).to.be.equal(obj) + + model.set('b.g.1.0', 'test') + model.set('b.g.1.1', 'test') + model.set('b.h.az', 'test') + + expect(obj).to.have.nested.property('b.g.1.0', 'test') + expect(obj).to.have.nested.property('b.g.1.1', 'test') + expect(obj).to.have.nested.property('b.h.az', 'test') + + model.del('b.h.az') + expect(obj).to.not.have.nested.property('b.h.az') + expect(obj).to.have.nested.property('b.h') + + model.del('b.g.1.1') + expect(obj).to.not.have.nested.property('b.g.1.1') + expect(obj).to.have.nested.property('b.g.1.0', 'test') + + model.del(['b', 'g', '1', '0']) + expect(obj).to.not.have.nested.property('b.g.1.0') + expect(obj).to.have.nested.property('b.g.1') + + expect(model.del(['b'])).to.not.have.nested.property('b.g') + expect(obj).to.be.deep.equal({'a': 'b'}) + }) + + it('should insert value into existing array', function () { + var obj = getTestObj() + var model = objectPath(obj) + + model.insert('b.c', 'asdf') + expect(obj).to.have.nested.property('b.c.0', 'asdf') + expect(obj).to.not.have.nested.property('b.c.1') + }) + + it('should test under shallow object', function () { + var obj = getTestObj() + var model = objectPath(obj) + + expect(model.has('a')).to.be.equal(true) + expect(model.has(['a'])).to.be.equal(true) + expect(model.has('z')).to.be.equal(false) + expect(model.has(['z'])).to.be.equal(false) + }) +}) describe('Don\'t access not own properties [default]', function () { - it('should not get a not own property', function() { - var Obj = function() {}; - Obj.prototype.notOwn = {a: 'a'}; - var obj = new Obj(); + it('should not get a not own property', function () { + var Obj = function () { + } + Obj.prototype.notOwn = {a: 'a'} + var obj = new Obj() expect(objectPath.get(obj, 'notOwn')).to.be.undefined - }); + }) - it('should set a not own property on the instance (not the prototype)', function() { + it('should set a not own property on the instance (not the prototype)', function () { var proto = { notOwn: {} } var obj = Object.create(proto) - objectPath.set(obj, 'notOwn.test', 'a'); - expect(obj.notOwn.test).to.be.equal('a'); - expect(proto.notOwn).to.be.deep.equal({}); - }); + objectPath.set(obj, 'notOwn.test', 'a') + expect(obj.notOwn.test).to.be.equal('a') + expect(proto.notOwn).to.be.deep.equal({}) + }) - it('has should return false on a not own property', function() { + it('has should return false on a not own property', function () { var proto = { notOwn: {a: 'a'} } var obj = Object.create(proto) - expect(objectPath.has(obj, 'notOwn')).to.be.false; - expect(objectPath.has(obj, 'notOwn.a')).to.be.false; - }); + expect(objectPath.has(obj, 'notOwn')).to.be.false + expect(objectPath.has(obj, 'notOwn.a')).to.be.false + }) - it('empty should not empty on a not own property', function() { + it('empty should not empty on a not own property', function () { var proto = { notOwn: {a: 'a'} } - var obj = Object.create(proto); + var obj = Object.create(proto) - objectPath.empty(obj, 'notOwn'); - expect(proto.notOwn).to.be.deep.equal({a: 'a'}); - expect(obj.notOwn).to.be.deep.equal({a: 'a'}); - }); + objectPath.empty(obj, 'notOwn') + expect(proto.notOwn).to.be.deep.equal({a: 'a'}) + expect(obj.notOwn).to.be.deep.equal({a: 'a'}) + }) - it('del should not delete not own property', function() { + it('del should not delete not own property', function () { var proto = { notOwn: {a: 'a'} } - var obj = Object.create(proto); + var obj = Object.create(proto) - objectPath.del(obj, 'notOwn.a'); - expect(proto.notOwn).to.be.deep.equal({a: 'a'}); + objectPath.del(obj, 'notOwn.a') + expect(proto.notOwn).to.be.deep.equal({a: 'a'}) //expect(obj.notOwn).to.be.deep.equal({a: 'a'}); //objectPath.del(obj, 'notOwn'); //expect(proto).to.be.deep.equal({notOwn: {a: 'a'}}); //expect(obj).to.be.deep.equal({notOwn: {a: 'a'}}); - }); -}); + }) +}) describe('Access own properties [optional]', function () { - it('should get a not own property', function() { - var Obj = function() {}; - Obj.prototype.notOwn = {a: 'a'}; - var obj = new Obj(); + it('should get a not own property', function () { + var Obj = function () { + } + Obj.prototype.notOwn = {a: 'a'} + var obj = new Obj() expect(objectPath.withInheritedProps.get(obj, 'notOwn.a')).to.be.equal('a') - }); + }) - it('should set a deep not own property on the prototype (if exists)', function() { + it('should set a deep not own property on the prototype (if exists)', function () { var proto = { notOwn: {} } var obj = Object.create(proto) - objectPath.withInheritedProps.set(obj, 'notOwn.test', 'a'); - expect(obj.notOwn.test).to.be.equal('a'); - expect(proto.notOwn).to.be.deep.equal({test: 'a'}); - }); + objectPath.withInheritedProps.set(obj, 'notOwn.test', 'a') + expect(obj.notOwn.test).to.be.equal('a') + expect(proto.notOwn).to.be.deep.equal({test: 'a'}) + }) - it('has should return true on a not own property', function() { + it('has should return true on a not own property', function () { var proto = { notOwn: {a: 'a'} } var obj = Object.create(proto) - expect(objectPath.withInheritedProps.has(obj, 'notOwn')).to.be.true; - expect(objectPath.withInheritedProps.has(obj, 'notOwn.a')).to.be.true; - }); + expect(objectPath.withInheritedProps.has(obj, 'notOwn')).to.be.true + expect(objectPath.withInheritedProps.has(obj, 'notOwn.a')).to.be.true + }) - it('empty should empty a not own property', function() { + it('empty should empty a not own property', function () { var proto = { notOwn: {a: 'a'} } - var obj = Object.create(proto); + var obj = Object.create(proto) - objectPath.withInheritedProps.empty(obj, 'notOwn'); - expect(proto.notOwn).to.be.deep.equal({}); - expect(obj.notOwn).to.be.deep.equal({}); - }); + objectPath.withInheritedProps.empty(obj, 'notOwn') + expect(proto.notOwn).to.be.deep.equal({}) + expect(obj.notOwn).to.be.deep.equal({}) + }) - it('del should delete a not own property', function() { + it('del should delete a not own property', function () { var proto = { notOwn: {a: 'a'} } - var obj = Object.create(proto); + var obj = Object.create(proto) - objectPath.withInheritedProps.del(obj, 'notOwn.a'); - expect(proto.notOwn).to.be.deep.equal({}); + objectPath.withInheritedProps.del(obj, 'notOwn.a') + expect(proto.notOwn).to.be.deep.equal({}) //expect(obj.notOwn).to.be.deep.equal({}); - objectPath.withInheritedProps.del(obj, 'notOwn'); + objectPath.withInheritedProps.del(obj, 'notOwn') //expect(proto).to.be.deep.equal({notOwn: {}}); //expect(obj).to.be.deep.equal({notOwn: {}}); - }); -}); + }) +}) diff --git a/node_modules/parse-json/index.js b/node_modules/parse-json/index.js index 4d96c596..2f5e1053 100644 --- a/node_modules/parse-json/index.js +++ b/node_modules/parse-json/index.js @@ -1,6 +1,6 @@ 'use strict'; const errorEx = require('error-ex'); -const fallback = require('json-parse-better-errors'); +const fallback = require('json-parse-even-better-errors'); const {default: LinesAndColumns} = require('lines-and-columns'); const {codeFrameColumns} = require('@babel/code-frame'); @@ -24,7 +24,7 @@ module.exports = (string, reviver, filename) => { } } catch (error) { error.message = error.message.replace(/\n/g, ''); - const indexMatch = error.message.match(/in JSON at position (\d+) while parsing near/); + const indexMatch = error.message.match(/in JSON at position (\d+) while parsing/); const jsonError = new JSONError(error); if (filename) { diff --git a/node_modules/parse-json/license b/node_modules/parse-json/license index e7af2f77..fa7ceba3 100644 --- a/node_modules/parse-json/license +++ b/node_modules/parse-json/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/node_modules/parse-json/package.json b/node_modules/parse-json/package.json index a7d2d869..1110381d 100644 --- a/node_modules/parse-json/package.json +++ b/node_modules/parse-json/package.json @@ -1,13 +1,14 @@ { "name": "parse-json", - "version": "5.0.0", + "version": "5.1.0", "description": "Parse JSON with more helpful errors", "license": "MIT", "repository": "sindresorhus/parse-json", + "funding": "https://github.com/sponsors/sindresorhus", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, "engines": { "node": ">=8" @@ -33,7 +34,7 @@ "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1", + "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" }, "devDependencies": { @@ -42,7 +43,7 @@ "xo": "^0.24.0" } -,"_resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz" -,"_integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==" -,"_from": "parse-json@5.0.0" +,"_resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.1.0.tgz" +,"_integrity": "sha512-+mi/lmVVNKFNVyLXV31ERiy2CY5E1/F6QtJFEzoChPRwwngMNXRDQ9GJ5WdE2Z2P4AujsOi0/+2qHID68KwfIQ==" +,"_from": "parse-json@5.1.0" } \ No newline at end of file diff --git a/node_modules/parse-json/readme.md b/node_modules/parse-json/readme.md index c4efee0f..adee7f3c 100644 --- a/node_modules/parse-json/readme.md +++ b/node_modules/parse-json/readme.md @@ -1,15 +1,13 @@ -# parse-json [![Build Status](https://travis-ci.org/sindresorhus/parse-json.svg?branch=master)](https://travis-ci.org/sindresorhus/parse-json) +# parse-json [![Build Status](https://travis-ci.com/sindresorhus/parse-json.svg?branch=master)](https://travis-ci.com/github/sindresorhus/parse-json) > Parse JSON with more helpful errors - ## Install ``` $ npm install parse-json ``` - ## Usage ```js @@ -87,7 +85,6 @@ Type: `string` Filename displayed in the error message. - ---
diff --git a/node_modules/resolve/.editorconfig b/node_modules/resolve/.editorconfig index bc228f82..b96fcfbf 100644 --- a/node_modules/resolve/.editorconfig +++ b/node_modules/resolve/.editorconfig @@ -1,20 +1,34 @@ root = true [*] -indent_style = tab -indent_size = 4 +indent_style = space +indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -max_line_length = 150 +max_line_length = 200 + +[*.js] +block_comment_start = /* +block_comment = * +block_comment_end = */ + +[*.yml] +indent_size = 1 + +[package.json] +indent_style = tab [CHANGELOG.md] indent_style = space indent_size = 2 -[*.json] +[{*.json,Makefile}] max_line_length = off -[Makefile] +[test/{dotdot,resolver,module_dir,multirepo,node_path,pathfilter,precedence}/**/*] +indent_style = off +indent_size = off max_line_length = off +insert_final_newline = off diff --git a/node_modules/resolve/lib/async.js b/node_modules/resolve/lib/async.js index 06aa4588..6e9dd71d 100644 --- a/node_modules/resolve/lib/async.js +++ b/node_modules/resolve/lib/async.js @@ -1,9 +1,9 @@ var fs = require('fs'); var path = require('path'); -var caller = require('./caller.js'); -var nodeModulesPaths = require('./node-modules-paths.js'); -var normalizeOptions = require('./normalize-options.js'); -var isCore = require('./is-core'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); +var isCore = require('is-core-module'); var realpathFS = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; diff --git a/node_modules/resolve/lib/core.js b/node_modules/resolve/lib/core.js index 0877650c..c417d23c 100644 --- a/node_modules/resolve/lib/core.js +++ b/node_modules/resolve/lib/core.js @@ -6,8 +6,8 @@ function specifierIncluded(specifier) { var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); for (var i = 0; i < 3; ++i) { - var cur = Number(current[i] || 0); - var ver = Number(versionParts[i] || 0); + var cur = parseInt(current[i] || 0, 10); + var ver = parseInt(versionParts[i] || 0, 10); if (cur === ver) { continue; // eslint-disable-line no-restricted-syntax, no-continue } diff --git a/node_modules/resolve/lib/core.json b/node_modules/resolve/lib/core.json index d51b70b1..915d0dcd 100644 --- a/node_modules/resolve/lib/core.json +++ b/node_modules/resolve/lib/core.json @@ -1,5 +1,6 @@ { "assert": true, + "assert/strict": ">= 15", "async_hooks": ">= 8", "buffer_ieee754": "< 0.9.7", "buffer": true, @@ -12,7 +13,8 @@ "_debugger": "< 8", "dgram": true, "dns": true, - "domain": true, + "dns/promises": ">= 15", + "domain": ">= 0.7.12", "events": true, "freelist": "< 6", "fs": true, @@ -49,9 +51,11 @@ "_stream_readable": ">= 0.9.4", "_stream_writable": ">= 0.9.4", "stream": true, + "stream/promises": ">= 15", "string_decoder": true, - "sys": true, + "sys": [">= 0.6 && < 0.7", ">= 0.8"], "timers": true, + "timers/promises": ">= 15", "_tls_common": ">= 0.11.13", "_tls_legacy": ">= 0.11.3 && < 10", "_tls_wrap": ">= 0.11.3", diff --git a/node_modules/resolve/lib/is-core.js b/node_modules/resolve/lib/is-core.js index 48bc96c4..537f5c78 100644 --- a/node_modules/resolve/lib/is-core.js +++ b/node_modules/resolve/lib/is-core.js @@ -1,5 +1,5 @@ -var core = require('./core'); +var isCoreModule = require('is-core-module'); module.exports = function isCore(x) { - return Object.prototype.hasOwnProperty.call(core, x); + return isCoreModule(x); }; diff --git a/node_modules/resolve/lib/sync.js b/node_modules/resolve/lib/sync.js index da74e19d..e5973e50 100644 --- a/node_modules/resolve/lib/sync.js +++ b/node_modules/resolve/lib/sync.js @@ -1,9 +1,9 @@ -var isCore = require('./is-core'); +var isCore = require('is-core-module'); var fs = require('fs'); var path = require('path'); -var caller = require('./caller.js'); -var nodeModulesPaths = require('./node-modules-paths.js'); -var normalizeOptions = require('./normalize-options.js'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; diff --git a/node_modules/resolve/package.json b/node_modules/resolve/package.json index 43b8e1c0..811e0e03 100644 --- a/node_modules/resolve/package.json +++ b/node_modules/resolve/package.json @@ -1,7 +1,7 @@ { "name": "resolve", "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", - "version": "1.17.0", + "version": "1.18.1", "repository": { "type": "git", "url": "git://github.com/browserify/resolve.git" @@ -14,23 +14,26 @@ "module" ], "scripts": { - "prepublish": "safe-publish-latest", - "lint": "eslint .", + "prepublish": "safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/", + "prelint": "eclint check '**/*'", + "lint": "eslint --ext=js,mjs .", "pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async", "tests-only": "tape test/*.js", "pretest": "npm run lint", "test": "npm run --silent tests-only", - "posttest": "npm run test:multirepo", + "posttest": "npm run test:multirepo && aud --production", "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test" }, "devDependencies": { - "@ljharb/eslint-config": "^16.0.0", + "@ljharb/eslint-config": "^17.2.0", "array.prototype.map": "^1.0.2", - "eslint": "^6.8.0", + "aud": "^1.1.2", + "eclint": "^2.8.1", + "eslint": "^7.11.0", "object-keys": "^1.1.1", "safe-publish-latest": "^1.1.4", "tap": "0.4.13", - "tape": "^5.0.0-next.5" + "tape": "^5.0.1" }, "license": "MIT", "author": { @@ -42,10 +45,11 @@ "url": "https://github.com/sponsors/ljharb" }, "dependencies": { + "is-core-module": "^2.0.0", "path-parse": "^1.0.6" } -,"_resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz" -,"_integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==" -,"_from": "resolve@1.17.0" +,"_resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz" +,"_integrity": "sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA==" +,"_from": "resolve@1.18.1" } \ No newline at end of file diff --git a/node_modules/resolve/readme.markdown b/node_modules/resolve/readme.markdown index 5e1aea33..8f81cbbf 100644 --- a/node_modules/resolve/readme.markdown +++ b/node_modules/resolve/readme.markdown @@ -122,12 +122,12 @@ default `opts` values: }); }, realpath: function realpath(file, cb) { - var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; - realpath(file, function (realPathErr, realPath) { - if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); - else cb(null, realPathErr ? file : realPath); - }); - }, + var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + realpath(file, function (realPathErr, realPath) { + if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); + else cb(null, realPathErr ? file : realPath); + }); + }, moduleDirectory: 'node_modules', preserveSymlinks: true } @@ -225,10 +225,6 @@ default `opts` values: } ``` -## resolve.isCore(pkg) - -Return whether a package is in core. - # install With [npm](https://npmjs.org) do: diff --git a/node_modules/resolve/test/core.js b/node_modules/resolve/test/core.js index 4c111e1d..7a3ccb16 100644 --- a/node_modules/resolve/test/core.js +++ b/node_modules/resolve/test/core.js @@ -22,16 +22,12 @@ test('core modules', function (t) { for (var i = 0; i < cores.length; ++i) { var mod = cores[i]; + var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func + console.log(mod, resolve.core, resolve.core[mod]); if (resolve.core[mod]) { - st.doesNotThrow( - function () { require(mod); }, // eslint-disable-line no-loop-func - mod + ' supported; requiring does not throw' - ); + st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw'); } else { - st.throws( - function () { require(mod); }, // eslint-disable-line no-loop-func - mod + ' not supported; requiring throws' - ); + st.throws(requireFunc, mod + ' not supported; requiring throws'); } } diff --git a/node_modules/resolve/test/symlinks.js b/node_modules/resolve/test/symlinks.js index 152d14ef..35f881af 100644 --- a/node_modules/resolve/test/symlinks.js +++ b/node_modules/resolve/test/symlinks.js @@ -68,7 +68,10 @@ test('sync symlink when preserveSymlinks = true', function (t) { test('sync symlink', function (t) { var start = new Date(); t.doesNotThrow(function () { - t.equal(resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js')); + t.equal( + resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), + path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js') + ); }); t.ok(new Date() - start < 50, 'resolve.sync timedout'); t.end(); diff --git a/node_modules/semver/CHANGELOG.md b/node_modules/semver/CHANGELOG.md index f567dd3f..220af176 100644 --- a/node_modules/semver/CHANGELOG.md +++ b/node_modules/semver/CHANGELOG.md @@ -1,5 +1,46 @@ # changes log +## 7.3.0 + +* Add `subset(r1, r2)` method to determine if `r1` range is entirely + contained by `r2` range. + +## 7.2.3 + +* Fix handling of `includePrelease` mode where version ranges like `1.0.0 - + 2.0.0` would include `3.0.0-pre` and not `1.0.0-pre`. + +## 7.2.2 + +* Fix bug where `2.0.0-pre` would be included in `^1.0.0` if + `includePrerelease` was set to true. + +## 7.2.0 + +* Add `simplifyRange` method to attempt to generate a more human-readable + range expression that is equivalent to a supplied range, for a given set + of versions. + +## 7.1.2 + +* Remove fancy lazy-loading logic, as it was causing problems for webpack + users. + +## 7.1.0 + +* Add `require('semver/preload')` to load the entire module without using + lazy getter methods. + +## 7.0.0 + +* Refactor module into separate files for better tree-shaking +* Drop support for very old node versions, use const/let, `=>` functions, + and classes. + +## 6.3.0 + +* Expose the token enum on the exports + ## 6.2.0 * Coerce numbers to strings when passed to semver.coerce() diff --git a/node_modules/semver/README.md b/node_modules/semver/README.md index 2293a14f..9bef045a 100644 --- a/node_modules/semver/README.md +++ b/node_modules/semver/README.md @@ -25,6 +25,63 @@ semver.valid(semver.coerce('v2')) // '2.0.0' semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' ``` +You can also just load the module for the function that you care about, if +you'd like to minimize your footprint. + +```js +// load the whole API at once in a single object +const semver = require('semver') + +// or just load the bits you need +// all of them listed here, just pick and choose what you want + +// classes +const SemVer = require('semver/classes/semver') +const Comparator = require('semver/classes/comparator') +const Range = require('semver/classes/range') + +// functions for working with versions +const semverParse = require('semver/functions/parse') +const semverValid = require('semver/functions/valid') +const semverClean = require('semver/functions/clean') +const semverInc = require('semver/functions/inc') +const semverDiff = require('semver/functions/diff') +const semverMajor = require('semver/functions/major') +const semverMinor = require('semver/functions/minor') +const semverPatch = require('semver/functions/patch') +const semverPrerelease = require('semver/functions/prerelease') +const semverCompare = require('semver/functions/compare') +const semverRcompare = require('semver/functions/rcompare') +const semverCompareLoose = require('semver/functions/compare-loose') +const semverCompareBuild = require('semver/functions/compare-build') +const semverSort = require('semver/functions/sort') +const semverRsort = require('semver/functions/rsort') + +// low-level comparators between versions +const semverGt = require('semver/functions/gt') +const semverLt = require('semver/functions/lt') +const semverEq = require('semver/functions/eq') +const semverNeq = require('semver/functions/neq') +const semverGte = require('semver/functions/gte') +const semverLte = require('semver/functions/lte') +const semverCmp = require('semver/functions/cmp') +const semverCoerce = require('semver/functions/coerce') + +// working with ranges +const semverSatisfies = require('semver/functions/satisfies') +const semverMaxSatisfying = require('semver/ranges/max-satisfying') +const semverMinSatisfying = require('semver/ranges/min-satisfying') +const semverToComparators = require('semver/ranges/to-comparators') +const semverMinVersion = require('semver/ranges/min-version') +const semverValidRange = require('semver/ranges/valid') +const semverOutside = require('semver/ranges/outside') +const semverGtr = require('semver/ranges/gtr') +const semverLtr = require('semver/ranges/ltr') +const semverIntersects = require('semver/ranges/intersects') +const simplifyRange = require('semver/ranges/simplify') +const rangeSubset = require('semver/ranges/subset') +``` + As a command-line utility: ``` @@ -199,8 +256,8 @@ inclusive range, then all versions that start with the supplied parts of the tuple are accepted, but nothing that would be greater than the provided tuple parts. -* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` -* `1.2.3 - 2` := `>=1.2.3 <3.0.0` +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0-0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0-0` #### X-Ranges `1.2.x` `1.X` `1.2.*` `*` @@ -208,28 +265,28 @@ Any of `X`, `x`, or `*` may be used to "stand in" for one of the numeric values in the `[major, minor, patch]` tuple. * `*` := `>=0.0.0` (Any version satisfies) -* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) -* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) +* `1.x` := `>=1.0.0 <2.0.0-0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0-0` (Matching major and minor versions) A partial version range is treated as an X-Range, so the special character is in fact optional. * `""` (empty string) := `*` := `>=0.0.0` -* `1` := `1.x.x` := `>=1.0.0 <2.0.0` -* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0-0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0-0` #### Tilde Ranges `~1.2.3` `~1.2` `~1` Allows patch-level changes if a minor version is specified on the comparator. Allows minor-level changes if not. -* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` -* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) -* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) -* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` -* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) -* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) -* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0-0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0-0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0-0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0-0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0-0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0-0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0-0` Note that prereleases in the `1.2.3` version will be allowed, if they are greater than or equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but `1.2.4-beta.2` would not, because it is a prerelease of a @@ -251,15 +308,15 @@ However, it presumes that there will *not* be breaking changes between `0.2.4` and `0.2.5`. It allows for changes that are presumed to be additive (but non-breaking), according to commonly observed practices. -* `^1.2.3` := `>=1.2.3 <2.0.0` -* `^0.2.3` := `>=0.2.3 <0.3.0` -* `^0.0.3` := `>=0.0.3 <0.0.4` -* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in +* `^1.2.3` := `>=1.2.3 <2.0.0-0` +* `^0.2.3` := `>=0.2.3 <0.3.0-0` +* `^0.0.3` := `>=0.0.3 <0.0.4-0` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0-0` Note that prereleases in the `1.2.3` version will be allowed, if they are greater than or equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but `1.2.4-beta.2` would not, because it is a prerelease of a different `[major, minor, patch]` tuple. -* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4-0` Note that prereleases in the `0.0.3` version *only* will be allowed, if they are greater than or equal to `beta`. So, `0.0.3-pr.2` would be allowed. @@ -267,16 +324,16 @@ When parsing caret ranges, a missing `patch` value desugars to the number `0`, but will allow flexibility within that value, even if the major and minor versions are both `0`. -* `^1.2.x` := `>=1.2.0 <2.0.0` -* `^0.0.x` := `>=0.0.0 <0.1.0` -* `^0.0` := `>=0.0.0 <0.1.0` +* `^1.2.x` := `>=1.2.0 <2.0.0-0` +* `^0.0.x` := `>=0.0.0 <0.1.0-0` +* `^0.0` := `>=0.0.0 <0.1.0-0` A missing `minor` and `patch` values will desugar to zero, but also allow flexibility within those values, even if the major version is zero. -* `^1.x` := `>=1.0.0 <2.0.0` -* `^0.x` := `>=0.0.0 <1.0.0` +* `^1.x` := `>=1.0.0 <2.0.0-0` +* `^0.x` := `>=0.0.0 <1.0.0-0` ### Range Grammar @@ -391,6 +448,16 @@ strings that they parse. `hilo` argument must be either the string `'>'` or `'<'`. (This is the function called by `gtr` and `ltr`.) * `intersects(range)`: Return true if any of the ranges comparators intersect +* `simplifyRange(versions, range)`: Return a "simplified" range that + matches the same items in `versions` list as the range specified. Note + that it does *not* guarantee that it would match the same versions in all + cases, only for the set of versions provided. This is useful when + generating ranges by joining together multiple versions with `||` + programmatically, to provide the user with something a bit more + ergonomic. If the provided range is shorter in string-length than the + generated range, then that is returned. +* `subset(subRange, superRange)`: Return `true` if the `subRange` range is + entirely contained by the `superRange` range. Note that, since ranges may be non-contiguous, a version might not be greater than a range, less than a range, *or* satisfy a range! For @@ -417,7 +484,7 @@ surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes is not valid). The maximum length for any semver component considered for coercion is 16 characters; longer components will be ignored (`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any -semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value components are invalid (`9999999999999999.4.7.4` is likely invalid). If the `options.rtl` flag is set, then `coerce` will return the right-most @@ -430,7 +497,9 @@ any other overlapping SemVer tuple. * `clean(version)`: Clean a string to be a valid semver if possible -This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges. +This will return a cleaned and trimmed semver version. If the provided +version is not valid a null will be returned. This does not work for +ranges. ex. * `s.clean(' = v 2.1.5foo')`: `null` @@ -441,3 +510,57 @@ ex. * `s.clean(' =v2.1.5')`: `2.1.5` * `s.clean(' 2.1.5 ')`: `'2.1.5'` * `s.clean('~1.0.0')`: `null` + +## Exported Modules + + + +You may pull in just the part of this semver utility that you need, if you +are sensitive to packing and tree-shaking concerns. The main +`require('semver')` export uses getter functions to lazily load the parts +of the API that are used. + +The following modules are available: + +* `require('semver')` +* `require('semver/classes')` +* `require('semver/classes/comparator')` +* `require('semver/classes/range')` +* `require('semver/classes/semver')` +* `require('semver/functions/clean')` +* `require('semver/functions/cmp')` +* `require('semver/functions/coerce')` +* `require('semver/functions/compare')` +* `require('semver/functions/compare-build')` +* `require('semver/functions/compare-loose')` +* `require('semver/functions/diff')` +* `require('semver/functions/eq')` +* `require('semver/functions/gt')` +* `require('semver/functions/gte')` +* `require('semver/functions/inc')` +* `require('semver/functions/lt')` +* `require('semver/functions/lte')` +* `require('semver/functions/major')` +* `require('semver/functions/minor')` +* `require('semver/functions/neq')` +* `require('semver/functions/parse')` +* `require('semver/functions/patch')` +* `require('semver/functions/prerelease')` +* `require('semver/functions/rcompare')` +* `require('semver/functions/rsort')` +* `require('semver/functions/satisfies')` +* `require('semver/functions/sort')` +* `require('semver/functions/valid')` +* `require('semver/ranges/gtr')` +* `require('semver/ranges/intersects')` +* `require('semver/ranges/ltr')` +* `require('semver/ranges/max-satisfying')` +* `require('semver/ranges/min-satisfying')` +* `require('semver/ranges/min-version')` +* `require('semver/ranges/outside')` +* `require('semver/ranges/to-comparators')` +* `require('semver/ranges/valid')` diff --git a/node_modules/semver/bin/semver.js b/node_modules/semver/bin/semver.js index 666034a7..73fe2953 100755 --- a/node_modules/semver/bin/semver.js +++ b/node_modules/semver/bin/semver.js @@ -3,39 +3,37 @@ // Exits successfully and prints matching version(s) if // any supplied version is valid and passes all tests. -var argv = process.argv.slice(2) +const argv = process.argv.slice(2) -var versions = [] +let versions = [] -var range = [] +const range = [] -var inc = null +let inc = null -var version = require('../package.json').version +const version = require('../package.json').version -var loose = false +let loose = false -var includePrerelease = false +let includePrerelease = false -var coerce = false +let coerce = false -var rtl = false +let rtl = false -var identifier +let identifier -var semver = require('../semver') +const semver = require('../') -var reverse = false +let reverse = false -var options = {} +const options = {} -main() - -function main () { +const main = () => { if (!argv.length) return help() while (argv.length) { - var a = argv.shift() - var indexOfEqualSign = a.indexOf('=') + let a = argv.shift() + const indexOfEqualSign = a.indexOf('=') if (indexOfEqualSign !== -1) { a = a.slice(0, indexOfEqualSign) argv.unshift(a.slice(indexOfEqualSign + 1)) @@ -87,18 +85,18 @@ function main () { } } - var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } + const options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } - versions = versions.map(function (v) { + versions = versions.map((v) => { return coerce ? (semver.coerce(v, options) || { version: v }).version : v - }).filter(function (v) { + }).filter((v) => { return semver.valid(v) }) if (!versions.length) return fail() if (inc && (versions.length !== 1 || range.length)) { return failInc() } - for (var i = 0, l = range.length; i < l; i++) { - versions = versions.filter(function (v) { + for (let i = 0, l = range.length; i < l; i++) { + versions = versions.filter((v) => { return semver.satisfies(v, range[i], options) }) if (!versions.length) return fail() @@ -106,69 +104,70 @@ function main () { return success(versions) } -function failInc () { + +const failInc = () => { console.error('--inc can only be used on a single version with no range') fail() } -function fail () { process.exit(1) } +const fail = () => process.exit(1) -function success () { - var compare = reverse ? 'rcompare' : 'compare' - versions.sort(function (a, b) { +const success = () => { + const compare = reverse ? 'rcompare' : 'compare' + versions.sort((a, b) => { return semver[compare](a, b, options) - }).map(function (v) { + }).map((v) => { return semver.clean(v, options) - }).map(function (v) { + }).map((v) => { return inc ? semver.inc(v, inc, options, identifier) : v - }).forEach(function (v, i, _) { console.log(v) }) + }).forEach((v, i, _) => { console.log(v) }) } -function help () { - console.log(['SemVer ' + version, - '', - 'A JavaScript implementation of the https://semver.org/ specification', - 'Copyright Isaac Z. Schlueter', - '', - 'Usage: semver [options] [ [...]]', - 'Prints valid versions sorted by SemVer precedence', - '', - 'Options:', - '-r --range ', - ' Print versions that match the specified range.', - '', - '-i --increment []', - ' Increment a version by the specified level. Level can', - ' be one of: major, minor, patch, premajor, preminor,', - " prepatch, or prerelease. Default level is 'patch'.", - ' Only one version may be specified.', - '', - '--preid ', - ' Identifier to be used to prefix premajor, preminor,', - ' prepatch or prerelease version increments.', - '', - '-l --loose', - ' Interpret versions and ranges loosely', - '', - '-p --include-prerelease', - ' Always include prerelease versions in range matching', - '', - '-c --coerce', - ' Coerce a string into SemVer if possible', - ' (does not imply --loose)', - '', - '--rtl', - ' Coerce version strings right to left', - '', - '--ltr', - ' Coerce version strings left to right (default)', - '', - 'Program exits successfully if any valid version satisfies', - 'all supplied ranges, and prints all satisfying versions.', - '', - 'If no satisfying versions are found, then exits failure.', - '', - 'Versions are printed in ascending order, so supplying', - 'multiple versions to the utility will just sort them.' - ].join('\n')) -} +const help = () => console.log( +`SemVer ${version} + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +--rtl + Coerce version strings right to left + +--ltr + Coerce version strings left to right (default) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them.`) + +main() diff --git a/node_modules/semver/classes/comparator.js b/node_modules/semver/classes/comparator.js new file mode 100644 index 00000000..3595792d --- /dev/null +++ b/node_modules/semver/classes/comparator.js @@ -0,0 +1,139 @@ +const ANY = Symbol('SemVer ANY') +// hoisted class for cyclic dependency +class Comparator { + static get ANY () { + return ANY + } + constructor (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) + } + + parse (comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + const m = comp.match(r) + + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`) + } + + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } + } + + toString () { + return this.value + } + + test (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY || version === ANY) { + return true + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + return cmp(version, this.operator, this.semver, this.options) + } + + intersects (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (this.operator === '') { + if (this.value === '') { + return true + } + return new Range(comp.value, options).test(this.value) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + return new Range(this.value, options).test(comp.semver) + } + + const sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + const sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + const sameSemVer = this.semver.version === comp.semver.version + const differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + const oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<') + const oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>') + + return ( + sameDirectionIncreasing || + sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || + oppositeDirectionsGreaterThan + ) + } +} + +module.exports = Comparator + +const {re, t} = require('../internal/re') +const cmp = require('../functions/cmp') +const debug = require('../internal/debug') +const SemVer = require('./semver') +const Range = require('./range') diff --git a/node_modules/semver/classes/index.js b/node_modules/semver/classes/index.js new file mode 100644 index 00000000..198b84d6 --- /dev/null +++ b/node_modules/semver/classes/index.js @@ -0,0 +1,5 @@ +module.exports = { + SemVer: require('./semver.js'), + Range: require('./range.js'), + Comparator: require('./comparator.js') +} diff --git a/node_modules/semver/classes/range.js b/node_modules/semver/classes/range.js new file mode 100644 index 00000000..83f89677 --- /dev/null +++ b/node_modules/semver/classes/range.js @@ -0,0 +1,463 @@ +// hoisted class for cyclic dependency +class Range { + constructor (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (range instanceof Range) { + if ( + range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease + ) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + // just put it in the set and return + this.raw = range.value + this.set = [[range]] + this.format() + return this + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First, split based on boolean or || + this.raw = range + this.set = range + .split(/\s*\|\|\s*/) + // map the range to a 2d array of comparators + .map(range => this.parseRange(range.trim())) + // throw out any comparator lists that are empty + // this generally means that it was not a valid range, which is allowed + // in loose mode, but will still throw if the WHOLE range is invalid. + .filter(c => c.length) + + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${range}`) + } + + this.format() + } + + format () { + this.range = this.set + .map((comps) => { + return comps.join(' ').trim() + }) + .join('||') + .trim() + return this.range + } + + toString () { + return this.range + } + + parseRange (range) { + const loose = this.options.loose + range = range.trim() + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, re[t.COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[t.CARETTRIM], caretTrimReplace) + + // normalize spaces + range = range.split(/\s+/).join(' ') + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + return range + .split(' ') + .map(comp => parseComparator(comp, this.options)) + .join(' ') + .split(/\s+/) + .map(comp => replaceGTE0(comp, this.options)) + // in loose mode, throw out any that are not valid comparators + .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true) + .map(comp => new Comparator(comp, this.options)) + } + + intersects (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some((thisComparators) => { + return ( + isSatisfiable(thisComparators, options) && + range.set.some((rangeComparators) => { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) + } + + // if ANY of the sets match ALL of its comparators, then pass + test (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false + } +} +module.exports = Range + +const Comparator = require('./comparator') +const debug = require('../internal/debug') +const SemVer = require('./semver') +const { + re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace +} = require('../internal/re') + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +const isSatisfiable = (comparators, options) => { + let result = true + const remainingComparators = comparators.slice() + let testComparator = remainingComparators.pop() + + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options) + }) + + testComparator = remainingComparators.pop() + } + + return result +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +const parseComparator = (comp, options) => { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +const isX = id => !id || id.toLowerCase() === 'x' || id === '*' + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 +const replaceTildes = (comp, options) => + comp.trim().split(/\s+/).map((comp) => { + return replaceTilde(comp, options) + }).join(' ') + +const replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + return comp.replace(r, (_, M, m, p, pr) => { + debug('tilde', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0` + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0-0 + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` + } else if (pr) { + debug('replaceTilde pr', pr) + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } else { + // ~1.2.3 == >=1.2.3 <1.3.0-0 + ret = `>=${M}.${m}.${p + } <${M}.${+m + 1}.0-0` + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 +// ^1.2.3 --> >=1.2.3 <2.0.0-0 +// ^1.2.0 --> >=1.2.0 <2.0.0-0 +const replaceCarets = (comp, options) => + comp.trim().split(/\s+/).map((comp) => { + return replaceCaret(comp, options) + }).join(' ') + +const replaceCaret = (comp, options) => { + debug('caret', comp, options) + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + const z = options.includePrerelease ? '-0' : '' + return comp.replace(r, (_, M, m, p, pr) => { + debug('caret', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` + } else if (isX(p)) { + if (M === '0') { + ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` + } else { + ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${+M + 1}.0.0-0` + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p + }${z} <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p + }${z} <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p + } <${+M + 1}.0.0-0` + } + } + + debug('caret return', ret) + return ret + }) +} + +const replaceXRanges = (comp, options) => { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map((comp) => { + return replaceXRange(comp, options) + }).join(' ') +} + +const replaceXRange = (comp, options) => { + comp = comp.trim() + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + const xM = isX(M) + const xm = xM || isX(m) + const xp = xm || isX(p) + const anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + if (gtlt === '<') + pr = '-0' + + ret = `${gtlt + M}.${m}.${p}${pr}` + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` + } else if (xp) { + ret = `>=${M}.${m}.0${pr + } <${M}.${+m + 1}.0-0` + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +const replaceStars = (comp, options) => { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[t.STAR], '') +} + +const replaceGTE0 = (comp, options) => { + debug('replaceGTE0', comp, options) + return comp.trim() + .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') +} + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 +const hyphenReplace = incPr => ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) => { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? '-0' : ''}` + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` + } else if (fpr) { + from = `>=${from}` + } else { + from = `>=${from}${incPr ? '-0' : ''}` + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0` + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0` + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}` + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0` + } else { + to = `<=${to}` + } + + return (`${from} ${to}`).trim() +} + +const testSet = (set, version, options) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (let i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === Comparator.ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} diff --git a/node_modules/semver/classes/semver.js b/node_modules/semver/classes/semver.js new file mode 100644 index 00000000..73247ad2 --- /dev/null +++ b/node_modules/semver/classes/semver.js @@ -0,0 +1,290 @@ +const debug = require('../internal/debug') +const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants') +const { re, t } = require('../internal/re') + +const { compareIdentifiers } = require('../internal/identifiers') +class SemVer { + constructor (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === !!options.loose && + version.includePrerelease === !!options.includePrerelease) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError(`Invalid Version: ${version}`) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError( + `version is longer than ${MAX_LENGTH} characters` + ) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + // this isn't actually relevant for versions, but keep it so that we + // don't run into trouble passing this.options around. + this.includePrerelease = !!options.includePrerelease + + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + + if (!m) { + throw new TypeError(`Invalid Version: ${version}`) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() + } + + format () { + this.version = `${this.major}.${this.minor}.${this.patch}` + if (this.prerelease.length) { + this.version += `-${this.prerelease.join('.')}` + } + return this.version + } + + toString () { + return this.version + } + + compare (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + if (typeof other === 'string' && other === this.version) { + return 0 + } + other = new SemVer(other, this.options) + } + + if (other.version === this.version) { + return 0 + } + + return this.compareMain(other) || this.comparePre(other) + } + + compareMain (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return ( + compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) + ) + } + + comparePre (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + let i = 0 + do { + const a = this.prerelease[i] + const b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + compareBuild (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + let i = 0 + do { + const a = this.build[i] + const b = other.build[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if ( + this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0 + ) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + let i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break + + default: + throw new Error(`invalid increment argument: ${release}`) + } + this.format() + this.raw = this.version + return this + } +} + +module.exports = SemVer diff --git a/node_modules/semver/functions/clean.js b/node_modules/semver/functions/clean.js new file mode 100644 index 00000000..811fe6b8 --- /dev/null +++ b/node_modules/semver/functions/clean.js @@ -0,0 +1,6 @@ +const parse = require('./parse') +const clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} +module.exports = clean diff --git a/node_modules/semver/functions/cmp.js b/node_modules/semver/functions/cmp.js new file mode 100644 index 00000000..3b89db77 --- /dev/null +++ b/node_modules/semver/functions/cmp.js @@ -0,0 +1,48 @@ +const eq = require('./eq') +const neq = require('./neq') +const gt = require('./gt') +const gte = require('./gte') +const lt = require('./lt') +const lte = require('./lte') + +const cmp = (a, op, b, loose) => { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError(`Invalid operator: ${op}`) + } +} +module.exports = cmp diff --git a/node_modules/semver/functions/coerce.js b/node_modules/semver/functions/coerce.js new file mode 100644 index 00000000..106ca71c --- /dev/null +++ b/node_modules/semver/functions/coerce.js @@ -0,0 +1,51 @@ +const SemVer = require('../classes/semver') +const parse = require('./parse') +const {re, t} = require('../internal/re') + +const coerce = (version, options) => { + if (version instanceof SemVer) { + return version + } + + if (typeof version === 'number') { + version = String(version) + } + + if (typeof version !== 'string') { + return null + } + + options = options || {} + + let match = null + if (!options.rtl) { + match = version.match(re[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + let next + while ((next = re[t.COERCERTL].exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + re[t.COERCERTL].lastIndex = -1 + } + + if (match === null) + return null + + return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options) +} +module.exports = coerce diff --git a/node_modules/semver/functions/compare-build.js b/node_modules/semver/functions/compare-build.js new file mode 100644 index 00000000..9eb881be --- /dev/null +++ b/node_modules/semver/functions/compare-build.js @@ -0,0 +1,7 @@ +const SemVer = require('../classes/semver') +const compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose) + const versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} +module.exports = compareBuild diff --git a/node_modules/semver/functions/compare-loose.js b/node_modules/semver/functions/compare-loose.js new file mode 100644 index 00000000..4881fbe0 --- /dev/null +++ b/node_modules/semver/functions/compare-loose.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const compareLoose = (a, b) => compare(a, b, true) +module.exports = compareLoose diff --git a/node_modules/semver/functions/compare.js b/node_modules/semver/functions/compare.js new file mode 100644 index 00000000..748b7afa --- /dev/null +++ b/node_modules/semver/functions/compare.js @@ -0,0 +1,5 @@ +const SemVer = require('../classes/semver') +const compare = (a, b, loose) => + new SemVer(a, loose).compare(new SemVer(b, loose)) + +module.exports = compare diff --git a/node_modules/semver/functions/diff.js b/node_modules/semver/functions/diff.js new file mode 100644 index 00000000..87200ef3 --- /dev/null +++ b/node_modules/semver/functions/diff.js @@ -0,0 +1,23 @@ +const parse = require('./parse') +const eq = require('./eq') + +const diff = (version1, version2) => { + if (eq(version1, version2)) { + return null + } else { + const v1 = parse(version1) + const v2 = parse(version2) + const hasPre = v1.prerelease.length || v2.prerelease.length + const prefix = hasPre ? 'pre' : '' + const defaultResult = hasPre ? 'prerelease' : '' + for (const key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} +module.exports = diff diff --git a/node_modules/semver/functions/eq.js b/node_modules/semver/functions/eq.js new file mode 100644 index 00000000..271fed97 --- /dev/null +++ b/node_modules/semver/functions/eq.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const eq = (a, b, loose) => compare(a, b, loose) === 0 +module.exports = eq diff --git a/node_modules/semver/functions/gt.js b/node_modules/semver/functions/gt.js new file mode 100644 index 00000000..d9b2156d --- /dev/null +++ b/node_modules/semver/functions/gt.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const gt = (a, b, loose) => compare(a, b, loose) > 0 +module.exports = gt diff --git a/node_modules/semver/functions/gte.js b/node_modules/semver/functions/gte.js new file mode 100644 index 00000000..5aeaa634 --- /dev/null +++ b/node_modules/semver/functions/gte.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const gte = (a, b, loose) => compare(a, b, loose) >= 0 +module.exports = gte diff --git a/node_modules/semver/functions/inc.js b/node_modules/semver/functions/inc.js new file mode 100644 index 00000000..aa4d83ab --- /dev/null +++ b/node_modules/semver/functions/inc.js @@ -0,0 +1,15 @@ +const SemVer = require('../classes/semver') + +const inc = (version, release, options, identifier) => { + if (typeof (options) === 'string') { + identifier = options + options = undefined + } + + try { + return new SemVer(version, options).inc(release, identifier).version + } catch (er) { + return null + } +} +module.exports = inc diff --git a/node_modules/semver/functions/lt.js b/node_modules/semver/functions/lt.js new file mode 100644 index 00000000..b440ab7d --- /dev/null +++ b/node_modules/semver/functions/lt.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const lt = (a, b, loose) => compare(a, b, loose) < 0 +module.exports = lt diff --git a/node_modules/semver/functions/lte.js b/node_modules/semver/functions/lte.js new file mode 100644 index 00000000..6dcc9565 --- /dev/null +++ b/node_modules/semver/functions/lte.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const lte = (a, b, loose) => compare(a, b, loose) <= 0 +module.exports = lte diff --git a/node_modules/semver/functions/major.js b/node_modules/semver/functions/major.js new file mode 100644 index 00000000..4283165e --- /dev/null +++ b/node_modules/semver/functions/major.js @@ -0,0 +1,3 @@ +const SemVer = require('../classes/semver') +const major = (a, loose) => new SemVer(a, loose).major +module.exports = major diff --git a/node_modules/semver/functions/minor.js b/node_modules/semver/functions/minor.js new file mode 100644 index 00000000..57b3455f --- /dev/null +++ b/node_modules/semver/functions/minor.js @@ -0,0 +1,3 @@ +const SemVer = require('../classes/semver') +const minor = (a, loose) => new SemVer(a, loose).minor +module.exports = minor diff --git a/node_modules/semver/functions/neq.js b/node_modules/semver/functions/neq.js new file mode 100644 index 00000000..f944c015 --- /dev/null +++ b/node_modules/semver/functions/neq.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const neq = (a, b, loose) => compare(a, b, loose) !== 0 +module.exports = neq diff --git a/node_modules/semver/functions/parse.js b/node_modules/semver/functions/parse.js new file mode 100644 index 00000000..457fee04 --- /dev/null +++ b/node_modules/semver/functions/parse.js @@ -0,0 +1,37 @@ +const {MAX_LENGTH} = require('../internal/constants') +const { re, t } = require('../internal/re') +const SemVer = require('../classes/semver') + +const parse = (version, options) => { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + const r = options.loose ? re[t.LOOSE] : re[t.FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +module.exports = parse diff --git a/node_modules/semver/functions/patch.js b/node_modules/semver/functions/patch.js new file mode 100644 index 00000000..63afca25 --- /dev/null +++ b/node_modules/semver/functions/patch.js @@ -0,0 +1,3 @@ +const SemVer = require('../classes/semver') +const patch = (a, loose) => new SemVer(a, loose).patch +module.exports = patch diff --git a/node_modules/semver/functions/prerelease.js b/node_modules/semver/functions/prerelease.js new file mode 100644 index 00000000..06aa1324 --- /dev/null +++ b/node_modules/semver/functions/prerelease.js @@ -0,0 +1,6 @@ +const parse = require('./parse') +const prerelease = (version, options) => { + const parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} +module.exports = prerelease diff --git a/node_modules/semver/functions/rcompare.js b/node_modules/semver/functions/rcompare.js new file mode 100644 index 00000000..0ac509e7 --- /dev/null +++ b/node_modules/semver/functions/rcompare.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const rcompare = (a, b, loose) => compare(b, a, loose) +module.exports = rcompare diff --git a/node_modules/semver/functions/rsort.js b/node_modules/semver/functions/rsort.js new file mode 100644 index 00000000..82404c5c --- /dev/null +++ b/node_modules/semver/functions/rsort.js @@ -0,0 +1,3 @@ +const compareBuild = require('./compare-build') +const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) +module.exports = rsort diff --git a/node_modules/semver/functions/satisfies.js b/node_modules/semver/functions/satisfies.js new file mode 100644 index 00000000..50af1c19 --- /dev/null +++ b/node_modules/semver/functions/satisfies.js @@ -0,0 +1,10 @@ +const Range = require('../classes/range') +const satisfies = (version, range, options) => { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} +module.exports = satisfies diff --git a/node_modules/semver/functions/sort.js b/node_modules/semver/functions/sort.js new file mode 100644 index 00000000..4d10917a --- /dev/null +++ b/node_modules/semver/functions/sort.js @@ -0,0 +1,3 @@ +const compareBuild = require('./compare-build') +const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) +module.exports = sort diff --git a/node_modules/semver/functions/valid.js b/node_modules/semver/functions/valid.js new file mode 100644 index 00000000..f27bae10 --- /dev/null +++ b/node_modules/semver/functions/valid.js @@ -0,0 +1,6 @@ +const parse = require('./parse') +const valid = (version, options) => { + const v = parse(version, options) + return v ? v.version : null +} +module.exports = valid diff --git a/node_modules/semver/index.js b/node_modules/semver/index.js new file mode 100644 index 00000000..57e2ae64 --- /dev/null +++ b/node_modules/semver/index.js @@ -0,0 +1,48 @@ +// just pre-load all the stuff that index.js lazily exports +const internalRe = require('./internal/re') +module.exports = { + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: require('./internal/constants').SEMVER_SPEC_VERSION, + SemVer: require('./classes/semver'), + compareIdentifiers: require('./internal/identifiers').compareIdentifiers, + rcompareIdentifiers: require('./internal/identifiers').rcompareIdentifiers, + parse: require('./functions/parse'), + valid: require('./functions/valid'), + clean: require('./functions/clean'), + inc: require('./functions/inc'), + diff: require('./functions/diff'), + major: require('./functions/major'), + minor: require('./functions/minor'), + patch: require('./functions/patch'), + prerelease: require('./functions/prerelease'), + compare: require('./functions/compare'), + rcompare: require('./functions/rcompare'), + compareLoose: require('./functions/compare-loose'), + compareBuild: require('./functions/compare-build'), + sort: require('./functions/sort'), + rsort: require('./functions/rsort'), + gt: require('./functions/gt'), + lt: require('./functions/lt'), + eq: require('./functions/eq'), + neq: require('./functions/neq'), + gte: require('./functions/gte'), + lte: require('./functions/lte'), + cmp: require('./functions/cmp'), + coerce: require('./functions/coerce'), + Comparator: require('./classes/comparator'), + Range: require('./classes/range'), + satisfies: require('./functions/satisfies'), + toComparators: require('./ranges/to-comparators'), + maxSatisfying: require('./ranges/max-satisfying'), + minSatisfying: require('./ranges/min-satisfying'), + minVersion: require('./ranges/min-version'), + validRange: require('./ranges/valid'), + outside: require('./ranges/outside'), + gtr: require('./ranges/gtr'), + ltr: require('./ranges/ltr'), + intersects: require('./ranges/intersects'), + simplifyRange: require('./ranges/simplify'), + subset: require('./ranges/subset'), +} diff --git a/node_modules/semver/internal/constants.js b/node_modules/semver/internal/constants.js new file mode 100644 index 00000000..49df215a --- /dev/null +++ b/node_modules/semver/internal/constants.js @@ -0,0 +1,17 @@ +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +const SEMVER_SPEC_VERSION = '2.0.0' + +const MAX_LENGTH = 256 +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +const MAX_SAFE_COMPONENT_LENGTH = 16 + +module.exports = { + SEMVER_SPEC_VERSION, + MAX_LENGTH, + MAX_SAFE_INTEGER, + MAX_SAFE_COMPONENT_LENGTH +} diff --git a/node_modules/semver/internal/debug.js b/node_modules/semver/internal/debug.js new file mode 100644 index 00000000..1c00e136 --- /dev/null +++ b/node_modules/semver/internal/debug.js @@ -0,0 +1,9 @@ +const debug = ( + typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG) +) ? (...args) => console.error('SEMVER', ...args) + : () => {} + +module.exports = debug diff --git a/node_modules/semver/internal/identifiers.js b/node_modules/semver/internal/identifiers.js new file mode 100644 index 00000000..ed130942 --- /dev/null +++ b/node_modules/semver/internal/identifiers.js @@ -0,0 +1,23 @@ +const numeric = /^[0-9]+$/ +const compareIdentifiers = (a, b) => { + const anum = numeric.test(a) + const bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) + +module.exports = { + compareIdentifiers, + rcompareIdentifiers +} diff --git a/node_modules/semver/internal/re.js b/node_modules/semver/internal/re.js new file mode 100644 index 00000000..54d4176d --- /dev/null +++ b/node_modules/semver/internal/re.js @@ -0,0 +1,182 @@ +const { MAX_SAFE_COMPONENT_LENGTH } = require('./constants') +const debug = require('./debug') +exports = module.exports = {} + +// The actual regexps go on exports.re +const re = exports.re = [] +const src = exports.src = [] +const t = exports.t = {} +let R = 0 + +const createToken = (name, value, isGlobal) => { + const index = R++ + debug(index, value) + t[name] = index + src[index] = value + re[index] = new RegExp(value, isGlobal ? 'g' : undefined) +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') +createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+') + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*') + +// ## Main Version +// Three dot-separated numeric identifiers. + +createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})`) + +createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})`) + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] +}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) + +createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] +}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+') + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] +}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +createToken('FULLPLAIN', `v?${src[t.MAINVERSION] +}${src[t.PRERELEASE]}?${ + src[t.BUILD]}?`) + +createToken('FULL', `^${src[t.FULLPLAIN]}$`) + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] +}${src[t.PRERELEASELOOSE]}?${ + src[t.BUILD]}?`) + +createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) + +createToken('GTLT', '((?:<|>)?=?)') + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) +createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) + +createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:${src[t.PRERELEASE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:${src[t.PRERELEASELOOSE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) +createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +createToken('COERCE', `${'(^|[^\\d])' + + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:$|[^\\d])`) +createToken('COERCERTL', src[t.COERCE], true) + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +createToken('LONETILDE', '(?:~>?)') + +createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) +exports.tildeTrimReplace = '$1~' + +createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) +createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +createToken('LONECARET', '(?:\\^)') + +createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) +exports.caretTrimReplace = '$1^' + +createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) +createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) +createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] +}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) +exports.comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAIN]})` + + `\\s*$`) + +createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAINLOOSE]})` + + `\\s*$`) + +// Star ranges basically just allow anything at all. +createToken('STAR', '(<|>)?=?\\s*\\*') +// >=0.0.0 is like a star +createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$') +createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$') diff --git a/node_modules/semver/package.json b/node_modules/semver/package.json index 13030769..9aa9bd2a 100644 --- a/node_modules/semver/package.json +++ b/node_modules/semver/package.json @@ -1,16 +1,17 @@ { "name": "semver", - "version": "6.3.0", + "version": "7.3.2", "description": "The semantic version parser used by npm.", - "main": "semver.js", + "main": "index.js", "scripts": { "test": "tap", + "snap": "tap", "preversion": "npm test", "postversion": "npm publish", "postpublish": "git push origin --follow-tags" }, "devDependencies": { - "tap": "^14.3.1" + "tap": "^14.10.7" }, "license": "ISC", "repository": "https://github.com/npm/node-semver", @@ -18,15 +19,24 @@ "semver": "./bin/semver.js" }, "files": [ - "bin", + "bin/**/*.js", "range.bnf", - "semver.js" + "classes/**/*.js", + "functions/**/*.js", + "internal/**/*.js", + "ranges/**/*.js", + "index.js", + "preload.js" ], "tap": { - "check-coverage": true + "check-coverage": true, + "coverage-map": "map.js" + }, + "engines": { + "node": ">=10" } -,"_resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz" -,"_integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" -,"_from": "semver@6.3.0" +,"_resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz" +,"_integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" +,"_from": "semver@7.3.2" } \ No newline at end of file diff --git a/node_modules/semver/preload.js b/node_modules/semver/preload.js new file mode 100644 index 00000000..947cd4f7 --- /dev/null +++ b/node_modules/semver/preload.js @@ -0,0 +1,2 @@ +// XXX remove in v8 or beyond +module.exports = require('./index.js') diff --git a/node_modules/semver/ranges/gtr.js b/node_modules/semver/ranges/gtr.js new file mode 100644 index 00000000..db7e3559 --- /dev/null +++ b/node_modules/semver/ranges/gtr.js @@ -0,0 +1,4 @@ +// Determine if version is greater than all the versions possible in the range. +const outside = require('./outside') +const gtr = (version, range, options) => outside(version, range, '>', options) +module.exports = gtr diff --git a/node_modules/semver/ranges/intersects.js b/node_modules/semver/ranges/intersects.js new file mode 100644 index 00000000..3d1a6f31 --- /dev/null +++ b/node_modules/semver/ranges/intersects.js @@ -0,0 +1,7 @@ +const Range = require('../classes/range') +const intersects = (r1, r2, options) => { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} +module.exports = intersects diff --git a/node_modules/semver/ranges/ltr.js b/node_modules/semver/ranges/ltr.js new file mode 100644 index 00000000..528a885e --- /dev/null +++ b/node_modules/semver/ranges/ltr.js @@ -0,0 +1,4 @@ +const outside = require('./outside') +// Determine if version is less than all the versions possible in the range +const ltr = (version, range, options) => outside(version, range, '<', options) +module.exports = ltr diff --git a/node_modules/semver/ranges/max-satisfying.js b/node_modules/semver/ranges/max-satisfying.js new file mode 100644 index 00000000..6e3d993c --- /dev/null +++ b/node_modules/semver/ranges/max-satisfying.js @@ -0,0 +1,25 @@ +const SemVer = require('../classes/semver') +const Range = require('../classes/range') + +const maxSatisfying = (versions, range, options) => { + let max = null + let maxSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} +module.exports = maxSatisfying diff --git a/node_modules/semver/ranges/min-satisfying.js b/node_modules/semver/ranges/min-satisfying.js new file mode 100644 index 00000000..9b60974e --- /dev/null +++ b/node_modules/semver/ranges/min-satisfying.js @@ -0,0 +1,24 @@ +const SemVer = require('../classes/semver') +const Range = require('../classes/range') +const minSatisfying = (versions, range, options) => { + let min = null + let minSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} +module.exports = minSatisfying diff --git a/node_modules/semver/ranges/min-version.js b/node_modules/semver/ranges/min-version.js new file mode 100644 index 00000000..7118d237 --- /dev/null +++ b/node_modules/semver/ranges/min-version.js @@ -0,0 +1,57 @@ +const SemVer = require('../classes/semver') +const Range = require('../classes/range') +const gt = require('../functions/gt') + +const minVersion = (range, loose) => { + range = new Range(range, loose) + + let minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + comparators.forEach((comparator) => { + // Clone to avoid manipulating the comparator's semver object. + const compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error(`Unexpected operation: ${comparator.operator}`) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} +module.exports = minVersion diff --git a/node_modules/semver/ranges/outside.js b/node_modules/semver/ranges/outside.js new file mode 100644 index 00000000..e35ed117 --- /dev/null +++ b/node_modules/semver/ranges/outside.js @@ -0,0 +1,80 @@ +const SemVer = require('../classes/semver') +const Comparator = require('../classes/comparator') +const {ANY} = Comparator +const Range = require('../classes/range') +const satisfies = require('../functions/satisfies') +const gt = require('../functions/gt') +const lt = require('../functions/lt') +const lte = require('../functions/lte') +const gte = require('../functions/gte') + +const outside = (version, range, hilo, options) => { + version = new SemVer(version, options) + range = new Range(range, options) + + let gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let high = null + let low = null + + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +module.exports = outside diff --git a/node_modules/semver/ranges/simplify.js b/node_modules/semver/ranges/simplify.js new file mode 100644 index 00000000..b792f972 --- /dev/null +++ b/node_modules/semver/ranges/simplify.js @@ -0,0 +1,44 @@ +// given a set of versions and a range, create a "simplified" range +// that includes the same versions that the original range does +// If the original range is shorter than the simplified one, return that. +const satisfies = require('../functions/satisfies.js') +const compare = require('../functions/compare.js') +module.exports = (versions, range, options) => { + const set = [] + let min = null + let prev = null + const v = versions.sort((a, b) => compare(a, b, options)) + for (const version of v) { + const included = satisfies(version, range, options) + if (included) { + prev = version + if (!min) + min = version + } else { + if (prev) { + set.push([min, prev]) + } + prev = null + min = null + } + } + if (min) + set.push([min, null]) + + const ranges = [] + for (const [min, max] of set) { + if (min === max) + ranges.push(min) + else if (!max && min === v[0]) + ranges.push('*') + else if (!max) + ranges.push(`>=${min}`) + else if (min === v[0]) + ranges.push(`<=${max}`) + else + ranges.push(`${min} - ${max}`) + } + const simplified = ranges.join(' || ') + const original = typeof range.raw === 'string' ? range.raw : String(range) + return simplified.length < original.length ? simplified : range +} diff --git a/node_modules/semver/ranges/subset.js b/node_modules/semver/ranges/subset.js new file mode 100644 index 00000000..6ae29a3c --- /dev/null +++ b/node_modules/semver/ranges/subset.js @@ -0,0 +1,155 @@ +const Range = require('../classes/range.js') +const { ANY } = require('../classes/comparator.js') +const satisfies = require('../functions/satisfies.js') +const compare = require('../functions/compare.js') + +// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: +// - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...` +// +// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: +// - If c is only the ANY comparator +// - If C is only the ANY comparator, return true +// - Else return false +// - Let EQ be the set of = comparators in c +// - If EQ is more than one, return true (null set) +// - Let GT be the highest > or >= comparator in c +// - Let LT be the lowest < or <= comparator in c +// - If GT and LT, and GT.semver > LT.semver, return true (null set) +// - If EQ +// - If GT, and EQ does not satisfy GT, return true (null set) +// - If LT, and EQ does not satisfy LT, return true (null set) +// - If EQ satisfies every C, return true +// - Else return false +// - If GT +// - If GT is lower than any > or >= comp in C, return false +// - If GT is >=, and GT.semver does not satisfy every C, return false +// - If LT +// - If LT.semver is greater than that of any > comp in C, return false +// - If LT is <=, and LT.semver does not satisfy every C, return false +// - If any C is a = range, and GT or LT are set, return false +// - Else return true + +const subset = (sub, dom, options) => { + sub = new Range(sub, options) + dom = new Range(dom, options) + let sawNonNull = false + + OUTER: for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options) + sawNonNull = sawNonNull || isSub !== null + if (isSub) + continue OUTER + } + // the null set is a subset of everything, but null simple ranges in + // a complex range should be ignored. so if we saw a non-null range, + // then we know this isn't a subset, but if EVERY simple range was null, + // then it is a subset. + if (sawNonNull) + return false + } + return true +} + +const simpleSubset = (sub, dom, options) => { + if (sub.length === 1 && sub[0].semver === ANY) + return dom.length === 1 && dom[0].semver === ANY + + const eqSet = new Set() + let gt, lt + for (const c of sub) { + if (c.operator === '>' || c.operator === '>=') + gt = higherGT(gt, c, options) + else if (c.operator === '<' || c.operator === '<=') + lt = lowerLT(lt, c, options) + else + eqSet.add(c.semver) + } + + if (eqSet.size > 1) + return null + + let gtltComp + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options) + if (gtltComp > 0) + return null + else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) + return null + } + + // will iterate one or zero times + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) + return null + + if (lt && !satisfies(eq, String(lt), options)) + return null + + for (const c of dom) { + if (!satisfies(eq, String(c), options)) + return false + } + return true + } + + let higher, lower + let hasDomLT, hasDomGT + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' + hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' + if (gt) { + if (c.operator === '>' || c.operator === '>=') { + higher = higherGT(gt, c, options) + if (higher === c) + return false + } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) + return false + } + if (lt) { + if (c.operator === '<' || c.operator === '<=') { + lower = lowerLT(lt, c, options) + if (lower === c) + return false + } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) + return false + } + if (!c.operator && (lt || gt) && gtltComp !== 0) + return false + } + + // if there was a < or >, and nothing in the dom, then must be false + // UNLESS it was limited by another range in the other direction. + // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 + if (gt && hasDomLT && !lt && gtltComp !== 0) + return false + + if (lt && hasDomGT && !gt && gtltComp !== 0) + return false + + return true +} + +// >=1.2.3 is lower than >1.2.3 +const higherGT = (a, b, options) => { + if (!a) + return b + const comp = compare(a.semver, b.semver, options) + return comp > 0 ? a + : comp < 0 ? b + : b.operator === '>' && a.operator === '>=' ? b + : a +} + +// <=1.2.3 is higher than <1.2.3 +const lowerLT = (a, b, options) => { + if (!a) + return b + const comp = compare(a.semver, b.semver, options) + return comp < 0 ? a + : comp > 0 ? b + : b.operator === '<' && a.operator === '<=' ? b + : a +} + +module.exports = subset diff --git a/node_modules/semver/ranges/to-comparators.js b/node_modules/semver/ranges/to-comparators.js new file mode 100644 index 00000000..6c8bc7e6 --- /dev/null +++ b/node_modules/semver/ranges/to-comparators.js @@ -0,0 +1,8 @@ +const Range = require('../classes/range') + +// Mostly just for testing and legacy API reasons +const toComparators = (range, options) => + new Range(range, options).set + .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) + +module.exports = toComparators diff --git a/node_modules/semver/ranges/valid.js b/node_modules/semver/ranges/valid.js new file mode 100644 index 00000000..365f3568 --- /dev/null +++ b/node_modules/semver/ranges/valid.js @@ -0,0 +1,11 @@ +const Range = require('../classes/range') +const validRange = (range, options) => { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} +module.exports = validRange diff --git a/node_modules/spdx-license-ids/deprecated.json b/node_modules/spdx-license-ids/deprecated.json index 1681f487..c7de0985 100644 --- a/node_modules/spdx-license-ids/deprecated.json +++ b/node_modules/spdx-license-ids/deprecated.json @@ -1,6 +1,8 @@ [ "AGPL-1.0", "AGPL-3.0", + "BSD-2-Clause-FreeBSD", + "BSD-2-Clause-NetBSD", "GFDL-1.1", "GFDL-1.2", "GFDL-1.3", diff --git a/node_modules/spdx-license-ids/index.json b/node_modules/spdx-license-ids/index.json index 5283c78d..de204732 100644 --- a/node_modules/spdx-license-ids/index.json +++ b/node_modules/spdx-license-ids/index.json @@ -35,9 +35,8 @@ "Artistic-2.0", "BSD-1-Clause", "BSD-2-Clause", - "BSD-2-Clause-FreeBSD", - "BSD-2-Clause-NetBSD", "BSD-2-Clause-Patent", + "BSD-2-Clause-Views", "BSD-3-Clause", "BSD-3-Clause-Attribution", "BSD-3-Clause-Clear", @@ -58,11 +57,14 @@ "BitTorrent-1.1", "BlueOak-1.0.0", "Borceux", + "CAL-1.0", + "CAL-1.0-Combined-Work-Exception", "CATOSL-1.1", "CC-BY-1.0", "CC-BY-2.0", "CC-BY-2.5", "CC-BY-3.0", + "CC-BY-3.0-AT", "CC-BY-4.0", "CC-BY-NC-1.0", "CC-BY-NC-2.0", @@ -73,6 +75,7 @@ "CC-BY-NC-ND-2.0", "CC-BY-NC-ND-2.5", "CC-BY-NC-ND-3.0", + "CC-BY-NC-ND-3.0-IGO", "CC-BY-NC-ND-4.0", "CC-BY-NC-SA-1.0", "CC-BY-NC-SA-2.0", @@ -88,6 +91,7 @@ "CC-BY-SA-2.0", "CC-BY-SA-2.5", "CC-BY-SA-3.0", + "CC-BY-SA-3.0-AT", "CC-BY-SA-4.0", "CC-PDDC", "CC0-1.0", @@ -103,6 +107,9 @@ "CECILL-C", "CERN-OHL-1.1", "CERN-OHL-1.2", + "CERN-OHL-P-2.0", + "CERN-OHL-S-2.0", + "CERN-OHL-W-2.0", "CNRI-Jython", "CNRI-Python", "CNRI-Python-GPL-Compatible", @@ -124,6 +131,7 @@ "ECL-2.0", "EFL-1.0", "EFL-2.0", + "EPICS", "EPL-1.0", "EPL-2.0", "EUDatagrid", @@ -140,13 +148,26 @@ "Fair", "Frameworx-1.0", "FreeImage", + "GFDL-1.1-invariants-only", + "GFDL-1.1-invariants-or-later", + "GFDL-1.1-no-invariants-only", + "GFDL-1.1-no-invariants-or-later", "GFDL-1.1-only", "GFDL-1.1-or-later", + "GFDL-1.2-invariants-only", + "GFDL-1.2-invariants-or-later", + "GFDL-1.2-no-invariants-only", + "GFDL-1.2-no-invariants-or-later", "GFDL-1.2-only", "GFDL-1.2-or-later", + "GFDL-1.3-invariants-only", + "GFDL-1.3-invariants-or-later", + "GFDL-1.3-no-invariants-only", + "GFDL-1.3-no-invariants-or-later", "GFDL-1.3-only", "GFDL-1.3-or-later", "GL2PS", + "GLWTPL", "GPL-1.0-only", "GPL-1.0-or-later", "GPL-2.0-only", @@ -159,6 +180,7 @@ "HPND", "HPND-sell-variant", "HaskellReport", + "Hippocratic-2.1", "IBM-pibs", "ICU", "IJG", @@ -214,12 +236,17 @@ "MakeIndex", "MirOS", "Motosoto", + "MulanPSL-1.0", + "MulanPSL-2.0", "Multics", "Mup", "NASA-1.3", "NBPL-1.0", + "NCGL-UK-2.0", "NCSA", "NGPL", + "NIST-PD", + "NIST-PD-fallback", "NLOD-1.0", "NLPL", "NOSL", @@ -228,18 +255,26 @@ "NPOSL-3.0", "NRL", "NTP", + "NTP-0", "Naumen", "Net-SNMP", "NetCDF", "Newsletr", "Nokia", "Noweb", + "O-UDA-1.0", "OCCT-PL", "OCLC-2.0", "ODC-By-1.0", "ODbL-1.0", "OFL-1.0", + "OFL-1.0-RFN", + "OFL-1.0-no-RFN", "OFL-1.1", + "OFL-1.1-RFN", + "OFL-1.1-no-RFN", + "OGC-1.0", + "OGL-Canada-2.0", "OGL-UK-1.0", "OGL-UK-2.0", "OGL-UK-3.0", @@ -272,8 +307,12 @@ "PDDL-1.0", "PHP-3.0", "PHP-3.01", + "PSF-2.0", "Parity-6.0.0", + "Parity-7.0.0", "Plexus", + "PolyForm-Noncommercial-1.0.0", + "PolyForm-Small-Business-1.0.0", "PostgreSQL", "Python-2.0", "QPL-1.0", @@ -299,6 +338,8 @@ "SMPPL", "SNIA", "SPL-1.0", + "SSH-OpenSSH", + "SSH-short", "SSPL-1.0", "SWL", "Saxpath", @@ -318,6 +359,7 @@ "TOSL", "TU-Berlin-1.0", "TU-Berlin-2.0", + "UCL-1.0", "UPL-1.0", "Unicode-DFS-2015", "Unicode-DFS-2016", @@ -356,10 +398,12 @@ "diffmark", "dvipdfm", "eGenix", + "etalab-2.0", "gSOAP-1.3b", "gnuplot", "iMatix", "libpng-2.0", + "libselinux-1.0", "libtiff", "mpich2", "psfrag", diff --git a/node_modules/spdx-license-ids/package.json b/node_modules/spdx-license-ids/package.json index 0aff08f2..edc136bd 100644 --- a/node_modules/spdx-license-ids/package.json +++ b/node_modules/spdx-license-ids/package.json @@ -1,8 +1,8 @@ { "name": "spdx-license-ids", - "version": "3.0.5", + "version": "3.0.6", "description": "A list of SPDX license identifiers", - "repository": "shinnn/spdx-license-ids", + "repository": "jslicense/spdx-license-ids", "author": "Shinnosuke Watanabe (https://github.com/shinnn)", "license": "CC0-1.0", "scripts": { @@ -37,7 +37,7 @@ "extends": "@shinnn" } -,"_resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz" -,"_integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==" -,"_from": "spdx-license-ids@3.0.5" +,"_resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz" +,"_integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==" +,"_from": "spdx-license-ids@3.0.6" } \ No newline at end of file diff --git a/node_modules/uglify-js/README.md b/node_modules/uglify-js/README.md index ec7457ab..ecc844b5 100644 --- a/node_modules/uglify-js/README.md +++ b/node_modules/uglify-js/README.md @@ -212,17 +212,16 @@ Example: To enable the mangler you need to pass `--mangle` (`-m`). The following (comma-separated) options are supported: -- `toplevel` (default `false`) -- mangle names declared in the top level scope. +- `eval` (default `false`) -- mangle names visible in scopes where `eval` or + `with` are used. -- `eval` (default `false`) -- mangle names visible in scopes where `eval` or `with` are used. +- `reserved` (default: `[]`) -- when mangling is enabled but you want to + prevent certain names from being mangled, you can declare those names with + `--mangle reserved` — pass a comma-separated list of names. For example: -When mangling is enabled but you want to prevent certain names from being -mangled, you can declare those names with `--mangle reserved` — pass a -comma-separated list of names. For example: + uglifyjs ... -m reserved=['$','require','exports'] - uglifyjs ... -m reserved=['$','require','exports'] - -to prevent the `require`, `exports` and `$` names from being changed. + to prevent the `require`, `exports` and `$` names from being changed. ### CLI mangling property names (`--mangle-props`) @@ -657,8 +656,8 @@ to be `false` and all symbol names will be omitted. - `hoist_props` (default: `true`) -- hoist properties from constant object and array literals into regular variables subject to a set of constraints. For example: `var o={p:1, q:2}; f(o.p, o.q);` is converted to `f(1, 2);`. Note: `hoist_props` - works best with `mangle` enabled, the `compress` option `passes` set to `2` or higher, - and the `compress` option `toplevel` enabled. + works best with `toplevel` and `mangle` enabled, alongside with `compress` option + `passes` set to `2` or higher. - `hoist_vars` (default: `false`) -- hoist `var` declarations (this is `false` by default because it seems to increase the size of the output in general) @@ -689,6 +688,8 @@ to be `false` and all symbol names will be omitted. - `loops` (default: `true`) -- optimizations for `do`, `while` and `for` loops when we can statically determine the condition. +- `merge_vars` (default: `true`) -- combine and reuse variables. + - `negate_iife` (default: `true`) -- negate "Immediately-Called Function Expressions" where the return value is discarded, to avoid the parens that the code generator would insert. @@ -783,6 +784,9 @@ to be `false` and all symbol names will be omitted. - `unused` (default: `true`) -- drop unreferenced functions and variables (simple direct variable assignments do not count as references unless set to `"keep_assign"`) +- `varify` (default: `true`) -- convert block-scoped declaractions into `var` + whenever safe to do so + ## Mangle options - `eval` (default `false`) -- Pass `true` to mangle names visible in scopes @@ -1157,3 +1161,19 @@ To allow for better optimizations, the compiler makes various assumptions: - Object properties can be added, removed and modified (not prevented with `Object.defineProperty()`, `Object.defineProperties()`, `Object.freeze()`, `Object.preventExtensions()` or `Object.seal()`). +- When `toplevel` is enabled, UglifyJS effectively assumes input code is wrapped + within `function(){ ... }`, thus forbids aliasing of declared global variables: + ```js + A = "FAIL"; + var B = "FAIL"; + // can be `global`, `self`, `window` etc. + var top = function() { + return this; + }(); + // "PASS" + top.A = "PASS"; + console.log(A); + // "FAIL" after compress and/or mangle + top.B = "PASS"; + console.log(B); + ``` diff --git a/node_modules/uglify-js/bin/uglifyjs b/node_modules/uglify-js/bin/uglifyjs index da2528d6..c6062657 100755 --- a/node_modules/uglify-js/bin/uglifyjs +++ b/node_modules/uglify-js/bin/uglifyjs @@ -342,7 +342,18 @@ function run() { } fatal(ex); } else if (output == "ast") { - if (!options.compress && !options.mangle) result.ast.figure_out_scope({}); + if (!options.compress && !options.mangle) { + var toplevel = result.ast; + if (!(toplevel instanceof UglifyJS.AST_Toplevel)) { + if (!(toplevel instanceof UglifyJS.AST_Statement)) toplevel = new UglifyJS.AST_SimpleStatement({ + body: toplevel, + }); + toplevel = new UglifyJS.AST_Toplevel({ + body: [ toplevel ], + }); + } + toplevel.figure_out_scope({}); + } print(JSON.stringify(result.ast, function(key, value) { if (value) switch (key) { case "thedef": diff --git a/node_modules/uglify-js/lib/ast.js b/node_modules/uglify-js/lib/ast.js index 31072a08..a87e9c58 100644 --- a/node_modules/uglify-js/lib/ast.js +++ b/node_modules/uglify-js/lib/ast.js @@ -120,6 +120,20 @@ var AST_Node = DEFNODE("Node", "start end", { ctor.prototype._validate.call(this); } while (ctor = ctor.BASE); }, + validate_ast: function() { + var marker = {}; + this.walk(new TreeWalker(function(node) { + if (node.validate_visited === marker) { + throw new Error(string_template("cannot reuse {type} from [{file}:{line},{col}]", { + type: "AST_" + node.TYPE, + file: node.start.file, + line: node.start.line, + col: node.start.col, + })); + } + node.validate_visited = marker; + })); + }, }, null); (AST_Node.log_function = function(fn, verbose) { @@ -189,6 +203,10 @@ var AST_Directive = DEFNODE("Directive", "value quote", { }, }, AST_Statement); +var AST_EmptyStatement = DEFNODE("EmptyStatement", null, { + $documentation: "The empty statement (empty block or simply a semicolon)" +}, AST_Statement); + function must_be_expression(node, prop) { if (!(node[prop] instanceof AST_Node)) throw new Error(prop + " must be AST_Node"); if (node[prop] instanceof AST_Statement && !(node[prop] instanceof AST_Function)) { @@ -212,6 +230,34 @@ var AST_SimpleStatement = DEFNODE("SimpleStatement", "body", { }, }, AST_Statement); +var AST_BlockScope = DEFNODE("BlockScope", "enclosed functions make_def parent_scope variables", { + $documentation: "Base class for all statements introducing a lexical scope", + $propdoc: { + enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes", + functions: "[Object/S] like `variables`, but only lists function declarations", + parent_scope: "[AST_Scope?/S] link to the parent scope", + variables: "[Object/S] a map of name -> SymbolDef for all variables/functions defined in this scope", + }, + clone: function(deep) { + var node = this._clone(deep); + if (this.enclosed) node.enclosed = this.enclosed.slice(); + if (this.functions) node.functions = this.functions.clone(); + if (this.variables) node.variables = this.variables.clone(); + return node; + }, + pinned: function() { + return this.resolve().pinned(); + }, + resolve: function() { + return this.parent_scope.resolve(); + }, + _validate: function() { + if (this.parent_scope == null) return; + if (!(this.parent_scope instanceof AST_BlockScope)) throw new Error("parent_scope must be AST_BlockScope"); + if (!(this.resolve() instanceof AST_Scope)) throw new Error("must be contained within AST_Scope"); + }, +}, AST_Statement); + function walk_body(node, visitor) { node.body.forEach(function(node) { node.walk(visitor); @@ -235,16 +281,12 @@ var AST_Block = DEFNODE("Block", "body", { if (node instanceof AST_Function) throw new Error("body cannot contain AST_Function"); }); }, -}, AST_Statement); +}, AST_BlockScope); var AST_BlockStatement = DEFNODE("BlockStatement", null, { $documentation: "A block statement", }, AST_Block); -var AST_EmptyStatement = DEFNODE("EmptyStatement", null, { - $documentation: "The empty statement (empty block or simply a semicolon)" -}, AST_Statement); - var AST_StatementWithBody = DEFNODE("StatementWithBody", "body", { $documentation: "Base class for all statements that contain one nested body: `For`, `ForIn`, `Do`, `While`, `With`", $propdoc: { @@ -254,7 +296,7 @@ var AST_StatementWithBody = DEFNODE("StatementWithBody", "body", { if (!(this.body instanceof AST_Statement)) throw new Error("body must be AST_Statement"); if (this.body instanceof AST_Function) throw new Error("body cannot be AST_Function"); }, -}, AST_Statement); +}, AST_BlockScope); var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", { $documentation: "Statement with a label", @@ -274,10 +316,13 @@ var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", { var label = node.label; var def = this.label; node.walk(new TreeWalker(function(node) { - if (node instanceof AST_LoopControl && node.label && node.label.thedef === def) { + if (node instanceof AST_LoopControl) { + if (!node.label || node.label.thedef !== def) return; node.label.thedef = label; label.references.push(node); + return true; } + if (node instanceof AST_Scope) return true; })); } return node; @@ -395,32 +440,16 @@ var AST_With = DEFNODE("With", "expression", { /* -----[ scope and functions ]----- */ -var AST_Scope = DEFNODE("Scope", "variables functions uses_with uses_eval parent_scope enclosed cname", { +var AST_Scope = DEFNODE("Scope", "uses_eval uses_with", { $documentation: "Base class for all statements introducing a lexical scope", $propdoc: { - variables: "[Object/S] a map of name -> SymbolDef for all variables/functions defined in this scope", - functions: "[Object/S] like `variables`, but only lists function declarations", - uses_with: "[boolean/S] tells whether this scope uses the `with` statement", uses_eval: "[boolean/S] tells whether this scope contains a direct call to the global `eval`", - parent_scope: "[AST_Scope?/S] link to the parent scope", - enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes", - cname: "[integer/S] current index for mangling variables (used internally by the mangler)", - }, - clone: function(deep) { - var node = this._clone(deep); - if (this.variables) node.variables = this.variables.clone(); - if (this.functions) node.functions = this.functions.clone(); - if (this.enclosed) node.enclosed = this.enclosed.slice(); - return node; + uses_with: "[boolean/S] tells whether this scope uses the `with` statement", }, pinned: function() { return this.uses_eval || this.uses_with; }, - _validate: function() { - if (this.parent_scope != null) { - if (!(this.parent_scope instanceof AST_Scope)) throw new Error("parent_scope must be AST_Scope"); - } - }, + resolve: return_this, }, AST_Block); var AST_Toplevel = DEFNODE("Toplevel", "globals", { @@ -614,6 +643,9 @@ var AST_Switch = DEFNODE("Switch", "expression", { }, _validate: function() { must_be_expression(this, "expression"); + this.body.forEach(function(node) { + if (!(node instanceof AST_SwitchBranch)) throw new Error("body must be AST_SwitchBranch[]"); + }); }, }, AST_Block); @@ -671,17 +703,19 @@ var AST_Try = DEFNODE("Try", "bcatch bfinally", { var AST_Catch = DEFNODE("Catch", "argname", { $documentation: "A `catch` node; only makes sense as part of a `try` statement", $propdoc: { - argname: "[AST_SymbolCatch] symbol for the exception" + argname: "[AST_SymbolCatch?] symbol for the exception, or null if not present", }, walk: function(visitor) { var node = this; visitor.visit(node, function() { - node.argname.walk(visitor); + if (node.argname) node.argname.walk(visitor); walk_body(node, visitor); }); }, _validate: function() { - if (!(this.argname instanceof AST_SymbolCatch)) throw new Error("argname must be AST_SymbolCatch"); + if (this.argname != null) { + if (!(this.argname instanceof AST_SymbolCatch)) throw new Error("argname must be AST_SymbolCatch"); + } }, }, AST_Block); @@ -703,14 +737,41 @@ var AST_Definitions = DEFNODE("Definitions", "definitions", { defn.walk(visitor); }); }); - } + }, + _validate: function() { + if (this.definitions.length < 1) throw new Error("must have at least one definition"); + }, }, AST_Statement); +var AST_Const = DEFNODE("Const", null, { + $documentation: "A `const` statement", + _validate: function() { + this.definitions.forEach(function(node) { + if (!(node instanceof AST_VarDef)) throw new Error("definitions must be AST_VarDef[]"); + if (!(node.name instanceof AST_SymbolConst)) throw new Error("name must be AST_SymbolConst"); + must_be_expression(node, "value"); + }); + }, +}, AST_Definitions); + +var AST_Let = DEFNODE("Let", null, { + $documentation: "A `let` statement", + _validate: function() { + this.definitions.forEach(function(node) { + if (!(node instanceof AST_VarDef)) throw new Error("definitions must be AST_VarDef[]"); + if (!(node.name instanceof AST_SymbolLet)) throw new Error("name must be AST_SymbolLet"); + if (node.value != null) must_be_expression(node, "value"); + }); + }, +}, AST_Definitions); + var AST_Var = DEFNODE("Var", null, { $documentation: "A `var` statement", _validate: function() { this.definitions.forEach(function(node) { if (!(node instanceof AST_VarDef)) throw new Error("definitions must be AST_VarDef[]"); + if (!(node.name instanceof AST_SymbolVar)) throw new Error("name must be AST_SymbolVar"); + if (node.value != null) must_be_expression(node, "value"); }); }, }, AST_Definitions); @@ -728,10 +789,6 @@ var AST_VarDef = DEFNODE("VarDef", "name value", { if (node.value) node.value.walk(visitor); }); }, - _validate: function() { - if (!(this.name instanceof AST_SymbolVar)) throw new Error("name must be AST_SymbolVar"); - if (this.value != null) must_be_expression(this, "value"); - }, }); /* -----[ OTHER ]----- */ @@ -997,12 +1054,12 @@ var AST_ObjectGetter = DEFNODE("ObjectGetter", null, { }, AST_ObjectProperty); var AST_Symbol = DEFNODE("Symbol", "scope name thedef", { + $documentation: "Base class for all symbols", $propdoc: { name: "[string] name of this symbol", scope: "[AST_Scope/S] the current scope (not necessarily the definition scope)", thedef: "[SymbolDef/S] the definition of this symbol" }, - $documentation: "Base class for all symbols", _validate: function() { if (typeof this.name != "string") throw new Error("name must be string"); }, @@ -1016,6 +1073,14 @@ var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "init", { $documentation: "A declaration symbol (symbol in var, function name or argument, symbol in catch)", }, AST_Symbol); +var AST_SymbolConst = DEFNODE("SymbolConst", null, { + $documentation: "Symbol defining a constant", +}, AST_SymbolDeclaration); + +var AST_SymbolLet = DEFNODE("SymbolLet", null, { + $documentation: "Symbol defining a lexical-scoped variable", +}, AST_SymbolDeclaration); + var AST_SymbolVar = DEFNODE("SymbolVar", null, { $documentation: "Symbol defining a variable", }, AST_SymbolDeclaration); diff --git a/node_modules/uglify-js/lib/compress.js b/node_modules/uglify-js/lib/compress.js index 0e11ba96..647c97e1 100644 --- a/node_modules/uglify-js/lib/compress.js +++ b/node_modules/uglify-js/lib/compress.js @@ -73,6 +73,7 @@ function Compressor(options, false_by_default) { keep_fnames : false, keep_infinity : false, loops : !false_by_default, + merge_vars : !false_by_default, negate_iife : !false_by_default, objects : !false_by_default, passes : 1, @@ -96,6 +97,7 @@ function Compressor(options, false_by_default) { unsafe_regexp : false, unsafe_undefined: false, unused : !false_by_default, + varify : !false_by_default, }, true); var evaluate = this.options["evaluate"]; this.eval_threshold = /eager/.test(evaluate) ? 1 / 0 : +evaluate; @@ -164,10 +166,12 @@ Compressor.prototype = new TreeTransformer; merge(Compressor.prototype, { option: function(key) { return this.options[key] }, exposed: function(def) { - if (def.global) for (var i = 0; i < def.orig.length; i++) - if (!this.toplevel[def.orig[i] instanceof AST_SymbolDefun ? "funcs" : "vars"]) - return true; - return false; + if (def.undeclared) return true; + if (!(def.global || def.scope.resolve() instanceof AST_Toplevel)) return false; + var toplevel = this.toplevel; + return !all(def.orig, function(sym) { + return toplevel[sym instanceof AST_SymbolDefun ? "funcs" : "vars"]; + }); }, compress: function(node) { node = node.resolve_defines(this); @@ -225,7 +229,8 @@ merge(Compressor.prototype, { // output and performance. descend(node, this); var opt = node.optimize(this); - if (is_scope && opt === node) { + if (is_scope && opt === node && !this.has_directive("use asm") && !opt.pinned()) { + opt.merge_variables(this); opt.drop_unused(this); descend(opt, this); } @@ -325,22 +330,22 @@ merge(Compressor.prototype, { } var lhs = is_lhs(node, parent); if (lhs) return lhs; - if (!immutable - && parent instanceof AST_Call - && parent.expression === node - && !parent.is_expr_pure(compressor) - && (!(value instanceof AST_Function) - || !(parent instanceof AST_New) && value.contains_this())) { - return true; - } - if (parent instanceof AST_Array) { - return is_modified(compressor, tw, parent, parent, level + 1); - } - if (parent instanceof AST_ObjectKeyVal && node === parent.value) { + if (parent instanceof AST_Array) return is_modified(compressor, tw, parent, parent, level + 1); + if (parent instanceof AST_Call) { + return !immutable + && parent.expression === node + && !parent.is_expr_pure(compressor) + && (!(value instanceof AST_Function) + || !(parent instanceof AST_New) && value.contains_this()); + } + if (parent instanceof AST_ForIn) return parent.init === node; + if (parent instanceof AST_ObjectKeyVal) { + if (parent.value !== node) return; var obj = tw.parent(level + 1); return is_modified(compressor, tw, obj, obj, level + 2); } - if (parent instanceof AST_PropAccess && parent.expression === node) { + if (parent instanceof AST_PropAccess) { + if (parent.expression !== node) return; var prop = read_property(value, parent); return (!immutable || recursive) && is_modified(compressor, tw, parent, prop, level + 1); } @@ -352,6 +357,13 @@ merge(Compressor.prototype, { return orig.length == 1 && orig[0] instanceof AST_SymbolFunarg; } + function cross_scope(def, sym) { + do { + if (def === sym) return false; + if (sym instanceof AST_Scope) return true; + } while (sym = sym.parent_scope); + } + (function(def) { def(AST_Node, noop); @@ -361,15 +373,16 @@ merge(Compressor.prototype, { def.cross_loop = false; def.direct_access = false; def.escaped = []; - def.fixed = !def.scope.pinned() + def.fixed = !def.const_redefs + && !def.scope.pinned() && !compressor.exposed(def) && !(def.init instanceof AST_Function && def.init !== def.scope) && def.init; if (def.fixed instanceof AST_Defun && !all(def.references, function(ref) { - var scope = ref.scope; + var scope = ref.scope.resolve(); do { if (def.scope === scope) return true; - } while (scope instanceof AST_Function && (scope = scope.parent_scope)); + } while (scope instanceof AST_Function && (scope = scope.parent_scope.resolve())); })) { tw.defun_ids[def.id] = false; } @@ -472,8 +485,13 @@ merge(Compressor.prototype, { return def.fixed instanceof AST_Defun; } - function safe_to_assign(tw, def) { - if (def.fixed === undefined) return true; + function safe_to_assign(tw, def, declare) { + if (!(declare || all(def.orig, function(sym) { + return !(sym instanceof AST_SymbolConst); + }))) return false; + if (def.fixed === undefined) return declare || all(def.orig, function(sym) { + return !(sym instanceof AST_SymbolLet); + }); if (def.fixed === null && def.safe_ids) { def.safe_ids[def.id] = false; delete def.safe_ids; @@ -504,6 +522,7 @@ merge(Compressor.prototype, { function ref_once(compressor, def) { return compressor.option("unused") && !def.scope.pinned() + && def.single_use !== false && def.references.length - def.recursive_refs == 1; } @@ -514,33 +533,41 @@ merge(Compressor.prototype, { || value instanceof AST_This; } + function has_escaped(d, node, parent) { + if (parent instanceof AST_Assign) return parent.operator == "=" && parent.right === node; + if (parent instanceof AST_Call) return parent.expression !== node || parent instanceof AST_New; + if (parent instanceof AST_Exit) return parent.value === node && node.scope !== d.scope; + if (parent instanceof AST_VarDef) return parent.value === node; + } + + function value_in_use(node, parent) { + if (parent instanceof AST_Array) return true; + if (parent instanceof AST_Binary) return lazy_op[parent.operator]; + if (parent instanceof AST_Conditional) return parent.condition !== node; + if (parent instanceof AST_Sequence) return parent.tail_node() === node; + } + function mark_escaped(tw, d, scope, node, value, level, depth) { var parent = tw.parent(level); if (value && value.is_constant()) return; - if (parent instanceof AST_Assign && parent.operator == "=" && node === parent.right - || parent instanceof AST_Call && (node !== parent.expression || parent instanceof AST_New) - || parent instanceof AST_Exit && node === parent.value && node.scope !== d.scope - || parent instanceof AST_VarDef && node === parent.value) { + if (has_escaped(d, node, parent)) { d.escaped.push(parent); if (depth > 1 && !(value && value.is_constant_expression(scope))) depth = 1; if (!d.escaped.depth || d.escaped.depth > depth) d.escaped.depth = depth; return; - } else if (parent instanceof AST_Array - || parent instanceof AST_Binary && lazy_op[parent.operator] - || parent instanceof AST_Conditional && node !== parent.condition - || parent instanceof AST_Sequence && node === parent.tail_node()) { + } else if (value_in_use(node, parent)) { mark_escaped(tw, d, scope, parent, parent, level + 1, depth); - } else if (parent instanceof AST_ObjectKeyVal && node === parent.value) { + } else if (parent instanceof AST_ObjectKeyVal && parent.value === node) { var obj = tw.parent(level + 1); mark_escaped(tw, d, scope, obj, obj, level + 2, depth); - } else if (parent instanceof AST_PropAccess && node === parent.expression) { + } else if (parent instanceof AST_PropAccess && parent.expression === node) { value = read_property(value, parent); mark_escaped(tw, d, scope, parent, value, level + 1, depth + 1); if (value) return; } if (level > 0) return; - if (parent instanceof AST_Call && node === parent.expression) return; - if (parent instanceof AST_Sequence && node !== parent.tail_node()) return; + if (parent instanceof AST_Call && parent.expression === node) return; + if (parent instanceof AST_Sequence && parent.tail_node() !== node) return; if (parent instanceof AST_SimpleStatement) return; if (parent instanceof AST_Unary && !unary_side_effects[parent.operator]) return; d.direct_access = true; @@ -554,13 +581,6 @@ merge(Compressor.prototype, { if (is_arguments(def) && node.property instanceof AST_Number) def.reassigned = true; } - var suppressor = new TreeWalker(function(node) { - if (!(node instanceof AST_Symbol)) return; - var d = node.definition(); - if (!d) return; - if (node instanceof AST_SymbolRef) push_ref(d, node); - d.fixed = false; - }); def(AST_Accessor, function(tw, descend, compressor) { push(tw); reset_variables(tw, compressor, this); @@ -587,7 +607,10 @@ merge(Compressor.prototype, { d.assignments++; var fixed = d.fixed; var value = eq ? node.right : node; - if (is_modified(compressor, tw, node, value, 0)) return; + if (is_modified(compressor, tw, node, value, 0)) { + d.fixed = false; + return; + } var safe = eq || safe_to_read(tw, d); node.right.walk(tw); if (safe && safe_to_assign(tw, d)) { @@ -600,6 +623,7 @@ merge(Compressor.prototype, { return node.right; }; } else { + if (d.single_use) d.single_use = false; sym.fixed = d.fixed = function() { return make_node(AST_Binary, node, { operator: node.operator.slice(0, -1), @@ -639,6 +663,11 @@ merge(Compressor.prototype, { pop(tw); return true; }); + def(AST_BlockScope, function(tw, descend, compressor) { + this.variables.each(function(def) { + reset_def(tw, compressor, def); + }); + }); def(AST_Call, function(tw, descend) { tw.find_parent(AST_Scope).may_call_this(); var exp = this.expression; @@ -665,15 +694,6 @@ merge(Compressor.prototype, { exp.left.definition().bool_fn++; } }); - def(AST_Case, function(tw) { - push(tw); - this.expression.walk(tw); - pop(tw); - push(tw); - walk_body(this, tw); - pop(tw); - return true; - }); def(AST_Conditional, function(tw) { this.condition.walk(tw); push(tw); @@ -684,12 +704,6 @@ merge(Compressor.prototype, { pop(tw); return true; }); - def(AST_Default, function(tw, descend) { - push(tw); - descend(); - pop(tw); - return true; - }); def(AST_Defun, function(tw, descend, compressor) { var id = this.name.definition().id; if (tw.defun_visited[id]) return true; @@ -708,7 +722,7 @@ merge(Compressor.prototype, { tw.in_loop = this; push(tw); this.body.walk(tw); - if (has_break_or_continue(this, tw.parent())) { + if (has_loop_control(this, tw.parent())) { pop(tw); push(tw); } @@ -717,7 +731,10 @@ merge(Compressor.prototype, { tw.in_loop = saved_loop; return true; }); - def(AST_For, function(tw) { + def(AST_For, function(tw, descend, compressor) { + this.variables.each(function(def) { + reset_def(tw, compressor, def); + }); if (this.init) this.init.walk(tw); var saved_loop = tw.in_loop; tw.in_loop = this; @@ -725,7 +742,7 @@ merge(Compressor.prototype, { if (this.condition) this.condition.walk(tw); this.body.walk(tw); if (this.step) { - if (has_break_or_continue(this, tw.parent())) { + if (has_loop_control(this, tw.parent())) { pop(tw); push(tw); } @@ -735,12 +752,21 @@ merge(Compressor.prototype, { tw.in_loop = saved_loop; return true; }); - def(AST_ForIn, function(tw) { - this.init.walk(suppressor); + def(AST_ForIn, function(tw, descend, compressor) { + this.variables.each(function(def) { + reset_def(tw, compressor, def); + }); this.object.walk(tw); var saved_loop = tw.in_loop; tw.in_loop = this; push(tw); + var init = this.init; + init.walk(tw); + if (init instanceof AST_SymbolRef) { + init.definition().fixed = false; + } else if (init instanceof AST_Var) { + init.definitions[0].name.definition().fixed = false; + } this.body.walk(tw); pop(tw); tw.in_loop = saved_loop; @@ -773,6 +799,7 @@ merge(Compressor.prototype, { var j = fn.argnames.indexOf(arg); return (j < 0 ? value : iife.args[j]) || make_node(AST_Undefined, iife); }; + d.fixed.assigns = [ arg ]; } else { d.fixed = false; } @@ -809,6 +836,30 @@ merge(Compressor.prototype, { pop(tw); return true; }); + def(AST_Switch, function(tw, descend, compressor) { + this.variables.each(function(def) { + reset_def(tw, compressor, def); + }); + this.expression.walk(tw); + var first = true; + this.body.forEach(function(branch) { + if (branch instanceof AST_Default) return; + branch.expression.walk(tw); + if (first) { + first = false; + push(tw); + } + }) + if (!first) pop(tw); + walk_body(this, tw); + return true; + }); + def(AST_SwitchBranch, function(tw) { + push(tw); + walk_body(this, tw); + pop(tw); + return true; + }); def(AST_SymbolCatch, function() { this.definition().fixed = false; }); @@ -820,11 +871,13 @@ merge(Compressor.prototype, { && d.orig[0] instanceof AST_SymbolDefun) { tw.loop_ids[d.id] = tw.in_loop; } - var value; - if (d.fixed === undefined || !safe_to_read(tw, d)) { + if (d.fixed === false) { + var redef = d.redefined(); + if (redef && cross_scope(d.scope, this.scope)) redef.single_use = false; + } else if (d.fixed === undefined || !safe_to_read(tw, d)) { d.fixed = false; } else if (d.fixed) { - value = this.fixed_value(); + var value = this.fixed_value(); var recursive = recursive_ref(tw, d); if (recursive) { d.recursive_refs++; @@ -834,7 +887,7 @@ merge(Compressor.prototype, { && !value.pinned() && (!d.in_loop || tw.parent() instanceof AST_Call) || !d.in_loop - && d.scope === this.scope + && d.scope === this.scope.resolve() && value.is_constant_expression(); } else { d.single_use = false; @@ -870,7 +923,10 @@ merge(Compressor.prototype, { walk_defuns(tw, this); return true; }); - def(AST_Try, function(tw) { + def(AST_Try, function(tw, descend, compressor) { + this.variables.each(function(def) { + reset_def(tw, compressor, def); + }); push(tw); walk_body(this, tw); pop(tw); @@ -896,6 +952,7 @@ merge(Compressor.prototype, { if (safe_to_read(tw, d) && safe_to_assign(tw, d)) { push_ref(d, exp); mark(tw, d); + if (d.single_use) d.single_use = false; d.fixed = function() { return make_node(AST_Binary, node, { operator: node.operator.slice(0, -1), @@ -932,13 +989,14 @@ merge(Compressor.prototype, { if (!node.value) return; descend(); var d = node.name.definition(); - if (safe_to_assign(tw, d)) { + if (safe_to_assign(tw, d, true)) { mark(tw, d); tw.loop_ids[d.id] = tw.in_loop; d.fixed = function() { return node.value; }; d.fixed.assigns = [ node ]; + if (node.name instanceof AST_SymbolConst && d.redefined()) d.single_use = false; } else { d.fixed = false; } @@ -997,6 +1055,13 @@ merge(Compressor.prototype, { return sym instanceof AST_SymbolLambda && def.scope.name === sym; }); + function find_scope(compressor) { + var level = 0, node; + while (node = compressor.parent(level++)) { + if (node.variables) return node; + } + } + function is_lhs_read_only(lhs, compressor) { if (lhs instanceof AST_This) return true; if (lhs instanceof AST_SymbolRef) { @@ -1016,18 +1081,6 @@ merge(Compressor.prototype, { return false; } - function find_variable(compressor, name) { - var scope, i = 0; - while (scope = compressor.parent(i++)) { - if (scope instanceof AST_Scope) break; - if (scope instanceof AST_Catch) { - scope = scope.argname.definition().scope; - break; - } - } - return scope.find_variable(name); - } - function make_node(ctor, orig, props) { if (!props) props = {}; if (orig) { @@ -1088,11 +1141,14 @@ merge(Compressor.prototype, { // func(something) because that changes the meaning of // the func (becomes lexical instead of global). function maintain_this_binding(compressor, parent, orig, val) { - if (parent instanceof AST_UnaryPrefix && parent.operator == "delete" - || parent.TYPE == "Call" && parent.expression === orig && needs_unbinding(compressor, val)) { - return make_sequence(orig, [ make_node(AST_Number, orig, { value: 0 }), val ]); - } - return val; + var wrap = false; + if (parent.TYPE == "Call") { + wrap = parent.expression === orig && needs_unbinding(compressor, val); + } else if (parent instanceof AST_UnaryPrefix) { + wrap = parent.operator == "delete" + || parent.operator == "typeof" && is_undeclared_ref(val); + } + return wrap ? make_sequence(orig, [ make_node(AST_Number, orig, { value: 0 }), val ]) : val; } function merge_sequence(array, node) { @@ -1168,6 +1224,16 @@ merge(Compressor.prototype, { || node instanceof AST_Undefined; } + function declarations_only(node) { + return all(node.definitions, function(var_def) { + return !var_def.value; + }); + } + + function is_declaration(stat) { + return stat instanceof AST_Defun || stat instanceof AST_Var && declarations_only(stat); + } + function tighten_body(statements, compressor) { var in_loop, in_try, scope; find_loop_scope_try(); @@ -1197,7 +1263,9 @@ merge(Compressor.prototype, { function find_loop_scope_try() { var node = compressor.self(), level = 0; do { - if (node instanceof AST_Catch || node instanceof AST_Finally) { + if (node instanceof AST_Catch) { + if (!compressor.parent(level).bfinally) level++; + } else if (node instanceof AST_Finally) { level++; } else if (node instanceof AST_IterationStatement) { in_loop = true; @@ -1279,7 +1347,7 @@ merge(Compressor.prototype, { col: node.start.col }); if (candidate instanceof AST_UnaryPostfix) { - lhs.definition().fixed = false; + if (lhs instanceof AST_SymbolRef) lhs.definition().fixed = false; return make_node(AST_UnaryPrefix, candidate, candidate); } if (candidate instanceof AST_VarDef) { @@ -1379,6 +1447,7 @@ merge(Compressor.prototype, { var scan_lhs = lhs && !side_effects && !is_lhs_read_only(lhs, compressor); var scan_rhs = foldable(candidate); if (!scan_lhs && !scan_rhs) continue; + var read_toplevel = false; var modify_toplevel = false; // Locate symbols which may execute code outside of scanning range var lvalues = get_lvalues(candidate); @@ -1432,9 +1501,23 @@ merge(Compressor.prototype, { } function handle_custom_scan_order(node, tt) { + if (!(node instanceof AST_BlockScope)) return; // Skip (non-executed) functions if (node instanceof AST_Scope) return node; - // Scan case expressions first in a switch statement + // Stop upon collision with block-scoped variables + if (!(node.variables && node.variables.all(function(def) { + return !lvalues.has(def.name); + }))) { + abort = true; + return node; + } + // Scan object only in a for-in statement + if (node instanceof AST_ForIn) { + node.object = node.object.transform(tt); + abort = true; + return node; + } + // Scan first case expression only in a switch statement if (node instanceof AST_Switch) { node.expression = node.expression.transform(tt); for (var i = 0; !abort && i < node.body.length; i++) { @@ -1467,7 +1550,7 @@ merge(Compressor.prototype, { } if (node instanceof AST_Debugger) return true; if (node instanceof AST_Defun) return funarg && lhs.name === node.name.name; - if (node instanceof AST_IterationStatement) return !(node instanceof AST_For); + if (node instanceof AST_DWLoop) return true; if (node instanceof AST_LoopControl) return true; if (node instanceof AST_Try) return true; if (node instanceof AST_With) return true; @@ -1531,9 +1614,13 @@ merge(Compressor.prototype, { } if (node instanceof AST_SymbolRef) { if (symbol_in_lvalues(node, parent)) { - return !parent || parent.operator != "=" || parent.left !== node; + return !(parent instanceof AST_Assign && parent.operator == "=" && parent.left === node); } - return side_effects && may_modify(node); + if (side_effects && may_modify(node)) return true; + var def = node.definition(); + return (in_try || def.scope.resolve() !== scope) && !all(def.orig, function(sym) { + return !(sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet); + }); } if (node instanceof AST_This) return symbol_in_lvalues(node, parent); if (node instanceof AST_VarDef) { @@ -1541,8 +1628,9 @@ merge(Compressor.prototype, { return lvalues.has(node.name.name) || side_effects && may_modify(node.name); } var sym = is_lhs(node.left, node); - if (sym && lvalues.has(sym.name)) return true; if (sym instanceof AST_PropAccess) return true; + if (!(sym instanceof AST_SymbolRef)) return false; + return lvalues.has(sym.name) || read_toplevel && compressor.exposed(sym.definition()); } function extract_args() { @@ -1618,8 +1706,6 @@ merge(Compressor.prototype, { extract_candidates(expr.condition); extract_candidates(expr.consequent); extract_candidates(expr.alternative); - } else if (expr instanceof AST_Definitions) { - expr.definitions.forEach(extract_candidates); } else if (expr instanceof AST_Dot) { extract_candidates(expr.expression); } else if (expr instanceof AST_DWLoop) { @@ -1673,6 +1759,8 @@ merge(Compressor.prototype, { } else { extract_candidates(expr.expression); } + } else if (expr instanceof AST_Var) { + expr.definitions.forEach(extract_candidates); } else if (expr instanceof AST_VarDef) { if (expr.value) { var def = expr.name.definition(); @@ -1825,7 +1913,9 @@ merge(Compressor.prototype, { if (parent instanceof AST_SimpleStatement) return find_stop_unused(parent, level + 1); if (parent instanceof AST_Switch) return find_stop_unused(parent, level + 1); if (parent instanceof AST_Unary) return find_stop_unused(parent, level + 1); - if (parent instanceof AST_VarDef) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_VarDef) { + return may_throw(parent) ? node : find_stop_unused(parent, level + 1); + } return null; } @@ -1844,6 +1934,7 @@ merge(Compressor.prototype, { function get_lhs(expr) { if (expr instanceof AST_VarDef) { var def = expr.name.definition(); + if (def.const_redefs) return; if (!member(expr.name, def.orig)) return; var declared = def.orig.length - def.eliminated - (declare_only[def.name] || 0); var referenced = def.references.length - def.replaced - (assignments[def.name] || 0); @@ -1883,6 +1974,7 @@ merge(Compressor.prototype, { } function foldable(expr) { + if (expr instanceof AST_Assign && expr.right.single_use) return; var lhs_ids = Object.create(null); var marker = new TreeWalker(function(node) { if (node instanceof AST_SymbolRef) lhs_ids[node.definition().id] = true; @@ -1929,19 +2021,21 @@ merge(Compressor.prototype, { }; } + function may_be_global(node) { + if (node instanceof AST_SymbolRef) { + node = node.fixed_value(); + if (!node) return true; + } + if (node instanceof AST_Assign) return node.operator == "=" && may_be_global(node.right); + return node instanceof AST_PropAccess || node instanceof AST_This; + } + function get_lvalues(expr) { var lvalues = new Dictionary(); - if (candidate instanceof AST_VarDef) lvalues.add(candidate.name.name, lhs); - var scan_iife = scope instanceof AST_Toplevel; + if (expr instanceof AST_VarDef) lvalues.add(expr.name.name, lhs); + var find_arguments = scope.uses_arguments && !compressor.has_directive("use strict"); + var scan_toplevel = scope instanceof AST_Toplevel; var tw = new TreeWalker(function(node) { - if (scan_iife && node.TYPE == "Call") { - var exp = node.expression; - if (exp instanceof AST_PropAccess) return; - if (exp instanceof AST_Function && !exp.contains_this()) return; - modify_toplevel = true; - scan_iife = false; - return; - } var value; if (node instanceof AST_SymbolRef) { value = node.fixed_value() || node; @@ -1949,6 +2043,28 @@ merge(Compressor.prototype, { value = node; } if (value) lvalues.add(node.name, is_modified(compressor, tw, node, value, 0)); + if (find_arguments && node instanceof AST_Sub) { + scope.argnames.forEach(function(argname) { + if (!compressor.option("reduce_vars") || argname.definition().assignments) { + lvalues.add(argname.name, true); + } + }); + find_arguments = false; + } + if (!scan_toplevel) return; + if (node.TYPE == "Call") { + if (modify_toplevel) return; + var exp = node.expression; + if (exp instanceof AST_PropAccess) return; + if (exp instanceof AST_Function && !exp.contains_this()) return; + modify_toplevel = true; + } else if (node instanceof AST_PropAccess && may_be_global(node.expression)) { + if (node === lhs && !(expr instanceof AST_Unary)) { + modify_toplevel = true; + } else { + read_toplevel = true; + } + } }); expr.walk(tw); return lvalues; @@ -1958,9 +2074,12 @@ merge(Compressor.prototype, { if (expr.name instanceof AST_SymbolFunarg) { var index = compressor.self().argnames.indexOf(expr.name); var args = compressor.parent().args; - if (args[index]) args[index] = make_node(AST_Number, args[index], { - value: 0 - }); + if (args[index]) { + args[index] = make_node(AST_Number, args[index], { + value: 0 + }); + expr.name.definition().fixed = false; + } return true; } var end = hit_stack.length - 1; @@ -2061,29 +2180,39 @@ merge(Compressor.prototype, { for (var i = 0; i < statements.length;) { var stat = statements[i]; if (stat instanceof AST_BlockStatement) { - CHANGED = true; - eliminate_spurious_blocks(stat.body); - [].splice.apply(statements, [i, 1].concat(stat.body)); - i += stat.body.length; - } else if (stat instanceof AST_EmptyStatement) { - CHANGED = true; - statements.splice(i, 1); - } else if (stat instanceof AST_Directive) { - if (!member(stat.value, seen_dirs)) { - i++; - seen_dirs.push(stat.value); - } else { + if (all(stat.body, function(stat) { + return !(stat instanceof AST_Const || stat instanceof AST_Let); + })) { + CHANGED = true; + eliminate_spurious_blocks(stat.body); + [].splice.apply(statements, [i, 1].concat(stat.body)); + i += stat.body.length; + continue; + } + } + if (stat instanceof AST_Directive) { + if (member(stat.value, seen_dirs)) { CHANGED = true; statements.splice(i, 1); + continue; } - } else i++; + seen_dirs.push(stat.value); + } + if (stat instanceof AST_EmptyStatement) { + CHANGED = true; + statements.splice(i, 1); + continue; + } + i++; } } function handle_if_return(statements, compressor) { var self = compressor.self(); var parent = compressor.parent(); - var in_lambda = self instanceof AST_Lambda; + var in_lambda = last_of(function(node) { + return node instanceof AST_Lambda; + }); var in_iife = in_lambda && parent && parent.TYPE == "Call"; var multiple_if_returns = has_multiple_if_returns(statements); for (var i = statements.length; --i >= 0;) { @@ -2186,7 +2315,7 @@ merge(Compressor.prototype, { } //--- // if (foo()) return x; return y; => return foo() ? x : y; - if ((in_bool || value) && !stat.alternative && next instanceof AST_Return) { + if (!stat.alternative && next instanceof AST_Return) { CHANGED = true; stat = stat.clone(); stat.alternative = next; @@ -2247,12 +2376,39 @@ merge(Compressor.prototype, { return !value || value instanceof AST_UnaryPrefix && value.operator == "void"; } + function is_last_statement(body, stat) { + var index = body.lastIndexOf(stat); + if (index < 0) return false; + while (++index < body.length) { + if (!is_declaration(body[index])) return false; + } + return true; + } + + function last_of(predicate) { + var block = self, stat, level = 0; + do { + do { + if (predicate(block)) return true; + block = compressor.parent(level++); + } while (block instanceof AST_If && (stat = block)); + } while ((block instanceof AST_BlockStatement || block instanceof AST_Scope) + && is_last_statement(block.body, stat)); + } + + function match_target(target) { + return last_of(function(node) { + return node === target; + }); + } + function can_merge_flow(ab) { - if (!ab) return false; - var lct = ab instanceof AST_LoopControl ? compressor.loopcontrol_target(ab) : null; - return ab instanceof AST_Return && in_lambda && is_return_void(ab.value) - || ab instanceof AST_Continue && self === loop_body(lct) - || ab instanceof AST_Break && lct instanceof AST_BlockStatement && self === lct; + if (ab instanceof AST_Return) return in_lambda && is_return_void(ab.value); + if (!(ab instanceof AST_LoopControl)) return false; + var lct = compressor.loopcontrol_target(ab); + if (ab instanceof AST_Continue) return match_target(loop_body(lct)); + if (lct instanceof AST_IterationStatement) return false; + return match_target(lct); } function extract_functions() { @@ -2268,31 +2424,28 @@ merge(Compressor.prototype, { } function as_statement_array_with_return(node, ab) { - var body = as_statement_array(node).slice(0, -1); - if (ab.value) { - body.push(make_node(AST_SimpleStatement, ab.value, { - body: ab.value.expression - })); - } + var body = as_statement_array(node); + var block = body, last; + while ((last = block[block.length - 1]) !== ab) { + block = last.body; + } + block.pop(); + if (ab.value) body.push(make_node(AST_SimpleStatement, ab.value, { + body: ab.value.expression + })); return body; } function next_index(i) { for (var j = i + 1; j < statements.length; j++) { - var stat = statements[j]; - if (!(stat instanceof AST_Var && declarations_only(stat))) { - break; - } + if (!is_declaration(statements[j])) break; } return j; } function prev_index(i) { for (var j = i; --j >= 0;) { - var stat = statements[j]; - if (!(stat instanceof AST_Var && declarations_only(stat))) { - break; - } + if (!is_declaration(statements[j])) break; } return j; } @@ -2325,13 +2478,7 @@ merge(Compressor.prototype, { statements.length = n; CHANGED = n != len; if (has_quit) has_quit.forEach(function(stat) { - extract_declarations_from_unreachable_code(stat, statements); - }); - } - - function declarations_only(node) { - return all(node.definitions, function(var_def) { - return !var_def.value; + extract_declarations_from_unreachable_code(compressor, stat, statements); }); } @@ -2351,8 +2498,7 @@ merge(Compressor.prototype, { var body = stat.body; if (seq.length > 0) body = body.drop_side_effect_free(compressor); if (body) merge_sequence(seq, body); - } else if (stat instanceof AST_Definitions && declarations_only(stat) - || stat instanceof AST_Defun) { + } else if (is_declaration(stat)) { statements[n++] = stat; } else { push_seq(); @@ -2371,7 +2517,7 @@ merge(Compressor.prototype, { var line = block.body[i]; if (line instanceof AST_Var && declarations_only(line)) { decls.push(line); - } else if (stat) { + } else if (stat || line instanceof AST_Const || line instanceof AST_Let) { return false; } else { stat = line; @@ -2476,7 +2622,7 @@ merge(Compressor.prototype, { if (merge_conditional_assignments(def, exprs, keep)) trimmed = true; break; } - if (join_var_assign(defn.definitions, exprs, keep)) trimmed = true; + if (defn instanceof AST_Var && join_var_assign(defn.definitions, exprs, keep)) trimmed = true; } return trimmed && exprs; } @@ -2504,7 +2650,7 @@ merge(Compressor.prototype, { var lhs = expr.left; if (!(lhs instanceof AST_SymbolRef)) break; if (is_undeclared_ref(lhs)) break; - if (lhs.scope !== scope) break; + if (lhs.scope.resolve() !== scope) break; var def = lhs.definition(); if (def.scope !== scope) break; if (def.orig.length > def.eliminated + 1) break; @@ -2570,7 +2716,7 @@ merge(Compressor.prototype, { CHANGED = true; } else { statements[++j] = stat; - defs = stat; + if (stat instanceof AST_Var) defs = stat; } continue; } else if (stat instanceof AST_Exit) { @@ -2592,10 +2738,18 @@ merge(Compressor.prototype, { defs.definitions = defs.definitions.concat(stat.init.definitions); stat.init = null; CHANGED = true; - } else if (stat.init instanceof AST_Definitions) { + } else if (stat.init instanceof AST_Var) { defs = stat.init; } } else if (stat instanceof AST_ForIn) { + if (defs && defs.TYPE == stat.init.TYPE) { + defs.definitions = defs.definitions.concat(stat.init.definitions); + var name = stat.init.definitions[0].name; + var ref = make_node(AST_SymbolRef, name, name); + name.definition().references.push(ref); + stat.init = ref; + CHANGED = true; + } stat.object = join_assigns_expr(stat.object); } else if (stat instanceof AST_If) { stat.condition = join_assigns_expr(stat.condition); @@ -2644,25 +2798,46 @@ merge(Compressor.prototype, { } } - function extract_declarations_from_unreachable_code(stat, target) { + function extract_declarations_from_unreachable_code(compressor, stat, target) { if (!(stat instanceof AST_Defun)) { AST_Node.warn("Dropping unreachable code [{file}:{line},{col}]", stat.start); } - stat.walk(new TreeWalker(function(node) { + var block; + stat.walk(new TreeWalker(function(node, descend) { if (node instanceof AST_Definitions) { AST_Node.warn("Declarations in unreachable code! [{file}:{line},{col}]", node.start); - node.remove_initializers(); - target.push(node); + node.remove_initializers(compressor); + push(node); return true; } if (node instanceof AST_Defun) { - target.push(node); + push(node); return true; } - if (node instanceof AST_Scope) { + if (node instanceof AST_Scope) return true; + if (node instanceof AST_BlockScope) { + var save = block; + block = []; + descend(); + if (block.required) { + target.push(make_node(AST_BlockStatement, stat, { + body: block + })); + } else if (block.length) { + [].push.apply(target, block); + } + block = save; return true; } })); + function push(node) { + if (block) { + block.push(node); + if (node instanceof AST_Const || node instanceof AST_Let) block.required = true; + } else { + target.push(node); + } + } } function is_undefined(node, compressor) { @@ -2815,9 +2990,15 @@ merge(Compressor.prototype, { var fixed = this.fixed_value(); if (!fixed) return true; this._dot_throw = return_true; - var result = fixed._dot_throw(compressor); - delete this._dot_throw; - return result; + if (fixed._dot_throw(compressor)) { + delete this._dot_throw; + return true; + } + this._dot_throw = return_false; + return false; + }); + def(AST_This, function(compressor) { + return is_strict(compressor) && !this.scope.new; }); def(AST_UnaryPrefix, function() { return this.operator == "void"; @@ -3012,7 +3193,12 @@ merge(Compressor.prototype, { (function(def) { def(AST_Node, return_false); def(AST_Assign, function(compressor) { - return (this.operator == "=" || this.operator == "+=") && this.right.is_string(compressor); + switch (this.operator) { + case "+=": + if (this.left.is_string(compressor)) return true; + case "=": + return this.right.is_string(compressor); + } }); def(AST_Binary, function(compressor) { return this.operator == "+" && @@ -3065,7 +3251,7 @@ merge(Compressor.prototype, { (function(def) { function to_node(value, orig) { - if (value instanceof AST_Node) return make_node(value.CTOR, orig, value); + if (value instanceof AST_Node) return value.clone(true); if (Array.isArray(value)) return make_node(AST_Array, orig, { elements: value.map(function(value) { return to_node(value, orig); @@ -3114,11 +3300,11 @@ merge(Compressor.prototype, { return this.expression._find_defs(compressor, "." + this.property + suffix); }); def(AST_SymbolDeclaration, function(compressor) { - if (!this.global()) return; + if (!this.definition().global) return; if (HOP(compressor.option("global_defs"), this.name)) warn(this); }); def(AST_SymbolRef, function(compressor, suffix) { - if (!this.global()) return; + if (!this.definition().global) return; var defines = compressor.option("global_defs"); var name = this.name + suffix; if (HOP(defines, name)) return to_node(defines[name], this); @@ -3337,7 +3523,7 @@ merge(Compressor.prototype, { }); } var value = node._eval(compressor, ignore_side_effects, cached, depth); - if (value === node) return this; + if (typeof value == "object") return this; modified(lhs); return value; }); @@ -3463,7 +3649,8 @@ merge(Compressor.prototype, { var left = this.left._eval(compressor, ignore_side_effects, cached, depth); if (left === this.left) return this; if (this.operator == (left ? "||" : "&&")) return left; - var right = this.right._eval(compressor, ignore_side_effects, cached, depth); + var rhs_ignore_side_effects = ignore_side_effects && !(left && typeof left == "object"); + var right = this.right._eval(compressor, rhs_ignore_side_effects, cached, depth); if (right === this.right) return this; var result; switch (this.operator) { @@ -3530,6 +3717,7 @@ merge(Compressor.prototype, { escaped[0].walk(new TreeWalker(function(node) { if (found) return true; if (node === ref) return found = true; + if (node instanceof AST_Scope) return true; })); return found; default: @@ -3621,6 +3809,8 @@ merge(Compressor.prototype, { if (fn.evaluating) return this; if (fn.name && fn.name.definition().recursive_refs > 0) return this; if (this.is_expr_pure(compressor)) return this; + var args = eval_args(this.args); + if (!args && !ignore_side_effects) return this; var stat = fn.first_statement(); if (!(stat instanceof AST_Return)) { if (ignore_side_effects) { @@ -3628,7 +3818,9 @@ merge(Compressor.prototype, { fn.walk(new TreeWalker(function(node) { if (found) return true; if (node instanceof AST_Return) { - if (node.value && node.value.evaluate(compressor, true) !== undefined) found = true; + if (node.value && node.value._eval(compressor, true, cached, depth) !== undefined) { + found = true; + } return true; } if (node instanceof AST_Scope && node !== fn) return true; @@ -3637,8 +3829,6 @@ merge(Compressor.prototype, { } return this; } - var args = eval_args(this.args); - if (!args && !ignore_side_effects) return this; var val = stat.value; if (!val) return; var cached_args = []; @@ -3799,7 +3989,8 @@ merge(Compressor.prototype, { if (is_undeclared_ref(expr) && global_pure_fns[expr.name]) return true; if (expr instanceof AST_Dot && is_undeclared_ref(expr.expression)) { var static_fn = static_fns[expr.expression.name]; - return static_fn && static_fn[expr.property]; + return static_fn && (static_fn[expr.property] + || expr.expression.name == "Math" && expr.property == "random"); } } return this.pure || !compressor.pure_funcs(this); @@ -3844,7 +4035,15 @@ merge(Compressor.prototype, { def(AST_Array, function(compressor) { return any(this.elements, compressor); }); - def(AST_Assign, return_true); + def(AST_Assign, function(compressor) { + var lhs = this.left; + if (!(lhs instanceof AST_PropAccess)) return true; + var node = lhs.expression; + return !(node instanceof AST_This) + || !node.scope.new + || lhs instanceof AST_Sub && lhs.property.has_side_effects(compressor) + || this.right.has_side_effects(compressor); + }); def(AST_Binary, function(compressor) { return this.left.has_side_effects(compressor) || this.right.has_side_effects(compressor) @@ -3910,7 +4109,9 @@ merge(Compressor.prototype, { }); def(AST_SymbolDeclaration, return_false); def(AST_SymbolRef, function(compressor) { - return !this.is_declared(compressor); + return !(this.is_declared(compressor) && all(this.definition().orig, function(sym) { + return !(sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet); + })); }); def(AST_This, return_false); def(AST_Try, function(compressor) { @@ -4065,13 +4266,7 @@ merge(Compressor.prototype, { var scopes = []; self.walk(new TreeWalker(function(node, descend) { if (!result) return true; - if (node instanceof AST_Catch) { - scopes.push(node.argname.scope); - descend(); - scopes.pop(); - return true; - } - if (node instanceof AST_Scope) { + if (node instanceof AST_BlockScope) { if (node === self) return; scopes.push(node); descend(); @@ -4079,14 +4274,14 @@ merge(Compressor.prototype, { return true; } if (node instanceof AST_SymbolRef) { - if (self.inlined) { + if (self.inlined || node.redef) { result = false; return true; } if (self.variables.has(node.name)) return true; var def = node.definition(); if (member(def.scope, scopes)) return true; - if (scope) { + if (scope && !def.redefined()) { var scope_def = scope.find_variable(node); if (def.undeclared ? !scope_def : scope_def === def) { result = "f"; @@ -4163,13 +4358,20 @@ merge(Compressor.prototype, { return self; }); + function trim_block(node) { + switch (node.body.length) { + case 0: + return make_node(AST_EmptyStatement, node); + case 1: + var stat = node.body[0]; + if (!(stat instanceof AST_Const || stat instanceof AST_Let)) return stat; + } + return node; + } + OPT(AST_BlockStatement, function(self, compressor) { self.body = tighten_body(self.body, compressor); - switch (self.body.length) { - case 1: return self.body[0]; - case 0: return make_node(AST_EmptyStatement, self); - } - return self; + return trim_block(self); }); OPT(AST_Function, function(self, compressor) { @@ -4226,100 +4428,411 @@ merge(Compressor.prototype, { return self; }); - AST_Scope.DEFMETHOD("drop_unused", function(compressor) { - if (!compressor.option("unused")) return; - if (compressor.has_directive("use asm")) return; - var self = this; - if (self.pinned()) return; - var drop_funcs = !(self instanceof AST_Toplevel) || compressor.toplevel.funcs; - var drop_vars = !(self instanceof AST_Toplevel) || compressor.toplevel.vars; - var assign_as_unused = /keep_assign/.test(compressor.option("unused")) ? return_false : function(node, props) { - var sym; + AST_Scope.DEFMETHOD("merge_variables", function(compressor) { + if (!compressor.option("merge_vars")) return; + var self = this, segment = {}, root; + var first = [], last = [], index = 0; + var declarations = new Dictionary(); + var references = Object.create(null); + var prev = Object.create(null); + var tw = new TreeWalker(function(node, descend) { if (node instanceof AST_Assign) { - if (node.write_only || node.operator == "=") sym = node.left; - } else if (node instanceof AST_Unary) { - if (node.write_only) sym = node.expression; + var sym = node.left; + if (!(sym instanceof AST_SymbolRef)) return; + if (node.operator != "=") mark(sym, true, false); + node.right.walk(tw); + mark(sym, false, true); + return true; } - if (/strict/.test(compressor.option("pure_getters"))) { - while (sym instanceof AST_PropAccess && !sym.expression.may_throw_on_access(compressor)) { - if (sym instanceof AST_Sub) props.unshift(sym.property); - sym = sym.expression; - } + if (node instanceof AST_Binary) { + if (!lazy_op[node.operator]) return; + node.left.walk(tw); + push(); + node.right.walk(tw); + pop(); + return true; } - if (!(sym instanceof AST_SymbolRef)) return; - if (compressor.exposed(sym.definition())) return; - if (!all(sym.definition().orig, function(sym) { - return !(sym instanceof AST_SymbolLambda); - })) return; - return sym; - }; - var assign_in_use = Object.create(null); - var in_use = []; - var in_use_ids = Object.create(null); // avoid expensive linear scans of in_use - var value_read = Object.create(null); - var value_modified = Object.create(null); - if (self instanceof AST_Toplevel && compressor.top_retain) { - self.variables.each(function(def) { - if (compressor.top_retain(def) && !(def.id in in_use_ids)) { - in_use_ids[def.id] = true; - in_use.push(def); - } - }); - } - var assignments = new Dictionary(); - var var_defs_by_id = new Dictionary(); - var initializations = new Dictionary(); - // pass 1: find out which symbols are directly used in - // this scope (not in nested scopes). - var scope = this; - var tw = new TreeWalker(function(node, descend) { - if (node instanceof AST_Lambda && node.uses_arguments && !tw.has_directive("use strict")) { - node.argnames.forEach(function(argname) { - var def = argname.definition(); - if (!(def.id in in_use_ids)) { - in_use_ids[def.id] = true; - in_use.push(def); - } + if (node instanceof AST_Conditional) { + node.condition.walk(tw); + push(); + node.consequent.walk(tw); + pop(); + push(); + node.alternative.walk(tw); + pop(); + return true; + } + if (node instanceof AST_Const) { + node.definitions.forEach(function(defn) { + references[defn.name.definition().id] = false; + defn.value.walk(tw); }); + return true; } - if (node === self) return; - if (node instanceof AST_Defun) { - var node_def = node.name.definition(); - if (!drop_funcs && scope === self) { - if (!(node_def.id in in_use_ids)) { - in_use_ids[node_def.id] = true; - in_use.push(node_def); - } + if (node instanceof AST_Continue) { + var target = tw.loopcontrol_target(node); + if (!(target instanceof AST_Do)) return true; + var stack = []; + while (!HOP(segment, "block") || segment.block !== target) { + stack.push(segment); + pop(); + } + segment.loop = "c"; + push(); + while (stack.length) { + var seg = stack.pop(); + push(); + if (HOP(seg, "block")) segment.block = seg.block; + if (HOP(seg, "loop")) segment.loop = seg.loop; } - initializations.add(node_def.id, node); - return true; // don't go in nested scopes + return true; } - if (node instanceof AST_SymbolFunarg && scope === self) { - var_defs_by_id.add(node.definition().id, node); + if (node instanceof AST_Do) { + push(); + segment.block = node; + segment.loop = true; + var save = segment; + node.body.walk(tw); + if (segment.loop == "c") segment = save; + node.condition.walk(tw); + pop(); + return true; } - if (node instanceof AST_Definitions && scope === self) { - node.definitions.forEach(function(def) { - var node_def = def.name.definition(); - var_defs_by_id.add(node_def.id, def); - if (!drop_vars) { - if (!(node_def.id in in_use_ids)) { - in_use_ids[node_def.id] = true; - in_use.push(node_def); - } - } - if (def.value) { - if (def.value.has_side_effects(compressor)) { - def.value.walk(tw); - } else { - initializations.add(node_def.id, def.value); - } - assignments.add(node_def.id, def); - } + if (node instanceof AST_For) { + if (node.init) node.init.walk(tw); + push(); + segment.block = node; + segment.loop = true; + if (node.condition) node.condition.walk(tw); + node.body.walk(tw); + if (node.step) node.step.walk(tw); + pop(); + return true; + } + if (node instanceof AST_ForIn) { + node.object.walk(tw); + push(); + segment.block = node; + segment.loop = true; + node.init.walk(tw); + node.body.walk(tw); + pop(); + return true; + } + if (node instanceof AST_If) { + node.condition.walk(tw); + push(); + node.body.walk(tw); + pop(); + if (node.alternative) { + push(); + node.alternative.walk(tw); + pop(); + } + return true; + } + if (node instanceof AST_LabeledStatement) { + push(); + segment.block = node; + node.body.walk(tw); + pop(); + return true; + } + if (node instanceof AST_Let) { + node.definitions.forEach(function(defn) { + references[defn.name.definition().id] = false; + if (defn.value) defn.value.walk(tw); + }); + return true; + } + if (node instanceof AST_Scope) { + push(); + segment.block = node; + if (node === self) root = segment; + if (node instanceof AST_Lambda) { + if (node.name) references[node.name.definition().id] = false; + if (node.uses_arguments && !tw.has_directive("use strict")) node.argnames.forEach(function(node) { + references[node.definition().id] = false; + }); + } + descend(); + pop(); + return true; + } + if (node instanceof AST_Switch) { + node.expression.walk(tw); + var save = segment; + node.body.forEach(function(branch) { + if (branch instanceof AST_Default) return; + branch.expression.walk(tw); + if (save === segment) push(); + }); + segment = save; + node.body.forEach(function(branch) { + push(); + walk_body(branch, tw); + pop(); }); return true; } + if (node instanceof AST_SymbolFunarg) { + if (!node.__unused) mark(node, false, true); + return true; + } + if (node instanceof AST_SymbolRef) { + mark(node, true, false); + return true; + } + if (node instanceof AST_Try) { + push(); + segment.block = node; + walk_body(node, tw); + pop(); + if (node.bcatch) { + if (node.bcatch.argname) { + var def = node.bcatch.argname.definition(); + references[def.id] = false; + if (def = def.redefined()) references[def.id] = false; + } + push(); + if (node.bfinally) segment.block = node.bcatch; + walk_body(node.bcatch, tw); + pop(); + } + if (node.bfinally) node.bfinally.walk(tw); + return true; + } + if (node instanceof AST_Unary) { + if (!unary_arithmetic[node.operator]) return; + var sym = node.expression; + if (!(sym instanceof AST_SymbolRef)) return; + mark(sym, true, true); + return true; + } + if (node instanceof AST_VarDef) { + if (node.value) { + node.value.walk(tw); + mark(node.name, false, true); + } else { + var id = node.name.definition().id; + if (!(id in references)) { + declarations.add(id, node.name); + } else if (references[id]) { + references[id].push(node.name); + } + } + return true; + } + if (node instanceof AST_While) { + push(); + segment.block = node; + segment.loop = true; + descend(); + pop(); + return true; + } + }); + tw.directives = Object.create(compressor.directives); + self.walk(tw); + var merged = Object.create(null); + while (first.length && last.length) { + var head = first.pop(); + var def = head.definition; + if (!(def.id in prev)) continue; + if (!references[def.id]) continue; + var head_refs = { + start: references[def.id].start, + }; + while (def.id in merged) def = merged[def.id]; + head_refs.end = references[def.id].end; + var skipped = []; + do { + var tail = last.pop(); + if (!tail) continue; + if (tail.index > head.index) continue; + var id = tail.definition.id; + var tail_refs = references[id]; + if (!tail_refs) continue; + if (head_refs.start.block !== tail_refs.start.block + || !mergeable(head_refs, tail_refs) + || head_refs.start.loop && !mergeable(tail_refs, head_refs) + || !all(tail_refs, function(sym) { + return sym.scope.find_variable(def.name) === def; + })) { + skipped.unshift(tail); + continue; + } + var orig = [], refs = []; + tail_refs.forEach(function(sym) { + sym.thedef = def; + sym.name = def.name; + if (sym instanceof AST_SymbolRef) { + refs.push(sym); + } else { + orig.push(sym); + } + }); + def.orig = orig.concat(def.orig); + def.references = refs.concat(def.references); + def.fixed = tail.definition.fixed && def.fixed; + merged[id] = def; + break; + } while (last.length); + if (skipped.length) last = last.concat(skipped); + } + + function push() { + segment = Object.create(segment); + } + + function pop() { + segment = Object.getPrototypeOf(segment); + } + + function mark(sym, read, write) { + var def = sym.definition(); + if (def.id in references) { + var refs = references[def.id]; + if (!refs) return; + if (refs.start.block !== segment.block) return references[def.id] = false; + refs.push(sym); + refs.end = segment; + if (def.id in prev) { + last[prev[def.id]] = null; + } else if (!read) { + return; + } + } else if (self.variables.get(def.name) !== def || compressor.exposed(def) || sym.name == "arguments") { + return references[def.id] = false; + } else { + var refs = declarations.get(def.id) || []; + refs.push(sym); + references[def.id] = refs; + if (!read) { + refs.start = segment; + return first.push({ + index: index++, + definition: def, + }); + } + if (segment.block !== self) return references[def.id] = false; + refs.start = root; + } + prev[def.id] = last.length; + last.push({ + index: index++, + definition: def, + }); + } + + function must_visit(base, segment) { + return base === segment || base.isPrototypeOf(segment); + } + + function mergeable(head, tail) { + return must_visit(head.start, head.end) || must_visit(head.start, tail.start); + } + }); + + AST_Scope.DEFMETHOD("drop_unused", function(compressor) { + if (!compressor.option("unused")) return; + var self = this; + var drop_funcs = !(self instanceof AST_Toplevel) || compressor.toplevel.funcs; + var drop_vars = !(self instanceof AST_Toplevel) || compressor.toplevel.vars; + var assign_as_unused = /keep_assign/.test(compressor.option("unused")) ? return_false : function(node, props) { + var sym; + if (node instanceof AST_Assign) { + if (node.write_only || node.operator == "=") sym = node.left; + } else if (node instanceof AST_Unary) { + if (node.write_only) sym = node.expression; + } + if (/strict/.test(compressor.option("pure_getters"))) { + while (sym instanceof AST_PropAccess && !sym.expression.may_throw_on_access(compressor)) { + if (sym instanceof AST_Sub) props.unshift(sym.property); + sym = sym.expression; + } + } + if (!(sym instanceof AST_SymbolRef)) return; + if (compressor.exposed(sym.definition())) return; + if (!all(sym.definition().orig, function(sym) { + return !(sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLambda || sym instanceof AST_SymbolLet); + })) return; + return sym; + }; + var assign_in_use = Object.create(null); + var for_ins = Object.create(null); + var in_use = []; + var in_use_ids = Object.create(null); // avoid expensive linear scans of in_use + var value_read = Object.create(null); + var value_modified = Object.create(null); + if (self instanceof AST_Toplevel && compressor.top_retain) { + self.variables.each(function(def) { + if (compressor.top_retain(def) && !(def.id in in_use_ids)) { + in_use_ids[def.id] = true; + in_use.push(def); + } + }); + } + var assignments = new Dictionary(); + var var_defs_by_id = new Dictionary(); + var initializations = new Dictionary(); + // pass 1: find out which symbols are directly used in + // this scope (not in nested scopes). + var scope = this; + var tw = new TreeWalker(function(node, descend) { + if (node instanceof AST_Lambda && node.uses_arguments && !tw.has_directive("use strict")) { + node.argnames.forEach(function(argname) { + var def = argname.definition(); + if (!(def.id in in_use_ids)) { + in_use_ids[def.id] = true; + in_use.push(def); + } + }); + } + if (node === self) return; + if (scope === self) { + if (node instanceof AST_Defun) { + var def = node.name.definition(); + if (!drop_funcs && !(def.id in in_use_ids)) { + in_use_ids[def.id] = true; + in_use.push(def); + } + initializations.add(def.id, node); + return true; // don't go in nested scopes + } + if (node instanceof AST_Definitions) { + node.definitions.forEach(function(defn) { + var def = defn.name.definition(); + var_defs_by_id.add(def.id, defn); + if (node instanceof AST_Var && def.orig[0] instanceof AST_SymbolCatch) { + var redef = def.redefined(); + if (redef) var_defs_by_id.add(redef.id, defn); + } + if ((!drop_vars || (node instanceof AST_Const ? def.redefined() : def.const_redefs)) + && !(def.id in in_use_ids)) { + in_use_ids[def.id] = true; + in_use.push(def); + } + if (!defn.value) return; + if (defn.value.has_side_effects(compressor)) { + defn.value.walk(tw); + } else { + initializations.add(def.id, defn.value); + } + assignments.add(def.id, defn); + }); + return true; + } + if (node instanceof AST_SymbolFunarg) { + var def = node.definition(); + var_defs_by_id.add(def.id, node); + assignments.add(def.id, node); + return true; + } + } return scan_ref_scoped(node, descend, true); }); + tw.directives = Object.create(compressor.directives); self.walk(tw); // pass 2: for every used symbol we need to walk its // initialization code to figure out if it uses other @@ -4408,6 +4921,13 @@ merge(Compressor.prototype, { })); } } + } else if (node instanceof AST_UnaryPostfix + && node.expression instanceof AST_SymbolRef + && indexOf_assign(node.expression.definition(), node) < 0) { + return make_node(AST_UnaryPrefix, node, { + operator: "+", + expression: node.expression + }); } } if (node instanceof AST_Call) calls_to_drop_args.push(node); @@ -4416,7 +4936,7 @@ merge(Compressor.prototype, { if (drop_funcs && node !== self && node instanceof AST_Defun) { var def = node.name.definition(); if (!(def.id in in_use_ids)) { - log(node.name, "Dropping unused function {name} [{file}:{line},{col}]", template(node.name)); + log(node.name, "Dropping unused function {name}"); def.eliminated++; return in_list ? List.skip : make_node(AST_EmptyStatement, node); } @@ -4428,14 +4948,16 @@ merge(Compressor.prototype, { var trim = compressor.drop_fargs(node, parent); for (var a = node.argnames, i = a.length; --i >= 0;) { var sym = a[i]; - if (!(sym.definition().id in in_use_ids)) { + var def = sym.definition(); + if (def.id in in_use_ids) { + trim = false; + if (indexOf_assign(def, sym) < 0) sym.__unused = null; + } else { sym.__unused = true; if (trim) { - log(sym, "Dropping unused function argument {name} [{file}:{line},{col}]", template(sym)); + log(sym, "Dropping unused function argument {name}"); a.pop(); } - } else { - trim = false; } } fns_with_marked_args.push(node); @@ -4454,8 +4976,18 @@ merge(Compressor.prototype, { var sym = def.name.definition(); if (!drop_vars || sym.id in in_use_ids) { if (def.value && indexOf_assign(sym, def) < 0) { - def.value = def.value.drop_side_effect_free(compressor); - if (def.value) def.value.tail_node().write_only = false; + var write_only = def.value.write_only; + var value = def.value.drop_side_effect_free(compressor); + if (def.value !== value) { + def.value = value && make_sequence(def.value, [ + value, + make_node(AST_Number, def.value, { + value: 0 + }), + ]); + } else if (def.value.write_only !== write_only) { + def.value.write_only = write_only; + } } var old_def, var_defs = var_defs_by_id.get(sym.id); if (!def.value) { @@ -4468,16 +5000,19 @@ merge(Compressor.prototype, { } } else if (compressor.option("functions") && !compressor.option("ie8") + && !(node instanceof AST_Const || node instanceof AST_Let) && var_defs.length == 1 && sym.assignments == 0 - && def.value === def.name.fixed_value() && def.value instanceof AST_Function + && (sym.references.length ? all(sym.references, function(ref) { + return def.value === ref.fixed_value(); + }) : def.value === def.name.fixed_value()) && (!def.value.name || (old_def = def.value.name.definition()).assignments == 0 && (old_def.name == def.name.name || all(old_def.references, function(ref) { return ref.scope.find_variable(def.name) === def.name.definition(); }))) - && can_rename(def.value, def.name.name) - && (!compressor.has_directive("use strict") || parent instanceof AST_Scope)) { + && can_declare_defun() + && can_rename(def.value, def.name.name)) { AST_Node.warn("Declaring {name} as function [{file}:{line},{col}]", template(def.name)); var defun = make_node(AST_Defun, def, def.value); defun.name = make_node(AST_SymbolDefun, def.name, def.name); @@ -4506,7 +5041,8 @@ merge(Compressor.prototype, { } tail.push(def); } - } else if (sym.orig[0] instanceof AST_SymbolCatch) { + } else if (sym.orig[0] instanceof AST_SymbolCatch + && sym.scope.resolve() === def.name.scope.resolve()) { var value = def.value && def.value.drop_side_effect_free(compressor); if (value) side_effects.push(value); var var_defs = var_defs_by_id.get(sym.id); @@ -4524,7 +5060,7 @@ merge(Compressor.prototype, { AST_Node.warn("Side effects in initialization of unused variable {name} [{file}:{line},{col}]", template(def.name)); side_effects.push(value); } else { - log(def.name, "Dropping unused variable {name} [{file}:{line},{col}]", template(def.name)); + log(def.name, "Dropping unused variable {name}"); } sym.eliminated++; } @@ -4533,24 +5069,45 @@ merge(Compressor.prototype, { var def = fn.variables.get(name); return !def || fn.name && def === fn.name.definition(); } + + function can_declare_defun() { + if (compressor.has_directive("use strict")) return parent instanceof AST_Scope; + return parent instanceof AST_Block + || parent instanceof AST_For && parent.init === node + || parent instanceof AST_If; + } }); - if (head.length == 0 && tail.length == duplicated) { - [].unshift.apply(side_effects, tail.map(function(def) { - AST_Node.warn("Dropping duplicated definition of variable {name} [{file}:{line},{col}]", template(def.name)); - var sym = def.name.definition(); - var ref = make_node(AST_SymbolRef, def.name, def.name); - sym.references.push(ref); - var assign = make_node(AST_Assign, def, { - operator: "=", - left: ref, - right: def.value - }); - var index = indexOf_assign(sym, def); - if (index >= 0) assign_in_use[sym.id][index] = assign; - sym.eliminated++; - return assign; - })); - } else if (head.length > 0 || tail.length > 0) { + switch (head.length) { + case 0: + if (tail.length == 0) break; + if (tail.length == duplicated) { + [].unshift.apply(side_effects, tail.map(function(def) { + AST_Node.warn("Dropping duplicated definition of variable {name} [{file}:{line},{col}]", template(def.name)); + var sym = def.name.definition(); + var ref = make_node(AST_SymbolRef, def.name, def.name); + sym.references.push(ref); + var assign = make_node(AST_Assign, def, { + operator: "=", + left: ref, + right: def.value + }); + var index = indexOf_assign(sym, def); + if (index >= 0) assign_in_use[sym.id][index] = assign; + sym.eliminated++; + return assign; + })); + break; + } + case 1: + if (tail.length == 0) { + var id = head[0].name.definition().id; + if (id in for_ins) { + node.definitions = head; + for_ins[id].init = node; + break; + } + } + default: node.definitions = head.concat(tail); body.push(node); } @@ -4559,16 +5116,7 @@ merge(Compressor.prototype, { body: make_sequence(node, side_effects) })); } - switch (body.length) { - case 0: - return in_list ? List.skip : make_node(AST_EmptyStatement, node); - case 1: - return body[0]; - default: - return in_list ? List.splice(body) : make_node(AST_BlockStatement, node, { - body: body - }); - } + return insert_statements(body, node, in_list); } if (node instanceof AST_LabeledStatement && node.body instanceof AST_For) { // Certain combination of unused name + side effect leads to invalid AST: @@ -4591,7 +5139,13 @@ merge(Compressor.prototype, { return node; } }, function(node, in_list) { - if (node instanceof AST_For) { + if (node instanceof AST_BlockStatement) switch (node.body.length) { + case 0: + return in_list ? List.skip : make_node(AST_EmptyStatement, node); + case 1: + var stat = node.body[0]; + if (!(stat instanceof AST_Const || stat instanceof AST_Let)) return stat; + } else if (node instanceof AST_For) { // Certain combination of unused name + side effect leads to invalid AST: // https://github.com/mishoo/UglifyJS/issues/44 // https://github.com/mishoo/UglifyJS/issues/1838 @@ -4619,19 +5173,31 @@ merge(Compressor.prototype, { return !block ? node : in_list ? List.splice(block.body) : block; } else if (node instanceof AST_ForIn) { if (!drop_vars || !compressor.option("loops")) return; - if (!(node.init instanceof AST_Definitions)) return; - var sym = node.init.definitions[0].name; - if (sym.definition().id in in_use_ids) return; if (!is_empty(node.body)) return; - log(sym, "Dropping unused loop variable {name} [{file}:{line},{col}]", template(sym)); + var sym = node.init; + if (sym instanceof AST_Definitions) { + sym = sym.definitions[0].name; + } else while (sym instanceof AST_PropAccess) { + sym = sym.expression.tail_node(); + } + var def = sym.definition(); + if (!def) return; + if (def.id in in_use_ids) return; + if (def.scope !== self && self.find_variable(sym) === def) return; + log(sym, "Dropping unused loop variable {name}"); + if (for_ins[def.id] === node) delete for_ins[def.id]; + var body = []; var value = node.object.drop_side_effect_free(compressor); if (value) { - AST_Node.warn("Side effects in object of for-in loop [{file}:{line},{col}]", template(sym)); - return make_node(AST_SimpleStatement, node, { + AST_Node.warn("Side effects in object of for-in loop [{file}:{line},{col}]", value.start); + body.push(make_node(AST_SimpleStatement, node, { body: value - }); + })); } - return in_list ? List.skip : make_node(AST_EmptyStatement, node); + if (node.init instanceof AST_Definitions && def.orig[0] instanceof AST_SymbolCatch) { + body.push(node.init); + } + return insert_statements(body, node, in_list); } else if (node instanceof AST_Sequence) { if (node.expressions.length == 1) return node.expressions[0]; } @@ -4651,8 +5217,8 @@ merge(Compressor.prototype, { drop_unused_call_args(call, compressor, fns_with_marked_args); }); - function log(sym, text, props) { - AST_Node[sym.unreferenced() ? "warn" : "info"](text, props); + function log(sym, text) { + AST_Node[sym.definition().references.length > 0 ? "info" : "warn"](text + " [{file}:{line},{col}]", template(sym)); } function template(sym) { @@ -4664,6 +5230,19 @@ merge(Compressor.prototype, { }; } + function insert_statements(body, orig, in_list) { + switch (body.length) { + case 0: + return in_list ? List.skip : make_node(AST_EmptyStatement, orig); + case 1: + return body[0]; + default: + return in_list ? List.splice(body) : make_node(AST_BlockStatement, orig, { + body: body + }); + } + } + function track_assigns(def, node) { if (def.scope !== self) return false; if (!def.fixed || !node.fixed) assign_in_use[def.id] = false; @@ -4740,12 +5319,30 @@ merge(Compressor.prototype, { if (track_assigns(node_def, sym) && is_lhs(sym, node) !== sym) add_assigns(node_def, sym); return true; } + if (node instanceof AST_ForIn) { + if (node.init instanceof AST_SymbolRef && scope === self) { + var id = node.init.definition().id; + if (!(id in for_ins)) for_ins[id] = node; + } + if (!drop_vars || !compressor.option("loops")) return; + if (!is_empty(node.body)) return; + if (node.init.has_side_effects(compressor)) return; + node.object.walk(tw); + return true; + } if (node instanceof AST_SymbolRef) { node_def = node.definition(); if (!(node_def.id in in_use_ids)) { in_use_ids[node_def.id] = true; in_use.push(node_def); } + if (cross_scope(node_def.scope, node.scope)) { + var redef = node_def.redefined(); + if (redef && !(redef.id in in_use_ids)) { + in_use_ids[redef.id] = true; + in_use.push(redef); + } + } if (track_assigns(node_def, node)) add_assigns(node_def, node); return true; } @@ -4973,7 +5570,7 @@ merge(Compressor.prototype, { process_boolean_returns(this, compressor); }); - AST_Scope.DEFMETHOD("var_names", function() { + AST_BlockScope.DEFMETHOD("var_names", function() { var var_names = this._var_names; if (!var_names) { this._var_names = var_names = Object.create(null); @@ -5063,6 +5660,7 @@ merge(Compressor.prototype, { } })); self.transform(new TreeTransformer(function(node, descend) { + if (node instanceof AST_Binary) return replace("right"); if (node instanceof AST_PropAccess) { if (!(node.expression instanceof AST_SymbolRef)) return; var defs = defs_by_id[node.expression.definition().id]; @@ -5078,10 +5676,15 @@ merge(Compressor.prototype, { } if (node instanceof AST_Unary) { if (unary_side_effects[node.operator]) return; - if (!(node.expression instanceof AST_SymbolRef)) return; - if (!(node.expression.definition().id in defs_by_id)) return; + return replace("expression"); + } + + function replace(prop) { + var sym = node[prop]; + if (!(sym instanceof AST_SymbolRef)) return; + if (!(sym.definition().id in defs_by_id)) return; var opt = node.clone(); - opt.expression = make_node(AST_Object, node, { + opt[prop] = make_node(AST_Object, sym, { properties: [] }); return opt; @@ -5104,6 +5707,9 @@ merge(Compressor.prototype, { }) && all(def.references, function(ref) { return ref.fixed_value() === right; + }) + && all(def.orig, function(sym) { + return !(sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet); }); } }); @@ -5191,36 +5797,53 @@ merge(Compressor.prototype, { } }); def(AST_Call, function(compressor, first_in_statement) { - if (!this.is_expr_pure(compressor)) { - var exp = this.expression; - if (this.is_call_pure(compressor)) { - var exprs = this.args.slice(); - exprs.unshift(exp.expression); - exprs = trim(exprs, compressor, first_in_statement); - return exprs && make_sequence(this, exprs); - } - if (exp instanceof AST_Function) { - if (exp.name) { - var def = exp.name.definition(); - if (def.references.length > def.replaced) return this; - } - exp.process_expression(false, function(node) { - var value = node.value && node.value.drop_side_effect_free(compressor, true); - return value ? make_node(AST_SimpleStatement, node, { - body: value - }) : make_node(AST_EmptyStatement, node); - }); - scan_local_returns(exp, function(node) { - if (node.value) node.value = node.value.drop_side_effect_free(compressor); + var self = this; + if (self.is_expr_pure(compressor)) { + if (self.pure) AST_Node.warn("Dropping __PURE__ call [{file}:{line},{col}]", self.start); + var args = trim(self.args, compressor, first_in_statement); + return args && make_sequence(self, args); + } + var exp = self.expression; + if (self.is_call_pure(compressor)) { + var exprs = self.args.slice(); + exprs.unshift(exp.expression); + exprs = trim(exprs, compressor, first_in_statement); + return exprs && make_sequence(self, exprs); + } + var def; + if (exp instanceof AST_Function + && !(exp.name && (def = exp.name.definition()).references.length > def.replaced)) { + exp.process_expression(false, function(node) { + var value = node.value && node.value.drop_side_effect_free(compressor, true); + return value ? make_node(AST_SimpleStatement, node, { + body: value + }) : make_node(AST_EmptyStatement, node); + }); + scan_local_returns(exp, function(node) { + if (node.value) node.value = node.value.drop_side_effect_free(compressor); + }); + // always shallow clone to ensure stripping of negated IIFEs + self = self.clone(); + } + if (self instanceof AST_New) { + var fn = exp; + if (fn instanceof AST_SymbolRef) fn = fn.fixed_value(); + if (fn instanceof AST_Lambda) { + fn.new = true; + var assign_this_only = all(fn.body, function(stat) { + return !stat.has_side_effects(compressor); }); - // always shallow clone to ensure stripping of negated IIFEs - return this.clone(); + delete fn.new; + if (assign_this_only) { + var exprs = self.args.slice(); + exprs.unshift(exp); + exprs = trim(exprs, compressor, first_in_statement); + return exprs && make_sequence(self, exprs); + } + if (!fn.contains_this()) return make_node(AST_Call, self, self); } - return this; } - if (this.pure) AST_Node.warn("Dropping __PURE__ call [{file}:{line},{col}]", this.start); - var args = trim(this.args, compressor, first_in_statement); - return args && make_sequence(this, args); + return self; }); def(AST_Conditional, function(compressor) { var consequent = this.consequent.drop_side_effect_free(compressor); @@ -5302,28 +5925,28 @@ merge(Compressor.prototype, { if (!property) return expression; return make_sequence(this, [ expression, property ]); }); + function drop_symbol(ref) { + return all(ref.definition().orig, function(sym) { + return !(sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet); + }); + } def(AST_SymbolRef, function(compressor) { - if (!this.is_declared(compressor)) return this; - var def = this.definition(); - if (member(this, def.references)) def.replaced++; - return null; + return this.is_declared(compressor) && drop_symbol(this) ? null : this; }); def(AST_This, return_null); def(AST_Unary, function(compressor, first_in_statement) { + var exp = this.expression; if (unary_side_effects[this.operator]) { - this.write_only = !this.expression.has_side_effects(compressor); + this.write_only = !exp.has_side_effects(compressor); return this; } - if (this.operator == "typeof" && this.expression instanceof AST_SymbolRef) { - this.expression.definition().replaced++; - return null; + if (this.operator == "typeof" && exp instanceof AST_SymbolRef && drop_symbol(exp)) return null; + var node = exp.drop_side_effect_free(compressor, first_in_statement); + if (first_in_statement && node && is_iife_call(node)) { + if (node === exp && this.operator == "!") return this; + return node.negate(compressor, first_in_statement); } - var expression = this.expression.drop_side_effect_free(compressor, first_in_statement); - if (first_in_statement && expression && is_iife_call(expression)) { - if (expression === this.expression && this.operator == "!") return this; - return expression.negate(compressor, first_in_statement); - } - return expression; + return node; }); })(function(node, func) { node.DEFMETHOD("drop_side_effect_free", func); @@ -5348,11 +5971,12 @@ merge(Compressor.prototype, { return compressor.option("loops") ? make_node(AST_For, self, self).optimize(compressor) : self; }); - function has_break_or_continue(loop, parent) { + function has_loop_control(loop, parent, type) { + if (!type) type = AST_LoopControl; var found = false; var tw = new TreeWalker(function(node) { if (found || node instanceof AST_Scope) return true; - if (node instanceof AST_LoopControl && tw.loopcontrol_target(node) === loop) { + if (node instanceof type && tw.loopcontrol_target(node) === loop) { return found = true; } }); @@ -5366,27 +5990,54 @@ merge(Compressor.prototype, { if (!compressor.option("loops")) return self; var cond = self.condition.is_truthy() || self.condition.evaluate(compressor, true); if (!(cond instanceof AST_Node)) { - if (cond) return make_node(AST_For, self, { + if (cond && !has_loop_control(self, compressor.parent(), AST_Continue)) return make_node(AST_For, self, { body: make_node(AST_BlockStatement, self.body, { body: [ self.body, make_node(AST_SimpleStatement, self.condition, { body: self.condition - }) + }), ] }) }).optimize(compressor); - if (!has_break_or_continue(self, compressor.parent())) { - return make_node(AST_BlockStatement, self.body, { - body: [ - self.body, - make_node(AST_SimpleStatement, self.condition, { - body: self.condition - }) - ] - }).optimize(compressor); + if (!has_loop_control(self, compressor.parent())) return make_node(AST_BlockStatement, self.body, { + body: [ + self.body, + make_node(AST_SimpleStatement, self.condition, { + body: self.condition + }), + ] + }).optimize(compressor); + } + if (self.body instanceof AST_BlockStatement && !has_loop_control(self, compressor.parent(), AST_Continue)) { + var body = self.body.body; + for (var i = body.length; --i >= 0;) { + var stat = body[i]; + if (stat instanceof AST_If + && !stat.alternative + && stat.body instanceof AST_Break + && compressor.loopcontrol_target(stat.body) === self) { + if (has_block_scope_refs(stat.condition)) break; + self.condition = make_node(AST_Binary, self, { + operator: "&&", + left: stat.condition.negate(compressor), + right: self.condition, + }); + body.splice(i, 1); + } else if (stat instanceof AST_SimpleStatement) { + if (has_block_scope_refs(stat.body)) break; + self.condition = make_sequence(self, [ + stat.body, + self.condition, + ]); + body.splice(i, 1); + } else if (!is_declaration(stat)) { + break; + } } + self.body = trim_block(self.body); } + if (self.body instanceof AST_EmptyStatement) return make_node(AST_For, self, self).optimize(compressor); if (self.body instanceof AST_SimpleStatement) return make_node(AST_For, self, { condition: make_sequence(self.condition, [ self.body.body, @@ -5395,6 +6046,18 @@ merge(Compressor.prototype, { body: make_node(AST_EmptyStatement, self) }).optimize(compressor); return self; + + function has_block_scope_refs(node) { + var found = false; + node.walk(new TreeWalker(function(node) { + if (found) return true; + if (node instanceof AST_SymbolRef) { + if (!member(node.definition(), self.enclosed)) found = true; + return true; + } + })); + return found; + } }); function if_break_in_loop(self, compressor) { @@ -5425,7 +6088,7 @@ merge(Compressor.prototype, { } else if (retain) { body.push(first); } - extract_declarations_from_unreachable_code(self.body, body); + extract_declarations_from_unreachable_code(compressor, self.body, body); return make_node(AST_BlockStatement, self, { body: body }); @@ -5443,7 +6106,7 @@ merge(Compressor.prototype, { self.condition = first.condition.negate(compressor); } var body = as_statement_array(first.alternative); - extract_declarations_from_unreachable_code(first.body, body); + extract_declarations_from_unreachable_code(compressor, first.body, body); return drop_it(body); } ab = first_statement(first.alternative); @@ -5458,7 +6121,7 @@ merge(Compressor.prototype, { self.condition = first.condition; } var body = as_statement_array(first.body); - extract_declarations_from_unreachable_code(first.alternative, body); + extract_declarations_from_unreachable_code(compressor, first.alternative, body); return drop_it(body); } } @@ -5506,7 +6169,6 @@ merge(Compressor.prototype, { if (!cond) { if (compressor.option("dead_code")) { var body = []; - extract_declarations_from_unreachable_code(self.body, body); if (self.init instanceof AST_Statement) { body.push(self.init); } else if (self.init) { @@ -5517,6 +6179,7 @@ merge(Compressor.prototype, { body.push(make_node(AST_SimpleStatement, self.condition, { body: self.condition })); + extract_declarations_from_unreachable_code(compressor, self.body, body); return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor); } } else if (self.condition && !(cond instanceof AST_Node)) { @@ -5612,21 +6275,23 @@ merge(Compressor.prototype, { } if (!cond) { AST_Node.warn("Condition always false [{file}:{line},{col}]", self.condition.start); - var body = []; - extract_declarations_from_unreachable_code(self.body, body); - body.push(make_node(AST_SimpleStatement, self.condition, { - body: self.condition - })); + var body = [ + make_node(AST_SimpleStatement, self.condition, { + body: self.condition + }), + ]; + extract_declarations_from_unreachable_code(compressor, self.body, body); if (self.alternative) body.push(self.alternative); return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor); } else if (!(cond instanceof AST_Node)) { AST_Node.warn("Condition always true [{file}:{line},{col}]", self.condition.start); - var body = []; - if (self.alternative) extract_declarations_from_unreachable_code(self.alternative, body); - body.push(make_node(AST_SimpleStatement, self.condition, { - body: self.condition - })); - body.push(self.body); + var body = [ + make_node(AST_SimpleStatement, self.condition, { + body: self.condition + }), + self.body, + ]; + if (self.alternative) extract_declarations_from_unreachable_code(compressor, self.alternative, body); return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor); } } @@ -5875,28 +6540,57 @@ merge(Compressor.prototype, { } body[0].body = decl.concat(body[0].body); self.body = body; - if (body.length == 1 && (body[0] === exact_match || body[0] === default_branch)) { - var has_break = false; - var tw = new TreeWalker(function(node) { - if (has_break - || node instanceof AST_Lambda - || node instanceof AST_SimpleStatement) return true; - if (is_break(node, tw)) has_break = true; + if (compressor.option("conditionals")) switch (body.length) { + case 1: + if (!no_break(body[0])) break; + var exp = body[0].expression; + var statements = body[0].body.slice(); + if (body[0] !== default_branch && body[0] !== exact_match) return make_node(AST_If, self, { + condition: make_node(AST_Binary, self, { + operator: "===", + left: self.expression, + right: exp, + }), + body: make_node(AST_BlockStatement, self, { + body: statements, + }), + alternative: null, + }).optimize(compressor); + if (exp) statements.unshift(make_node(AST_SimpleStatement, exp, { + body: exp, + })); + statements.unshift(make_node(AST_SimpleStatement, self.expression, { + body:self.expression, + })); + return make_node(AST_BlockStatement, self, { + body: statements, + }).optimize(compressor); + case 2: + if (!member(default_branch, body) || !no_break(body[1])) break; + var statements = body[0].body.slice(); + var exclusive = statements.length && is_break(statements[statements.length - 1], compressor); + if (exclusive) statements.pop(); + if (!all(statements, no_break)) break; + var alternative = body[1].body.length && make_node(AST_BlockStatement, body[1], body[1]); + var node = make_node(AST_If, self, { + condition: make_node(AST_Binary, self, body[0] === default_branch ? { + operator: "!==", + left: self.expression, + right: body[1].expression, + } : { + operator: "===", + left: self.expression, + right: body[0].expression, + }), + body: make_node(AST_BlockStatement, body[0], { + body: statements, + }), + alternative: exclusive && alternative || null, }); - self.walk(tw); - if (!has_break) { - var statements = body[0].body.slice(); - var exp = body[0].expression; - if (exp) statements.unshift(make_node(AST_SimpleStatement, exp, { - body: exp - })); - statements.unshift(make_node(AST_SimpleStatement, self.expression, { - body:self.expression - })); - return make_node(AST_BlockStatement, self, { - body: statements - }).optimize(compressor); - } + if (!exclusive && alternative) node = make_node(AST_BlockStatement, self, { + body: [ node, alternative ], + }); + return node.optimize(compressor); } return self; @@ -5904,11 +6598,24 @@ merge(Compressor.prototype, { return node instanceof AST_Break && tw.loopcontrol_target(node) === self; } + function no_break(node) { + var found = false; + var tw = new TreeWalker(function(node) { + if (found + || node instanceof AST_Lambda + || node instanceof AST_SimpleStatement) return true; + if (is_break(node, tw)) found = true; + }); + tw.push(self); + node.walk(tw); + return !found; + } + function eliminate_branch(branch, prev) { if (prev && !aborts(prev)) { prev.body = prev.body.concat(branch.body); } else { - extract_declarations_from_unreachable_code(branch, decl); + extract_declarations_from_unreachable_code(compressor, branch, decl); } } }); @@ -5919,9 +6626,9 @@ merge(Compressor.prototype, { if (has_declarations_only(self)) { var body = []; if (self.bcatch) { - extract_declarations_from_unreachable_code(self.bcatch, body); + extract_declarations_from_unreachable_code(compressor, self.bcatch, body); body.forEach(function(stat) { - if (!(stat instanceof AST_Definitions)) return; + if (!(stat instanceof AST_Var)) return; stat.definitions.forEach(function(var_def) { var def = var_def.name.definition().redefined(); if (!def) return; @@ -5930,14 +6637,17 @@ merge(Compressor.prototype, { }); }); } - [].unshift.apply(body, self.body); - if (self.bfinally) [].push.apply(body, self.bfinally.body); + body.unshift(make_node(AST_BlockStatement, self, self).optimize(compressor)); + if (self.bfinally) { + body.push(make_node(AST_BlockStatement, self.bfinally, self.bfinally).optimize(compressor)); + } return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor); } if (self.bfinally && has_declarations_only(self.bfinally)) { - var body = self.body.concat(self.bfinally.body); + var body = make_node(AST_BlockStatement, self.bfinally, self.bfinally).optimize(compressor); + body = self.body.concat(body); if (!self.bcatch) return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor); @@ -5948,7 +6658,19 @@ merge(Compressor.prototype, { return self; }); - AST_Definitions.DEFMETHOD("remove_initializers", function() { + AST_Const.DEFMETHOD("remove_initializers", function(compressor) { + this.definitions.forEach(function(def) { + def.value = make_node(AST_Undefined, def).optimize(compressor); + }); + }); + + AST_Let.DEFMETHOD("remove_initializers", function() { + this.definitions.forEach(function(def) { + def.value = null; + }); + }); + + AST_Var.DEFMETHOD("remove_initializers", function() { this.definitions.forEach(function(def) { def.value = null; }); @@ -5975,9 +6697,35 @@ merge(Compressor.prototype, { return make_sequence(this, assignments); }); - OPT(AST_Definitions, function(self, compressor) { - return self.definitions.length ? self : make_node(AST_EmptyStatement, self); - }); + function varify(self, compressor) { + return compressor.option("varify") && all(self.definitions, function(defn) { + var node = defn.name; + if (!node.fixed_value()) return false; + var def = node.definition(); + if (compressor.exposed(def)) return false; + var scope = def.scope.resolve(); + for (var s = def.scope; s !== scope;) { + s = s.parent_scope; + if (s.var_names()[node.name]) return false; + } + return true; + }) ? make_node(AST_Var, self, { + definitions: self.definitions.map(function(defn) { + var name = make_node(AST_SymbolVar, defn.name, defn.name); + var def = name.definition(); + def.orig[def.orig.indexOf(defn.name)] = name; + var scope = def.scope.resolve(); + if (def.scope !== scope) scope.variables.set(def.name, def); + return make_node(AST_VarDef, defn, { + name: name, + value: defn.value + }); + }) + }) : self; + } + + OPT(AST_Const, varify); + OPT(AST_Let, varify); function lift_sequence_in_expression(node, compressor) { var exp = node.expression; @@ -6002,10 +6750,10 @@ merge(Compressor.prototype, { var side_effects = []; for (var i = 0; i < args.length; i++) { var trim = i >= fn.argnames.length; - if (trim || fn.argnames[i].__unused) { + if (trim || "__unused" in fn.argnames[i]) { var node = args[i].drop_side_effect_free(compressor); - if (drop_fargs) { - fn.argnames.splice(i, 1); + if (drop_fargs && (trim || fn.argnames[i].__unused)) { + if (!trim) fn.argnames.splice(i, 1); args.splice(i, 1); if (node) side_effects.push(node); i--; @@ -6016,15 +6764,14 @@ merge(Compressor.prototype, { side_effects = []; } else if (!trim) { if (side_effects.length) { - node = make_sequence(call, side_effects); + args[pos++] = make_sequence(call, side_effects); side_effects = []; } else { - node = make_node(AST_Number, args[i], { + args[pos++] = make_node(AST_Number, args[i], { value: 0 }); + continue; } - args[pos++] = node; - continue; } } else { side_effects.push(args[i]); @@ -6277,7 +7024,7 @@ merge(Compressor.prototype, { if (self.args.length == 0) return make_node(AST_Function, self, { argnames: [], body: [] - }); + }).init_vars(exp.scope); if (all(self.args, function(x) { return x instanceof AST_String; })) { @@ -6305,7 +7052,7 @@ merge(Compressor.prototype, { } })); var code = OutputStream(); - AST_BlockStatement.prototype._codegen.call(fun, fun, code); + AST_BlockStatement.prototype._codegen.call(fun, code); self.args = [ make_node(AST_String, self, { value: fun.argnames.map(function(arg) { @@ -6345,10 +7092,10 @@ merge(Compressor.prototype, { && !fn.pinned() && !(fn.name && fn instanceof AST_Function) && (exp === fn || !recursive_ref(compressor, def = exp.definition()) - && fn.is_constant_expression(compressor.find_parent(AST_Scope))) + && fn.is_constant_expression(find_scope(compressor))) && (value = can_flatten_body(stat)) && !fn.contains_this()) { - var replacing = exp === fn || compressor.option("unused") && def.references.length - def.replaced == 1; + var replacing = exp === fn || def.single_use && def.references.length - def.replaced == 1; if (can_substitute_directly()) { var args = self.args.slice(); var refs = []; @@ -6371,7 +7118,7 @@ merge(Compressor.prototype, { return arg; })).optimize(compressor); node = maintain_this_binding(compressor, compressor.parent(), compressor.self(), node); - if (replacing || best_of(compressor, self, node) === node) { + if (replacing || best_of_expression(node, self) === node) { refs.forEach(function(ref) { var def = ref.definition(); def.references.push(ref); @@ -6380,7 +7127,7 @@ merge(Compressor.prototype, { return node; } } - var scope, in_loop, level = -1; + var child, in_loop, scope; if (replacing && can_inject_symbols()) { fn._squeezed = true; if (exp !== fn) fn.parent_scope = exp.scope; @@ -6415,16 +7162,11 @@ merge(Compressor.prototype, { function return_value(stat) { if (!stat) return make_node(AST_Undefined, self); - if (stat instanceof AST_Return) { - if (!stat.value) return make_node(AST_Undefined, self); - return stat.value.clone(true); - } - if (stat instanceof AST_SimpleStatement) { - return make_node(AST_UnaryPrefix, stat, { - operator: "void", - expression: stat.body - }); - } + if (stat instanceof AST_Return) return stat.value || make_node(AST_Undefined, self); + if (stat instanceof AST_SimpleStatement) return make_node(AST_UnaryPrefix, stat, { + operator: "void", + expression: stat.body + }); } function can_flatten_body(stat) { @@ -6521,29 +7263,32 @@ merge(Compressor.prototype, { return defined[name] || identifier_atom[name] || scope.var_names()[name]; } - function can_inject_args(catches, used, safe_to_inject) { + function can_inject_args(defined, used, safe_to_inject) { for (var i = 0; i < fn.argnames.length; i++) { var arg = fn.argnames[i]; if (arg.__unused) continue; - if (!safe_to_inject || var_exists(catches, arg.name)) return false; + if (!safe_to_inject || var_exists(defined, arg.name)) return false; used[arg.name] = true; if (in_loop) in_loop.push(arg.definition()); } return true; } - function can_inject_vars(catches, used, safe_to_inject) { + function can_inject_vars(defined, used, safe_to_inject) { for (var i = 0; i < fn.body.length; i++) { var stat = fn.body[i]; if (stat instanceof AST_Defun) { if (!safe_to_inject || var_exists(used, stat.name.name)) return false; + if (!all(stat.enclosed, function(def) { + return def.scope === stat || !defined[def.name]; + })) return false; continue; } if (!(stat instanceof AST_Var)) continue; if (!safe_to_inject) return false; for (var j = stat.definitions.length; --j >= 0;) { var name = stat.definitions[j].name; - if (var_exists(catches, name.name)) return false; + if (var_exists(defined, name.name)) return false; if (in_loop) in_loop.push(name.definition()); } } @@ -6551,15 +7296,16 @@ merge(Compressor.prototype, { } function can_inject_symbols() { - var catches = Object.create(null); - var child; + var defined = Object.create(null); + var level = 0; scope = compressor.self(); - do { + while (!(scope instanceof AST_Scope)) { + if (scope.variables) scope.variables.each(function(def) { + defined[def.name] = true; + }); child = scope; - scope = compressor.parent(++level); - if (scope instanceof AST_Catch) { - catches[scope.argname.name] = true; - } else if (scope instanceof AST_DWLoop) { + scope = compressor.parent(level++); + if (scope instanceof AST_DWLoop) { in_loop = []; } else if (scope instanceof AST_For) { if (scope.init === child) continue; @@ -6571,13 +7317,13 @@ merge(Compressor.prototype, { } else if (scope instanceof AST_SymbolRef) { if (scope.fixed_value() instanceof AST_Scope) return false; } - } while (!(scope instanceof AST_Scope)); + } var safe_to_inject = (!(scope instanceof AST_Toplevel) || compressor.toplevel.vars) - && (exp !== fn || fn.parent_scope === compressor.find_parent(AST_Scope)); + && (exp !== fn || fn.parent_scope.resolve() === compressor.find_parent(AST_Scope)); var inline = compressor.option("inline"); - var used = Object.create(catches); - if (!can_inject_args(catches, used, inline >= 2 && safe_to_inject)) return false; - if (!can_inject_vars(catches, used, inline >= 3 && safe_to_inject)) return false; + var used = Object.create(defined); + if (!can_inject_args(defined, used, inline >= 2 && safe_to_inject)) return false; + if (!can_inject_vars(defined, used, inline >= 3 && safe_to_inject)) return false; return !in_loop || in_loop.length == 0 || !is_reachable(fn, in_loop); } @@ -6592,9 +7338,10 @@ merge(Compressor.prototype, { value: null })); } + if (!value) return; var sym = make_node(AST_SymbolRef, name, name); def.references.push(sym); - if (value) expressions.push(make_node(AST_Assign, self, { + expressions.push(make_node(AST_Assign, self, { operator: "=", left: sym, right: value @@ -6615,7 +7362,12 @@ merge(Compressor.prototype, { var symbol = make_node(AST_SymbolVar, name, name); name.definition().orig.push(symbol); if (!value && in_loop) value = make_node(AST_Undefined, self); - append_var(decls, expressions, symbol, value); + if ("__unused" in name) { + append_var(decls, expressions, symbol); + if (value) expressions.push(value); + } else { + append_var(decls, expressions, symbol, value); + } } } decls.reverse(); @@ -6668,7 +7420,7 @@ merge(Compressor.prototype, { return true; } }); - args.unshift(scope.body.indexOf(compressor.parent(level - 1)) + 1, 0); + args.unshift(scope.body.indexOf(child) + 1, 0); if (decls.length) args.push(make_node(AST_Var, fn, { definitions: decls })); @@ -6805,72 +7557,70 @@ merge(Compressor.prototype, { var SIGN_OPS = makePredicate("+ -"); var MULTIPLICATIVE_OPS = makePredicate("* / %"); OPT(AST_UnaryPrefix, function(self, compressor) { - var e = self.expression; + var op = self.operator; + var exp = self.expression; if (compressor.option("evaluate") - && self.operator == "delete" - && !(e instanceof AST_SymbolRef - || e instanceof AST_PropAccess - || is_identifier_atom(e))) { - if (e instanceof AST_Sequence) { - e = e.expressions.slice(); - e.push(make_node(AST_True, self)); - return make_sequence(self, e).optimize(compressor); - } - return make_sequence(self, [ e, make_node(AST_True, self) ]).optimize(compressor); - } - if (compressor.option("sequences")) { + && op == "delete" + && !(exp instanceof AST_SymbolRef + || exp instanceof AST_PropAccess + || is_identifier_atom(exp))) { + if (exp instanceof AST_Sequence) { + exp = exp.expressions.slice(); + exp.push(make_node(AST_True, self)); + return make_sequence(self, exp).optimize(compressor); + } + return make_sequence(self, [ exp, make_node(AST_True, self) ]).optimize(compressor); + } + if (compressor.option("sequences") && !(op == "typeof" && is_undeclared_ref(exp.tail_node()))) { var seq = lift_sequence_in_expression(self, compressor); if (seq !== self) return seq.optimize(compressor); } - if (compressor.option("side_effects") && self.operator == "void") { - e = e.drop_side_effect_free(compressor); - if (e) { - self.expression = e; - return self; - } else { - return make_node(AST_Undefined, self).optimize(compressor); - } + if (compressor.option("side_effects") && op == "void") { + exp = exp.drop_side_effect_free(compressor); + if (!exp) return make_node(AST_Undefined, self).optimize(compressor); + self.expression = exp; + return self; } if (compressor.option("booleans")) { - if (self.operator == "!" && e.is_truthy()) { - return make_sequence(self, [ e, make_node(AST_False, self) ]).optimize(compressor); - } else if (compressor.in_boolean_context()) switch (self.operator) { + if (op == "!" && exp.is_truthy()) { + return make_sequence(self, [ exp, make_node(AST_False, self) ]).optimize(compressor); + } else if (compressor.in_boolean_context()) switch (op) { case "!": - if (e instanceof AST_UnaryPrefix && e.operator == "!") { + if (exp instanceof AST_UnaryPrefix && exp.operator == "!") { // !!foo => foo, if we're in boolean context - return e.expression; + return exp.expression; } - if (e instanceof AST_Binary) { - self = best_of(compressor, self, e.negate(compressor, first_in_statement(compressor))); + if (exp instanceof AST_Binary) { + self = best_of(compressor, self, exp.negate(compressor, first_in_statement(compressor))); } break; case "typeof": // typeof always returns a non-empty string, thus it's // always true in booleans AST_Node.warn("Boolean expression always true [{file}:{line},{col}]", self.start); - return (e instanceof AST_SymbolRef ? make_node(AST_True, self) : make_sequence(self, [ - e, + return (exp instanceof AST_SymbolRef ? make_node(AST_True, self) : make_sequence(self, [ + exp, make_node(AST_True, self) ])).optimize(compressor); } } - if (self.operator == "-" && e instanceof AST_Infinity) e = e.transform(compressor); + if (op == "-" && exp instanceof AST_Infinity) exp = exp.transform(compressor); if (compressor.option("evaluate") - && e instanceof AST_Binary - && SIGN_OPS[self.operator] - && MULTIPLICATIVE_OPS[e.operator] - && (e.left.is_constant() || !e.right.has_side_effects(compressor))) { + && exp instanceof AST_Binary + && SIGN_OPS[op] + && MULTIPLICATIVE_OPS[exp.operator] + && (exp.left.is_constant() || !exp.right.has_side_effects(compressor))) { return make_node(AST_Binary, self, { - operator: e.operator, - left: make_node(AST_UnaryPrefix, e.left, { - operator: self.operator, - expression: e.left + operator: exp.operator, + left: make_node(AST_UnaryPrefix, exp.left, { + operator: op, + expression: exp.left }), - right: e.right + right: exp.right }); } // avoids infinite recursion of numerals - return self.operator == "-" && (e instanceof AST_Number || e instanceof AST_Infinity) + return op == "-" && (exp instanceof AST_Number || exp instanceof AST_Infinity) ? self : try_evaluate(compressor, self); }); @@ -6920,16 +7670,24 @@ merge(Compressor.prototype, { var indexFns = makePredicate("indexOf lastIndexOf"); var commutativeOperators = makePredicate("== === != !== * & | ^"); function is_object(node) { - while ((node = node.tail_node()) instanceof AST_SymbolRef) { - node = node.fixed_value(); - if (!node) return false; - } + if (node instanceof AST_Assign) return node.operator == "=" && is_object(node.right); + if (node instanceof AST_Sequence) return is_object(node.tail_node()); + if (node instanceof AST_SymbolRef) return is_object(node.fixed_value()); return node instanceof AST_Array || node instanceof AST_Lambda || node instanceof AST_New || node instanceof AST_Object; } + function repeatable(compressor, node) { + if (node instanceof AST_Dot) return repeatable(compressor, node.expression); + if (node instanceof AST_Sub) { + return repeatable(compressor, node.expression) && repeatable(compressor, node.property); + } + if (node instanceof AST_Symbol) return true; + return !node.has_side_effects(compressor); + } + OPT(AST_Binary, function(self, compressor) { function reversible() { return self.left.is_constant() @@ -6998,7 +7756,7 @@ merge(Compressor.prototype, { if ((self.left.is_string(compressor) && self.right.is_string(compressor)) || (self.left.is_number(compressor) && self.right.is_number(compressor)) || (self.left.is_boolean(compressor) && self.right.is_boolean(compressor)) || - can_self_compare(self.left) && self.left.equivalent_to(self.right)) { + repeatable(compressor, self.left) && self.left.equivalent_to(self.right)) { self.operator = self.operator.slice(0, 2); } // XXX: intentionally falling down to the next case @@ -7027,7 +7785,7 @@ merge(Compressor.prototype, { && self.right instanceof AST_SymbolRef && self.left.definition() === self.right.definition() && is_object(self.left)) { - return make_node(self.operator[0] == "=" ? AST_True : AST_False, self); + return make_node(self.operator[0] == "=" ? AST_True : AST_False, self).optimize(compressor); } break; case "&&": @@ -7099,11 +7857,11 @@ merge(Compressor.prototype, { var parent = compressor.parent(); if (compressor.option("comparisons") && self.is_boolean(compressor)) { if (!(parent instanceof AST_Binary) || parent instanceof AST_Assign) { - var negated = make_node(AST_UnaryPrefix, self, { + var negated = best_of(compressor, self, make_node(AST_UnaryPrefix, self, { operator: "!", expression: self.negate(compressor, first_in_statement(compressor)) - }); - self = best_of(compressor, self, negated); + })); + if (negated !== self) return negated; } switch (self.operator) { case ">": reverse("<"); break; @@ -7254,29 +8012,6 @@ merge(Compressor.prototype, { }) }); } - // (x + "foo") + ("bar" + y) => (x + "foobar") + y - if (self.left instanceof AST_Binary - && self.left.operator == "+" - && self.left.is_string(compressor) - && self.left.right instanceof AST_Constant - && self.right instanceof AST_Binary - && self.right.operator == "+" - && self.right.left instanceof AST_Constant - && self.right.is_string(compressor)) { - self = make_node(AST_Binary, self, { - operator: "+", - left: make_node(AST_Binary, self.left, { - operator: "+", - left: self.left.left, - right: make_node(AST_String, self.left.right, { - value: "" + self.left.right.value + self.right.left.value, - start: self.left.right.start, - end: self.right.left.end - }) - }), - right: self.right.right - }); - } // a + -b => a - b if (self.right instanceof AST_UnaryPrefix && self.right.operator == "-" @@ -7338,14 +8073,15 @@ merge(Compressor.prototype, { associative = compressor.option("unsafe_math"); // +a - b => a - b // a - +b => a - b - if (self.operator != "+") { - if (self.left instanceof AST_UnaryPrefix && self.left.operator == "+") { - self.left = self.left.expression; - } - if (self.right instanceof AST_UnaryPrefix && self.right.operator == "+") { - self.right = self.right.expression; + if (self.operator != "+") [ "left", "right" ].forEach(function(operand) { + var node = self[operand]; + if (node instanceof AST_UnaryPrefix && node.operator == "+") { + var exp = node.expression; + if (exp.is_boolean(compressor) || exp.is_number(compressor) || exp.is_string(compressor)) { + self[operand] = exp; + } } - } + }); case "&": case "|": case "^": @@ -7411,69 +8147,73 @@ merge(Compressor.prototype, { && self.left.is_number(compressor)) { if (self.left.left instanceof AST_Constant) { var lhs = make_binary(self.left, self.operator, self.left.left, self.right, self.left.left.start, self.right.end); - self = make_binary(self, self.left.operator, lhs, self.left.right); + self = make_binary(self, self.left.operator, try_evaluate(compressor, lhs), self.left.right); } else if (self.left.right instanceof AST_Constant) { - var rhs = make_binary(self.left, align(self.left.operator, self.operator), self.left.right, self.right, self.left.right.start, self.right.end); - if (self.left.operator != "-" - || !self.right.value - || rhs.evaluate(compressor) - || !self.left.left.is_negative_zero()) { + var op = align(self.left.operator, self.operator); + var rhs = try_evaluate(compressor, make_binary(self.left, op, self.left.right, self.right)); + if (rhs.is_constant() + && !(self.left.operator == "-" + && self.right.value != 0 + && +rhs.value == 0 + && self.left.left.is_negative_zero())) { self = make_binary(self, self.left.operator, self.left.left, rhs); } } } break; } - if (self.left instanceof AST_Number && !self.right.is_constant()) switch (self.operator) { - // 0 + n => n - case "+": - if (self.left.value == 0) { - if (self.right.is_boolean(compressor)) return make_node(AST_UnaryPrefix, self, { - operator: "+", - expression: self.right - }).optimize(compressor); - if (self.right.is_number(compressor) && !self.right.is_negative_zero()) return self.right; - } - break; - // 1 * n => n - case "*": - if (self.left.value == 1) { - return self.right.is_number(compressor) ? self.right : make_node(AST_UnaryPrefix, self, { - operator: "+", - expression: self.right - }).optimize(compressor); - } - break; - } - if (self.right instanceof AST_Number && !self.left.is_constant()) switch (self.operator) { - // n + 0 => n - case "+": - if (self.right.value == 0) { - if (self.left.is_boolean(compressor)) return make_node(AST_UnaryPrefix, self, { - operator: "+", - expression: self.left - }).optimize(compressor); - if (self.left.is_number(compressor) && !self.left.is_negative_zero()) return self.left; - } - break; - // n - 0 => n - case "-": - if (self.right.value == 0) { - return self.left.is_number(compressor) ? self.left : make_node(AST_UnaryPrefix, self, { - operator: "+", - expression: self.left - }).optimize(compressor); + if (!(parent instanceof AST_UnaryPrefix && parent.operator == "delete")) { + if (self.left instanceof AST_Number && !self.right.is_constant()) switch (self.operator) { + // 0 + n => n + case "+": + if (self.left.value == 0) { + if (self.right.is_boolean(compressor)) return make_node(AST_UnaryPrefix, self, { + operator: "+", + expression: self.right + }).optimize(compressor); + if (self.right.is_number(compressor) && !self.right.is_negative_zero()) return self.right; + } + break; + // 1 * n => n + case "*": + if (self.left.value == 1) { + return self.right.is_number(compressor) ? self.right : make_node(AST_UnaryPrefix, self, { + operator: "+", + expression: self.right + }).optimize(compressor); + } + break; } - break; - // n / 1 => n - case "/": - if (self.right.value == 1) { - return self.left.is_number(compressor) ? self.left : make_node(AST_UnaryPrefix, self, { - operator: "+", - expression: self.left - }).optimize(compressor); + if (self.right instanceof AST_Number && !self.left.is_constant()) switch (self.operator) { + // n + 0 => n + case "+": + if (self.right.value == 0) { + if (self.left.is_boolean(compressor)) return make_node(AST_UnaryPrefix, self, { + operator: "+", + expression: self.left + }).optimize(compressor); + if (self.left.is_number(compressor) && !self.left.is_negative_zero()) return self.left; + } + break; + // n - 0 => n + case "-": + if (self.right.value == 0) { + return self.left.is_number(compressor) ? self.left : make_node(AST_UnaryPrefix, self, { + operator: "+", + expression: self.left + }).optimize(compressor); + } + break; + // n / 1 => n + case "/": + if (self.right.value == 1) { + return self.left.is_number(compressor) ? self.left : make_node(AST_UnaryPrefix, self, { + operator: "+", + expression: self.left + }).optimize(compressor); + } + break; } - break; } } if (compressor.option("typeofs")) switch (self.operator) { @@ -7521,13 +8261,6 @@ merge(Compressor.prototype, { } return try_evaluate(compressor, self); - function can_self_compare(node) { - if (node instanceof AST_Dot) return can_self_compare(node.expression); - if (node instanceof AST_Sub) return can_self_compare(node.expression) && can_self_compare(node.property); - if (node instanceof AST_Symbol) return true; - return !node.has_side_effects(compressor); - } - function align(ref, op) { switch (ref) { case "-": @@ -7571,7 +8304,7 @@ merge(Compressor.prototype, { } function is_indexFn(node) { - return node instanceof AST_Call + return node.TYPE == "Call" && node.expression instanceof AST_Dot && indexFns[node.expression.property]; } @@ -7608,7 +8341,7 @@ merge(Compressor.prototype, { if (!compressor.option("ie8") && is_undeclared_ref(self) // testing against `self.scope.uses_with` is an optimization - && !(self.scope.uses_with && compressor.find_parent(AST_With))) { + && !(self.scope.resolve().uses_with && compressor.find_parent(AST_With))) { switch (self.name) { case "undefined": return make_node(AST_Undefined, self).optimize(compressor); @@ -7625,12 +8358,14 @@ merge(Compressor.prototype, { var single_use = def.single_use && !(parent instanceof AST_Call && parent.is_expr_pure(compressor)); if (single_use) { if (fixed instanceof AST_Lambda) { - if ((def.scope !== self.scope || def.in_loop) + if ((def.scope !== self.scope.resolve() || def.in_loop) && (!compressor.option("reduce_funcs") || def.escaped.depth == 1 || fixed.inlined)) { single_use = false; } else if (recursive_ref(compressor, def)) { single_use = false; - } else if (def.scope !== self.scope || def.orig[0] instanceof AST_SymbolFunarg) { + } else if (fixed.name && fixed.name.definition() !== def) { + single_use = false; + } else if (fixed.parent_scope !== self.scope.resolve() || def.orig[0] instanceof AST_SymbolFunarg) { single_use = fixed.is_constant_expression(self.scope); if (single_use == "f") { var scope = self.scope; @@ -7638,8 +8373,6 @@ merge(Compressor.prototype, { scope.inlined = true; } while (scope = scope.parent_scope); } - } else if (compressor.option("ie8") && fixed.name && def !== fixed.name.definition()) { - single_use = false; } if (single_use) fixed.parent_scope = self.scope; } else if (!fixed || !fixed.is_constant_expression()) { @@ -7780,7 +8513,7 @@ merge(Compressor.prototype, { OPT(AST_Undefined, function(self, compressor) { if (compressor.option("unsafe_undefined")) { - var undef = find_variable(compressor, "undefined"); + var undef = find_scope(compressor).find_variable("undefined"); if (undef) { var ref = make_node(AST_SymbolRef, self, { name : "undefined", @@ -7806,7 +8539,7 @@ merge(Compressor.prototype, { if (lhs && is_atomic(lhs, self)) return self; if (compressor.option("keep_infinity") && !(lhs && !is_atomic(lhs, self)) - && !find_variable(compressor, "Infinity")) + && !find_scope(compressor).find_variable("Infinity")) return self; return make_node(AST_Binary, self, { operator: "/", @@ -7821,8 +8554,7 @@ merge(Compressor.prototype, { OPT(AST_NaN, function(self, compressor) { var lhs = is_lhs(compressor.self(), compressor.parent()); - if (lhs && !is_atomic(lhs, self) - || find_variable(compressor, "NaN")) { + if (lhs && !is_atomic(lhs, self) || find_scope(compressor).find_variable("NaN")) { return make_node(AST_Binary, self, { operator: "/", left: make_node(AST_Number, self, { @@ -7883,13 +8615,20 @@ merge(Compressor.prototype, { ]).optimize(compressor); } } - } else if (self.left instanceof AST_SymbolRef) { - if (self.operator == "=" && self.left.equivalent_to(self.right)) return self.right; + } else if (self.left instanceof AST_SymbolRef && all(self.left.definition().orig, function(sym) { + return !(sym instanceof AST_SymbolConst); + })) { + var parent; + if (self.operator == "=" && self.left.equivalent_to(self.right) + && !((parent = compressor.parent()) instanceof AST_UnaryPrefix && parent.operator == "delete")) { + return self.right; + } if (self.left.is_immutable()) return strip_assignment(); var def = self.left.definition(); var scope = def.scope.resolve(); var local = scope === compressor.find_parent(AST_Lambda); - var level = 0, node, parent = self; + var level = 0, node; + parent = self; do { node = parent; parent = compressor.parent(level++); @@ -7984,14 +8723,13 @@ merge(Compressor.prototype, { }); OPT(AST_Conditional, function(self, compressor) { - if (!compressor.option("conditionals")) return self; - // This looks like lift_sequences(), should probably be under "sequences" - if (self.condition instanceof AST_Sequence) { + if (compressor.option("sequences") && self.condition instanceof AST_Sequence) { var expressions = self.condition.expressions.slice(); self.condition = expressions.pop(); expressions.push(self); return make_sequence(self, expressions); } + if (!compressor.option("conditionals")) return self; var condition = self.condition.is_truthy() || self.condition.evaluate(compressor, true); if (!condition) { AST_Node.warn("Condition always false [{file}:{line},{col}]", self.start); @@ -8012,15 +8750,19 @@ merge(Compressor.prototype, { } var consequent = self.consequent; var alternative = self.alternative; - // x ? x : y => x || y - if (condition instanceof AST_SymbolRef - && consequent instanceof AST_SymbolRef - && condition.definition() === consequent.definition()) { - return make_node(AST_Binary, self, { + if (repeatable(compressor, condition)) { + // x ? x : y => x || y + if (condition.equivalent_to(consequent)) return make_node(AST_Binary, self, { operator: "||", left: condition, - right: alternative - }); + right: alternative, + }).optimize(compressor); + // x ? y : x => x && y + if (condition.equivalent_to(alternative)) return make_node(AST_Binary, self, { + operator: "&&", + left: condition, + right: consequent, + }).optimize(compressor); } // if (foo) exp = something; else exp = something_else; // | @@ -8054,35 +8796,26 @@ merge(Compressor.prototype, { condition, consequent ]).optimize(compressor); + // x ? y.p : z.p => (x ? y : z).p + // x ? y(a) : z(a) => (x ? y : z)(a) + // x ? y.f(a) : z.f(a) => (x ? y : z).f(a) + var combined = combine_tail(consequent, alternative, true); + if (combined) return combined; + // x ? y(a) : y(b) => y(x ? a : b) + var arg_index; if (consequent instanceof AST_Call - && alternative.TYPE === consequent.TYPE - && consequent.args.length == alternative.args.length) { - var arg_index = arg_diff(); - // x ? y(a) : z(a) => (x ? y : z)(a) - if (arg_index == -1 - && !(consequent.expression instanceof AST_PropAccess) - && !(alternative.expression instanceof AST_PropAccess)) { - var node = consequent.clone(); - node.expression = make_node(AST_Conditional, self, { - condition: condition, - consequent: consequent.expression, - alternative: alternative.expression - }); - return node; - } - // x ? y(a) : y(b) => y(x ? a : b) - if (arg_index >= 0 - && consequent.expression.equivalent_to(alternative.expression) - && !condition.has_side_effects(compressor) - && !consequent.expression.has_side_effects(compressor)) { - var node = consequent.clone(); - node.args[arg_index] = make_node(AST_Conditional, self, { - condition: condition, - consequent: consequent.args[arg_index], - alternative: alternative.args[arg_index] - }); - return node; - } + && alternative.TYPE == consequent.TYPE + && (arg_index = arg_diff(consequent, alternative)) >= 0 + && consequent.expression.equivalent_to(alternative.expression) + && !condition.has_side_effects(compressor) + && !consequent.expression.has_side_effects(compressor)) { + var node = consequent.clone(); + node.args[arg_index] = make_node(AST_Conditional, self, { + condition: condition, + consequent: consequent.args[arg_index], + alternative: alternative.args[arg_index] + }); + return node; } // x ? (y ? a : b) : b => x && y ? a : b if (consequent instanceof AST_Conditional @@ -8283,10 +9016,12 @@ merge(Compressor.prototype, { && node.expression.value); } - function arg_diff() { + function arg_diff(consequent, alternative) { var a = consequent.args; var b = alternative.args; - for (var i = 0, len = a.length; i < len; i++) { + var len = a.length; + if (len != b.length) return -2; + for (var i = 0; i < len; i++) { if (!a[i].equivalent_to(b[i])) { for (var j = i + 1; j < len; j++) { if (!a[j].equivalent_to(b[j])) return -2; @@ -8297,6 +9032,32 @@ merge(Compressor.prototype, { return -1; } + function is_tail_equivalent(consequent, alternative) { + if (consequent.TYPE != alternative.TYPE) return; + if (consequent instanceof AST_Call) { + if (arg_diff(consequent, alternative) != -1) return; + return consequent.TYPE != "Call" + || !(consequent.expression instanceof AST_PropAccess + || alternative.expression instanceof AST_PropAccess) + || is_tail_equivalent(consequent.expression, alternative.expression); + } + if (consequent instanceof AST_Dot) return consequent.property == alternative.property; + if (consequent instanceof AST_Sub) return consequent.property.equivalent_to(alternative.property); + } + + function combine_tail(consequent, alternative, top) { + if (!is_tail_equivalent(consequent, alternative)) return !top && make_node(AST_Conditional, self, { + condition: condition, + consequent: consequent, + alternative: alternative + }); + var exp = combine_tail(consequent.expression, alternative.expression); + if (!exp) return; + var node = consequent.clone(); + node.expression = exp; + return node; + } + function can_shift_lhs_of_tail(node) { return node === node.tail_node() || all(node.expressions.slice(0, -1), function(expr) { return !expr.has_side_effects(compressor); @@ -8389,7 +9150,7 @@ merge(Compressor.prototype, { && expr instanceof AST_SymbolRef && is_arguments(def = expr.definition()) && prop instanceof AST_Number - && (fn = expr.scope) === find_lambda()) { + && (fn = expr.scope.resolve()) === find_lambda()) { var index = prop.value; if (parent instanceof AST_UnaryPrefix && parent.operator == "delete") { if (!def.deleted) def.deleted = []; @@ -8428,7 +9189,9 @@ merge(Compressor.prototype, { } } if (is_lhs(compressor.self(), parent)) return self; - if (compressor.option("sequences") && compressor.parent().TYPE != "Call") { + if (compressor.option("sequences") + && parent.TYPE != "Call" + && !(parent instanceof AST_ForIn && parent.init === self)) { var seq = lift_sequence_in_expression(self, compressor); if (seq !== self) return seq.optimize(compressor); } @@ -8485,6 +9248,7 @@ merge(Compressor.prototype, { var i = 0, p; while (p = compressor.parent(i++)) { if (p instanceof AST_Lambda) { + if (p instanceof AST_Accessor) return; fn_parent = compressor.parent(i); return p; } @@ -8539,8 +9303,11 @@ merge(Compressor.prototype, { col: self.start.col }); } - if (is_lhs(compressor.self(), compressor.parent())) return self; - if (compressor.option("sequences") && compressor.parent().TYPE != "Call") { + var parent = compressor.parent(); + if (is_lhs(compressor.self(), parent)) return self; + if (compressor.option("sequences") + && parent.TYPE != "Call" + && !(parent instanceof AST_ForIn && parent.init === self)) { var seq = lift_sequence_in_expression(self, compressor); if (seq !== self) return seq.optimize(compressor); } @@ -8558,7 +9325,7 @@ merge(Compressor.prototype, { self.expression = make_node(AST_Function, self.expression, { argnames: [], body: [] - }); + }).init_vars(exp.scope); break; case "Number": self.expression = make_node(AST_Number, self.expression, { diff --git a/node_modules/uglify-js/lib/minify.js b/node_modules/uglify-js/lib/minify.js index 13d36de0..c264f695 100644 --- a/node_modules/uglify-js/lib/minify.js +++ b/node_modules/uglify-js/lib/minify.js @@ -178,13 +178,17 @@ function minify(files, options) { toplevel = toplevel[action](option); files[toplevel.start.file] = toplevel.print_to_string().replace(orig, ""); }); + if (options.validate) toplevel.validate_ast(); if (timings) timings.rename = Date.now(); if (options.rename) { toplevel.figure_out_scope(options.mangle); toplevel.expand_names(options.mangle); } if (timings) timings.compress = Date.now(); - if (options.compress) toplevel = new Compressor(options.compress).compress(toplevel); + if (options.compress) { + toplevel = new Compressor(options.compress).compress(toplevel); + if (options.validate) toplevel.validate_ast(); + } if (timings) timings.scope = Date.now(); if (options.mangle) toplevel.figure_out_scope(options.mangle); if (timings) timings.mangle = Date.now(); @@ -193,9 +197,7 @@ function minify(files, options) { toplevel.mangle_names(options.mangle); } if (timings) timings.properties = Date.now(); - if (options.mangle && options.mangle.properties) { - toplevel = mangle_properties(toplevel, options.mangle.properties); - } + if (options.mangle && options.mangle.properties) mangle_properties(toplevel, options.mangle.properties); if (timings) timings.output = Date.now(); var result = {}; if (options.output.ast) { diff --git a/node_modules/uglify-js/lib/output.js b/node_modules/uglify-js/lib/output.js index a9e0ca7b..ef1d41f6 100644 --- a/node_modules/uglify-js/lib/output.js +++ b/node_modules/uglify-js/lib/output.js @@ -100,13 +100,16 @@ function OutputStream(options) { } } - var indentation = 0; + var indentation = options.indent_start; var current_col = 0; var current_line = 1; var current_pos = 0; var OUTPUT = ""; var to_utf8 = options.ascii_only ? function(str, identifier) { + if (identifier) str = str.replace(/[\ud800-\udbff][\udc00-\udfff]/g, function(ch) { + return "\\u{" + (ch.charCodeAt(0) - 0xd7c0 << 10 | ch.charCodeAt(1) - 0xdc00).toString(16) + "}"; + }); return str.replace(/[\u0000-\u001f\u007f-\uffff]/g, function(ch) { var code = ch.charCodeAt(0).toString(16); if (code.length <= 2 && !identifier) { @@ -191,10 +194,6 @@ function OutputStream(options) { return name; } - function make_indent(back) { - return repeat_string(" ", options.indent_start + indentation - back * options.indent_level); - } - /* -----[ beautification/minification ]----- */ var has_parens = false; @@ -345,9 +344,7 @@ function OutputStream(options) { }; var indent = options.beautify ? function(half) { - if (options.beautify) { - print(make_indent(half ? 0.5 : 0)); - } + print(repeat_string(" ", half ? indentation - (options.indent_level >> 1) : indentation)); } : noop; var with_indent = options.beautify ? function(col, cont) { @@ -575,9 +572,9 @@ function OutputStream(options) { get : get, toString : get, indent : indent, - indentation : function() { return indentation }, - current_width : function() { return current_col - indentation }, - should_break : function() { return options.width && this.current_width() >= options.width }, + should_break : readonly ? noop : function() { + return options.width && current_col - indentation >= options.width; + }, has_parens : function() { return has_parens }, newline : newline, print : print, @@ -630,13 +627,7 @@ function OutputStream(options) { var use_asm = false; AST_Node.DEFMETHOD("print", function(stream, force_parens) { - var self = this, generator = self._codegen; - function doit() { - stream.prepend_comments(self); - self.add_source_map(stream); - generator(self, stream); - stream.append_comments(self); - } + var self = this; stream.push_node(self); if (force_parens || self.needs_parens(stream)) { stream.with_parens(doit); @@ -644,9 +635,14 @@ function OutputStream(options) { doit(); } stream.pop_node(); - }); - AST_Node.DEFMETHOD("_print", AST_Node.prototype.print); + function doit() { + stream.prepend_comments(self); + self.add_source_map(stream); + self._codegen(stream); + stream.append_comments(self); + } + }); AST_Node.DEFMETHOD("print_to_string", function(options) { var s = OutputStream(options); this.print(s); @@ -689,78 +685,66 @@ function OutputStream(options) { PARENS(AST_Unary, function(output) { var p = output.parent(); - return p instanceof AST_PropAccess && p.expression === this - || p instanceof AST_Call && p.expression === this; + return (p instanceof AST_Call || p instanceof AST_PropAccess) && p.expression === this; }); PARENS(AST_Sequence, function(output) { var p = output.parent(); - // (foo, bar)() or foo(1, (2, 3), 4) - return p instanceof AST_Call - // !(foo, bar, baz) - || p instanceof AST_Unary + // [ 1, (2, 3), 4 ] ==> [ 1, 3, 4 ] + return p instanceof AST_Array // 1 + (2, 3) + 4 ==> 8 || p instanceof AST_Binary - // var a = (1, 2), b = a + a; ==> b == 4 - || p instanceof AST_VarDef - // (1, {foo:2}).foo or (1, {foo:2})["foo"] ==> 2 - || p instanceof AST_PropAccess && p.expression === this - // [ 1, (2, 3), 4 ] ==> [ 1, 3, 4 ] - || p instanceof AST_Array - // { foo: (1, 2) }.foo ==> 2 - || p instanceof AST_ObjectProperty + // new (foo, bar) or foo(1, (2, 3), 4) + || p instanceof AST_Call // (false, true) ? (a = 10, b = 20) : (c = 30) // ==> 20 (side effect, set a := 10 and b := 20) - || p instanceof AST_Conditional; + || p instanceof AST_Conditional + // { foo: (1, 2) }.foo ==> 2 + || p instanceof AST_ObjectProperty + // (1, {foo:2}).foo or (1, {foo:2})["foo"] ==> 2 + || p instanceof AST_PropAccess && p.expression === this + // !(foo, bar, baz) + || p instanceof AST_Unary + // var a = (1, 2), b = a + a; ==> b == 4 + || p instanceof AST_VarDef; }); PARENS(AST_Binary, function(output) { var p = output.parent(); - // (foo && bar)() - if (p instanceof AST_Call && p.expression === this) - return true; - // typeof (foo && bar) - if (p instanceof AST_Unary) - return true; - // (foo && bar)["prop"], (foo && bar).prop - if (p instanceof AST_PropAccess && p.expression === this) - return true; // this deals with precedence: 3 * (2 + 1) if (p instanceof AST_Binary) { var po = p.operator, pp = PRECEDENCE[po]; var so = this.operator, sp = PRECEDENCE[so]; - if (pp > sp - || (pp == sp - && this === p.right)) { - return true; - } + return pp > sp || (pp == sp && this === p.right); } + // (foo && bar)() + if (p instanceof AST_Call) return p.expression === this; + // (foo && bar)["prop"], (foo && bar).prop + if (p instanceof AST_PropAccess) return p.expression === this; + // typeof (foo && bar) + if (p instanceof AST_Unary) return true; }); PARENS(AST_PropAccess, function(output) { + var node = this; var p = output.parent(); - if (p instanceof AST_New && p.expression === this) { - // i.e. new (foo.bar().baz) + if (p instanceof AST_New && p.expression === node) { + // i.e. new (foo().bar) // // if there's one call into this subtree, then we need // parens around it too, otherwise the call will be // interpreted as passing the arguments to the upper New // expression. - var parens = false; - this.walk(new TreeWalker(function(node) { - if (parens || node instanceof AST_Scope) return true; - if (node instanceof AST_Call) { - parens = true; - return true; - } - })); - return parens; + do { + node = node.expression; + } while (node instanceof AST_PropAccess); + return node.TYPE == "Call"; } }); PARENS(AST_Call, function(output) { var p = output.parent(); - if (p instanceof AST_New && p.expression === this) return true; + if (p instanceof AST_New) return p.expression === this; // https://bugs.webkit.org/show_bug.cgi?id=123506 if (output.option('webkit')) { var g = output.parent(1); @@ -773,11 +757,12 @@ function OutputStream(options) { }); PARENS(AST_New, function(output) { + if (need_constructor_parens(this, output)) return false; var p = output.parent(); - if (!need_constructor_parens(this, output) - && (p instanceof AST_PropAccess // (new Date).getTime(), (new Date)["getTime"]() - || p instanceof AST_Call && p.expression === this)) // (new foo)(bar) - return true; + // (new foo)(bar) + if (p instanceof AST_Call) return p.expression === this; + // (new Date).getTime(), (new Date)["getTime"]() + return p instanceof AST_PropAccess; }); PARENS(AST_Number, function(output) { @@ -786,36 +771,29 @@ function OutputStream(options) { var value = this.value; // https://github.com/mishoo/UglifyJS/issues/115 // https://github.com/mishoo/UglifyJS/pull/1009 - if (value < 0 || /^0/.test(make_num(value))) { - return true; - } + return value < 0 || /^0/.test(make_num(value)); } }); PARENS([ AST_Assign, AST_Conditional ], function(output) { var p = output.parent(); - // !(a = false) → true - if (p instanceof AST_Unary) - return true; // 1 + (a = 2) + 3 → 6, side effect setting a = 2 - if (p instanceof AST_Binary && !(p instanceof AST_Assign)) - return true; + if (p instanceof AST_Binary) return !(p instanceof AST_Assign); // (a = func)() —or— new (a = Object)() - if (p instanceof AST_Call && p.expression === this) - return true; + if (p instanceof AST_Call) return p.expression === this; // (a = foo) ? bar : baz - if (p instanceof AST_Conditional && p.condition === this) - return true; + if (p instanceof AST_Conditional) return p.condition === this; // (a = foo)["prop"] —or— (a = foo).prop - if (p instanceof AST_PropAccess && p.expression === this) - return true; + if (p instanceof AST_PropAccess) return p.expression === this; + // !(a = false) → true + if (p instanceof AST_Unary) return true; }); /* -----[ PRINTERS ]----- */ - DEFPRINT(AST_Directive, function(self, output) { - var quote = self.quote; - var value = self.value; + DEFPRINT(AST_Directive, function(output) { + var quote = this.quote; + var value = this.value; switch (output.option("quote_style")) { case 0: case 2: @@ -828,7 +806,7 @@ function OutputStream(options) { output.print(quote + value + quote); output.semicolon(); }); - DEFPRINT(AST_Debugger, function(self, output) { + DEFPRINT(AST_Debugger, function(output) { output.print("debugger"); output.semicolon(); }); @@ -860,25 +838,21 @@ function OutputStream(options) { use_asm = was_asm; } - AST_StatementWithBody.DEFMETHOD("_do_print_body", function(output) { - force_statement(this.body, output); - }); - - DEFPRINT(AST_Statement, function(self, output) { - self.body.print(output); + DEFPRINT(AST_Statement, function(output) { + this.body.print(output); output.semicolon(); }); - DEFPRINT(AST_Toplevel, function(self, output) { - display_body(self.body, true, output, true); + DEFPRINT(AST_Toplevel, function(output) { + display_body(this.body, true, output, true); output.print(""); }); - DEFPRINT(AST_LabeledStatement, function(self, output) { - self.label.print(output); + DEFPRINT(AST_LabeledStatement, function(output) { + this.label.print(output); output.colon(); - self.body.print(output); + this.body.print(output); }); - DEFPRINT(AST_SimpleStatement, function(self, output) { - self.body.print(output); + DEFPRINT(AST_SimpleStatement, function(output) { + this.body.print(output); output.semicolon(); }); function print_braced_empty(self, output) { @@ -895,13 +869,14 @@ function OutputStream(options) { }); } else print_braced_empty(self, output); } - DEFPRINT(AST_BlockStatement, function(self, output) { - print_braced(self, output); + DEFPRINT(AST_BlockStatement, function(output) { + print_braced(this, output); }); - DEFPRINT(AST_EmptyStatement, function(self, output) { + DEFPRINT(AST_EmptyStatement, function(output) { output.semicolon(); }); - DEFPRINT(AST_Do, function(self, output) { + DEFPRINT(AST_Do, function(output) { + var self = this; output.print("do"); output.space(); make_block(self.body, output); @@ -913,16 +888,18 @@ function OutputStream(options) { }); output.semicolon(); }); - DEFPRINT(AST_While, function(self, output) { + DEFPRINT(AST_While, function(output) { + var self = this; output.print("while"); output.space(); output.with_parens(function() { self.condition.print(output); }); output.space(); - self._do_print_body(output); + force_statement(self.body, output); }); - DEFPRINT(AST_For, function(self, output) { + DEFPRINT(AST_For, function(output) { + var self = this; output.print("for"); output.space(); output.with_parens(function() { @@ -949,9 +926,10 @@ function OutputStream(options) { } }); output.space(); - self._do_print_body(output); + force_statement(self.body, output); }); - DEFPRINT(AST_ForIn, function(self, output) { + DEFPRINT(AST_ForIn, function(output) { + var self = this; output.print("for"); output.space(); output.with_parens(function() { @@ -962,20 +940,21 @@ function OutputStream(options) { self.object.print(output); }); output.space(); - self._do_print_body(output); + force_statement(self.body, output); }); - DEFPRINT(AST_With, function(self, output) { + DEFPRINT(AST_With, function(output) { + var self = this; output.print("with"); output.space(); output.with_parens(function() { self.expression.print(output); }); output.space(); - self._do_print_body(output); + force_statement(self.body, output); }); /* -----[ functions ]----- */ - AST_Lambda.DEFMETHOD("_do_print", function(output, nokeyword) { + DEFPRINT(AST_Lambda, function(output, nokeyword) { var self = this; if (!nokeyword) { output.print("function"); @@ -993,37 +972,28 @@ function OutputStream(options) { output.space(); print_braced(self, output, true); }); - DEFPRINT(AST_Lambda, function(self, output) { - self._do_print(output); - }); /* -----[ jumps ]----- */ - function print_jump(output, kind, target) { - output.print(kind); - if (target) { - output.space(); - target.print(output); - } - output.semicolon(); + function print_jump(kind, prop) { + return function(output) { + output.print(kind); + var target = this[prop]; + if (target) { + output.space(); + target.print(output); + } + output.semicolon(); + }; } - - DEFPRINT(AST_Return, function(self, output) { - print_jump(output, "return", self.value); - }); - DEFPRINT(AST_Throw, function(self, output) { - print_jump(output, "throw", self.value); - }); - DEFPRINT(AST_Break, function(self, output) { - print_jump(output, "break", self.label); - }); - DEFPRINT(AST_Continue, function(self, output) { - print_jump(output, "continue", self.label); - }); + DEFPRINT(AST_Return, print_jump("return", "value")); + DEFPRINT(AST_Throw, print_jump("throw", "value")); + DEFPRINT(AST_Break, print_jump("break", "label")); + DEFPRINT(AST_Continue, print_jump("continue", "label")); /* -----[ if ]----- */ function make_then(self, output) { var b = self.body; - if (output.option("braces") + if (output.option("braces") && !(b instanceof AST_Const || b instanceof AST_Let) || output.option("ie8") && b instanceof AST_Do) return make_block(b, output); // The squeezer replaces "block"-s that contain only a single @@ -1047,7 +1017,8 @@ function OutputStream(options) { } force_statement(self.body, output); } - DEFPRINT(AST_If, function(self, output) { + DEFPRINT(AST_If, function(output) { + var self = this; output.print("if"); output.space(); output.with_parens(function() { @@ -1064,12 +1035,13 @@ function OutputStream(options) { else force_statement(self.alternative, output); } else { - self._do_print_body(output); + force_statement(self.body, output); } }); /* -----[ switch ]----- */ - DEFPRINT(AST_Switch, function(self, output) { + DEFPRINT(AST_Switch, function(output) { + var self = this; output.print("switch"); output.space(); output.with_parens(function() { @@ -1087,28 +1059,30 @@ function OutputStream(options) { }); }); }); - AST_SwitchBranch.DEFMETHOD("_do_print_body", function(output) { + function print_branch_body(self, output) { output.newline(); - this.body.forEach(function(stmt) { + self.body.forEach(function(stmt) { output.indent(); stmt.print(output); output.newline(); }); - }); - DEFPRINT(AST_Default, function(self, output) { + } + DEFPRINT(AST_Default, function(output) { output.print("default:"); - self._do_print_body(output); + print_branch_body(this, output); }); - DEFPRINT(AST_Case, function(self, output) { + DEFPRINT(AST_Case, function(output) { + var self = this; output.print("case"); output.space(); self.expression.print(output); output.print(":"); - self._do_print_body(output); + print_branch_body(self, output); }); /* -----[ exceptions ]----- */ - DEFPRINT(AST_Try, function(self, output) { + DEFPRINT(AST_Try, function(output) { + var self = this; output.print("try"); output.space(); print_braced(self, output); @@ -1121,31 +1095,40 @@ function OutputStream(options) { self.bfinally.print(output); } }); - DEFPRINT(AST_Catch, function(self, output) { + DEFPRINT(AST_Catch, function(output) { + var self = this; output.print("catch"); - output.space(); - output.with_parens(function() { - self.argname.print(output); - }); + if (self.argname) { + output.space(); + output.with_parens(function() { + self.argname.print(output); + }); + } output.space(); print_braced(self, output); }); - DEFPRINT(AST_Finally, function(self, output) { + DEFPRINT(AST_Finally, function(output) { output.print("finally"); output.space(); - print_braced(self, output); + print_braced(this, output); }); - DEFPRINT(AST_Var, function(self, output) { - output.print("var"); - output.space(); - self.definitions.forEach(function(def, i) { - if (i) output.comma(); - def.print(output); - }); - var p = output.parent(); - if (p && p.init !== self || !(p instanceof AST_For || p instanceof AST_ForIn)) output.semicolon(); - }); + function print_definitinos(type) { + return function(output) { + var self = this; + output.print(type); + output.space(); + self.definitions.forEach(function(def, i) { + if (i) output.comma(); + def.print(output); + }); + var p = output.parent(); + if (p && p.init !== self || !(p instanceof AST_For || p instanceof AST_ForIn)) output.semicolon(); + }; + } + DEFPRINT(AST_Const, print_definitinos("const")); + DEFPRINT(AST_Let, print_definitinos("let")); + DEFPRINT(AST_Var, print_definitinos("var")); function parenthesize_for_noin(node, output, noin) { var parens = false; @@ -1161,7 +1144,8 @@ function OutputStream(options) { node.print(output, parens); } - DEFPRINT(AST_VarDef, function(self, output) { + DEFPRINT(AST_VarDef, function(output) { + var self = this; self.name.print(output); if (self.value) { output.space(); @@ -1174,10 +1158,7 @@ function OutputStream(options) { }); /* -----[ other expressions ]----- */ - DEFPRINT(AST_Call, function(self, output) { - self.expression.print(output); - if (self instanceof AST_New && !need_constructor_parens(self, output)) - return; + function print_call_args(self, output) { if (self.expression instanceof AST_Call || self.expression instanceof AST_Lambda) { output.add_mapping(self.start); } @@ -1187,14 +1168,20 @@ function OutputStream(options) { expr.print(output); }); }); + } + DEFPRINT(AST_Call, function(output) { + this.expression.print(output); + print_call_args(this, output); }); - DEFPRINT(AST_New, function(self, output) { + DEFPRINT(AST_New, function(output) { + var self = this; output.print("new"); output.space(); - AST_Call.prototype._codegen(self, output); + self.expression.print(output); + if (need_constructor_parens(self, output)) print_call_args(self, output); }); - DEFPRINT(AST_Sequence, function(self, output) { - self.expressions.forEach(function(node, index) { + DEFPRINT(AST_Sequence, function(output) { + this.expressions.forEach(function(node, index) { if (index > 0) { output.comma(); if (output.should_break()) { @@ -1205,7 +1192,8 @@ function OutputStream(options) { node.print(output); }); }); - DEFPRINT(AST_Dot, function(self, output) { + DEFPRINT(AST_Dot, function(output) { + var self = this; var expr = self.expression; expr.print(output); var prop = self.property; @@ -1226,35 +1214,38 @@ function OutputStream(options) { output.print_name(prop); } }); - DEFPRINT(AST_Sub, function(self, output) { - self.expression.print(output); + DEFPRINT(AST_Sub, function(output) { + this.expression.print(output); output.print("["); - self.property.print(output); + this.property.print(output); output.print("]"); }); - DEFPRINT(AST_UnaryPrefix, function(self, output) { - var op = self.operator; + DEFPRINT(AST_UnaryPrefix, function(output) { + var op = this.operator; + var exp = this.expression; output.print(op); if (/^[a-z]/i.test(op) || (/[+-]$/.test(op) - && self.expression instanceof AST_UnaryPrefix - && /^[+-]/.test(self.expression.operator))) { + && exp instanceof AST_UnaryPrefix + && /^[+-]/.test(exp.operator))) { output.space(); } - self.expression.print(output); + exp.print(output); }); - DEFPRINT(AST_UnaryPostfix, function(self, output) { - self.expression.print(output); - output.print(self.operator); + DEFPRINT(AST_UnaryPostfix, function(output) { + this.expression.print(output); + output.print(this.operator); }); - DEFPRINT(AST_Binary, function(self, output) { + DEFPRINT(AST_Binary, function(output) { + var self = this; self.left.print(output); output.space(); output.print(self.operator); output.space(); self.right.print(output); }); - DEFPRINT(AST_Conditional, function(self, output) { + DEFPRINT(AST_Conditional, function(output) { + var self = this; self.condition.print(output); output.space(); output.print("?"); @@ -1266,10 +1257,10 @@ function OutputStream(options) { }); /* -----[ literals ]----- */ - DEFPRINT(AST_Array, function(self, output) { - output.with_square(function() { - var a = self.elements, len = a.length; - if (len > 0) output.space(); + DEFPRINT(AST_Array, function(output) { + var a = this.elements, len = a.length; + output.with_square(len > 0 ? function() { + output.space(); a.forEach(function(exp, i) { if (i) output.comma(); exp.print(output); @@ -1279,12 +1270,13 @@ function OutputStream(options) { if (i === len - 1 && exp instanceof AST_Hole) output.comma(); }); - if (len > 0) output.space(); - }); + output.space(); + } : noop); }); - DEFPRINT(AST_Object, function(self, output) { - if (self.properties.length > 0) output.with_block(function() { - self.properties.forEach(function(prop, i) { + DEFPRINT(AST_Object, function(output) { + var props = this.properties; + if (props.length > 0) output.with_block(function() { + props.forEach(function(prop, i) { if (i) { output.print(","); output.newline(); @@ -1294,7 +1286,7 @@ function OutputStream(options) { }); output.newline(); }); - else print_braced_empty(self, output); + else print_braced_empty(this, output); }); function print_property_name(key, quote, output) { @@ -1313,47 +1305,48 @@ function OutputStream(options) { } } - DEFPRINT(AST_ObjectKeyVal, function(self, output) { + DEFPRINT(AST_ObjectKeyVal, function(output) { + var self = this; print_property_name(self.key, self.quote, output); output.colon(); self.value.print(output); }); - AST_ObjectProperty.DEFMETHOD("_print_getter_setter", function(type, output) { - output.print(type); - output.space(); - print_property_name(this.key.name, this.quote, output); - this.value._do_print(output, true); - }); - DEFPRINT(AST_ObjectSetter, function(self, output) { - self._print_getter_setter("set", output); - }); - DEFPRINT(AST_ObjectGetter, function(self, output) { - self._print_getter_setter("get", output); - }); - DEFPRINT(AST_Symbol, function(self, output) { - var def = self.definition(); - output.print_name(def && def.mangled_name || self.name); + function print_accessor(type) { + return function(output) { + var self = this; + output.print(type); + output.space(); + print_property_name(self.key.name, self.quote, output); + self.value._codegen(output, true); + }; + } + DEFPRINT(AST_ObjectGetter, print_accessor("get")); + DEFPRINT(AST_ObjectSetter, print_accessor("set")); + DEFPRINT(AST_Symbol, function(output) { + var def = this.definition(); + output.print_name(def && def.mangled_name || this.name); }); DEFPRINT(AST_Hole, noop); - DEFPRINT(AST_This, function(self, output) { + DEFPRINT(AST_This, function(output) { output.print("this"); }); - DEFPRINT(AST_Constant, function(self, output) { - output.print(self.value); + DEFPRINT(AST_Constant, function(output) { + output.print(this.value); }); - DEFPRINT(AST_String, function(self, output) { - output.print_string(self.value, self.quote); + DEFPRINT(AST_String, function(output) { + output.print_string(this.value, this.quote); }); - DEFPRINT(AST_Number, function(self, output) { - if (use_asm && self.start && self.start.raw != null) { - output.print(self.start.raw); + DEFPRINT(AST_Number, function(output) { + var start = this.start; + if (use_asm && start && start.raw != null) { + output.print(start.raw); } else { - output.print(make_num(self.value)); + output.print(make_num(this.value)); } }); - DEFPRINT(AST_RegExp, function(self, output) { - var regexp = self.value; + DEFPRINT(AST_RegExp, function(output) { + var regexp = this.value; var str = regexp.toString(); var end = str.lastIndexOf("/"); if (regexp.raw_source) { @@ -1387,18 +1380,17 @@ function OutputStream(options) { } })); var p = output.parent(); - if (p instanceof AST_Binary && /^in/.test(p.operator) && p.left === self) + if (p instanceof AST_Binary && /^in/.test(p.operator) && p.left === this) output.print(" "); }); function force_statement(stat, output) { - if (output.option("braces")) { + if (output.option("braces") && !(stat instanceof AST_Const || stat instanceof AST_Let)) { make_block(stat, output); + } else if (!stat || stat instanceof AST_EmptyStatement) { + output.force_semicolon(); } else { - if (!stat || stat instanceof AST_EmptyStatement) - output.force_semicolon(); - else - stat.print(output); + stat.print(output); } } diff --git a/node_modules/uglify-js/lib/parse.js b/node_modules/uglify-js/lib/parse.js index abbf2df4..69c14e4a 100644 --- a/node_modules/uglify-js/lib/parse.js +++ b/node_modules/uglify-js/lib/parse.js @@ -44,21 +44,23 @@ "use strict"; -var KEYWORDS = 'break case catch const continue debugger default delete do else finally for function if in instanceof new return switch throw try typeof var void while with'; -var KEYWORDS_ATOM = 'false null true'; -var RESERVED_WORDS = 'abstract boolean byte char class double enum export extends final float goto implements import int interface let long native package private protected public short static super synchronized this throws transient volatile yield' - + " " + KEYWORDS_ATOM + " " + KEYWORDS; -var KEYWORDS_BEFORE_EXPRESSION = 'return new delete throw else case'; +var KEYWORDS = "break case catch const continue debugger default delete do else finally for function if in instanceof let new return switch throw try typeof var void while with"; +var KEYWORDS_ATOM = "false null true"; +var RESERVED_WORDS = [ + "abstract boolean byte char class double enum export extends final float goto implements import int interface let long native package private protected public short static super synchronized this throws transient volatile yield", + KEYWORDS_ATOM, + KEYWORDS, +].join(" "); +var KEYWORDS_BEFORE_EXPRESSION = "return new delete throw else case"; KEYWORDS = makePredicate(KEYWORDS); RESERVED_WORDS = makePredicate(RESERVED_WORDS); KEYWORDS_BEFORE_EXPRESSION = makePredicate(KEYWORDS_BEFORE_EXPRESSION); KEYWORDS_ATOM = makePredicate(KEYWORDS_ATOM); -var OPERATOR_CHARS = makePredicate(characters("+-*&%=<>!?|~^")); - -var RE_HEX_NUMBER = /^0x[0-9a-f]+$/i; -var RE_OCT_NUMBER = /^0[0-7]+$/; +var RE_BIN_NUMBER = /^0b([01]+)$/i; +var RE_HEX_NUMBER = /^0x([0-9a-f]+)$/i; +var RE_OCT_NUMBER = /^0o?([0-7]+)$/i; var OPERATORS = makePredicate([ "in", @@ -107,31 +109,21 @@ var OPERATORS = makePredicate([ "||" ]); -var WHITESPACE_CHARS = makePredicate(characters(" \u00a0\n\r\t\f\u000b\u200b\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\uFEFF")); - -var NEWLINE_CHARS = makePredicate(characters("\n\r\u2028\u2029")); - -var PUNC_BEFORE_EXPRESSION = makePredicate(characters("[{(,;:")); +var NEWLINE_CHARS = "\n\r\u2028\u2029"; +var OPERATOR_CHARS = "+-*&%=<>!?|~^"; +var PUNC_BEFORE_EXPRESSION = "[{(,;:"; +var PUNC_CHARS = PUNC_BEFORE_EXPRESSION + ")}]"; +var WHITESPACE_CHARS = NEWLINE_CHARS + " \u00a0\t\f\u000b\u200b\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\uFEFF"; +var NON_IDENTIFIER_CHARS = makePredicate(characters("./'\"" + OPERATOR_CHARS + PUNC_CHARS + WHITESPACE_CHARS)); -var PUNC_CHARS = makePredicate(characters("[]{}(),;:")); +NEWLINE_CHARS = makePredicate(characters(NEWLINE_CHARS)); +OPERATOR_CHARS = makePredicate(characters(OPERATOR_CHARS)); +PUNC_BEFORE_EXPRESSION = makePredicate(characters(PUNC_BEFORE_EXPRESSION)); +PUNC_CHARS = makePredicate(characters(PUNC_CHARS)); +WHITESPACE_CHARS = makePredicate(characters(WHITESPACE_CHARS)); /* -----[ Tokenizer ]----- */ -// regexps adapted from http://xregexp.com/plugins/#unicode -var UNICODE = { - letter: new RegExp("[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"), - digit: new RegExp("[\\u0030-\\u0039\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE6-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\u1040-\\u1049\\u1090-\\u1099\\u17E0-\\u17E9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19D9\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\uA620-\\uA629\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19]"), - non_spacing_mark: new RegExp("[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065E\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0900-\\u0902\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0955\\u0962\\u0963\\u0981\\u09BC\\u09C1-\\u09C4\\u09CD\\u09E2\\u09E3\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0B01\\u0B3C\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B56\\u0B62\\u0B63\\u0B82\\u0BC0\\u0BCD\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0CBC\\u0CBF\\u0CC6\\u0CCC\\u0CCD\\u0CE2\\u0CE3\\u0D41-\\u0D44\\u0D4D\\u0D62\\u0D63\\u0DCA\\u0DD2-\\u0DD4\\u0DD6\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F90-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1B00-\\u1B03\\u1B34\\u1B36-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1DC0-\\u1DE6\\u1DFD-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F\\uA67C\\uA67D\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA8C4\\uA8E0-\\uA8F1\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE26]"), - space_combining_mark: new RegExp("[\\u0903\\u093E-\\u0940\\u0949-\\u094C\\u094E\\u0982\\u0983\\u09BE-\\u09C0\\u09C7\\u09C8\\u09CB\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB\\u0ACC\\u0B02\\u0B03\\u0B3E\\u0B40\\u0B47\\u0B48\\u0B4B\\u0B4C\\u0B57\\u0BBE\\u0BBF\\u0BC1\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7\\u0CC8\\u0CCA\\u0CCB\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0F3E\\u0F3F\\u0F7F\\u102B\\u102C\\u1031\\u1038\\u103B\\u103C\\u1056\\u1057\\u1062-\\u1064\\u1067-\\u106D\\u1083\\u1084\\u1087-\\u108C\\u108F\\u109A-\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930\\u1931\\u1933-\\u1938\\u19B0-\\u19C0\\u19C8\\u19C9\\u1A19-\\u1A1B\\u1A55\\u1A57\\u1A61\\u1A63\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B44\\u1B82\\u1BA1\\u1BA6\\u1BA7\\u1BAA\\u1C24-\\u1C2B\\u1C34\\u1C35\\u1CE1\\u1CF2\\uA823\\uA824\\uA827\\uA880\\uA881\\uA8B4-\\uA8C3\\uA952\\uA953\\uA983\\uA9B4\\uA9B5\\uA9BA\\uA9BB\\uA9BD-\\uA9C0\\uAA2F\\uAA30\\uAA33\\uAA34\\uAA4D\\uAA7B\\uABE3\\uABE4\\uABE6\\uABE7\\uABE9\\uABEA\\uABEC]"), - connector_punctuation: new RegExp("[\\u005F\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]") -}; - -function is_letter(code) { - return (code >= 97 && code <= 122) - || (code >= 65 && code <= 90) - || (code >= 0xaa && UNICODE.letter.test(String.fromCharCode(code))); -} - function is_surrogate_pair_head(code) { return code >= 0xd800 && code <= 0xdbff; } @@ -144,36 +136,8 @@ function is_digit(code) { return code >= 48 && code <= 57; } -function is_alphanumeric_char(code) { - return is_digit(code) || is_letter(code); -} - -function is_unicode_digit(code) { - return UNICODE.digit.test(String.fromCharCode(code)); -} - -function is_unicode_combining_mark(ch) { - return UNICODE.non_spacing_mark.test(ch) || UNICODE.space_combining_mark.test(ch); -} - -function is_unicode_connector_punctuation(ch) { - return UNICODE.connector_punctuation.test(ch); -} - -function is_identifier_start(code) { - return code == 36 || code == 95 || is_letter(code); -} - function is_identifier_char(ch) { - var code = ch.charCodeAt(0); - return is_identifier_start(code) - || is_digit(code) - || code == 8204 // \u200c: zero-width non-joiner - || code == 8205 // \u200d: zero-width joiner (in my ECMA-262 PDF, this is also 200c) - || is_unicode_combining_mark(ch) - || is_unicode_connector_punctuation(ch) - || is_unicode_digit(code) - ; + return !NON_IDENTIFIER_CHARS[ch]; } function is_identifier_string(str) { @@ -181,14 +145,12 @@ function is_identifier_string(str) { } function parse_js_number(num) { - if (RE_HEX_NUMBER.test(num)) { - return parseInt(num.substr(2), 16); - } else if (RE_OCT_NUMBER.test(num)) { - return parseInt(num.substr(1), 8); - } else { - var val = parseFloat(num); - if (val == num) return val; - } + var match; + if (match = RE_BIN_NUMBER.exec(num)) return parseInt(match[1], 2); + if (match = RE_HEX_NUMBER.exec(num)) return parseInt(match[1], 16); + if (match = RE_OCT_NUMBER.exec(num)) return parseInt(match[1], 8); + var val = parseFloat(num); + if (val == num) return val; } function JS_Parse_Error(message, filename, line, col, pos) { @@ -344,11 +306,13 @@ function tokenizer($TEXT, filename, html5_comments, shebang) { case (after_e = false, 46): // . return (!has_dot && !has_x && !has_e) ? (has_dot = true) : false; } - return is_alphanumeric_char(code); + return is_digit(code) || /[_0-9a-fo]/i.test(ch); }); if (prefix) num = prefix + num; - if (RE_OCT_NUMBER.test(num) && next_token.has_directive("use strict")) { - parse_error("Legacy octal literals are not allowed in strict mode"); + if (/^0[0-7_]+$/.test(num)) { + if (next_token.has_directive("use strict")) parse_error("Legacy octal literals are not allowed in strict mode"); + } else { + num = num.replace(has_x ? /([1-9a-f]|.0)_(?=[0-9a-f])/gi : /([1-9]|.0)_(?=[0-9])/gi, "$1"); } var valid = parse_js_number(num); if (!isNaN(valid)) return token("num", valid); @@ -358,20 +322,30 @@ function tokenizer($TEXT, filename, html5_comments, shebang) { function read_escaped_char(in_string) { var ch = next(true, in_string); switch (ch.charCodeAt(0)) { - case 110 : return "\n"; - case 114 : return "\r"; - case 116 : return "\t"; - case 98 : return "\b"; - case 118 : return "\u000b"; // \v - case 102 : return "\f"; - case 120 : return String.fromCharCode(hex_bytes(2)); // \x - case 117 : return String.fromCharCode(hex_bytes(4)); // \u - case 10 : return ""; // newline - case 13 : // \r - if (peek() == "\n") { // DOS newline - next(true, in_string); - return ""; - } + case 110: return "\n"; + case 114: return "\r"; + case 116: return "\t"; + case 98: return "\b"; + case 118: return "\u000b"; // \v + case 102: return "\f"; + case 120: return String.fromCharCode(hex_bytes(2)); // \x + case 117: // \u + if (peek() != "{") return String.fromCharCode(hex_bytes(4)); + next(); + var num = 0; + do { + var digit = parseInt(next(true), 16); + if (isNaN(digit)) parse_error("Invalid hex-character pattern in string"); + num = num * 16 + digit; + } while (peek() != "}"); + next(); + if (num < 0x10000) return String.fromCharCode(num); + if (num > 0x10ffff) parse_error("Invalid character code: " + num); + return String.fromCharCode((num >> 10) + 0xd7c0) + String.fromCharCode((num & 0x03ff) + 0xdc00); + case 13: // \r + // DOS newline + if (peek() == "\n") next(true, in_string); + case 10: return ""; // \n } if (ch >= "0" && ch <= "7") return read_octal_escape_sequence(ch); @@ -438,7 +412,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) { var skip_multiline_comment = with_eof_error("Unterminated multiline comment", function() { var regex_allowed = S.regex_allowed; var i = find("*/", true); - var text = S.text.substring(S.pos, i).replace(/\r\n|\r|\u2028|\u2029/g, '\n'); + var text = S.text.substring(S.pos, i).replace(/\r\n|\r|\u2028|\u2029/g, "\n"); // update stream position forward(text.length /* doesn't count \r\n as 2 char while S.pos - i does */ + 2); S.comments_before.push(token("comment2", text, true)); @@ -448,7 +422,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) { function read_name() { var backslash = false, name = "", ch, escaped = false, hex; - while ((ch = peek()) != null) { + while (ch = peek()) { if (!backslash) { if (ch == "\\") escaped = backslash = true, next(); else if (is_identifier_char(ch)) name += next(); @@ -587,7 +561,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) { if (is_digit(code)) return read_num(); if (PUNC_CHARS[ch]) return token("punc", next()); if (OPERATOR_CHARS[ch]) return read_operator(); - if (code == 92 || is_identifier_start(code)) return read_word(); + if (code == 92 || !NON_IDENTIFIER_CHARS[ch]) return read_word(); break; } parse_error("Unexpected character '" + ch + "'"); @@ -832,6 +806,12 @@ function parse($TEXT, options) { next(); return break_cont(AST_Break); + case "const": + next(); + var node = const_(); + semicolon(); + return node; + case "continue": next(); return break_cont(AST_Continue); @@ -874,6 +854,12 @@ function parse($TEXT, options) { next(); return if_(); + case "let": + next(); + var node = let_(); + semicolon(); + return node; + case "return": if (S.in_function == 0 && !options.bare_returns) croak("'return' outside of function"); @@ -988,7 +974,9 @@ function parse($TEXT, options) { expect("("); var init = null; if (!is("punc", ";")) { - init = is("keyword", "var") + init = is("keyword", "const") + ? (next(), const_(true)) + : is("keyword", "var") ? (next(), var_(true)) : expression(true, true); if (is("operator", "in")) { @@ -1092,7 +1080,7 @@ function parse($TEXT, options) { function switch_body_() { expect("{"); - var a = [], cur = null, branch = null, tmp; + var a = [], branch, cur, default_branch, tmp; while (!is("punc", "}")) { if (is("eof")) expect_token("punc", "}"); if (is("keyword", "case")) { @@ -1107,12 +1095,14 @@ function parse($TEXT, options) { expect(":"); } else if (is("keyword", "default")) { if (branch) branch.end = prev(); + if (default_branch) croak("More than one default clause in switch statement"); cur = []; branch = new AST_Default({ start : (tmp = S.token, next(), expect(":"), tmp), body : cur }); a.push(branch); + default_branch = branch; } else { if (!cur) unexpected(); cur.push(statement()); @@ -1128,9 +1118,12 @@ function parse($TEXT, options) { if (is("keyword", "catch")) { var start = S.token; next(); - expect("("); - var name = as_symbol(AST_SymbolCatch); - expect(")"); + var name = null; + if (is("punc", "(")) { + next(); + name = as_symbol(AST_SymbolCatch); + expect(")"); + } bcatch = new AST_Catch({ start : start, argname : name, @@ -1156,13 +1149,22 @@ function parse($TEXT, options) { }); } - function vardefs(no_in) { + function vardefs(type, no_in, must_init) { var a = []; for (;;) { + var start = S.token; + var name = as_symbol(type); + var value = null; + if (is("operator", "=")) { + next(); + value = expression(false, no_in); + } else if (must_init) { + croak("Missing initializer in declaration"); + } a.push(new AST_VarDef({ - start : S.token, - name : as_symbol(AST_SymbolVar), - value : is("operator", "=") ? (next(), expression(false, no_in)) : null, + start : start, + name : name, + value : value, end : prev() })); if (!is("punc", ",")) @@ -1172,10 +1174,26 @@ function parse($TEXT, options) { return a; } + var const_ = function(no_in) { + return new AST_Const({ + start : prev(), + definitions : vardefs(AST_SymbolConst, no_in, true), + end : prev() + }); + }; + + var let_ = function(no_in) { + return new AST_Let({ + start : prev(), + definitions : vardefs(AST_SymbolLet, no_in), + end : prev() + }); + }; + var var_ = function(no_in) { return new AST_Var({ start : prev(), - definitions : vardefs(no_in), + definitions : vardefs(AST_SymbolVar, no_in), end : prev() }); }; diff --git a/node_modules/uglify-js/lib/propmangle.js b/node_modules/uglify-js/lib/propmangle.js index ebd1f4e9..e47497de 100644 --- a/node_modules/uglify-js/lib/propmangle.js +++ b/node_modules/uglify-js/lib/propmangle.js @@ -43,7 +43,8 @@ "use strict"; -function find_builtins(reserved) { +var builtins = function() { + var names = []; // NaN will be included due to Number.NaN [ "null", @@ -67,19 +68,21 @@ function find_builtins(reserved) { ].forEach(function(ctor) { Object.getOwnPropertyNames(ctor).map(add); if (ctor.prototype) { + Object.getOwnPropertyNames(new ctor()).map(add); Object.getOwnPropertyNames(ctor.prototype).map(add); } }); + return makePredicate(names); function add(name) { - push_uniq(reserved, name); + names.push(name); } -} +}(); function reserve_quoted_keys(ast, reserved) { ast.walk(new TreeWalker(function(node) { - if (node instanceof AST_ObjectKeyVal && node.quote) { - add(node.key); + if (node instanceof AST_ObjectKeyVal) { + if (node.quote) add(node.key); } else if (node instanceof AST_Sub) { addStrings(node.property, add); } @@ -91,17 +94,14 @@ function reserve_quoted_keys(ast, reserved) { } function addStrings(node, add) { - node.walk(new TreeWalker(function(node) { - if (node instanceof AST_Sequence) { - addStrings(node.tail_node(), add); - } else if (node instanceof AST_String) { - add(node.value); - } else if (node instanceof AST_Conditional) { - addStrings(node.consequent, add); - addStrings(node.alternative, add); - } - return true; - })); + if (node instanceof AST_Conditional) { + addStrings(node.consequent, add); + addStrings(node.alternative, add); + } else if (node instanceof AST_Sequence) { + addStrings(node.tail_node(), add); + } else if (node instanceof AST_String) { + add(node.value); + } } function mangle_properties(ast, options) { @@ -110,21 +110,21 @@ function mangle_properties(ast, options) { cache: null, debug: false, keep_quoted: false, - only_cache: false, regex: null, reserved: null, }, true); - var reserved = options.reserved; - if (!Array.isArray(reserved)) reserved = []; - if (!options.builtins) find_builtins(reserved); + var reserved = Object.create(options.builtins ? null : builtins); + if (Array.isArray(options.reserved)) options.reserved.forEach(function(name) { + reserved[name] = true; + }); var cname = -1; var cache; if (options.cache) { cache = options.cache.props; - cache.each(function(mangled_name) { - push_uniq(reserved, mangled_name); + cache.each(function(name) { + reserved[name] = true; }); } else { cache = new Dictionary(); @@ -139,62 +139,92 @@ function mangle_properties(ast, options) { var debug_suffix; if (debug) debug_suffix = options.debug === true ? "" : options.debug; - var names_to_mangle = []; - var unmangleable = []; + var names_to_mangle = Object.create(null); + var unmangleable = Object.create(reserved); // step 1: find candidates to mangle ast.walk(new TreeWalker(function(node) { - if (node instanceof AST_ObjectKeyVal) { + if (node instanceof AST_Binary) { + if (node.operator == "in") addStrings(node.left, add); + } else if (node.TYPE == "Call") { + var exp = node.expression; + if (exp instanceof AST_Dot) switch (exp.property) { + case "defineProperty": + case "getOwnPropertyDescriptor": + if (node.args.length < 2) break; + exp = exp.expression; + if (!(exp instanceof AST_SymbolRef)) break; + if (exp.name != "Object") break; + if (!exp.definition().undeclared) break; + addStrings(node.args[1], add); + break; + case "hasOwnProperty": + if (node.args.length < 1) break; + addStrings(node.args[0], add); + break; + } + } else if (node instanceof AST_Dot) { + add(node.property); + } else if (node instanceof AST_ObjectKeyVal) { add(node.key); } else if (node instanceof AST_ObjectProperty) { // setter or getter, since KeyVal is handled above add(node.key.name); - } else if (node instanceof AST_Dot) { - add(node.property); } else if (node instanceof AST_Sub) { addStrings(node.property, add); - } else if (node instanceof AST_Call - && node.expression.print_to_string() == "Object.defineProperty") { - addStrings(node.args[1], add); } })); - // step 2: transform the tree, renaming properties - return ast.transform(new TreeTransformer(function(node) { - if (node instanceof AST_ObjectKeyVal) { + // step 2: renaming properties + ast.walk(new TreeWalker(function(node) { + if (node instanceof AST_Binary) { + if (node.operator == "in") mangleStrings(node.left); + } else if (node.TYPE == "Call") { + var exp = node.expression; + if (exp instanceof AST_Dot) switch (exp.property) { + case "defineProperty": + case "getOwnPropertyDescriptor": + if (node.args.length < 2) break; + exp = exp.expression; + if (!(exp instanceof AST_SymbolRef)) break; + if (exp.name != "Object") break; + if (!exp.definition().undeclared) break; + mangleStrings(node.args[1]); + break; + case "hasOwnProperty": + if (node.args.length < 1) break; + mangleStrings(node.args[0]); + break; + } + } else if (node instanceof AST_Dot) { + node.property = mangle(node.property); + } else if (node instanceof AST_ObjectKeyVal) { node.key = mangle(node.key); } else if (node instanceof AST_ObjectProperty) { // setter or getter node.key.name = mangle(node.key.name); - } else if (node instanceof AST_Dot) { - node.property = mangle(node.property); - } else if (!options.keep_quoted && node instanceof AST_Sub) { - node.property = mangleStrings(node.property); - } else if (node instanceof AST_Call - && node.expression.print_to_string() == "Object.defineProperty") { - node.args[1] = mangleStrings(node.args[1]); + } else if (node instanceof AST_Sub) { + if (!options.keep_quoted) mangleStrings(node.property); } })); // only function declarations after this line function can_mangle(name) { - if (unmangleable.indexOf(name) >= 0) return false; - if (reserved.indexOf(name) >= 0) return false; - if (options.only_cache) return cache.has(name); + if (unmangleable[name]) return false; if (/^-?[0-9]+(\.[0-9]+)?(e[+-][0-9]+)?$/.test(name)) return false; return true; } function should_mangle(name) { + if (reserved[name]) return false; if (regex && !regex.test(name)) return false; - if (reserved.indexOf(name) >= 0) return false; - return cache.has(name) || names_to_mangle.indexOf(name) >= 0; + return cache.has(name) || names_to_mangle[name]; } function add(name) { - if (can_mangle(name)) push_uniq(names_to_mangle, name); - if (!should_mangle(name)) push_uniq(unmangleable, name); + if (can_mangle(name)) names_to_mangle[name] = true; + if (!should_mangle(name)) unmangleable[name] = true; } function mangle(name) { @@ -218,17 +248,13 @@ function mangle_properties(ast, options) { } function mangleStrings(node) { - return node.transform(new TreeTransformer(function(node) { - if (node instanceof AST_Sequence) { - var last = node.expressions.length - 1; - node.expressions[last] = mangleStrings(node.expressions[last]); - } else if (node instanceof AST_String) { - node.value = mangle(node.value); - } else if (node instanceof AST_Conditional) { - node.consequent = mangleStrings(node.consequent); - node.alternative = mangleStrings(node.alternative); - } - return node; - })); + if (node instanceof AST_Sequence) { + mangleStrings(node.expressions.tail_node()); + } else if (node instanceof AST_String) { + node.value = mangle(node.value); + } else if (node instanceof AST_Conditional) { + mangleStrings(node.consequent); + mangleStrings(node.alternative); + } } } diff --git a/node_modules/uglify-js/lib/scope.js b/node_modules/uglify-js/lib/scope.js index 66314766..80034a54 100644 --- a/node_modules/uglify-js/lib/scope.js +++ b/node_modules/uglify-js/lib/scope.js @@ -59,21 +59,17 @@ function SymbolDef(id, scope, orig, init) { } SymbolDef.prototype = { - unmangleable: function(options) { - return this.global && !options.toplevel - || this.undeclared - || !options.eval && this.scope.pinned() - || options.keep_fnames - && (this.orig[0] instanceof AST_SymbolLambda - || this.orig[0] instanceof AST_SymbolDefun); + forEach: function(fn) { + this.orig.forEach(fn); + this.references.forEach(fn); }, mangle: function(options) { var cache = options.cache && options.cache.props; if (this.global && cache && cache.has(this.name)) { this.mangled_name = cache.get(this.name); } else if (!this.mangled_name && !this.unmangleable(options)) { - var def; - if (def = this.redefined()) { + var def = this.redefined(); + if (def) { this.mangled_name = def.mangled_name || def.name; } else { this.mangled_name = next_mangled_name(this.scope, options, this); @@ -84,8 +80,24 @@ SymbolDef.prototype = { } }, redefined: function() { - return this.defun && this.defun.variables.get(this.name); - } + var scope = this.defun; + if (!scope) return; + var name = this.name; + var def = scope.variables.get(name) + || scope instanceof AST_Toplevel && scope.globals.get(name) + || this.orig[0] instanceof AST_SymbolConst && find_if(function(def) { + return def.name == name; + }, scope.enclosed); + if (def && def !== this) return def.redefined() || def; + }, + unmangleable: function(options) { + return this.global && !options.toplevel + || this.undeclared + || !options.eval && this.scope.pinned() + || options.keep_fnames + && (this.orig[0] instanceof AST_SymbolLambda + || this.orig[0] instanceof AST_SymbolDefun); + }, }; AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { @@ -96,30 +108,46 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { // pass 1: setup scope chaining and handle definitions var self = this; - var scope = self.parent_scope = null; var defun = null; + var next_def_id = 0; + var scope = self.parent_scope = null; var tw = new TreeWalker(function(node, descend) { - if (node instanceof AST_Catch) { - var save_scope = scope; - scope = new AST_Scope(node); - scope.init_scope_vars(save_scope); - descend(); - scope = save_scope; + if (node instanceof AST_Defun) { + node.name.walk(tw); + walk_scope(function() { + node.argnames.forEach(function(argname) { + argname.walk(tw); + }); + walk_body(node, tw); + }); return true; } - if (node instanceof AST_Scope) { - node.init_scope_vars(scope); - var save_scope = scope; - var save_defun = defun; - defun = scope = node; + if (node instanceof AST_SwitchBranch) { + node.init_vars(scope); descend(); - scope = save_scope; - defun = save_defun; + return true; + } + if (node instanceof AST_Try) { + walk_scope(function() { + walk_body(node, tw); + }); + if (node.bcatch) node.bcatch.walk(tw); + if (node.bfinally) node.bfinally.walk(tw); return true; } if (node instanceof AST_With) { - for (var s = scope; s; s = s.parent_scope) s.uses_with = true; - return; + var s = scope; + do { + s = s.resolve(); + if (s.uses_with) break; + s.uses_with = true; + } while (s = s.parent_scope); + walk_scope(descend); + return true; + } + if (node instanceof AST_BlockScope) { + walk_scope(descend); + return true; } if (node instanceof AST_Symbol) { node.scope = scope; @@ -128,28 +156,50 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { node.thedef = node; node.references = []; } - if (node instanceof AST_SymbolDefun) { - // This should be defined in the parent scope, as we encounter the - // AST_Defun node before getting to its AST_Symbol. - (node.scope = defun.parent_scope.resolve()).def_function(node, defun); + if (node instanceof AST_SymbolCatch) { + scope.def_variable(node).defun = defun; + } else if (node instanceof AST_SymbolConst) { + scope.def_variable(node).defun = defun; + } else if (node instanceof AST_SymbolDefun) { + defun.def_function(node, tw.parent()); + entangle(defun, scope); + } else if (node instanceof AST_SymbolFunarg) { + defun.def_variable(node); + entangle(defun, scope); } else if (node instanceof AST_SymbolLambda) { var def = defun.def_function(node, node.name == "arguments" ? undefined : defun); if (options.ie8) def.defun = defun.parent_scope.resolve(); + } else if (node instanceof AST_SymbolLet) { + scope.def_variable(node); } else if (node instanceof AST_SymbolVar) { - defun.def_variable(node, node.TYPE == "SymbolVar" ? null : undefined); - if (defun !== scope) { - node.mark_enclosed(options); - var def = scope.find_variable(node); - if (node.thedef !== def) { - node.thedef = def; - } - node.reference(options); - } - } else if (node instanceof AST_SymbolCatch) { - scope.def_variable(node).defun = defun; + defun.def_variable(node, null); + entangle(defun, scope); + } + + function walk_scope(descend) { + node.init_vars(scope); + var save_defun = defun; + var save_scope = scope; + if (node instanceof AST_Scope) defun = node; + scope = node; + descend(); + scope = save_scope; + defun = save_defun; + } + + function entangle(defun, scope) { + if (defun === scope) return; + node.mark_enclosed(options); + var def = scope.find_variable(node); + if (node.thedef === def) return; + node.thedef = def; + def.orig.push(node); + node.mark_enclosed(options); } }); - self.next_def_id = 0; + self.make_def = function(orig, init) { + return new SymbolDef(++next_def_id, this, orig, init); + }; self.walk(tw); // pass 2: find back references and eval @@ -164,15 +214,18 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { var sym = node.scope.find_variable(name); if (!sym) { sym = self.def_global(node); - } else if (sym.scope instanceof AST_Lambda && name == "arguments") { + } else if (name == "arguments" && sym.scope instanceof AST_Lambda) { sym.scope.uses_arguments = true; } if (name == "eval") { var parent = tw.parent(); if (parent.TYPE == "Call" && parent.expression === node) { - for (var s = node.scope; s && !s.uses_eval; s = s.parent_scope) { + var s = node.scope; + do { + s = s.resolve(); + if (s.uses_eval) break; s.uses_eval = true; - } + } while (s = s.parent_scope); } else if (sym.undeclared) { self.uses_eval = true; } @@ -181,7 +234,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { node.reference(options); return true; } - // ensure mangling works if catch reuses a scope variable + // ensure mangling works if `catch` reuses a scope variable if (node instanceof AST_SymbolCatch) { var def = node.definition().redefined(); if (def) for (var s = node.scope; s; s = s.parent_scope) { @@ -190,6 +243,12 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { } return true; } + // ensure compression works if `const` reuses a scope variable + if (node instanceof AST_SymbolConst) { + var redef = node.definition().redefined(); + if (redef) redef.const_redefs = true; + return true; + } }); self.walk(tw); @@ -218,10 +277,13 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { function redefine(node, scope) { var name = node.name; var old_def = node.thedef; + if (!all(old_def.orig, function(sym) { + return !(sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet); + })) return; var new_def = scope.find_variable(name); if (new_def) { - var redef; - while (redef = new_def.redefined()) new_def = redef; + var redef = new_def.redefined(); + if (redef) new_def = redef; } else { new_def = self.globals.get(name); } @@ -230,7 +292,9 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { } else { new_def = scope.def_variable(node); } - old_def.orig.concat(old_def.references).forEach(function(node) { + old_def.defun = new_def.scope; + old_def.forEach(function(node) { + node.redef = true; node.thedef = new_def; node.reference(options); }); @@ -239,12 +303,6 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { } }); -AST_Scope.DEFMETHOD("make_def", function(orig, init) { - var top = this; - while (top.parent_scope) top = top.parent_scope; - return new SymbolDef(++top.next_def_id, this, orig, init); -}); - AST_Toplevel.DEFMETHOD("def_global", function(node) { var globals = this.globals, name = node.name; if (globals.has(name)) { @@ -258,24 +316,35 @@ AST_Toplevel.DEFMETHOD("def_global", function(node) { } }); -AST_Scope.DEFMETHOD("init_scope_vars", function(parent_scope) { - this.variables = new Dictionary(); // map name to AST_SymbolVar (variables defined in this scope; includes functions) - this.functions = new Dictionary(); // map name to AST_SymbolDefun (functions defined in this scope) - this.uses_with = false; // will be set to true if this or some nested scope uses the `with` statement - this.uses_eval = false; // will be set to true if this or nested scope uses the global `eval` - this.parent_scope = parent_scope; // the parent scope - this.enclosed = []; // a list of variables from this or outer scope(s) that are referenced from this or inner scopes - this.cname = -1; // the current index for mangling functions/variables -}); +function init_block_vars(scope, parent) { + scope.enclosed = []; // variables from this or outer scope(s) that are referenced from this or inner scopes + scope.parent_scope = parent; // the parent scope (null if this is the top level) + scope.functions = new Dictionary(); // map name to AST_SymbolDefun (functions defined in this scope) + scope.variables = new Dictionary(); // map name to AST_SymbolVar (variables defined in this scope; includes functions) + if (parent) scope.make_def = parent.make_def; // top-level tracking of SymbolDef instances +} + +function init_scope_vars(scope, parent) { + init_block_vars(scope, parent); + scope.uses_eval = false; // will be set to true if this or nested scope uses the global `eval` + scope.uses_with = false; // will be set to true if this or some nested scope uses the `with` statement +} -AST_Lambda.DEFMETHOD("init_scope_vars", function() { - AST_Scope.prototype.init_scope_vars.apply(this, arguments); +AST_BlockScope.DEFMETHOD("init_vars", function(parent_scope) { + init_block_vars(this, parent_scope); +}); +AST_Scope.DEFMETHOD("init_vars", function(parent_scope) { + init_scope_vars(this, parent_scope); +}); +AST_Lambda.DEFMETHOD("init_vars", function(parent_scope) { + init_scope_vars(this, parent_scope); this.uses_arguments = false; this.def_variable(new AST_SymbolFunarg({ name: "arguments", start: this.start, - end: this.end + end: this.end, })); + return this; }); AST_Symbol.DEFMETHOD("mark_enclosed", function(options) { @@ -296,20 +365,20 @@ AST_Symbol.DEFMETHOD("reference", function(options) { this.mark_enclosed(options); }); -AST_Scope.DEFMETHOD("find_variable", function(name) { +AST_BlockScope.DEFMETHOD("find_variable", function(name) { if (name instanceof AST_Symbol) name = name.name; return this.variables.get(name) || (this.parent_scope && this.parent_scope.find_variable(name)); }); -AST_Scope.DEFMETHOD("def_function", function(symbol, init) { +AST_BlockScope.DEFMETHOD("def_function", function(symbol, init) { var def = this.def_variable(symbol, init); if (!def.init || def.init instanceof AST_Defun) def.init = init; this.functions.set(symbol.name, def); return def; }); -AST_Scope.DEFMETHOD("def_variable", function(symbol, init) { +AST_BlockScope.DEFMETHOD("def_variable", function(symbol, init) { var def = this.variables.get(symbol.name); if (def) { def.orig.push(symbol); @@ -322,17 +391,12 @@ AST_Scope.DEFMETHOD("def_variable", function(symbol, init) { return symbol.thedef = def; }); -AST_Lambda.DEFMETHOD("resolve", return_this); -AST_Scope.DEFMETHOD("resolve", function() { - return this.parent_scope.resolve(); -}); -AST_Toplevel.DEFMETHOD("resolve", return_this); - function names_in_use(scope, options) { var names = scope.names_in_use; if (!names) { - scope.names_in_use = names = Object.create(scope.mangled_names || null); + scope.cname = -1; scope.cname_holes = []; + scope.names_in_use = names = Object.create(null); var cache = options.cache && options.cache.props; scope.enclosed.forEach(function(def) { if (def.unmangleable(options)) names[def.name] = true; @@ -349,7 +413,7 @@ function next_mangled_name(scope, options, def) { var holes = scope.cname_holes; var names = Object.create(null); var scopes = [ scope ]; - def.references.forEach(function(sym) { + def.forEach(function(sym) { var scope = sym.scope; do { if (scopes.indexOf(scope) < 0) { @@ -365,7 +429,7 @@ function next_mangled_name(scope, options, def) { name = base54(holes[i]); if (names[name]) continue; holes.splice(i, 1); - scope.names_in_use[name] = true; + in_use[name] = true; return name; } while (true) { @@ -374,7 +438,7 @@ function next_mangled_name(scope, options, def) { if (!names[name]) break; holes.push(scope.cname); } - scope.names_in_use[name] = true; + in_use[name] = true; return name; } @@ -386,18 +450,10 @@ AST_Symbol.DEFMETHOD("unmangleable", function(options) { // labels are always mangleable AST_Label.DEFMETHOD("unmangleable", return_false); -AST_Symbol.DEFMETHOD("unreferenced", function() { - return !this.definition().references.length && !this.scope.pinned(); -}); - AST_Symbol.DEFMETHOD("definition", function() { return this.thedef; }); -AST_Symbol.DEFMETHOD("global", function() { - return this.definition().global; -}); - function _default_mangler_options(options) { options = defaults(options, { eval : false, @@ -423,7 +479,7 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) { var lname = -1; if (options.cache && options.cache.props) { - var mangled_names = this.mangled_names = Object.create(null); + var mangled_names = names_in_use(this, options); options.cache.props.each(function(mangled_name) { mangled_names[mangled_name] = true; }); @@ -438,7 +494,11 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) { lname = save_nesting; return true; } - if (node instanceof AST_Scope) { + if (node instanceof AST_BlockScope) { + var to_mangle = []; + node.variables.each(function(def) { + if (!defer_redef(def)) to_mangle.push(def); + }); descend(); if (options.cache && node instanceof AST_Toplevel) { node.globals.each(mangle); @@ -448,9 +508,7 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) { sym.scope = node; sym.reference(options); } - node.variables.each(function(def) { - if (!defer_redef(def)) mangle(def); - }); + to_mangle.forEach(mangle); return true; } if (node instanceof AST_Label) { @@ -461,13 +519,6 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) { node.mangled_name = name; return true; } - if (!options.ie8 && node instanceof AST_Catch) { - var def = node.argname.definition(); - var redef = defer_redef(def, node.argname); - descend(); - if (!redef) mangle(def); - return true; - } }); this.walk(tw); redefined.forEach(mangle); @@ -482,7 +533,8 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) { if (!redef) return false; redefined.push(def); def.references.forEach(reference); - if (node) reference(node); + var node = def.orig[0]; + if (node instanceof AST_SymbolCatch || node instanceof AST_SymbolConst) reference(node); return true; function reference(sym) { @@ -495,12 +547,11 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) { AST_Toplevel.DEFMETHOD("find_colliding_names", function(options) { var cache = options.cache && options.cache.props; - var avoid = Object.create(null); + var avoid = Object.create(RESERVED_WORDS); options.reserved.forEach(to_avoid); this.globals.each(add_def); this.walk(new TreeWalker(function(node) { - if (node instanceof AST_Scope) node.variables.each(add_def); - if (node instanceof AST_SymbolCatch) add_def(node.definition()); + if (node instanceof AST_BlockScope) node.variables.each(add_def); })); return avoid; @@ -524,15 +575,14 @@ AST_Toplevel.DEFMETHOD("expand_names", function(options) { var cname = 0; this.globals.each(rename); this.walk(new TreeWalker(function(node) { - if (node instanceof AST_Scope) node.variables.each(rename); - if (node instanceof AST_SymbolCatch) rename(node.definition()); + if (node instanceof AST_BlockScope) node.variables.each(rename); })); function next_name() { var name; do { name = base54(cname++); - } while (avoid[name] || RESERVED_WORDS[name]); + } while (avoid[name]); return name; } @@ -543,7 +593,7 @@ AST_Toplevel.DEFMETHOD("expand_names", function(options) { var redef = def.redefined(); var name = redef ? redef.rename || redef.name : next_name(); def.rename = name; - def.orig.concat(def.references).forEach(function(sym) { + def.forEach(function(sym) { if (sym.definition() === def) sym.name = name; }); } @@ -557,22 +607,24 @@ AST_Sequence.DEFMETHOD("tail_node", function() { AST_Toplevel.DEFMETHOD("compute_char_frequency", function(options) { options = _default_mangler_options(options); base54.reset(); + var fn = AST_Symbol.prototype.add_source_map; try { - AST_Node.prototype.print = function(stream, force_parens) { - this._print(stream, force_parens); - if (this instanceof AST_Symbol && !this.unmangleable(options)) { - base54.consider(this.name, -1); - } else if (options.properties) { - if (this instanceof AST_Dot) { - base54.consider(this.property, -1); - } else if (this instanceof AST_Sub) { - skip_string(this.property); - } - } + AST_Symbol.prototype.add_source_map = function() { + if (!this.unmangleable(options)) base54.consider(this.name, -1); }; + if (options.properties) { + AST_Dot.prototype.add_source_map = function() { + base54.consider(this.property, -1); + }; + AST_Sub.prototype.add_source_map = function() { + skip_string(this.property); + }; + } base54.consider(this.print_to_string(), 1); } finally { - AST_Node.prototype.print = AST_Node.prototype._print; + AST_Symbol.prototype.add_source_map = fn; + delete AST_Dot.prototype.add_source_map; + delete AST_Sub.prototype.add_source_map; } base54.sort(); diff --git a/node_modules/uglify-js/lib/transform.js b/node_modules/uglify-js/lib/transform.js index 153713dc..13598ea1 100644 --- a/node_modules/uglify-js/lib/transform.js +++ b/node_modules/uglify-js/lib/transform.js @@ -116,7 +116,7 @@ TreeTransformer.prototype = new TreeWalker; if (self.bfinally) self.bfinally = self.bfinally.transform(tw); }); DEF(AST_Catch, function(self, tw) { - self.argname = self.argname.transform(tw); + if (self.argname) self.argname = self.argname.transform(tw); self.body = do_list(self.body, tw); }); DEF(AST_Definitions, function(self, tw) { diff --git a/node_modules/uglify-js/lib/utils.js b/node_modules/uglify-js/lib/utils.js index 8ae17304..2f5a4866 100644 --- a/node_modules/uglify-js/lib/utils.js +++ b/node_modules/uglify-js/lib/utils.js @@ -112,51 +112,29 @@ function return_this() { return this; } function return_null() { return null; } var List = (function() { - function List(a, f, backwards) { - var ret = [], top = [], i; - function doit() { + function List(a, f) { + var ret = []; + for (var i = 0; i < a.length; i++) { var val = f(a[i], i); - var is_last = val instanceof Last; - if (is_last) val = val.v; - if (val instanceof AtTop) { - val = val.v; - if (val instanceof Splice) { - top.push.apply(top, backwards ? val.v.slice().reverse() : val.v); - } else { - top.push(val); - } - } else if (val !== skip) { - if (val instanceof Splice) { - ret.push.apply(ret, backwards ? val.v.slice().reverse() : val.v); - } else { - ret.push(val); - } - } - return is_last; - } - if (Array.isArray(a)) { - if (backwards) { - for (i = a.length; --i >= 0;) if (doit()) break; - ret.reverse(); - top.reverse(); + if (val === skip) continue; + if (val instanceof Splice) { + ret.push.apply(ret, val.v); } else { - for (i = 0; i < a.length; ++i) if (doit()) break; + ret.push(val); } - } else { - for (i in a) if (HOP(a, i)) if (doit()) break; } - return top.concat(ret); + return ret; } List.is_op = function(val) { - return val === skip || val instanceof AtTop || val instanceof Last || val instanceof Splice; + return val === skip || val instanceof Splice; + }; + List.splice = function(val) { + return new Splice(val); }; - List.at_top = function(val) { return new AtTop(val); }; - List.splice = function(val) { return new Splice(val); }; - List.last = function(val) { return new Last(val); }; var skip = List.skip = {}; - function AtTop(val) { this.v = val; } - function Splice(val) { this.v = val; } - function Last(val) { this.v = val; } + function Splice(val) { + this.v = val; + } return List; })(); diff --git a/node_modules/uglify-js/package.json b/node_modules/uglify-js/package.json index 4281fc5c..5b5e3d7b 100644 --- a/node_modules/uglify-js/package.json +++ b/node_modules/uglify-js/package.json @@ -3,7 +3,7 @@ "description": "JavaScript parser, mangler/compressor and beautifier toolkit", "author": "Mihai Bazon (http://lisperator.net/)", "license": "BSD-2-Clause", - "version": "3.10.0", + "version": "3.11.4", "engines": { "node": ">=0.8.0" }, @@ -54,7 +54,7 @@ "uglify" ] -,"_resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.10.0.tgz" -,"_integrity": "sha512-Esj5HG5WAyrLIdYU74Z3JdG2PxdIusvj6IWHMtlyESxc7kcDz7zYlYjpnSokn1UbpV0d/QX9fan7gkCNd/9BQA==" -,"_from": "uglify-js@3.10.0" +,"_resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.11.4.tgz" +,"_integrity": "sha512-FyYnoxVL1D6+jDGQpbK5jW6y/2JlVfRfEeQ67BPCUg5wfCjaKOpr2XeceE4QL+MkhxliLtf5EbrMDZgzpt2CNw==" +,"_from": "uglify-js@3.11.4" } \ No newline at end of file diff --git a/node_modules/uglify-js/tools/domprops.html b/node_modules/uglify-js/tools/domprops.html new file mode 100644 index 00000000..e217b173 --- /dev/null +++ b/node_modules/uglify-js/tools/domprops.html @@ -0,0 +1,456 @@ + + + + + + diff --git a/node_modules/uglify-js/tools/domprops.json b/node_modules/uglify-js/tools/domprops.json index 15bb2087..1045429d 100644 --- a/node_modules/uglify-js/tools/domprops.json +++ b/node_modules/uglify-js/tools/domprops.json @@ -126,6 +126,7 @@ "-webkit-flex-shrink", "-webkit-flex-wrap", "-webkit-justify-content", + "-webkit-line-clamp", "-webkit-mask", "-webkit-mask-clip", "-webkit-mask-composite", @@ -153,12 +154,65 @@ "-webkit-transition-property", "-webkit-transition-timing-function", "-webkit-user-select", + "0", + "1", + "10", + "11", + "12", + "13", + "14", + "15", + "16", + "17", + "18", + "19", + "2", + "20", + "21", + "22", + "23", + "24", + "25", + "26", + "27", + "28", + "29", + "3", + "30", + "31", + "32", + "33", + "34", + "35", + "36", + "37", + "38", + "39", + "4", + "40", + "41", + "42", + "43", + "44", + "45", + "46", + "47", + "48", + "49", + "5", + "50", + "51", + "6", + "7", + "8", + "9", "@@iterator", "ABORT_ERR", "ACTIVE", "ACTIVE_ATTRIBUTES", "ACTIVE_TEXTURE", "ACTIVE_UNIFORMS", + "ACTIVE_UNIFORM_BLOCKS", "ADDITION", "ALIASED_LINE_WIDTH_RANGE", "ALIASED_POINT_SIZE_RANGE", @@ -166,11 +220,17 @@ "ALLPASS", "ALPHA", "ALPHA_BITS", + "ALREADY_SIGNALED", "ALT_MASK", "ALWAYS", + "ANDROID", "ANGLE_instanced_arrays", + "ANY_SAMPLES_PASSED", + "ANY_SAMPLES_PASSED_CONSERVATIVE", "ANY_TYPE", "ANY_UNORDERED_NODE_TYPE", + "APP_UPDATE", + "ARM", "ARRAY_BUFFER", "ARRAY_BUFFER_BINDING", "ATTACHED_SHADERS", @@ -179,16 +239,20 @@ "AbortController", "AbortSignal", "AbsoluteOrientationSensor", + "AbstractRange", "Accelerometer", "ActiveXObject", "AddSearchProvider", "AesGcmEncryptResult", + "AggregateError", "AnalyserNode", "Animation", "AnimationEffect", "AnimationEvent", "AnimationPlaybackEvent", + "AnimationTimeline", "AnonXMLHttpRequest", + "AppBannerPromptResult", "ApplicationCache", "ApplicationCacheErrorEvent", "Array", @@ -217,6 +281,7 @@ "AutocompleteErrorEvent", "BACK", "BAD_BOUNDARYPOINTS_ERR", + "BAD_REQUEST", "BANDPASS", "BLEND", "BLEND_COLOR", @@ -241,7 +306,11 @@ "BUFFER_USAGE", "BYTE", "BYTES_PER_ELEMENT", + "BackgroundFetchManager", + "BackgroundFetchRecord", + "BackgroundFetchRegistration", "BarProp", + "BarcodeDetector", "BaseAudioContext", "BaseHref", "BatteryManager", @@ -274,21 +343,41 @@ "CHANGE", "CHARSET_RULE", "CHECKING", + "CHROME_UPDATE", "CLAMP_TO_EDGE", "CLICK", "CLOSED", "CLOSING", + "COLOR", "COLOR_ATTACHMENT0", + "COLOR_ATTACHMENT1", + "COLOR_ATTACHMENT10", + "COLOR_ATTACHMENT11", + "COLOR_ATTACHMENT12", + "COLOR_ATTACHMENT13", + "COLOR_ATTACHMENT14", + "COLOR_ATTACHMENT15", + "COLOR_ATTACHMENT2", + "COLOR_ATTACHMENT3", + "COLOR_ATTACHMENT4", + "COLOR_ATTACHMENT5", + "COLOR_ATTACHMENT6", + "COLOR_ATTACHMENT7", + "COLOR_ATTACHMENT8", + "COLOR_ATTACHMENT9", "COLOR_BUFFER_BIT", "COLOR_CLEAR_VALUE", "COLOR_WRITEMASK", "COMMENT_NODE", + "COMPARE_REF_TO_TEXTURE", "COMPILE_STATUS", "COMPRESSED_RGBA_S3TC_DXT1_EXT", "COMPRESSED_RGBA_S3TC_DXT3_EXT", "COMPRESSED_RGBA_S3TC_DXT5_EXT", "COMPRESSED_RGB_S3TC_DXT1_EXT", "COMPRESSED_TEXTURE_FORMATS", + "CONDITION_SATISFIED", + "CONFIGURATION_UNSUPPORTED", "CONNECTING", "CONSTANT_ALPHA", "CONSTANT_COLOR", @@ -296,9 +385,15 @@ "CONTENT", "CONTEXT_LOST_WEBGL", "CONTROL_MASK", + "COPY_READ_BUFFER", + "COPY_READ_BUFFER_BINDING", + "COPY_WRITE_BUFFER", + "COPY_WRITE_BUFFER_BINDING", "COUNTER_STYLE_RULE", + "CROS", "CSS", "CSS2Properties", + "CSSAnimation", "CSSCharsetRule", "CSSConditionRule", "CSSCounterStyleRule", @@ -342,6 +437,7 @@ "CSSSupportsRule", "CSSTransformComponent", "CSSTransformValue", + "CSSTransition", "CSSTranslate", "CSSUnitValue", "CSSUnknownRule", @@ -422,6 +518,7 @@ "CULL_FACE", "CULL_FACE_MODE", "CURRENT_PROGRAM", + "CURRENT_QUERY", "CURRENT_VERTEX_ATTRIB", "CUSTOM", "CW", @@ -443,6 +540,7 @@ "ClientRectList", "Clipboard", "ClipboardEvent", + "ClipboardItem", "CloseEvent", "Collator", "CollectGarbage", @@ -450,6 +548,7 @@ "Comment", "CompileError", "CompositionEvent", + "CompressionStream", "Console", "ConstantSourceNode", "ControlRangeCollection", @@ -472,18 +571,24 @@ "DECR", "DECR_WRAP", "DELETE_STATUS", + "DEPTH", + "DEPTH24_STENCIL8", + "DEPTH32F_STENCIL8", "DEPTH_ATTACHMENT", "DEPTH_BITS", "DEPTH_BUFFER_BIT", "DEPTH_CLEAR_VALUE", "DEPTH_COMPONENT", "DEPTH_COMPONENT16", + "DEPTH_COMPONENT24", + "DEPTH_COMPONENT32F", "DEPTH_FUNC", "DEPTH_RANGE", "DEPTH_STENCIL", "DEPTH_STENCIL_ATTACHMENT", "DEPTH_TEST", "DEPTH_WRITEMASK", + "DEVICE_INELIGIBLE", "DIRECTION_DOWN", "DIRECTION_LEFT", "DIRECTION_RIGHT", @@ -917,31 +1022,59 @@ "DONT_CARE", "DOWNLOADING", "DRAGDROP", + "DRAW_BUFFER0", + "DRAW_BUFFER1", + "DRAW_BUFFER10", + "DRAW_BUFFER11", + "DRAW_BUFFER12", + "DRAW_BUFFER13", + "DRAW_BUFFER14", + "DRAW_BUFFER15", + "DRAW_BUFFER2", + "DRAW_BUFFER3", + "DRAW_BUFFER4", + "DRAW_BUFFER5", + "DRAW_BUFFER6", + "DRAW_BUFFER7", + "DRAW_BUFFER8", + "DRAW_BUFFER9", + "DRAW_FRAMEBUFFER", + "DRAW_FRAMEBUFFER_BINDING", "DST_ALPHA", "DST_COLOR", + "DYNAMIC_COPY", "DYNAMIC_DRAW", + "DYNAMIC_READ", "DataChannel", + "DataCue", "DataTransfer", "DataTransferItem", "DataTransferItemList", "DataView", + "Database", "Date", "DateTimeFormat", "Debug", + "DecompressionStream", + "Default Browser Helper", "DelayNode", "DesktopNotification", "DesktopNotificationCenter", "DeviceAcceleration", "DeviceLightEvent", "DeviceMotionEvent", + "DeviceMotionEventAcceleration", + "DeviceMotionEventRotationRate", "DeviceOrientationEvent", "DeviceProximityEvent", "DeviceRotationRate", "DeviceStorage", "DeviceStorageChangeEvent", "Directory", + "DisplayNames", "Document", "DocumentFragment", + "DocumentTimeline", "DocumentType", "DragEvent", "DynamicsCompressorNode", @@ -963,6 +1096,7 @@ "EXPONENTIAL_DISTANCE", "EXT_texture_filter_anisotropic", "Element", + "ElementInternals", "ElementQuery", "EnterPictureInPictureEvent", "Entity", @@ -985,9 +1119,16 @@ "FINISHED_STATE", "FIRST_ORDERED_NODE_TYPE", "FLOAT", + "FLOAT_32_UNSIGNED_INT_24_8_REV", "FLOAT_MAT2", + "FLOAT_MAT2x3", + "FLOAT_MAT2x4", "FLOAT_MAT3", + "FLOAT_MAT3x2", + "FLOAT_MAT3x4", "FLOAT_MAT4", + "FLOAT_MAT4x2", + "FLOAT_MAT4x3", "FLOAT_VEC2", "FLOAT_VEC3", "FLOAT_VEC4", @@ -995,17 +1136,29 @@ "FONT_FACE_RULE", "FONT_FEATURE_VALUES_RULE", "FRAGMENT_SHADER", + "FRAGMENT_SHADER_DERIVATIVE_HINT", "FRAGMENT_SHADER_DERIVATIVE_HINT_OES", "FRAMEBUFFER", + "FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE", + "FRAMEBUFFER_ATTACHMENT_BLUE_SIZE", + "FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING", + "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE", + "FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE", + "FRAMEBUFFER_ATTACHMENT_GREEN_SIZE", "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME", "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", + "FRAMEBUFFER_ATTACHMENT_RED_SIZE", + "FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE", "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE", + "FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER", "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL", "FRAMEBUFFER_BINDING", "FRAMEBUFFER_COMPLETE", + "FRAMEBUFFER_DEFAULT", "FRAMEBUFFER_INCOMPLETE_ATTACHMENT", "FRAMEBUFFER_INCOMPLETE_DIMENSIONS", "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT", + "FRAMEBUFFER_INCOMPLETE_MULTISAMPLE", "FRAMEBUFFER_UNSUPPORTED", "FRONT", "FRONT_AND_BACK", @@ -1013,6 +1166,7 @@ "FUNC_ADD", "FUNC_REVERSE_SUBTRACT", "FUNC_SUBTRACT", + "FeaturePolicy", "FederatedCredential", "Feed", "FeedEntry", @@ -1025,6 +1179,7 @@ "FileSystemDirectoryReader", "FileSystemEntry", "FileSystemFileEntry", + "FinalizationRegistry", "FindInPage", "Float32Array", "Float64Array", @@ -1033,6 +1188,8 @@ "FontFaceSet", "FontFaceSetLoadEvent", "FormData", + "FormDataEvent", + "FragmentDirective", "Function", "GENERATE_MIPMAP_HINT", "GEQUAL", @@ -1045,9 +1202,13 @@ "GamepadHapticActuator", "GamepadPose", "Geolocation", + "GeolocationCoordinates", + "GeolocationPosition", + "GeolocationPositionError", "GestureEvent", "Global", "Gyroscope", + "HALF_FLOAT", "HAVE_CURRENT_DATA", "HAVE_ENOUGH_DATA", "HAVE_FUTURE_DATA", @@ -1161,6 +1322,7 @@ "HashChangeEvent", "Headers", "History", + "Hz", "ICE_CHECKING", "ICE_CLOSED", "ICE_COMPLETED", @@ -1191,8 +1353,15 @@ "INCR", "INCR_WRAP", "INDEX_SIZE_ERR", + "INSTALL", "INSTALLED", "INT", + "INTERLEAVED_ATTRIBS", + "INT_2_10_10_10_REV", + "INT_SAMPLER_2D", + "INT_SAMPLER_2D_ARRAY", + "INT_SAMPLER_3D", + "INT_SAMPLER_CUBE", "INT_VEC2", "INT_VEC3", "INT_VEC4", @@ -1202,6 +1371,7 @@ "INVALID_ENUM", "INVALID_EXPRESSION_ERR", "INVALID_FRAMEBUFFER_OPERATION", + "INVALID_INDEX", "INVALID_MODIFICATION_ERR", "INVALID_NODE_TYPE_ERR", "INVALID_OPERATION", @@ -1235,6 +1405,8 @@ "IsSearchProviderInstalled", "Iterator", "JSON", + "Java Deployment Toolkit 7.0.250.17", + "Java(TM) Platform SE 7 U25", "KEEP", "KEYDOWN", "KEYFRAMES_RULE", @@ -1263,6 +1435,7 @@ "LINE_STRIP", "LINE_WIDTH", "LINK_STATUS", + "LINUX", "LIVE", "LN10", "LN2", @@ -1279,25 +1452,58 @@ "LSParserFilter", "LUMINANCE", "LUMINANCE_ALPHA", + "LargestContentfulPaint", + "LayoutShift", + "LayoutShiftAttribution", "LinearAccelerationSensor", "LinkError", "ListFormat", "LocalMediaStream", + "Locale", "Location", "Lock", "LockManager", + "MAC", + "MAX", + "MAX_3D_TEXTURE_SIZE", + "MAX_ARRAY_TEXTURE_LAYERS", + "MAX_CLIENT_WAIT_TIMEOUT_WEBGL", + "MAX_COLOR_ATTACHMENTS", + "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", "MAX_COMBINED_TEXTURE_IMAGE_UNITS", + "MAX_COMBINED_UNIFORM_BLOCKS", + "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", "MAX_CUBE_MAP_TEXTURE_SIZE", + "MAX_DRAW_BUFFERS", + "MAX_ELEMENTS_INDICES", + "MAX_ELEMENTS_VERTICES", + "MAX_ELEMENT_INDEX", + "MAX_FRAGMENT_INPUT_COMPONENTS", + "MAX_FRAGMENT_UNIFORM_BLOCKS", + "MAX_FRAGMENT_UNIFORM_COMPONENTS", "MAX_FRAGMENT_UNIFORM_VECTORS", + "MAX_PROGRAM_TEXEL_OFFSET", "MAX_RENDERBUFFER_SIZE", "MAX_SAFE_INTEGER", + "MAX_SAMPLES", + "MAX_SERVER_WAIT_TIMEOUT", "MAX_TEXTURE_IMAGE_UNITS", + "MAX_TEXTURE_LOD_BIAS", "MAX_TEXTURE_MAX_ANISOTROPY_EXT", "MAX_TEXTURE_SIZE", + "MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", + "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", + "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", + "MAX_UNIFORM_BLOCK_SIZE", + "MAX_UNIFORM_BUFFER_BINDINGS", "MAX_VALUE", + "MAX_VARYING_COMPONENTS", "MAX_VARYING_VECTORS", "MAX_VERTEX_ATTRIBS", + "MAX_VERTEX_OUTPUT_COMPONENTS", "MAX_VERTEX_TEXTURE_IMAGE_UNITS", + "MAX_VERTEX_UNIFORM_BLOCKS", + "MAX_VERTEX_UNIFORM_COMPONENTS", "MAX_VERTEX_UNIFORM_VECTORS", "MAX_VIEWPORT_DIMS", "MEDIA_ERR_ABORTED", @@ -1323,6 +1529,8 @@ "MIDIOutput", "MIDIOutputMap", "MIDIPort", + "MIN", + "MIN_PROGRAM_TEXEL_OFFSET", "MIN_SAFE_INTEGER", "MIN_VALUE", "MIRRORED_REPEAT", @@ -1404,6 +1612,7 @@ "MS_MEDIA_KEYERR_UNKNOWN", "Map", "Math", + "MathMLElement", "MediaCapabilities", "MediaCapabilitiesInfo", "MediaController", @@ -1434,12 +1643,14 @@ "MediaStreamAudioSourceNode", "MediaStreamEvent", "MediaStreamTrack", + "MediaStreamTrackAudioSourceNode", "MediaStreamTrackEvent", "Memory", "MessageChannel", "MessageEvent", "MessagePort", "Methods", + "Microsoft® DRM", "MimeType", "MimeTypeArray", "Module", @@ -1575,6 +1786,7 @@ "NO_ERR", "NO_ERROR", "NO_MODIFICATION_ALLOWED_ERR", + "NO_UPDATE", "NUMBER_TYPE", "NUM_COMPRESSED_TEXTURE_FORMATS", "NaN", @@ -1593,11 +1805,13 @@ "NotifyPaintEvent", "Number", "NumberFormat", + "OBJECT_TYPE", "OBSOLETE", "OES_element_index_uint", "OES_standard_derivatives", "OES_texture_float", "OES_texture_float_linear", + "OK", "ONE", "ONE_MINUS_CONSTANT_ALPHA", "ONE_MINUS_CONSTANT_COLOR", @@ -1606,10 +1820,13 @@ "ONE_MINUS_SRC_ALPHA", "ONE_MINUS_SRC_COLOR", "OPEN", + "OPENBSD", "OPENED", "OPENING", "ORDERED_NODE_ITERATOR_TYPE", "ORDERED_NODE_SNAPSHOT_TYPE", + "OS_UPDATE", + "OTHER_ERROR", "OUT_OF_MEMORY", "Object", "OfflineAudioCompletionEvent", @@ -1617,13 +1834,19 @@ "OfflineResourceList", "OffscreenCanvas", "OffscreenCanvasRenderingContext2D", + "OnInstalledReason", + "OnRestartRequiredReason", "Option", "OrientationSensor", "OscillatorNode", "OverconstrainedError", + "OverconstrainedErrorEvent", "OverflowEvent", "PACKAGE", "PACK_ALIGNMENT", + "PACK_ROW_LENGTH", + "PACK_SKIP_PIXELS", + "PACK_SKIP_ROWS", "PAGE_RULE", "PARSE_ERR", "PATHSEG_ARC_ABS", @@ -1648,9 +1871,14 @@ "PATHSEG_UNKNOWN", "PATH_EXISTS_ERR", "PEAKING", + "PERIODIC", "PERMISSION_DENIED", "PERSISTENT", "PI", + "PIXEL_PACK_BUFFER", + "PIXEL_PACK_BUFFER_BINDING", + "PIXEL_UNPACK_BUFFER", + "PIXEL_UNPACK_BUFFER_BINDING", "PLAYING_STATE", "POINTS", "POLYGON_OFFSET_FACTOR", @@ -1671,11 +1899,14 @@ "PaymentAddress", "PaymentInstruments", "PaymentManager", + "PaymentMethodChangeEvent", "PaymentRequest", "PaymentRequestUpdateEvent", "PaymentResponse", "Performance", + "PerformanceElementTiming", "PerformanceEntry", + "PerformanceEventTiming", "PerformanceLongTaskTiming", "PerformanceMark", "PerformanceMeasure", @@ -1687,11 +1918,15 @@ "PerformanceResourceTiming", "PerformanceServerTiming", "PerformanceTiming", + "PeriodicSyncManager", "PeriodicWave", "PermissionStatus", "Permissions", "PhotoCapabilities", "PictureInPictureWindow", + "PlatformArch", + "PlatformNaclArch", + "PlatformOs", "Plugin", "PluginArray", "PluralRules", @@ -1719,14 +1954,33 @@ "PushSubscription", "PushSubscriptionOptions", "Q", + "QUERY_RESULT", + "QUERY_RESULT_AVAILABLE", "QUOTA_ERR", "QUOTA_EXCEEDED_ERR", "QueryInterface", + "R11F_G11F_B10F", + "R16F", + "R16I", + "R16UI", + "R32F", + "R32I", + "R32UI", + "R8", + "R8I", + "R8UI", + "R8_SNORM", + "RASTERIZER_DISCARD", "READY_TO_RUN", + "READ_BUFFER", + "READ_FRAMEBUFFER", + "READ_FRAMEBUFFER_BINDING", "READ_ONLY", "READ_ONLY_ERR", "READ_WRITE", + "RED", "RED_BITS", + "RED_INTEGER", "REMOVAL", "RENDERBUFFER", "RENDERBUFFER_ALPHA_SIZE", @@ -1737,6 +1991,7 @@ "RENDERBUFFER_HEIGHT", "RENDERBUFFER_INTERNAL_FORMAT", "RENDERBUFFER_RED_SIZE", + "RENDERBUFFER_SAMPLES", "RENDERBUFFER_STENCIL_SIZE", "RENDERBUFFER_WIDTH", "RENDERER", @@ -1748,12 +2003,49 @@ "RENDERING_INTENT_UNKNOWN", "REPEAT", "REPLACE", + "RG", + "RG16F", + "RG16I", + "RG16UI", + "RG32F", + "RG32I", + "RG32UI", + "RG8", + "RG8I", + "RG8UI", + "RG8_SNORM", "RGB", + "RGB10_A2", + "RGB10_A2UI", + "RGB16F", + "RGB16I", + "RGB16UI", + "RGB32F", + "RGB32I", + "RGB32UI", "RGB565", "RGB5_A1", + "RGB8", + "RGB8I", + "RGB8UI", + "RGB8_SNORM", + "RGB9_E5", "RGBA", + "RGBA16F", + "RGBA16I", + "RGBA16UI", + "RGBA32F", + "RGBA32I", + "RGBA32UI", "RGBA4", + "RGBA8", + "RGBA8I", + "RGBA8UI", + "RGBA8_SNORM", + "RGBA_INTEGER", "RGBColor", + "RGB_INTEGER", + "RG_INTEGER", "ROTATION_CLOCKWISE", "ROTATION_COUNTERCLOCKWISE", "RTCCertificate", @@ -1761,12 +2053,18 @@ "RTCDTMFToneChangeEvent", "RTCDataChannel", "RTCDataChannelEvent", + "RTCDtlsTransport", + "RTCError", + "RTCErrorEvent", "RTCIceCandidate", + "RTCIceTransport", "RTCPeerConnection", + "RTCPeerConnectionIceErrorEvent", "RTCPeerConnectionIceEvent", "RTCRtpReceiver", "RTCRtpSender", "RTCRtpTransceiver", + "RTCSctpTransport", "RTCSessionDescription", "RTCStatsReport", "RTCTrackEvent", @@ -1775,7 +2073,9 @@ "Range", "RangeError", "RangeException", + "ReadableByteStream", "ReadableStream", + "ReadableStreamDefaultReader", "RecordErrorEvent", "Rect", "ReferenceError", @@ -1786,13 +2086,21 @@ "RemotePlayback", "ReportingObserver", "Request", + "RequestUpdateCheckStatus", "ResizeObserver", "ResizeObserverEntry", + "ResizeObserverSize", "Response", "RunningState", "RuntimeError", "SAMPLER_2D", + "SAMPLER_2D_ARRAY", + "SAMPLER_2D_ARRAY_SHADOW", + "SAMPLER_2D_SHADOW", + "SAMPLER_3D", + "SAMPLER_BINDING", "SAMPLER_CUBE", + "SAMPLER_CUBE_SHADOW", "SAMPLES", "SAMPLE_ALPHA_TO_COVERAGE", "SAMPLE_BUFFERS", @@ -1810,6 +2118,7 @@ "SDP_PRANSWER", "SECURITY_ERR", "SELECT", + "SEPARATE_ATTRIBS", "SERIALIZE_ERR", "SEVERITY_ERROR", "SEVERITY_FATAL_ERROR", @@ -1817,6 +2126,7 @@ "SHADER_COMPILER", "SHADER_TYPE", "SHADING_LANGUAGE_VERSION", + "SHARED_MODULE_UPDATE", "SHIFT_MASK", "SHORT", "SHOWING", @@ -1833,19 +2143,31 @@ "SHOW_NOTATION", "SHOW_PROCESSING_INSTRUCTION", "SHOW_TEXT", + "SIGNALED", + "SIGNED_NORMALIZED", "SINE", "SKIN", "SOUNDFIELD", + "SQLError", "SQLException", + "SQLResultSet", + "SQLResultSetRowList", + "SQLTransaction", "SQRT1_2", "SQRT2", "SQUARE", "SRC_ALPHA", "SRC_ALPHA_SATURATE", "SRC_COLOR", + "SRGB", + "SRGB8", + "SRGB8_ALPHA8", "START_TO_END", "START_TO_START", + "STATIC_COPY", "STATIC_DRAW", + "STATIC_READ", + "STENCIL", "STENCIL_ATTACHMENT", "STENCIL_BACK_FAIL", "STENCIL_BACK_FUNC", @@ -1867,7 +2189,9 @@ "STENCIL_TEST", "STENCIL_VALUE_MASK", "STENCIL_WRITEMASK", + "STREAM_COPY", "STREAM_DRAW", + "STREAM_READ", "STRING_TYPE", "STYLE_RULE", "SUBPIXEL_BITS", @@ -2143,6 +2467,12 @@ "SVG_ZOOMANDPAN_DISABLE", "SVG_ZOOMANDPAN_MAGNIFY", "SVG_ZOOMANDPAN_UNKNOWN", + "SYNC_CONDITION", + "SYNC_FENCE", + "SYNC_FLAGS", + "SYNC_FLUSH_COMMANDS_BIT", + "SYNC_GPU_COMMANDS_COMPLETE", + "SYNC_STATUS", "SYNTAX_ERR", "SavedPages", "Screen", @@ -2160,6 +2490,7 @@ "SensorErrorEvent", "ServiceWorker", "ServiceWorkerContainer", + "ServiceWorkerMessageEvent", "ServiceWorkerRegistration", "SessionDescription", "Set", @@ -2187,6 +2518,7 @@ "StyleSheet", "StyleSheetList", "StyleSheetPageList", + "SubmitEvent", "SubtleCrypto", "Symbol", "SyncManager", @@ -2232,8 +2564,15 @@ "TEXTURE8", "TEXTURE9", "TEXTURE_2D", + "TEXTURE_2D_ARRAY", + "TEXTURE_3D", + "TEXTURE_BASE_LEVEL", "TEXTURE_BINDING_2D", + "TEXTURE_BINDING_2D_ARRAY", + "TEXTURE_BINDING_3D", "TEXTURE_BINDING_CUBE_MAP", + "TEXTURE_COMPARE_FUNC", + "TEXTURE_COMPARE_MODE", "TEXTURE_CUBE_MAP", "TEXTURE_CUBE_MAP_NEGATIVE_X", "TEXTURE_CUBE_MAP_NEGATIVE_Y", @@ -2241,16 +2580,36 @@ "TEXTURE_CUBE_MAP_POSITIVE_X", "TEXTURE_CUBE_MAP_POSITIVE_Y", "TEXTURE_CUBE_MAP_POSITIVE_Z", + "TEXTURE_IMMUTABLE_FORMAT", + "TEXTURE_IMMUTABLE_LEVELS", "TEXTURE_MAG_FILTER", "TEXTURE_MAX_ANISOTROPY_EXT", + "TEXTURE_MAX_LEVEL", + "TEXTURE_MAX_LOD", "TEXTURE_MIN_FILTER", + "TEXTURE_MIN_LOD", + "TEXTURE_WRAP_R", "TEXTURE_WRAP_S", "TEXTURE_WRAP_T", "TEXT_NODE", + "THROTTLED", "TIMEOUT", "TIMEOUT_ERR", + "TIMEOUT_EXPIRED", + "TIMEOUT_IGNORED", "TOO_LARGE_ERR", "TRANSACTION_INACTIVE_ERR", + "TRANSFORM_FEEDBACK", + "TRANSFORM_FEEDBACK_ACTIVE", + "TRANSFORM_FEEDBACK_BINDING", + "TRANSFORM_FEEDBACK_BUFFER", + "TRANSFORM_FEEDBACK_BUFFER_BINDING", + "TRANSFORM_FEEDBACK_BUFFER_MODE", + "TRANSFORM_FEEDBACK_BUFFER_SIZE", + "TRANSFORM_FEEDBACK_BUFFER_START", + "TRANSFORM_FEEDBACK_PAUSED", + "TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN", + "TRANSFORM_FEEDBACK_VARYINGS", "TRIANGLE", "TRIANGLES", "TRIANGLE_FAN", @@ -2285,9 +2644,33 @@ "TransformStream", "TransitionEvent", "TreeWalker", + "TrustedHTML", + "TrustedScript", + "TrustedScriptURL", + "TrustedTypePolicy", + "TrustedTypePolicyFactory", "TypeError", + "U2F", "UIEvent", "UNCACHED", + "UNIFORM_ARRAY_STRIDE", + "UNIFORM_BLOCK_ACTIVE_UNIFORMS", + "UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES", + "UNIFORM_BLOCK_BINDING", + "UNIFORM_BLOCK_DATA_SIZE", + "UNIFORM_BLOCK_INDEX", + "UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER", + "UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER", + "UNIFORM_BUFFER", + "UNIFORM_BUFFER_BINDING", + "UNIFORM_BUFFER_OFFSET_ALIGNMENT", + "UNIFORM_BUFFER_SIZE", + "UNIFORM_BUFFER_START", + "UNIFORM_IS_ROW_MAJOR", + "UNIFORM_MATRIX_STRIDE", + "UNIFORM_OFFSET", + "UNIFORM_SIZE", + "UNIFORM_TYPE", "UNKNOWN_ERR", "UNKNOWN_RULE", "UNMASKED_RENDERER_WEBGL", @@ -2297,17 +2680,37 @@ "UNPACK_ALIGNMENT", "UNPACK_COLORSPACE_CONVERSION_WEBGL", "UNPACK_FLIP_Y_WEBGL", + "UNPACK_IMAGE_HEIGHT", "UNPACK_PREMULTIPLY_ALPHA_WEBGL", + "UNPACK_ROW_LENGTH", + "UNPACK_SKIP_IMAGES", + "UNPACK_SKIP_PIXELS", + "UNPACK_SKIP_ROWS", "UNSCHEDULED_STATE", "UNSENT", + "UNSIGNALED", "UNSIGNED_BYTE", "UNSIGNED_INT", + "UNSIGNED_INT_10F_11F_11F_REV", + "UNSIGNED_INT_24_8", + "UNSIGNED_INT_2_10_10_10_REV", + "UNSIGNED_INT_5_9_9_9_REV", + "UNSIGNED_INT_SAMPLER_2D", + "UNSIGNED_INT_SAMPLER_2D_ARRAY", + "UNSIGNED_INT_SAMPLER_3D", + "UNSIGNED_INT_SAMPLER_CUBE", + "UNSIGNED_INT_VEC2", + "UNSIGNED_INT_VEC3", + "UNSIGNED_INT_VEC4", + "UNSIGNED_NORMALIZED", "UNSIGNED_SHORT", "UNSIGNED_SHORT_4_4_4_4", "UNSIGNED_SHORT_5_5_5_1", "UNSIGNED_SHORT_5_6_5", "UNSPECIFIED_EVENT_TYPE_ERR", + "UPDATE", "UPDATEREADY", + "UPDATE_AVAILABLE", "URIError", "URL", "URLSearchParams", @@ -2343,9 +2746,12 @@ "VERSION", "VERSION_CHANGE", "VERSION_ERR", + "VERTEX_ARRAY_BINDING", "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", + "VERTEX_ATTRIB_ARRAY_DIVISOR", "VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE", "VERTEX_ATTRIB_ARRAY_ENABLED", + "VERTEX_ATTRIB_ARRAY_INTEGER", "VERTEX_ATTRIB_ARRAY_NORMALIZED", "VERTEX_ATTRIB_ARRAY_POINTER", "VERTEX_ATTRIB_ARRAY_SIZE", @@ -2370,16 +2776,25 @@ "ValidityState", "VideoPlaybackQuality", "VideoStreamTrack", + "VideoTrack", + "VideoTrackList", "VisualViewport", + "WAIT_FAILED", "WEBGL_compressed_texture_s3tc", "WEBGL_debug_renderer_info", "WEBKIT_FILTER_RULE", + "WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN", + "WEBKIT_FORCE_AT_MOUSE_DOWN", "WEBKIT_KEYFRAMES_RULE", "WEBKIT_KEYFRAME_RULE", "WEBKIT_REGION_RULE", + "WIN", "WRONG_DOCUMENT_ERR", + "WakeLock", + "WakeLockSentinel", "WaveShaperNode", "WeakMap", + "WeakRef", "WeakSet", "WebAssembly", "WebGL2RenderingContext", @@ -2401,6 +2816,7 @@ "WebGLUniformLocation", "WebGLVertexArray", "WebGLVertexArrayObject", + "WebKit built-in PDF", "WebKitAnimationEvent", "WebKitBlobBuilder", "WebKitCSSFilterRule", @@ -2414,6 +2830,7 @@ "WebKitGamepad", "WebKitMediaKeyError", "WebKitMediaKeyMessageEvent", + "WebKitMediaKeyNeededEvent", "WebKitMediaKeySession", "WebKitMediaKeys", "WebKitMediaSource", @@ -2466,6 +2883,7 @@ "WebkitFlexShrink", "WebkitFlexWrap", "WebkitJustifyContent", + "WebkitLineClamp", "WebkitMask", "WebkitMaskClip", "WebkitMaskComposite", @@ -2495,9 +2913,14 @@ "WebkitUserSelect", "WheelEvent", "Window", + "Windows Media Player Plug-in Dynamic Link Library", + "Windows Presentation Foundation", "Worker", "Worklet", "WritableStream", + "WritableStreamDefaultWriter", + "X86_32", + "X86_64", "XMLDocument", "XMLHttpRequest", "XMLHttpRequestEventTarget", @@ -2511,6 +2934,33 @@ "XPathExpression", "XPathNSResolver", "XPathResult", + "XR", + "XRBoundedReferenceSpace", + "XRDOMOverlayState", + "XRFrame", + "XRHitTestResult", + "XRHitTestSource", + "XRInputSource", + "XRInputSourceArray", + "XRInputSourceEvent", + "XRInputSourcesChangeEvent", + "XRLayer", + "XRPose", + "XRRay", + "XRReferenceSpace", + "XRReferenceSpaceEvent", + "XRRenderState", + "XRRigidTransform", + "XRSession", + "XRSessionEvent", + "XRSpace", + "XRSystem", + "XRTransientInputHitTestResult", + "XRTransientInputHitTestSource", + "XRView", + "XRViewerPose", + "XRViewport", + "XRWebGLLayer", "XSLTProcessor", "ZERO", "_XD0M_", @@ -2521,6 +2971,7 @@ "__lookupSetter__", "__opera", "__proto__", + "__relevantExtensionKeys", "_browserjsran", "a", "aLink", @@ -2542,6 +2993,7 @@ "acosh", "action", "actionURL", + "actions", "activated", "active", "activeCues", @@ -2550,7 +3002,12 @@ "activeSourceCount", "activeTexture", "activeVRDisplays", + "actualBoundingBoxAscent", + "actualBoundingBoxDescent", + "actualBoundingBoxLeft", + "actualBoundingBoxRight", "add", + "addAll", "addBehavior", "addCandidate", "addColorStop", @@ -2571,6 +3028,7 @@ "addRange", "addRegion", "addRule", + "addRules", "addSearchEngine", "addSourceBuffer", "addStream", @@ -2578,11 +3036,15 @@ "addTrack", "addTransceiver", "addWakeLockListener", + "added", "addedNodes", "additionalName", "additiveSymbols", "addons", + "address", + "addressLine", "adoptNode", + "adoptText", "adoptedCallback", "adoptedStyleSheets", "adr", @@ -2601,16 +3063,24 @@ "alignmentBaseline", "alinkColor", "all", + "allSettled", "allow", "allowFullscreen", "allowPaymentRequest", + "allowTransparency", "allowedDirections", + "allowedFeatures", + "allowsFeature", "alpha", + "alphabeticBaseline", "alt", "altGraphKey", "altHtml", "altKey", "altLeft", + "alternate", + "alternateSetting", + "alternates", "altitude", "altitudeAccuracy", "amplitude", @@ -2649,12 +3119,15 @@ "animationTimingFunction", "animationsPaused", "anniversary", + "antialias", + "any", "app", "appCodeName", "appMinorVersion", "appName", "appNotifications", "appVersion", + "appearance", "append", "appendBuffer", "appendChild", @@ -2666,39 +3139,162 @@ "appendStream", "appendWindowEnd", "appendWindowStart", + "appleTrailingWord", "applets", + "application/apple-default-browser", + "application/asx", + "application/java-deployment-toolkit", "application/pdf", + "application/postscript", + "application/x-drm", + "application/x-drm-v2", "application/x-google-chrome-pdf", + "application/x-java-applet", + "application/x-java-applet;deploy=10.25.2", + "application/x-java-applet;javafx=2.2.25", + "application/x-java-applet;jpi-version=1.7.0_25", + "application/x-java-applet;version=1.1", + "application/x-java-applet;version=1.1.1", + "application/x-java-applet;version=1.1.2", + "application/x-java-applet;version=1.1.3", + "application/x-java-applet;version=1.2", + "application/x-java-applet;version=1.2.1", + "application/x-java-applet;version=1.2.2", + "application/x-java-applet;version=1.3", + "application/x-java-applet;version=1.3.1", + "application/x-java-applet;version=1.4", + "application/x-java-applet;version=1.4.1", + "application/x-java-applet;version=1.4.2", + "application/x-java-applet;version=1.5", + "application/x-java-applet;version=1.6", + "application/x-java-applet;version=1.7", + "application/x-java-bean", + "application/x-java-bean;jpi-version=1.7.0_25", + "application/x-java-bean;version=1.1", + "application/x-java-bean;version=1.1.1", + "application/x-java-bean;version=1.1.2", + "application/x-java-bean;version=1.1.3", + "application/x-java-bean;version=1.2", + "application/x-java-bean;version=1.2.1", + "application/x-java-bean;version=1.2.2", + "application/x-java-bean;version=1.3", + "application/x-java-bean;version=1.3.1", + "application/x-java-bean;version=1.4", + "application/x-java-bean;version=1.4.1", + "application/x-java-bean;version=1.4.2", + "application/x-java-bean;version=1.5", + "application/x-java-bean;version=1.6", + "application/x-java-bean;version=1.7", + "application/x-java-vm", + "application/x-java-vm-npruntime", + "application/x-mplayer2", + "application/x-ms-xbap", "application/x-nacl", "application/x-pnacl", + "application/xaml+xml", "applicationCache", + "applicationServerKey", "apply", + "applyConstraints", "applyElement", "arc", "arcTo", "archive", "areas", "arguments", + "aria-activedescendant", + "aria-busy", + "aria-checked", + "aria-controls", + "aria-describedby", + "aria-disabled", + "aria-expanded", + "aria-flowto", + "aria-haspopup", + "aria-hidden", + "aria-invalid", + "aria-labelledby", + "aria-level", + "aria-live", + "aria-multiselectable", + "aria-owns", + "aria-posinset", + "aria-pressed", + "aria-readonly", + "aria-relevant", + "aria-required", + "aria-secret", + "aria-selected", + "aria-setsize", + "aria-valuemax", + "aria-valuemin", + "aria-valuenow", + "ariaAtomic", + "ariaAutoComplete", + "ariaBusy", + "ariaChecked", + "ariaColCount", + "ariaColIndex", + "ariaColSpan", + "ariaCurrent", + "ariaDescription", + "ariaDisabled", + "ariaExpanded", + "ariaHasPopup", + "ariaHidden", + "ariaKeyShortcuts", + "ariaLabel", + "ariaLevel", + "ariaLive", + "ariaModal", + "ariaMultiLine", + "ariaMultiSelectable", + "ariaOrientation", + "ariaPlaceholder", + "ariaPosInSet", + "ariaPressed", + "ariaReadOnly", + "ariaRelevant", + "ariaRequired", + "ariaRoleDescription", + "ariaRowCount", + "ariaRowIndex", + "ariaRowSpan", + "ariaSelected", + "ariaSetSize", + "ariaSort", + "ariaValueMax", + "ariaValueMin", + "ariaValueNow", + "ariaValueText", "arrayBuffer", "artist", "artwork", "as", + "asIntN", + "asUintN", "asin", "asinh", "assert", "assign", + "assignedElements", + "assignedNodes", "assignedSlot", "async", + "asyncIterator", "atEnd", "atan", "atan2", "atanh", "atob", + "atomic", "attachEvent", + "attachInternals", "attachShader", "attachShadow", "attachments", "attack", + "attestationObject", "attrChange", "attrName", "attributeChangedCallback", @@ -2708,8 +3304,14 @@ "attributeOldValue", "attributeStyleMap", "attributes", + "attribution", + "audio/x-ms-wax", + "audio/x-ms-wma", + "audioBitsPerSecond", "audioTracks", "audioWorklet", + "authenticatedSignedWrites", + "authenticatorData", "autoIncrement", "autobuffer", "autocapitalize", @@ -2725,11 +3327,14 @@ "availability", "available", "aversion", + "ax", "axes", "axis", + "ay", "azimuth", "b", "back", + "backdropFilter", "backface-visibility", "backfaceVisibility", "background", @@ -2748,6 +3353,7 @@ "backgroundBlendMode", "backgroundClip", "backgroundColor", + "backgroundFetch", "backgroundImage", "backgroundOrigin", "backgroundPosition", @@ -2758,10 +3364,13 @@ "backgroundRepeatY", "backgroundSize", "badInput", + "badge", "balance", "baseFrequencyX", "baseFrequencyY", "baseLatency", + "baseLayer", + "baseName", "baseNode", "baseOffset", "baseURI", @@ -2773,6 +3382,8 @@ "beginElement", "beginElementAt", "beginPath", + "beginQuery", + "beginTransformFeedback", "behavior", "behaviorCookie", "behaviorPart", @@ -2787,19 +3398,26 @@ "bind", "bindAttribLocation", "bindBuffer", + "bindBufferBase", + "bindBufferRange", "bindFramebuffer", "bindRenderbuffer", + "bindSampler", "bindTexture", + "bindTransformFeedback", + "bindVertexArray", "blendColor", "blendEquation", "blendEquationSeparate", "blendFunc", "blendFuncSeparate", "blink", + "blitFramebuffer", "blob", "block-size", "blockDirection", "blockSize", + "blockedURI", "blue", "bluetooth", "blur", @@ -2887,6 +3505,7 @@ "borderBottomRightRadius", "borderBottomStyle", "borderBottomWidth", + "borderBoxSize", "borderCollapse", "borderColor", "borderColorDark", @@ -2941,6 +3560,7 @@ "boundingTop", "boundingWidth", "bounds", + "boundsGeometry", "box-decoration-break", "box-shadow", "box-sizing", @@ -2953,6 +3573,8 @@ "breakAfter", "breakBefore", "breakInside", + "breakType", + "broadcast", "browserLanguage", "btoa", "bubbles", @@ -2963,6 +3585,7 @@ "bufferSubData", "buffered", "bufferedAmount", + "bufferedAmountLowThreshold", "bufferedRendering", "buildID", "buildNumber", @@ -2971,8 +3594,11 @@ "buttons", "byteLength", "byteOffset", + "bytesWritten", "c", + "cache", "caches", + "calendar", "call", "caller", "canBeFormatted", @@ -2980,7 +3606,10 @@ "canBeShared", "canHaveChildren", "canHaveHTML", + "canInsertDTMF", + "canMakePayment", "canPlayType", + "canPresent", "canTrickleIceCandidates", "cancel", "cancelAndHoldAtTime", @@ -2988,10 +3617,13 @@ "cancelBubble", "cancelIdleCallback", "cancelScheduledValues", + "cancelVideoFrameCallback", "cancelWatchAvailability", "cancelable", "candidate", + "canonicalUUID", "canvas", + "capabilities", "caption", "caption-side", "captionSide", @@ -3000,9 +3632,11 @@ "captureStackTrace", "captureStream", "caret-color", + "caretBidiLevel", "caretColor", "caretPositionFromPoint", "caretRangeFromPoint", + "caseFirst", "cast", "catch", "category", @@ -3017,6 +3651,8 @@ "chOff", "chain", "challenge", + "changeType", + "changeVersion", "changedTouches", "channel", "channelCount", @@ -3027,15 +3663,18 @@ "charCode", "charCodeAt", "charIndex", + "charLength", "characterData", "characterDataOldValue", "characterSet", + "characteristic", "charging", "chargingTime", "charset", "check", "checkEnclosure", "checkFramebufferStatus", + "checkInstalled", "checkIntersection", "checkValidity", "checked", @@ -3046,14 +3685,23 @@ "chrome", "ciphertext", "cite", + "city", + "claimInterface", + "claimed", "classList", "className", "classid", "clear", + "clearAppBadge", "clearAttributes", + "clearBufferfi", + "clearBufferfv", + "clearBufferiv", + "clearBufferuiv", "clearColor", "clearData", "clearDepth", + "clearHalt", "clearImmediate", "clearInterval", "clearLiveSeekableRange", @@ -3068,12 +3716,14 @@ "clearWatch", "click", "clickCount", + "clientDataJSON", "clientHeight", "clientInformation", "clientLeft", "clientRect", "clientRects", "clientTop", + "clientWaitSync", "clientWidth", "clientX", "clientY", @@ -3099,6 +3749,7 @@ "closest", "clz", "clz32", + "cm", "cmp", "code", "codeBase", @@ -3109,6 +3760,7 @@ "collapseToEnd", "collapseToStart", "collapsed", + "collation", "collect", "colno", "color", @@ -3120,9 +3772,12 @@ "colorInterpolation", "colorInterpolationFilters", "colorMask", + "colorProfile", "colorRendering", + "colorScheme", "colorType", "cols", + "column", "column-count", "column-fill", "column-gap", @@ -3130,6 +3785,7 @@ "column-rule-color", "column-rule-style", "column-rule-width", + "column-span", "column-width", "columnCount", "columnFill", @@ -3143,7 +3799,10 @@ "columnWidth", "columns", "command", + "commit", + "commitLoadTime", "commitPreferences", + "commitStyles", "commonAncestorContainer", "compact", "compare", @@ -3159,19 +3818,27 @@ "compileShader", "compileStreaming", "complete", + "component", "componentFromPoint", "composed", "composedPath", + "composite", "compositionEndOffset", "compositionStartOffset", "compressedTexImage2D", + "compressedTexImage3D", "compressedTexSubImage2D", + "compressedTexSubImage3D", "computedStyleMap", "concat", "conditionText", "coneInnerAngle", "coneOuterAngle", "coneOuterGain", + "configuration", + "configurationName", + "configurationValue", + "configurations", "confirm", "confirmComposition", "confirmSiteSpecificTrackingException", @@ -3182,21 +3849,34 @@ "connected", "connectedCallback", "connection", + "connectionInfo", + "connectionList", "connectionSpeed", "connectionState", + "connections", "console", + "consoleHistory", "consolidate", + "constraint", "constrictionActive", "construct", "constructor", "contactID", "contain", + "containIntrinsicSize", + "containerId", + "containerName", + "containerSrc", + "containerType", "contains", "containsNode", "content", + "contentBoxSize", "contentDocument", "contentEditable", + "contentHint", "contentOverflow", + "contentRect", "contentScriptType", "contentStyleType", "contentType", @@ -3205,30 +3885,40 @@ "contextMenu", "contextmenu", "continue", + "continuePrimaryKey", "continuous", "control", + "controlTransferIn", + "controlTransferOut", "controller", "controls", "controlsList", + "convertToBlob", "convertToSpecifiedUnits", "cookie", "cookieEnabled", "coords", + "copyBufferSubData", "copyFromChannel", "copyTexImage2D", "copyTexSubImage2D", + "copyTexSubImage3D", "copyToChannel", "copyWithin", "correspondingElement", "correspondingUseElement", + "corruptedVideoFrames", "cos", "cosh", "count", "countReset", "counter-increment", "counter-reset", + "counter-set", "counterIncrement", "counterReset", + "counterSet", + "country", "cpuClass", "cpuSleepAllowed", "create", @@ -3267,6 +3957,7 @@ "createFunction", "createGain", "createGainNode", + "createHTML", "createHTMLDocument", "createIIRFilter", "createImageBitmap", @@ -3278,6 +3969,7 @@ "createMediaKeys", "createMediaStreamDestination", "createMediaStreamSource", + "createMediaStreamTrackSource", "createMutableFile", "createNSResolver", "createNodeIterator", @@ -3289,12 +3981,15 @@ "createPanner", "createPattern", "createPeriodicWave", + "createPolicy", "createPopup", "createProcessingInstruction", "createProgram", + "createQuery", "createRadialGradient", "createRange", "createRangeCollection", + "createReader", "createRenderbuffer", "createSVGAngle", "createSVGLength", @@ -3323,7 +4018,10 @@ "createSVGRect", "createSVGTransform", "createSVGTransformFromMatrix", + "createSampler", + "createScript", "createScriptProcessor", + "createScriptURL", "createSession", "createShader", "createShadowRoot", @@ -3337,11 +4035,14 @@ "createTexture", "createTouch", "createTouchList", + "createTransformFeedback", "createTreeWalker", + "createVertexArray", "createWaveShaper", "creationTime", "credentials", "crossOrigin", + "crossOriginIsolated", "crypto", "csi", "csp", @@ -3353,9 +4054,14 @@ "ctrlLeft", "cues", "cullFace", + "currency", + "currencyDisplay", + "current", + "currentDirection", "currentLocalDescription", "currentNode", "currentPage", + "currentRect", "currentRemoteDescription", "currentScale", "currentScript", @@ -3370,12 +4076,15 @@ "curve", "customElements", "customError", + "customSections", "cx", "cy", "d", "data", "dataFld", "dataFormatAs", + "dataLoss", + "dataLossMessage", "dataPageSize", "dataSrc", "dataTransfer", @@ -3383,6 +4092,7 @@ "databases", "dataset", "dateTime", + "day", "db", "debug", "debuggerEnabled", @@ -3391,6 +4101,7 @@ "decodeAudioData", "decodeURI", "decodeURIComponent", + "decodedBodySize", "decoding", "decodingInfo", "decrypt", @@ -3399,6 +4110,7 @@ "defaultChecked", "defaultMuted", "defaultPlaybackRate", + "defaultPolicy", "defaultPrevented", "defaultRequest", "defaultSelected", @@ -3413,6 +4125,8 @@ "defineMagicVariable", "defineProperties", "defineProperty", + "deg", + "delay", "delayTime", "delegatesFocus", "delete", @@ -3429,13 +4143,18 @@ "deleteObjectStore", "deleteProgram", "deleteProperty", + "deleteQuery", "deleteRenderbuffer", "deleteRow", "deleteRule", + "deleteSampler", "deleteShader", + "deleteSync", "deleteTFoot", "deleteTHead", "deleteTexture", + "deleteTransformFeedback", + "deleteVertexArray", "deliverChangeRecords", "delivery", "deliveryInfo", @@ -3446,31 +4165,49 @@ "deltaX", "deltaY", "deltaZ", + "dependentLocality", + "depthFar", "depthFunc", "depthMask", + "depthNear", "depthRange", + "deref", "deriveBits", "deriveKey", "description", "deselectAll", "designMode", + "desiredSize", "destination", "destinationURL", "detach", "detachEvent", "detachShader", "detail", + "details", + "detect", "detune", + "device", + "deviceClass", + "deviceId", "deviceMemory", + "devicePixelContentBoxSize", "devicePixelRatio", + "deviceProtocol", "deviceSessionId", + "deviceSubclass", + "deviceVersionMajor", + "deviceVersionMinor", + "deviceVersionSubminor", "deviceXDPI", "deviceYDPI", + "didTimeout", "diffuseConstant", "digest", "dimensions", "dir", "dirName", + "dirXml", "direction", "dirxml", "disable", @@ -3481,9 +4218,15 @@ "dischargingTime", "disconnect", "disconnectedCallback", + "dispatch", "dispatchEvent", + "dispatchToListener", "display", + "displayId", + "displayName", + "disposition", "distanceModel", + "div", "divisor", "djsapi", "djsproxy", @@ -3504,6 +4247,7 @@ "domContentLoadedEventStart", "domInteractive", "domLoading", + "domOverlayState", "domain", "domainLookupEnd", "domainLookupStart", @@ -3512,26 +4256,38 @@ "done", "dopplerFactor", "dotAll", + "downDegrees", "downlink", "download", + "downloadTotal", + "downloaded", + "dpcm", + "dpi", + "dppx", "dragDrop", "draggable", "drawArrays", + "drawArraysInstanced", "drawArraysInstancedANGLE", + "drawBuffers", "drawCustomFocusRing", "drawElements", + "drawElementsInstanced", "drawElementsInstancedANGLE", "drawFocusIfNeeded", "drawImage", "drawImageFromRect", + "drawRangeElements", "drawSystemFocusRing", "drawingBufferHeight", "drawingBufferWidth", "dropEffect", "droppedVideoFrames", "dropzone", + "dtmf", "dump", "duplicate", + "durability", "duration", "dvname", "dvnum", @@ -3542,20 +4298,31 @@ "edgeMode", "effect", "effectAllowed", + "effectiveDirective", "effectiveType", "elapsedTime", + "element", "elementFromPoint", + "elementTiming", "elements", "elementsFromPoint", "elevation", "ellipse", + "em", + "emHeightAscent", + "emHeightDescent", "email", "embeds", + "emma", "empty", "empty-cells", "emptyCells", + "emptyHTML", + "emptyScript", + "emulatedPosition", "enable", "enableBackground", + "enableDelegations", "enableStyleSheetsForSet", "enableVertexAttribArray", "enabled", @@ -3564,6 +4331,7 @@ "encodeInto", "encodeURI", "encodeURIComponent", + "encodedBodySize", "encoding", "encodingInfo", "encrypt", @@ -3574,15 +4342,22 @@ "endElementAt", "endOfStream", "endOffset", + "endQuery", "endTime", + "endTransformFeedback", "ended", + "endpoint", + "endpointNumber", + "endpoints", "endsWith", + "enterKeyHint", "entities", "entries", "entryType", "enumerate", "enumerateDevices", "enumerateEditable", + "environmentBlendMode", "epubCaptionSide", "epubTextCombine", "epubTextEmphasis", @@ -3592,8 +4367,12 @@ "epubTextTransform", "epubWordBreak", "epubWritingMode", + "equals", + "era", "error", "errorCode", + "errorDetail", + "errorText", "escape", "estimate", "eval", @@ -3601,26 +4380,33 @@ "event", "eventPhase", "every", + "ex", "exception", "exchange", "exec", "execCommand", "execCommandShowHelp", "execScript", + "executeSql", "exitFullscreen", "exitPictureInPicture", "exitPointerLock", + "exitPresent", "exp", "expand", "expandEntityReferences", "expando", "expansion", + "expiration", + "expirationTime", + "expires", "expiryDate", "explicitOriginalTarget", "expm1", "exponent", "exponentialRampToValueAtTime", "exportKey", + "exports", "extend", "extensions", "extentNode", @@ -3629,18 +4415,27 @@ "externalResourcesRequired", "extractContents", "extractable", + "eye", "f", "face", "factoryReset", + "failureReason", "fallback", + "family", "familyName", "farthestViewportElement", "fastSeek", "fatal", + "featurePolicy", + "featureSettings", + "features", + "fenceSync", "fetch", "fetchStart", "fftSize", "fgColor", + "fieldOfView", + "file", "fileCreatedDate", "fileHandle", "fileModifiedDate", @@ -3649,9 +4444,11 @@ "fileUpdatedDate", "filename", "files", + "filesystem", "fill", "fill-opacity", "fill-rule", + "fillLightMode", "fillOpacity", "fillRect", "fillRule", @@ -3668,12 +4465,17 @@ "findRule", "findText", "finish", + "finishDocumentLoadTime", + "finishLoadTime", "finished", "fireEvent", "firesTouchEvents", + "first", "firstChild", "firstElementChild", "firstPage", + "firstPaintAfterLoadTime", + "firstPaintTime", "fixed", "flags", "flat", @@ -3721,11 +4523,14 @@ "font-variant-numeric", "font-variant-position", "font-weight", + "fontBoundingBoxAscent", + "fontBoundingBoxDescent", "fontDisplay", "fontFamily", "fontFeatureSettings", "fontKerning", "fontLanguageOverride", + "fontOpticalSizing", "fontSize", "fontSizeAdjust", "fontSmoothingEnabled", @@ -3742,10 +4547,12 @@ "fontVariationSettings", "fontWeight", "fontcolor", + "fontfaces", "fonts", "fontsize", "for", "forEach", + "force", "forceRedraw", "form", "formAction", @@ -3755,19 +4562,27 @@ "formNoValidate", "formTarget", "format", + "formatRange", + "formatRangeToParts", "formatToParts", "forms", "forward", "forwardX", "forwardY", "forwardZ", + "foundation", "fr", + "fragmentDirective", "frame", "frameBorder", "frameElement", "frameSpacing", + "framebuffer", + "framebufferHeight", "framebufferRenderbuffer", "framebufferTexture2D", + "framebufferTextureLayer", + "framebufferWidth", "frames", "freeSpace", "freeze", @@ -3777,8 +4592,16 @@ "fromCharCode", "fromCodePoint", "fromElement", + "fromEntries", + "fromFloat32Array", + "fromFloat64Array", + "fromMatrix", + "fromPoint", + "fromQuad", + "fromRect", "frontFace", "fround", + "fullPath", "fullScreen", "fullscreen", "fullscreenElement", @@ -3789,7 +4612,10 @@ "gamepad", "gamma", "gap", + "gatheringState", + "gatt", "genderIdentity", + "generateCertificate", "generateKey", "generateMipmap", "generateRequest", @@ -3798,9 +4624,16 @@ "get", "getActiveAttrib", "getActiveUniform", + "getActiveUniformBlockName", + "getActiveUniformBlockParameter", + "getActiveUniforms", + "getAdditionalLanguages", "getAdjacentText", "getAll", + "getAllKeys", "getAllResponseHeaders", + "getAllowlistForFeature", + "getAnimations", "getAsFile", "getAsString", "getAttachedShaders", @@ -3810,30 +4643,44 @@ "getAttributeNames", "getAttributeNode", "getAttributeNodeNS", + "getAttributeType", "getAudioTracks", + "getAvailability", "getBBox", "getBattery", + "getBigInt64", + "getBigUint64", "getBlob", "getBookmark", "getBoundingClientRect", "getBounds", "getBufferParameter", + "getBufferSubData", "getByteFrequencyData", "getByteTimeDomainData", "getCSSCanvasContext", "getCTM", "getCandidateWindowClientRect", "getCanonicalLocales", + "getCapabilities", "getChannelData", "getCharNumAtPosition", + "getCharacteristic", + "getCharacteristics", + "getClientExtensionResults", "getClientRect", "getClientRects", + "getCoalescedEvents", "getCompositionAlternatives", "getComputedStyle", "getComputedTextLength", + "getComputedTiming", "getConfiguration", + "getConstraints", "getContext", "getContextAttributes", + "getContributingSources", + "getCount", "getCounterValue", "getCueAsHTML", "getCueById", @@ -3844,9 +4691,12 @@ "getDate", "getDay", "getDefaultComputedStyle", + "getDescriptor", + "getDescriptors", "getDestinationInsertionPoints", "getDetails", "getDevices", + "getDirectory", "getDisplayMedia", "getDistributedNodes", "getEditable", @@ -3863,31 +4713,49 @@ "getError", "getExtension", "getExtentOfChar", + "getEyeParameters", "getFeature", "getFile", + "getFiles", + "getFilesAndDirectories", + "getFingerprints", "getFloat32", "getFloat64", "getFloatFrequencyData", "getFloatTimeDomainData", "getFloatValue", + "getFragDataLocation", + "getFrameData", "getFramebufferAttachmentParameter", "getFrequencyResponse", "getFullYear", "getGamepads", + "getHitTestResults", + "getHitTestResultsForTransientInput", "getHours", "getIdentityAssertion", + "getIds", "getImageData", + "getIndexedParameter", + "getInstalled", + "getInstalledRelatedApps", "getInt16", "getInt32", "getInt8", + "getInternalformatParameter", "getIntersectionList", "getIsInstalled", "getItem", "getItems", "getKey", + "getKeyframes", + "getLayers", "getLayoutMap", "getLineDash", + "getLocalCandidates", + "getLocalParameters", "getLocalStreams", + "getLocalizationResource", "getMarks", "getMatchedCSSRules", "getMeasures", @@ -3898,28 +4766,43 @@ "getMonth", "getNamedItem", "getNamedItemNS", + "getNativeFramebufferScaleFactor", + "getNotifications", "getNotifier", "getNumberOfChars", + "getOffsetReferenceSpace", "getOutputTimestamp", "getOverrideHistoryNavigationMode", "getOverrideStyle", "getOwnPropertyDescriptor", + "getOwnPropertyDescriptors", "getOwnPropertyNames", "getOwnPropertySymbols", "getParameter", + "getParameters", + "getParent", "getPathSegAtLength", + "getPhotoCapabilities", + "getPhotoSettings", "getPointAtLength", + "getPose", + "getPredictedEvents", "getPreference", "getPreferenceDefault", "getPresentationAttribute", "getPreventDefault", + "getPrimaryService", + "getPrimaryServices", "getProgramInfoLog", "getProgramParameter", "getPropertyCSSValue", "getPropertyPriority", "getPropertyShorthand", + "getPropertyType", "getPropertyValue", "getPrototypeOf", + "getQuery", + "getQueryParameter", "getRGBColorValue", "getRandomValues", "getRangeAt", @@ -3928,17 +4811,27 @@ "getRectValue", "getRegistration", "getRegistrations", + "getRemoteCandidates", + "getRemoteCertificates", + "getRemoteParameters", "getRemoteStreams", "getRenderbufferParameter", "getResponseHeader", + "getRevision", "getRoot", "getRootNode", "getRotationOfChar", + "getRules", "getSVGDocument", + "getSamplerParameter", "getScreenCTM", "getSeconds", + "getSelectedCandidatePair", "getSelection", + "getSelf", "getSenders", + "getService", + "getSettings", "getShaderInfoLog", "getShaderParameter", "getShaderPrecisionFormat", @@ -3947,9 +4840,12 @@ "getSiteIcons", "getSources", "getSpeculativeParserUrls", + "getStartDate", "getStartPositionOfChar", "getStartTime", + "getState", "getStats", + "getStatusForPolicy", "getStorageUpdates", "getStreamById", "getStringValue", @@ -3957,14 +4853,25 @@ "getSubscription", "getSupportedConstraints", "getSupportedExtensions", + "getSupportedFormats", + "getSyncParameter", + "getSynchronizationSources", + "getTags", + "getTargetRanges", "getTexParameter", "getTime", "getTimezoneOffset", + "getTiming", "getTotalLength", "getTrackById", "getTracks", "getTransceivers", + "getTransform", + "getTransformFeedbackVarying", "getTransformToElement", + "getTransports", + "getType", + "getTypeMapping", "getUTCDate", "getUTCDay", "getUTCFullYear", @@ -3977,6 +4884,8 @@ "getUint32", "getUint8", "getUniform", + "getUniformBlockIndex", + "getUniformIndices", "getUniformLocation", "getUserMedia", "getVRDisplays", @@ -3987,6 +4896,8 @@ "getVertexAttribOffset", "getVideoPlaybackQuality", "getVideoTracks", + "getViewerPose", + "getViewport", "getVoices", "getWakeLockState", "getWriter", @@ -4000,6 +4911,8 @@ "glyphOrientationVertical", "glyphRef", "go", + "grabFrame", + "grad", "gradientTransform", "gradientUnits", "grammars", @@ -4039,9 +4952,18 @@ "gridTemplateAreas", "gridTemplateColumns", "gridTemplateRows", + "gripSpace", "group", "groupCollapsed", "groupEnd", + "groupId", + "grow", + "hadRecentInput", + "hand", + "handedness", + "hangingBaseline", + "hangingPunctuation", + "hapticActuators", "hardwareConcurrency", "has", "hasAttribute", @@ -4050,12 +4972,19 @@ "hasBeenActive", "hasChildNodes", "hasComposition", + "hasEnrolledInstrument", "hasExtension", + "hasExternalDisplay", "hasFeature", "hasFocus", + "hasInstance", "hasLayout", + "hasListener", + "hasListeners", + "hasOrientation", "hasOwnProperty", "hasPointerCapture", + "hasPosition", "hasReading", "hasStorageAccess", "hash", @@ -4067,39 +4996,56 @@ "hide", "hideFocus", "high", + "highWaterMark", "hint", "history", "honorificPrefix", "honorificSuffix", "horizontalOverflow", "host", + "hostCandidate", "hostname", + "hour", + "hour12", + "hourCycle", "href", + "hrefTranslate", "hreflang", "hspace", "html5TagCheckInerface", "htmlFor", "htmlText", "httpEquiv", + "httpRequestStatusCode", "hwTimestamp", "hyphens", "hypot", "iccId", "iceConnectionState", "iceGatheringState", + "iceTransport", "icon", + "iconURL", "id", "identifier", "identity", + "ideographicBaseline", "idpLoginUrl", "ignoreBOM", "ignoreCase", + "ignoreDepthValues", + "ignoreMutedMedia", + "ignorePunctuation", "image-orientation", "image-rendering", + "imageHeight", "imageOrientation", "imageRendering", "imageSizes", + "imageSmoothingEnabled", + "imageSmoothingQuality", "imageSrcset", + "imageWidth", "images", "ime-mode", "imeMode", @@ -4111,6 +5057,7 @@ "imports", "impp", "imul", + "in", "in1", "in2", "inBandMetadataTrackDispatchType", @@ -4122,6 +5069,7 @@ "indexNames", "indexOf", "indexedDB", + "indicate", "inertiaDestinationX", "inertiaDestinationY", "info", @@ -4134,6 +5082,7 @@ "initCompositionEvent", "initCustomEvent", "initData", + "initDataType", "initDeviceMotionEvent", "initDeviceOrientationEvent", "initDragEvent", @@ -4174,6 +5123,7 @@ "initiatorType", "inline-size", "inlineSize", + "inlineVerticalFieldOfView", "inner", "innerHTML", "innerHeight", @@ -4184,12 +5134,18 @@ "inputEncoding", "inputMethod", "inputMode", + "inputSource", + "inputSources", + "inputType", + "inputs", "insertAdjacentElement", "insertAdjacentHTML", "insertAdjacentText", "insertBefore", "insertCell", + "insertDTMF", "insertData", + "insertId", "insertItemBefore", "insertNode", "insertRow", @@ -4209,17 +5165,32 @@ "insetInlineStart", "install", "installChrome", + "installPackage", "installState", + "installing", "instanceRoot", "instantiate", "instantiateStreaming", + "instruments", "integrity", + "interactionMode", "intercept", + "interfaceClass", + "interfaceName", + "interfaceNumber", + "interfaceProtocol", + "interfaceSubclass", + "interfaces", "interimResults", "internalSubset", + "interpretation", + "intersectionRatio", + "intersectionRect", "intersectsNode", "interval", "invalidIteratorState", + "invalidateFramebuffer", + "invalidateSubFramebuffer", "inverse", "invertSelf", "is", @@ -4233,25 +5204,32 @@ "isChar", "isCollapsed", "isComposing", + "isConcatSpreadable", "isConnected", "isContentEditable", "isContentHandlerRegistered", "isContextLost", "isDefaultNamespace", + "isDirectory", "isDisabled", "isEnabled", "isEqual", "isEqualNode", "isExtensible", + "isExternalCTAP2SecurityKeySupported", + "isFile", "isFinite", "isFramebuffer", "isFrozen", "isGenerator", + "isHTML", + "isHistoryNavigation", "isId", "isIdentity", "isInjected", "isInstalled", "isInteger", + "isIntersecting", "isLockFree", "isMap", "isMultiLine", @@ -4262,23 +5240,37 @@ "isPointInRange", "isPointInStroke", "isPrefAlternate", + "isPresenting", "isPrimary", "isProgram", "isPropertyImplicit", "isProtocolHandlerRegistered", "isPrototypeOf", + "isQuery", "isRenderbuffer", "isSafeInteger", "isSameNode", + "isSampler", + "isScript", + "isScriptURL", "isSealed", "isSecureContext", + "isSessionSupported", "isShader", "isSupported", + "isSync", "isTextEdit", "isTexture", + "isTransformFeedback", "isTrusted", "isTypeSupported", + "isTypeSupportedWithFeatures", + "isUserVerifyingPlatformAuthenticatorAvailable", + "isVertexArray", "isView", + "isVisible", + "isochronousTransferIn", + "isochronousTransferOut", "isolation", "italics", "item", @@ -4306,6 +5298,8 @@ "k2", "k3", "k4", + "kHz", + "keepalive", "kernelMatrix", "kernelUnitLengthX", "kernelUnitLengthY", @@ -4317,6 +5311,7 @@ "keyLightEnabled", "keyLocation", "keyPath", + "keyStatuses", "keySystem", "keyText", "keyUsage", @@ -4331,11 +5326,13 @@ "language", "languages", "largeArcFlag", + "lastActivePanel", "lastChild", "lastElementChild", "lastEventId", "lastIndex", "lastIndexOf", + "lastInputTime", "lastMatch", "lastMessageSubject", "lastMessageType", @@ -4357,6 +5354,7 @@ "lbound", "left", "leftContext", + "leftDegrees", "leftMargin", "leftProjectionMatrix", "leftViewMatrix", @@ -4370,6 +5368,7 @@ "lightingColor", "limitingConeAngle", "line", + "line-break", "line-height", "lineAlign", "lineBreak", @@ -4402,10 +5401,13 @@ "load", "loadEventEnd", "loadEventStart", + "loadTime", "loadTimes", "loaded", + "loading", "localDescription", "localName", + "localService", "localStorage", "locale", "localeCompare", @@ -4450,7 +5452,10 @@ "m42", "m43", "m44", + "makeXRCompatible", "manifest", + "manufacturer", + "manufacturerName", "map", "mapping", "margin", @@ -4477,6 +5482,7 @@ "marginTop", "marginWidth", "mark", + "markTimeline", "marker", "marker-end", "marker-mid", @@ -4527,19 +5533,27 @@ "max-height", "max-inline-size", "max-width", + "maxActions", "maxAlternatives", "maxBlockSize", "maxChannelCount", + "maxChannels", "maxConnectionsPerServer", "maxDecibels", "maxDistance", "maxHeight", "maxInlineSize", + "maxLayers", "maxLength", + "maxMessageSize", + "maxPacketLifeTime", + "maxRetransmits", "maxTouchPoints", "maxValue", "maxWidth", "maxZoom", + "maximize", + "maximumFractionDigits", "measure", "measureText", "media", @@ -4549,6 +5563,7 @@ "mediaGroup", "mediaKeys", "mediaSession", + "mediaStream", "mediaText", "meetOrSlice", "memory", @@ -4557,9 +5572,13 @@ "message", "messageClass", "messageHandlers", + "messageType", "metaKey", "metadata", "method", + "methodDetails", + "methodName", + "mid", "mimeType", "mimeTypes", "min", @@ -4575,11 +5594,21 @@ "minValue", "minWidth", "minZoom", + "minimize", + "minimumFractionDigits", + "minimumIntegerDigits", + "minute", "miterLimit", "mix-blend-mode", "mixBlendMode", + "mm", "mode", "modify", + "month", + "motion", + "motionOffset", + "motionPath", + "motionRotation", "mount", "move", "moveBy", @@ -4679,6 +5708,7 @@ "mozUnlockOrientation", "mozUserCancelled", "mozVisibilityState", + "ms", "msAnimation", "msAnimationDelay", "msAnimationDirection", @@ -4822,6 +5852,7 @@ "msZoom", "msZoomTo", "mt", + "mul", "multiEntry", "multiSelectionObj", "multiline", @@ -4843,11 +5874,14 @@ "navigate", "navigation", "navigationMode", + "navigationPreload", "navigationStart", + "navigationType", "navigator", "near", "nearestViewportElement", "negative", + "negotiated", "netscape", "networkState", "newScale", @@ -4859,6 +5893,7 @@ "newhome", "next", "nextElementSibling", + "nextHopProtocol", "nextNode", "nextPage", "nextSibling", @@ -4869,6 +5904,7 @@ "noShade", "noValidate", "noWrap", + "node", "nodeName", "nodeType", "nodeValue", @@ -4883,6 +5919,7 @@ "noteOn", "notify", "now", + "npnNegotiatedProtocol", "numOctaves", "number", "numberOfChannels", @@ -4890,6 +5927,8 @@ "numberOfItems", "numberOfOutputs", "numberValue", + "numberingSystem", + "numeric", "oMatchesSelector", "object", "object-fit", @@ -4903,8 +5942,21 @@ "of", "offscreenBuffering", "offset", + "offset-anchor", + "offset-block-end", + "offset-block-start", + "offset-distance", + "offset-inline-end", + "offset-inline-start", + "offset-path", + "offset-rotate", + "offsetAnchor", + "offsetBlockEnd", + "offsetBlockStart", "offsetDistance", "offsetHeight", + "offsetInlineEnd", + "offsetInlineStart", "offsetLeft", "offsetNode", "offsetParent", @@ -4919,6 +5971,8 @@ "oldValue", "oldVersion", "olderShadowRoot", + "onDownloadProgress", + "onInstallStageChanged", "onLine", "onabort", "onabsolutedeviceorientation", @@ -4946,16 +6000,21 @@ "onbeforecut", "onbeforedeactivate", "onbeforeeditfocus", + "onbeforeinput", "onbeforeinstallprompt", + "onbeforeload", "onbeforepaste", "onbeforeprint", "onbeforescriptexecute", "onbeforeunload", "onbeforeupdate", + "onbeforexrselect", + "onbegin", "onblocked", "onblur", "onbounce", "onboundary", + "onbufferedamountlow", "oncached", "oncancel", "oncandidatewindowhide", @@ -4966,16 +6025,20 @@ "once", "oncellchange", "onchange", + "oncharacteristicvaluechanged", "onchargingchange", "onchargingtimechange", "onchecking", "onclick", "onclose", + "onclosing", "oncompassneedscalibration", "oncomplete", "onconnect", "onconnecting", + "onconnectionavailable", "onconnectionstatechange", + "oncontactchange", "oncontextmenu", "oncontrollerchange", "oncontrolselect", @@ -5021,9 +6084,12 @@ "onfocus", "onfocusin", "onfocusout", + "onformdata", "onfreeze", "onfullscreenchange", "onfullscreenerror", + "ongatheringstatechange", + "ongattserverdisconnected", "ongesturechange", "ongestureend", "ongesturestart", @@ -5031,19 +6097,23 @@ "onhashchange", "onhelp", "onicecandidate", + "onicecandidateerror", "oniceconnectionstatechange", "onicegatheringstatechange", "oninactive", "oninput", + "oninputsourceschange", "oninvalid", "onkeydown", "onkeypress", + "onkeystatuseschange", "onkeyup", "onlanguagechange", "onlayoutcomplete", "onleavepictureinpicture", "onlevelchange", "onload", + "onloadT", "onloadeddata", "onloadedmetadata", "onloadend", @@ -5057,6 +6127,7 @@ "onmark", "onmessage", "onmessageerror", + "onmidimessage", "onmousedown", "onmouseenter", "onmouseleave", @@ -5099,6 +6170,7 @@ "onmspointerup", "onmssitemodejumplistitemremoved", "onmsthumbnailclick", + "onmute", "onnegotiationneeded", "onnomatch", "onnoupdate", @@ -5107,11 +6179,15 @@ "ononline", "onopen", "onorientationchange", + "onoverconstrained", + "onpage", "onpagechange", "onpagehide", "onpageshow", "onpaste", "onpause", + "onpayerdetailchange", + "onpaymentmethodchange", "onplay", "onplaying", "onpluginstreamstart", @@ -5124,17 +6200,22 @@ "onpointermove", "onpointerout", "onpointerover", + "onpointerrawupdate", "onpointerup", "onpopstate", + "onprocessorerror", "onprogress", "onpropertychange", "onratechange", "onreading", "onreadystatechange", "onrejectionhandled", + "onrelease", + "onremove", "onremovesourcebuffer", "onremovestream", "onremovetrack", + "onrepeat", "onreset", "onresize", "onresizeend", @@ -5148,11 +6229,16 @@ "onrowsinserted", "onscroll", "onsearch", + "onsecuritypolicyviolation", "onseeked", "onseeking", "onselect", + "onselectedcandidatepairchange", + "onselectend", "onselectionchange", "onselectstart", + "onshippingaddresschange", + "onshippingoptionchange", "onshow", "onsignalingstatechange", "onsoundend", @@ -5163,6 +6249,9 @@ "onsourceopen", "onspeechend", "onspeechstart", + "onsqueeze", + "onsqueezeend", + "onsqueezestart", "onstalled", "onstart", "onstatechange", @@ -5172,10 +6261,12 @@ "onsubmit", "onsuccess", "onsuspend", + "onterminate", "ontextinput", "ontimeout", "ontimeupdate", "ontoggle", + "ontonechange", "ontouchcancel", "ontouchend", "ontouchmove", @@ -5187,7 +6278,12 @@ "ontransitionstart", "onunhandledrejection", "onunload", + "onunmute", + "onupdate", + "onupdateend", + "onupdatefound", "onupdateready", + "onupdatestart", "onupgradeneeded", "onuserproximity", "onversionchange", @@ -5211,6 +6307,10 @@ "onwebkitkeyadded", "onwebkitkeyerror", "onwebkitkeymessage", + "onwebkitmouseforcechanged", + "onwebkitmouseforcedown", + "onwebkitmouseforceup", + "onwebkitmouseforcewillbegin", "onwebkitneedkey", "onwebkitorientationchange", "onwebkitplaybacktargetavailabilitychanged", @@ -5225,11 +6325,13 @@ "openCursor", "openDatabase", "openKeyCursor", + "opened", "opener", "opera", "operationType", "operator", "opr", + "opsProfile", "optimum", "options", "or", @@ -5238,6 +6340,7 @@ "orderY", "ordered", "org", + "organization", "orient", "orientAngle", "orientType", @@ -5246,9 +6349,11 @@ "orientationY", "orientationZ", "origin", + "originalPolicy", "originalTarget", "orphans", "oscpu", + "outcome", "outerHTML", "outerHeight", "outerText", @@ -5263,21 +6368,31 @@ "outlineStyle", "outlineWidth", "outputBuffer", + "outputLatency", + "outputs", "overflow", "overflow-anchor", + "overflow-block", + "overflow-inline", "overflow-wrap", "overflow-x", "overflow-y", "overflowAnchor", + "overflowBlock", + "overflowInline", "overflowWrap", "overflowX", "overflowY", "overrideMimeType", "oversample", "overscroll-behavior", + "overscroll-behavior-block", + "overscroll-behavior-inline", "overscroll-behavior-x", "overscroll-behavior-y", "overscrollBehavior", + "overscrollBehaviorBlock", + "overscrollBehaviorInline", "overscrollBehaviorX", "overscrollBehaviorY", "ownKeys", @@ -5291,6 +6406,8 @@ "p2", "p3", "p4", + "packetSize", + "packets", "pad", "padEnd", "padStart", @@ -5324,6 +6441,7 @@ "pageBreakInside", "pageCount", "pageLeft", + "pageT", "pageTop", "pageX", "pageXOffset", @@ -5334,9 +6452,11 @@ "paintOrder", "paintRequests", "paintType", + "paintWorklet", "palette", "pan", "panningModel", + "parameters", "parent", "parentElement", "parentNode", @@ -5345,6 +6465,7 @@ "parentTextEdit", "parentWindow", "parse", + "parseAll", "parseFloat", "parseFromString", "parseInt", @@ -5367,13 +6488,22 @@ "pause", "pauseAnimations", "pauseOnExit", + "pauseTransformFeedback", "paused", + "payerEmail", + "payerName", + "payerPhone", + "paymentManager", + "pc", "peerIdentity", "pending", "pendingLocalDescription", "pendingRemoteDescription", + "percent", "performance", + "periodicSync", "permission", + "permissionState", "permissions", "persist", "persisted", @@ -5381,11 +6511,15 @@ "perspective", "perspective-origin", "perspectiveOrigin", + "perspectiveOriginX", + "perspectiveOriginY", + "phone", "phoneticFamilyName", "phoneticGivenName", "photo", "pictureInPictureElement", "pictureInPictureEnabled", + "pictureInPictureWindow", "ping", "pipeThrough", "pipeTo", @@ -5408,12 +6542,16 @@ "placeSelf", "placeholder", "platform", + "platforms", "play", + "playEffect", "playState", "playbackRate", "playbackState", "playbackTime", "played", + "playoutDelayHint", + "playsInline", "plugins", "pluginspage", "pname", @@ -5452,8 +6590,10 @@ "positionZ", "postError", "postMessage", + "postalCode", "poster", "pow", + "powerEfficient", "powerOff", "preMultiplySelf", "precision", @@ -5475,6 +6615,7 @@ "previousElementSibling", "previousNode", "previousPage", + "previousRect", "previousScale", "previousSibling", "previousTranslate", @@ -5483,15 +6624,22 @@ "primitiveUnits", "principals", "print", + "priority", "privateKey", "probablySupportsContext", "process", "processIceMessage", + "processingEnd", + "processingStart", "product", + "productId", + "productName", "productSub", "profile", "profileEnd", "profiles", + "projectionMatrix", + "promise", "prompt", "properties", "propertyIsEnumerable", @@ -5499,16 +6647,21 @@ "protocol", "protocolLong", "prototype", + "provider", "pseudoClass", "pseudoElement", + "pt", "publicId", "publicKey", "published", + "pulse", "push", + "pushManager", "pushNotification", "pushState", "put", "putImageData", + "px", "quadraticCurveTo", "qualifier", "quaternion", @@ -5529,6 +6682,7 @@ "r1", "r2", "race", + "rad", "radiogroup", "radiusX", "radiusY", @@ -5544,27 +6698,41 @@ "rate", "ratio", "raw", + "rawId", "read", "readAsArrayBuffer", "readAsBinaryString", "readAsBlob", "readAsDataURL", "readAsText", + "readBuffer", + "readEntries", "readOnly", "readPixels", "readReportRequested", "readText", + "readTransaction", + "readValue", "readable", "ready", "readyState", "reason", "reboot", + "receivedAlert", + "receivedTime", "receiver", "receivers", + "recipient", + "reconnect", + "record", + "recordEnd", "recordNumber", + "recordsAvailable", "recordset", "rect", "red", + "redEyeReduction", + "redirect", "redirectCount", "redirectEnd", "redirectStart", @@ -5576,6 +6744,7 @@ "refX", "refY", "referenceNode", + "referenceSpace", "referrer", "referrerPolicy", "refresh", @@ -5587,19 +6756,26 @@ "register", "registerContentHandler", "registerElement", + "registerProperty", "registerProtocolHandler", "reject", "rel", "relList", + "relatedAddress", "relatedNode", + "relatedPort", "relatedTarget", "release", "releaseCapture", "releaseEvents", + "releaseInterface", + "releaseLock", "releasePointerCapture", "releaseShaderCompiler", "reliable", + "reliableWrite", "reload", + "rem", "remainingSpace", "remote", "remoteDescription", @@ -5624,6 +6800,7 @@ "removeRange", "removeRegion", "removeRule", + "removeRules", "removeSiteSpecificTrackingException", "removeSourceBuffer", "removeStream", @@ -5631,14 +6808,23 @@ "removeVariable", "removeWakeLockListener", "removeWebWideTrackingException", + "removed", "removedNodes", + "renderHeight", + "renderState", + "renderTime", + "renderWidth", "renderbufferStorage", + "renderbufferStorageMultisample", "renderedBuffer", "renderingMode", + "renotify", "repeat", "replace", "replaceAdjacentText", + "replaceAll", "replaceChild", + "replaceChildren", "replaceData", "replaceId", "replaceItem", @@ -5654,39 +6840,61 @@ "requestAutocomplete", "requestData", "requestDevice", + "requestFrame", "requestFullscreen", + "requestHitTestSource", + "requestHitTestSourceForTransientInput", + "requestId", "requestIdleCallback", "requestMIDIAccess", "requestMediaKeySystemAccess", "requestPermission", "requestPictureInPicture", "requestPointerLock", + "requestPresent", "requestQuota", + "requestReferenceSpace", + "requestSession", "requestStart", "requestStorageAccess", + "requestSubmit", + "requestTime", + "requestVideoFrameCallback", + "requestedLocale", "requestingWindow", + "requireInteraction", "required", "requiredExtensions", "requiredFeatures", "reset", + "resetPose", "resetTransform", "resize", "resizeBy", "resizeTo", "resolve", + "resolved", "resolvedOptions", + "resource-history", + "resourcesFramesExpanded", "response", "responseBody", "responseEnd", + "responseReady", "responseStart", "responseText", "responseType", "responseURL", "responseXML", + "restartIce", "restore", "result", + "resultIndex", "resultType", + "results", "resume", + "resumeTransformFeedback", + "retry", "returnValue", "rev", "reverse", @@ -5696,12 +6904,16 @@ "rgbColor", "right", "rightContext", + "rightDegrees", "rightMargin", "rightProjectionMatrix", "rightViewMatrix", + "role", "rolloffFactor", "root", + "rootBounds", "rootElement", + "rootMargin", "rotate", "rotateAxisAngle", "rotateAxisAngleSelf", @@ -5709,6 +6921,7 @@ "rotateFromVectorSelf", "rotateSelf", "rotation", + "rotationAngle", "rotationRate", "round", "row-gap", @@ -5716,6 +6929,8 @@ "rowIndex", "rowSpan", "rows", + "rowsAffected", + "rtcpTransport", "rtt", "ruby-align", "ruby-position", @@ -5728,9 +6943,13 @@ "runtimeStyle", "rx", "ry", + "s", "safari", + "sample", "sampleCoverage", "sampleRate", + "samplerParameterf", + "samplerParameteri", "sandbox", "save", "saveData", @@ -5754,9 +6973,34 @@ "screenTop", "screenX", "screenY", + "script", + "scriptURL", "scripts", "scroll", "scroll-behavior", + "scroll-margin", + "scroll-margin-block", + "scroll-margin-block-end", + "scroll-margin-block-start", + "scroll-margin-bottom", + "scroll-margin-inline", + "scroll-margin-inline-end", + "scroll-margin-inline-start", + "scroll-margin-left", + "scroll-margin-right", + "scroll-margin-top", + "scroll-padding", + "scroll-padding-block", + "scroll-padding-block-end", + "scroll-padding-block-start", + "scroll-padding-bottom", + "scroll-padding-inline", + "scroll-padding-inline-end", + "scroll-padding-inline-start", + "scroll-padding-left", + "scroll-padding-right", + "scroll-padding-top", + "scroll-snap-align", "scroll-snap-coordinate", "scroll-snap-destination", "scroll-snap-points-x", @@ -5803,6 +7047,11 @@ "scrollSnapAlign", "scrollSnapCoordinate", "scrollSnapDestination", + "scrollSnapMargin", + "scrollSnapMarginBottom", + "scrollSnapMarginLeft", + "scrollSnapMarginRight", + "scrollSnapMarginTop", "scrollSnapPointsX", "scrollSnapPointsY", "scrollSnapStop", @@ -5830,7 +7079,10 @@ "scrollbars", "scrolling", "scrollingElement", + "sctp", + "sctpCauseCode", "sdp", + "sdpLineNumber", "sdpMLineIndex", "sdpMid", "seal", @@ -5838,6 +7090,7 @@ "searchBox", "searchBoxJavaBridge_", "searchParams", + "second", "sectionRowIndex", "secureConnectionStart", "security", @@ -5847,6 +7100,8 @@ "seeking", "select", "selectAllChildren", + "selectAlternateInterface", + "selectConfiguration", "selectNode", "selectNodeContents", "selectNodes", @@ -5854,6 +7109,7 @@ "selectSubString", "selected", "selectedIndex", + "selectedOption", "selectedOptions", "selectedStyleSheetSet", "selectedStylesheetSet", @@ -5867,24 +7123,35 @@ "send", "sendAsBinary", "sendBeacon", + "sendMessage", "sender", + "sensitivity", + "sentAlert", "sentTimestamp", "separator", + "serialNumber", "serializeToString", + "serverTiming", + "service", "serviceWorker", + "session", "sessionId", "sessionStorage", "set", "setActionHandler", "setActive", "setAlpha", + "setAppBadge", "setAttribute", "setAttributeNS", "setAttributeNode", "setAttributeNodeNS", "setBaseAndExtent", + "setBigInt64", + "setBigUint64", "setBingCurrentSearchDefault", "setCapture", + "setCodecPreferences", "setColor", "setCompositeOperation", "setConfiguration", @@ -5892,6 +7159,7 @@ "setCustomValidity", "setData", "setDate", + "setDirection", "setDragImage", "setEnd", "setEndAfter", @@ -5902,7 +7170,9 @@ "setFloat32", "setFloat64", "setFloatValue", + "setFormValue", "setFullYear", + "setHeaderValue", "setHours", "setIdentityProvider", "setImmediate", @@ -5911,6 +7181,7 @@ "setInt8", "setInterval", "setItem", + "setKeyframes", "setLineCap", "setLineDash", "setLineJoin", @@ -5933,9 +7204,11 @@ "setOverrideHistoryNavigationMode", "setPaint", "setParameter", + "setParameters", "setPeriodicWave", "setPointerCapture", "setPosition", + "setPositionState", "setPreference", "setProperty", "setPrototypeOf", @@ -5960,6 +7233,7 @@ "setStartAfter", "setStartBefore", "setStdDeviation", + "setStreams", "setStringValue", "setStrokeColor", "setSuggestResult", @@ -5980,6 +7254,7 @@ "setUint32", "setUint8", "setUri", + "setValidity", "setValueAtTime", "setValueCurveAtTime", "setVariable", @@ -6008,6 +7283,9 @@ "shift", "shiftKey", "shiftLeft", + "shippingAddress", + "shippingOption", + "shippingType", "show", "showHelp", "showModal", @@ -6018,12 +7296,17 @@ "sign", "signal", "signalingState", + "signature", + "silent", "sin", "singleNodeValue", "sinh", "sinkId", + "sittingToStandingTransform", "size", "sizeToContent", + "sizeX", + "sizeZ", "sizes", "skewX", "skewXSelf", @@ -6034,22 +7317,28 @@ "slot", "small", "smil", + "smooth", "smoothingTimeConstant", "snapToLines", "snapshotItem", "snapshotLength", "some", "sort", + "sortingCode", "source", "sourceBuffer", "sourceBuffers", "sourceCapabilities", + "sourceFile", "sourceIndex", + "sourceURL", + "sources", "spacing", "span", "speak", "speakAs", "speaking", + "species", "specified", "specularConstant", "specularExponent", @@ -6073,12 +7362,16 @@ "stack", "stackTraceLimit", "stacktrace", + "stageParameters", "standalone", "standby", "start", "startContainer", + "startE", "startIce", + "startLoadTime", "startMessages", + "startNotifications", "startOffset", "startRendering", "startSoftwareUpdate", @@ -6086,6 +7379,7 @@ "startsWith", "state", "status", + "statusCode", "statusMessage", "statusText", "statusbar", @@ -6108,8 +7402,10 @@ "stop-opacity", "stopColor", "stopImmediatePropagation", + "stopNotifications", "stopOpacity", "stopPropagation", + "stopped", "storage", "storageArea", "storageName", @@ -6119,6 +7415,9 @@ "storeWebWideTrackingException", "stpVersion", "stream", + "streams", + "strength", + "stretch", "strike", "stringValue", "stringify", @@ -6130,6 +7429,7 @@ "stroke-miterlimit", "stroke-opacity", "stroke-width", + "strokeColor", "strokeDasharray", "strokeDashoffset", "strokeLinecap", @@ -6142,6 +7442,7 @@ "strokeWidth", "style", "styleFloat", + "styleMap", "styleMedia", "styleSheet", "styleSheetSets", @@ -6150,6 +7451,8 @@ "subarray", "subject", "submit", + "submitFrame", + "submitter", "subscribe", "substr", "substring", @@ -6160,7 +7463,12 @@ "suffixes", "summary", "sup", + "supported", + "supportedContentEncodings", + "supportedEntryTypes", + "supportedLocalesOf", "supports", + "supportsSession", "surfaceScale", "surroundContents", "suspend", @@ -6169,6 +7477,8 @@ "swapNode", "sweepFlag", "symbols", + "sync", + "sysexEnabled", "system", "systemCode", "systemId", @@ -6189,22 +7499,32 @@ "tagUrn", "tags", "taintEnabled", + "takeHeapSnapshot", + "takePhoto", "takeRecords", "tan", + "tangentialPressure", "tanh", "target", "targetElement", + "targetRayMode", + "targetRaySpace", "targetTouches", "targetX", "targetY", + "tcpType", "tee", "tel", "terminate", "test", "texImage2D", + "texImage3D", "texParameterf", "texParameteri", + "texStorage2D", + "texStorage3D", "texSubImage2D", + "texSubImage3D", "text", "text-align", "text-align-last", @@ -6213,7 +7533,9 @@ "text-decoration", "text-decoration-color", "text-decoration-line", + "text-decoration-skip-ink", "text-decoration-style", + "text-decoration-thickness", "text-emphasis", "text-emphasis-color", "text-emphasis-position", @@ -6225,6 +7547,9 @@ "text-rendering", "text-shadow", "text-transform", + "text-underline-offset", + "text-underline-position", + "text/pdf", "textAlign", "textAlignLast", "textAnchor", @@ -6241,6 +7566,7 @@ "textDecorationOverline", "textDecorationSkipInk", "textDecorationStyle", + "textDecorationThickness", "textDecorationUnderline", "textEmphasis", "textEmphasisColor", @@ -6259,22 +7585,32 @@ "textSizeAdjust", "textTracks", "textTransform", + "textUnderlineOffset", "textUnderlinePosition", "then", "threadId", "threshold", + "thresholds", "tiltX", "tiltY", "time", "timeEnd", "timeLog", "timeOrigin", + "timeRemaining", "timeStamp", + "timeZone", + "timeZoneName", + "timecode", + "timeline", + "timelineEnd", + "timelineTime", "timeout", "timestamp", "timestampOffset", "timing", "title", + "to", "toArray", "toBlob", "toDataURL", @@ -6294,19 +7630,24 @@ "toLocaleTimeString", "toLocaleUpperCase", "toLowerCase", + "toMatrix", "toMethod", "toPrecision", + "toPrimitive", "toSdp", "toSource", "toStaticHTML", "toString", "toStringTag", + "toSum", "toTimeString", "toUTCString", "toUpperCase", "toggle", "toggleAttribute", "toggleLongPressEnabled", + "tone", + "toneBuffer", "tooLong", "tooShort", "toolbar", @@ -6315,21 +7656,36 @@ "total", "totalFrameDelay", "totalJSHeapSize", + "totalSize", "totalVideoFrames", "touch-action", "touchAction", + "touched", "touches", "trace", "track", + "trackVisibility", + "tran", "transaction", "transactions", + "transceiver", "transferControlToOffscreen", + "transferFromImageBitmap", + "transferImageBitmap", + "transferIn", + "transferOut", + "transferSize", + "transferToImageBitmap", "transform", "transform-box", "transform-origin", "transform-style", "transformBox", + "transformFeedbackVaryings", "transformOrigin", + "transformOriginX", + "transformOriginY", + "transformOriginZ", "transformPoint", "transformString", "transformStyle", @@ -6348,6 +7704,7 @@ "translateSelf", "translationX", "translationY", + "transport", "trim", "trimEnd", "trimLeft", @@ -6356,11 +7713,16 @@ "trueSpeed", "trunc", "truncate", + "trustedTypes", + "turn", + "twist", "type", "typeDetail", "typeMismatch", "typeMustMatch", "types", + "tz", + "u2f", "ubound", "undefined", "unescape", @@ -6373,24 +7735,40 @@ "uniform1fv", "uniform1i", "uniform1iv", + "uniform1ui", + "uniform1uiv", "uniform2f", "uniform2fv", "uniform2i", "uniform2iv", + "uniform2ui", + "uniform2uiv", "uniform3f", "uniform3fv", "uniform3i", "uniform3iv", + "uniform3ui", + "uniform3uiv", "uniform4f", "uniform4fv", "uniform4i", "uniform4iv", + "uniform4ui", + "uniform4uiv", + "uniformBlockBinding", "uniformMatrix2fv", + "uniformMatrix2x3fv", + "uniformMatrix2x4fv", "uniformMatrix3fv", + "uniformMatrix3x2fv", + "uniformMatrix3x4fv", "uniformMatrix4fv", + "uniformMatrix4x2fv", + "uniformMatrix4x3fv", "unique", "uniqueID", "uniqueNumber", + "unit", "unitType", "units", "unloadEventEnd", @@ -6412,6 +7790,7 @@ "unsuspendRedrawAll", "unwatch", "unwrapKey", + "upDegrees", "upX", "upY", "upZ", @@ -6421,11 +7800,17 @@ "updateIce", "updateInterval", "updatePlaybackRate", + "updateRenderState", "updateSettings", + "updateTiming", + "updateViaCache", + "updateWith", "updated", "updating", "upgrade", "upload", + "uploadTotal", + "uploaded", "upper", "upperBound", "upperOpen", @@ -6433,20 +7818,35 @@ "url", "urn", "urns", + "usage", "usages", "usb", + "usbVersionMajor", + "usbVersionMinor", + "usbVersionSubminor", "useCurrentView", + "useGrouping", "useMap", "useProgram", "usedJSHeapSize", "usedSpace", + "user-select", "userActivation", "userAgent", + "userChoice", + "userHandle", + "userHint", "userLanguage", + "userProfile", "userSelect", + "userVisibleOnly", "userZoom", "username", + "usernameFragment", + "utterance", + "uuid", "v8BreakIterator", + "v8Parse", "vAlign", "vLink", "valid", @@ -6464,6 +7864,8 @@ "valueText", "valueType", "values", + "variable", + "variant", "vector-effect", "vectorEffect", "velocityAngular", @@ -6471,6 +7873,7 @@ "velocityX", "velocityY", "vendor", + "vendorId", "vendorSub", "verify", "version", @@ -6482,13 +7885,27 @@ "vertexAttrib3fv", "vertexAttrib4f", "vertexAttrib4fv", + "vertexAttribDivisor", "vertexAttribDivisorANGLE", + "vertexAttribI4i", + "vertexAttribI4iv", + "vertexAttribI4ui", + "vertexAttribI4uiv", + "vertexAttribIPointer", "vertexAttribPointer", "vertical", "vertical-align", "verticalAlign", "verticalOverflow", + "vh", "vibrate", + "vibrationActuator", + "video/x-ms-asf", + "video/x-ms-asf-plugin", + "video/x-ms-wm", + "video/x-ms-wmv", + "video/x-ms-wvx", + "videoBitsPerSecond", "videoHeight", "videoTracks", "videoWidth", @@ -6501,22 +7918,34 @@ "viewportAnchorX", "viewportAnchorY", "viewportElement", + "views", + "violatedDirective", "visibility", "visibilityState", "visible", "visualViewport", "vlinkColor", + "vmax", + "vmin", "voice", + "voiceURI", "volume", "vrml", "vspace", + "vw", "w", "wait", + "waitSync", + "waiting", "wake", + "wakeLock", "wand", "warn", + "wasAlternateProtocolAvailable", "wasClean", "wasDiscarded", + "wasFetchedViaSpdy", + "wasNpnNegotiated", "watch", "watchAvailability", "watchPosition", @@ -6536,14 +7965,17 @@ "webkitAnimationTimingFunction", "webkitAppRegion", "webkitAppearance", + "webkitAspectRatio", "webkitAudioContext", "webkitAudioDecodedByteCount", "webkitAudioPannerNode", + "webkitBackdropFilter", "webkitBackfaceVisibility", "webkitBackground", "webkitBackgroundAttachment", "webkitBackgroundClip", "webkitBackgroundColor", + "webkitBackgroundComposite", "webkitBackgroundImage", "webkitBackgroundOrigin", "webkitBackgroundPosition", @@ -6566,6 +7998,7 @@ "webkitBorderEndColor", "webkitBorderEndStyle", "webkitBorderEndWidth", + "webkitBorderFit", "webkitBorderHorizontalSpacing", "webkitBorderImage", "webkitBorderImageOutset", @@ -6585,6 +8018,8 @@ "webkitBoxDecorationBreak", "webkitBoxDirection", "webkitBoxFlex", + "webkitBoxFlexGroup", + "webkitBoxLines", "webkitBoxOrdinalGroup", "webkitBoxOrient", "webkitBoxPack", @@ -6598,11 +8033,13 @@ "webkitClearResourceTimings", "webkitClipPath", "webkitClosedCaptionsVisible", + "webkitColumnAxis", "webkitColumnBreakAfter", "webkitColumnBreakBefore", "webkitColumnBreakInside", "webkitColumnCount", "webkitColumnGap", + "webkitColumnProgression", "webkitColumnRule", "webkitColumnRuleColor", "webkitColumnRuleStyle", @@ -6615,6 +8052,8 @@ "webkitCreateShadowRoot", "webkitCurrentFullScreenElement", "webkitCurrentPlaybackTargetIsWireless", + "webkitCursorVisibility", + "webkitDashboardRegion", "webkitDecodedFrameCount", "webkitDirectionInvertedFromDevice", "webkitDisplayingFullscreen", @@ -6634,8 +8073,10 @@ "webkitFlexShrink", "webkitFlexWrap", "webkitFontFeatureSettings", + "webkitFontKerning", "webkitFontSizeDelta", "webkitFontSmoothing", + "webkitForce", "webkitFullScreenKeyboardInputAllowed", "webkitFullscreenElement", "webkitFullscreenEnabled", @@ -6655,6 +8096,10 @@ "webkitHidden", "webkitHighlight", "webkitHyphenateCharacter", + "webkitHyphenateLimitAfter", + "webkitHyphenateLimitBefore", + "webkitHyphenateLimitLines", + "webkitHyphens", "webkitIDBCursor", "webkitIDBDatabase", "webkitIDBDatabaseError", @@ -6668,12 +8113,18 @@ "webkitImageSmoothingEnabled", "webkitIndexedDB", "webkitInitMessageEvent", + "webkitInitialLetter", "webkitIsFullScreen", "webkitJustifyContent", "webkitKeys", + "webkitLineAlign", + "webkitLineBoxContain", "webkitLineBreak", "webkitLineClamp", + "webkitLineDash", "webkitLineDashOffset", + "webkitLineGrid", + "webkitLineSnap", "webkitLocale", "webkitLockOrientation", "webkitLogicalHeight", @@ -6687,6 +8138,12 @@ "webkitMarginEnd", "webkitMarginStart", "webkitMarginTopCollapse", + "webkitMarquee", + "webkitMarqueeDirection", + "webkitMarqueeIncrement", + "webkitMarqueeRepetition", + "webkitMarqueeSpeed", + "webkitMarqueeStyle", "webkitMask", "webkitMaskBoxImage", "webkitMaskBoxImageOutset", @@ -6705,12 +8162,14 @@ "webkitMaskRepeatX", "webkitMaskRepeatY", "webkitMaskSize", + "webkitMaskSourceType", "webkitMatchesSelector", "webkitMaxLogicalHeight", "webkitMaxLogicalWidth", "webkitMediaStream", "webkitMinLogicalHeight", "webkitMinLogicalWidth", + "webkitNbspMode", "webkitNotifications", "webkitOfflineAudioContext", "webkitOpacity", @@ -6733,6 +8192,7 @@ "webkitPutImageDataHD", "webkitRTCPeerConnection", "webkitRegionOverset", + "webkitRelativePath", "webkitRequestAnimationFrame", "webkitRequestFileSystem", "webkitRequestFullScreen", @@ -6756,9 +8216,15 @@ "webkitSpeechRecognitionEvent", "webkitStorageInfo", "webkitSupportsFullscreen", + "webkitSvgShadow", "webkitTapHighlightColor", "webkitTemporaryStorage", "webkitTextCombine", + "webkitTextDecoration", + "webkitTextDecorationColor", + "webkitTextDecorationLine", + "webkitTextDecorationSkip", + "webkitTextDecorationStyle", "webkitTextDecorationsInEffect", "webkitTextEmphasis", "webkitTextEmphasisColor", @@ -6771,6 +8237,8 @@ "webkitTextStroke", "webkitTextStrokeColor", "webkitTextStrokeWidth", + "webkitTextUnderlinePosition", + "webkitTextZoom", "webkitTransform", "webkitTransformOrigin", "webkitTransformOriginX", @@ -6794,6 +8262,7 @@ "webkitdirectory", "webkitdropzone", "webstore", + "weekday", "weight", "whatToShow", "wheelDelta", @@ -6817,11 +8286,15 @@ "wordBreak", "wordSpacing", "wordWrap", + "workerStart", "wrap", "wrapKey", "writable", + "writableAuxiliaries", "write", "writeText", + "writeValue", + "writeWithoutResponse", "writeln", "writing-mode", "writingMode", @@ -6836,11 +8309,13 @@ "xmllang", "xmlspace", "xor", + "xr", "y", "y1", "y2", "yChannelSelector", "yandex", + "year", "z", "z-index", "zIndex", diff --git a/node_modules/uglify-js/tools/props.html b/node_modules/uglify-js/tools/props.html deleted file mode 100644 index ce2e7e6b..00000000 --- a/node_modules/uglify-js/tools/props.html +++ /dev/null @@ -1,540 +0,0 @@ - - - - - - diff --git a/node_modules/yargs-parser/node_modules/camelcase/index.d.ts b/node_modules/yargs-parser/node_modules/camelcase/index.d.ts deleted file mode 100644 index 58f2069a..00000000 --- a/node_modules/yargs-parser/node_modules/camelcase/index.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -declare namespace camelcase { - interface Options { - /** - Uppercase the first character: `foo-bar` → `FooBar`. - - @default false - */ - readonly pascalCase?: boolean; - } -} - -declare const camelcase: { - /** - Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`. - - @param input - String to convert to camel case. - - @example - ``` - import camelCase = require('camelcase'); - - camelCase('foo-bar'); - //=> 'fooBar' - - camelCase('foo_bar'); - //=> 'fooBar' - - camelCase('Foo-Bar'); - //=> 'fooBar' - - camelCase('Foo-Bar', {pascalCase: true}); - //=> 'FooBar' - - camelCase('--foo.bar', {pascalCase: false}); - //=> 'fooBar' - - camelCase('foo bar'); - //=> 'fooBar' - - console.log(process.argv[3]); - //=> '--foo-bar' - camelCase(process.argv[3]); - //=> 'fooBar' - - camelCase(['foo', 'bar']); - //=> 'fooBar' - - camelCase(['__foo__', '--bar'], {pascalCase: true}); - //=> 'FooBar' - ``` - */ - (input: string | ReadonlyArray, options?: camelcase.Options): string; - - // TODO: Remove this for the next major release, refactor the whole definition to: - // declare function camelcase( - // input: string | ReadonlyArray, - // options?: camelcase.Options - // ): string; - // export = camelcase; - default: typeof camelcase; -}; - -export = camelcase; diff --git a/node_modules/yargs-parser/node_modules/camelcase/index.js b/node_modules/yargs-parser/node_modules/camelcase/index.js deleted file mode 100644 index 579f99b4..00000000 --- a/node_modules/yargs-parser/node_modules/camelcase/index.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; - -const preserveCamelCase = string => { - let isLastCharLower = false; - let isLastCharUpper = false; - let isLastLastCharUpper = false; - - for (let i = 0; i < string.length; i++) { - const character = string[i]; - - if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) { - string = string.slice(0, i) + '-' + string.slice(i); - isLastCharLower = false; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = true; - i++; - } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) { - string = string.slice(0, i - 1) + '-' + string.slice(i - 1); - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = false; - isLastCharLower = true; - } else { - isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character; - } - } - - return string; -}; - -const camelCase = (input, options) => { - if (!(typeof input === 'string' || Array.isArray(input))) { - throw new TypeError('Expected the input to be `string | string[]`'); - } - - options = Object.assign({ - pascalCase: false - }, options); - - const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x; - - if (Array.isArray(input)) { - input = input.map(x => x.trim()) - .filter(x => x.length) - .join('-'); - } else { - input = input.trim(); - } - - if (input.length === 0) { - return ''; - } - - if (input.length === 1) { - return options.pascalCase ? input.toUpperCase() : input.toLowerCase(); - } - - const hasUpperCase = input !== input.toLowerCase(); - - if (hasUpperCase) { - input = preserveCamelCase(input); - } - - input = input - .replace(/^[_.\- ]+/, '') - .toLowerCase() - .replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase()) - .replace(/\d+(\w|$)/g, m => m.toUpperCase()); - - return postProcess(input); -}; - -module.exports = camelCase; -// TODO: Remove this for the next major release -module.exports.default = camelCase; diff --git a/node_modules/yargs-parser/node_modules/camelcase/package.json b/node_modules/yargs-parser/node_modules/camelcase/package.json deleted file mode 100644 index 07bc8fe9..00000000 --- a/node_modules/yargs-parser/node_modules/camelcase/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "camelcase", - "version": "5.3.1", - "description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`", - "license": "MIT", - "repository": "sindresorhus/camelcase", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=6" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "camelcase", - "camel-case", - "camel", - "case", - "dash", - "hyphen", - "dot", - "underscore", - "separator", - "string", - "text", - "convert", - "pascalcase", - "pascal-case" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - } - -,"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz" -,"_integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" -,"_from": "camelcase@5.3.1" -} \ No newline at end of file diff --git a/node_modules/yargs-parser/node_modules/camelcase/readme.md b/node_modules/yargs-parser/node_modules/camelcase/readme.md deleted file mode 100644 index fde27261..00000000 --- a/node_modules/yargs-parser/node_modules/camelcase/readme.md +++ /dev/null @@ -1,99 +0,0 @@ -# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase) - -> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar` - ---- - -
- - Get professional support for 'camelcase' with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
- ---- - -## Install - -``` -$ npm install camelcase -``` - - -## Usage - -```js -const camelCase = require('camelcase'); - -camelCase('foo-bar'); -//=> 'fooBar' - -camelCase('foo_bar'); -//=> 'fooBar' - -camelCase('Foo-Bar'); -//=> 'fooBar' - -camelCase('Foo-Bar', {pascalCase: true}); -//=> 'FooBar' - -camelCase('--foo.bar', {pascalCase: false}); -//=> 'fooBar' - -camelCase('foo bar'); -//=> 'fooBar' - -console.log(process.argv[3]); -//=> '--foo-bar' -camelCase(process.argv[3]); -//=> 'fooBar' - -camelCase(['foo', 'bar']); -//=> 'fooBar' - -camelCase(['__foo__', '--bar'], {pascalCase: true}); -//=> 'FooBar' -``` - - -## API - -### camelCase(input, [options]) - -#### input - -Type: `string` `string[]` - -String to convert to camel case. - -#### options - -Type: `Object` - -##### pascalCase - -Type: `boolean`
-Default: `false` - -Uppercase the first character: `foo-bar` → `FooBar` - - -## Security - -To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. - - -## Related - -- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module -- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase -- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string -- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/package.json b/package.json index 5640bd28..a71167b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "conventional-changelog-action", - "version": "3.4.0", + "version": "3.4.1", "description": "Github Action that generates a changelog with the Conventional Changelog CLI", "keywords": [ "actions",